| /** |
| * |
| * Copyright (c) 2011, 2016 - 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 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.datamart.common; |
| |
| import org.eclipse.osbp.ui.api.datamart.IDualData; |
| |
| |
| public class DatamartData implements IDualData { |
| private String selectionValue; |
| private String formattedValue; |
| private String significantValue; |
| private String hierarchy = null; |
| |
| @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; |
| } |
| |
| public void set_hierarchy(String _hierarchy) { |
| this.hierarchy = _hierarchy; |
| } |
| |
| @Override |
| public void setUnformattedValue(String unformattedValue) { |
| significantValue = unformattedValue; |
| formattedValue = ""; |
| selectionValue = unformattedValue; |
| hierarchy = null; |
| if (unformattedValue != null && unformattedValue.startsWith("[") && unformattedValue.endsWith("]") && unformattedValue.contains(".")) { |
| String parts[] = unformattedValue.split("\\]\\.\\["); |
| // hierarchy = parts[0].replace("[","").replace("]", ""); |
| hierarchy = parts[0]; |
| for (int idx=1; idx<parts.length; idx ++) { |
| if(idx < parts.length-1) { |
| hierarchy += "].["+parts[idx]; |
| } else { |
| hierarchy += "]"; |
| } |
| if (idx > 1) { |
| formattedValue += " "; |
| } |
| formattedValue += parts[idx].replace("[","").replace("]", ""); |
| if(idx == parts.length-1) { |
| significantValue = parts[idx].replace("[","").replace("]", ""); |
| } |
| } |
| } |
| else { |
| formattedValue = unformattedValue; |
| } |
| // if(hierarchy != null) { |
| // formattedValue = "["+hierarchy+"]."+formattedValue; |
| // } |
| } |
| |
| public String getSignificantValue() { |
| return significantValue; |
| } |
| } |