| /** |
| * |
| * 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 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.datamart.common.olap; |
| |
| import org.eclipse.osbp.xtext.datamart.common.sql.SqlCell; |
| |
| import mondrian.olap.Cell; |
| |
| |
| public class DerivedCell { |
| |
| private org.olap4j.Cell olapCell; |
| private mondrian.olap.Cell mondrianCell; |
| private Object value = null; |
| private String formattedValue = ""; |
| |
| public DerivedCell(org.olap4j.Cell olapCell) { |
| this.olapCell = olapCell; |
| } |
| |
| public DerivedCell(Cell mondrianCell) { |
| super(); |
| this.mondrianCell = mondrianCell; |
| } |
| |
| public DerivedCell(Object value, String formattedValue) { |
| super(); |
| this.value = value; |
| this.formattedValue = formattedValue; |
| } |
| |
| public Object getValue(){ |
| if (olapCell!=null){ |
| return olapCell.getValue(); |
| } else if (mondrianCell!=null){ |
| return mondrianCell.getValue(); |
| } else { |
| return value; |
| } |
| } |
| |
| public String getFormattedValue(){ |
| if (olapCell!=null){ |
| return olapCell.getFormattedValue(); |
| } else if (mondrianCell!=null){ |
| return mondrianCell.getFormattedValue(); |
| } else { |
| return formattedValue; |
| } |
| } |
| |
| public boolean isId() { |
| if (olapCell!=null){ |
| if (olapCell instanceof SqlCell) { |
| return ((SqlCell)olapCell).isId(); |
| } |
| } |
| return false; |
| } |
| |
| public String getIdType() { |
| if (olapCell!=null){ |
| if (olapCell instanceof SqlCell) { |
| return ((SqlCell)olapCell).getType().toString(); |
| } |
| } |
| return ""; |
| } |
| } |