| /* |
| * |
| * Copyright (c) 2011 - 2017 - Loetz GmbH & Co KG, 69115 Heidelberg, Germany |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Initial contribution: |
| * Loetz GmbH & Co. KG |
| * |
| */ |
| package org.eclipse.osbp.ui.api.datamart; |
| |
| import org.eclipse.osbp.runtime.common.event.IDualData; |
| |
| /** |
| * The Class DatamartData. |
| */ |
| public class DatamartData implements IDualData { |
| private String selectionValue; |
| private String formattedValue; |
| private String hierarchy = null; |
| private boolean isString = false; |
| |
| @Override |
| public void asString(boolean isString) { |
| this.isString = isString; |
| } |
| |
| @Override |
| public String getDatabaseSelectionValue() { |
| if(isString) { |
| return "'"+selectionValue.replace("'", "''")+"'"; |
| } |
| return selectionValue; |
| } |
| |
| @Override |
| public String getSelectionValue() { |
| return selectionValue; |
| } |
| |
| @Override |
| public void setSelectionValue(String selectionValue) { |
| this.selectionValue = selectionValue; |
| } |
| |
| @Override |
| public String getFormattedValue() { |
| return formattedValue; |
| } |
| |
| @Override |
| public void setFormattedValue(String formattedValue) { |
| this.formattedValue = formattedValue; |
| } |
| |
| @Override |
| public String getHierarchy() { |
| return hierarchy; |
| } |
| |
| @Override |
| public String getHierarchyWithBrackets() { |
| if (hierarchy != null) { |
| return "[" + hierarchy + "]"; |
| } |
| return ""; |
| } |
| |
| @Override |
| public void setHierarchy(String hierarchy) { |
| this.hierarchy = hierarchy; |
| } |
| |
| @Override |
| public boolean equals(IDualData item) { |
| if (item != null && (item.getHierarchy() == null || item.getHierarchy().equals(getHierarchy())) |
| && item.getSelectionValue().equals(getSelectionValue()) |
| && item.getFormattedValue().equals(getFormattedValue())) { |
| return true; |
| } |
| return false; |
| } |
| } |