| /** |
| * 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 |
| * |
| * |
| * This copyright notice shows up in the generated Java code |
| */ |
| package org.eclipse.osbp.xtext.table.scoping; |
| |
| import com.google.common.base.Objects; |
| import java.util.ArrayList; |
| import javax.inject.Inject; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EPackage; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.osbp.dsl.common.xtext.extensions.ModelExtensions; |
| import org.eclipse.osbp.dsl.entity.xtext.extensions.EntityTypesBuilder; |
| import org.eclipse.osbp.dsl.semantic.common.types.LReference; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntity; |
| import org.eclipse.osbp.dsl.semantic.entity.LEntityFeature; |
| import org.eclipse.osbp.infogrid.model.gridsource.CxGridSourcePackage; |
| import org.eclipse.osbp.infogrid.model.gridsource.style.CxGridStylePackage; |
| import org.eclipse.osbp.xtext.cubedsl.CubeDimensionEntity; |
| import org.eclipse.osbp.xtext.cubedsl.CubeHierarchy; |
| import org.eclipse.osbp.xtext.cubedsl.CubeLevel; |
| import org.eclipse.osbp.xtext.cubedsl.CubeMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.AxisEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartAggregationFunctionInterface; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartAxis; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartColumn; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCube; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCubeElement; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefineDerivedMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDerivedMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartElement; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartEntity; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchy; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMeasure; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartMember; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartNavigation; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartOwner; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartProperty; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartSetAggregation; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartSetAggregationFunction; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartSource; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartTask; |
| import org.eclipse.osbp.xtext.datamartdsl.Expression; |
| import org.eclipse.osbp.xtext.datamartdsl.SetAggregationEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.TaskQueryColumnEnum; |
| import org.eclipse.osbp.xtext.datamartdsl.jvmmodel.DatamartDSLJvmModelInferrer; |
| import org.eclipse.osbp.xtext.datamartdsl.scoping.DatamartDSLScopeProvider; |
| import org.eclipse.osbp.xtext.gridsource.scoping.GridSourceScopeProvider; |
| import org.eclipse.osbp.xtext.table.TableAxis; |
| import org.eclipse.osbp.xtext.table.TableBrokerDatamart; |
| import org.eclipse.osbp.xtext.table.TableDSLPackage; |
| import org.eclipse.osbp.xtext.table.TableDatamart; |
| import org.eclipse.xtext.naming.QualifiedName; |
| import org.eclipse.xtext.resource.EObjectDescription; |
| import org.eclipse.xtext.resource.IEObjectDescription; |
| import org.eclipse.xtext.scoping.IScope; |
| import org.eclipse.xtext.scoping.impl.MapBasedScope; |
| import org.eclipse.xtext.xbase.annotations.typesystem.XbaseWithAnnotationsBatchScopeProvider; |
| import org.eclipse.xtext.xbase.lib.CollectionLiterals; |
| import org.eclipse.xtext.xbase.lib.Extension; |
| |
| @SuppressWarnings("all") |
| public class TableScopeProvider extends XbaseWithAnnotationsBatchScopeProvider { |
| @Inject |
| @Extension |
| private ModelExtensions _modelExtensions; |
| |
| @Inject |
| @Extension |
| private EntityTypesBuilder _entityTypesBuilder; |
| |
| @Inject |
| @Extension |
| private DatamartDSLScopeProvider datamartScopeProvider; |
| |
| @Inject |
| @Extension |
| private DatamartDSLJvmModelInferrer datamartInferrer; |
| |
| @Inject |
| private GridSourceScopeProvider gridScopeProvider; |
| |
| @Override |
| public IScope getScope(final EObject context, final EReference reference) { |
| boolean _or = false; |
| EClass _eClass = context.eClass(); |
| EPackage _ePackage = _eClass.getEPackage(); |
| boolean _equals = Objects.equal(_ePackage, CxGridSourcePackage.eINSTANCE); |
| if (_equals) { |
| _or = true; |
| } else { |
| EClass _eClass_1 = context.eClass(); |
| EPackage _ePackage_1 = _eClass_1.getEPackage(); |
| boolean _equals_1 = Objects.equal(_ePackage_1, CxGridStylePackage.eINSTANCE); |
| _or = _equals_1; |
| } |
| if (_or) { |
| return this.gridScopeProvider.getScope(context, reference); |
| } |
| boolean _equals_2 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_AXIS__AXIS); |
| if (_equals_2) { |
| return this.getScope_Table_Axis_axis(context); |
| } else { |
| boolean _or_1 = false; |
| boolean _or_2 = false; |
| boolean _or_3 = false; |
| boolean _or_4 = false; |
| boolean _equals_3 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_MEASURE__VALUE_REF); |
| if (_equals_3) { |
| _or_4 = true; |
| } else { |
| boolean _equals_4 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_DERIVED__VALUE_REF); |
| _or_4 = _equals_4; |
| } |
| if (_or_4) { |
| _or_3 = true; |
| } else { |
| boolean _equals_5 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_PROPERTY__VALUE_REF); |
| _or_3 = _equals_5; |
| } |
| if (_or_3) { |
| _or_2 = true; |
| } else { |
| boolean _equals_6 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_COLUMN__VALUE_REF); |
| _or_2 = _equals_6; |
| } |
| if (_or_2) { |
| _or_1 = true; |
| } else { |
| boolean _equals_7 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_HIERARCHY__VALUE_REF); |
| _or_1 = _equals_7; |
| } |
| if (_or_1) { |
| return this.getScope_Table_valueRef(context, reference); |
| } else { |
| boolean _equals_8 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_AGGREGATION__VALUE_REF); |
| if (_equals_8) { |
| return this.getScope_Table_Aggregation_valueRef(context); |
| } else { |
| boolean _equals_9 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_BROKER_DATAMART__REFERENCE); |
| if (_equals_9) { |
| return this.getScope_Table_Broker_reference(context); |
| } else { |
| return super.getScope(context, reference); |
| } |
| } |
| } |
| } |
| } |
| |
| public IScope getScope_Table_Broker_reference(final EObject object) { |
| ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList(); |
| if ((object instanceof TableBrokerDatamart)) { |
| DatamartDefinition datamart = ((TableBrokerDatamart) object).getDatamartDef(); |
| DatamartSource _source = datamart.getSource(); |
| if ((_source instanceof DatamartEntity)) { |
| DatamartSource _source_1 = datamart.getSource(); |
| LEntity entity = ((DatamartEntity) _source_1).getEntityRef(); |
| EList<LEntityFeature> _features = entity.getFeatures(); |
| for (final LEntityFeature f : _features) { |
| boolean _and = false; |
| if (!(f instanceof LReference)) { |
| _and = false; |
| } else { |
| boolean _isToMany = this._modelExtensions.isToMany(((LReference) f)); |
| boolean _not = (!_isToMany); |
| _and = _not; |
| } |
| if (_and) { |
| String _name = ((LReference) f).getName(); |
| IEObjectDescription _create = EObjectDescription.create(_name, ((LReference) f)); |
| result.add(_create); |
| } |
| } |
| } |
| } |
| return MapBasedScope.createScope(IScope.NULLSCOPE, result); |
| } |
| |
| public IScope getScope_Table_Axis_axis(final EObject object) { |
| ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList(); |
| EObject eObj = object; |
| while ((!(eObj instanceof TableDatamart))) { |
| EObject _eContainer = eObj.eContainer(); |
| eObj = _eContainer; |
| } |
| boolean _notEquals = (!Objects.equal(eObj, null)); |
| if (_notEquals) { |
| DatamartDefinition datamart = ((TableDatamart) eObj).getDatamartRef(); |
| boolean _and = false; |
| boolean _notEquals_1 = (!Objects.equal(datamart, null)); |
| if (!_notEquals_1) { |
| _and = false; |
| } else { |
| DatamartSource _source = datamart.getSource(); |
| boolean _notEquals_2 = (!Objects.equal(_source, null)); |
| _and = _notEquals_2; |
| } |
| if (_and) { |
| DatamartSource _source_1 = datamart.getSource(); |
| if ((_source_1 instanceof DatamartCube)) { |
| DatamartSource _source_2 = datamart.getSource(); |
| EList<DatamartCubeElement> _axisslicer = ((DatamartCube) _source_2).getAxisslicer(); |
| for (final DatamartCubeElement axis : _axisslicer) { |
| if ((axis instanceof DatamartAxis)) { |
| AxisEnum _name = ((DatamartAxis) axis).getName(); |
| String literal = _name.getLiteral(); |
| IEObjectDescription _create = EObjectDescription.create(literal, ((DatamartAxis) axis)); |
| result.add(_create); |
| } |
| } |
| } else { |
| DatamartSource _source_3 = datamart.getSource(); |
| if ((_source_3 instanceof DatamartEntity)) { |
| DatamartSource _source_4 = datamart.getSource(); |
| this.getEntityAxes(((DatamartEntity) _source_4), result); |
| String _literal = AxisEnum.COLUMNS.getLiteral(); |
| boolean _containsName = this.containsName(result, _literal); |
| boolean _not = (!_containsName); |
| if (_not) { |
| String _literal_1 = AxisEnum.COLUMNS.getLiteral(); |
| DatamartSource _source_5 = datamart.getSource(); |
| IEObjectDescription _create_1 = EObjectDescription.create(_literal_1, ((DatamartEntity) _source_5)); |
| result.add(_create_1); |
| } |
| String _literal_2 = AxisEnum.ROWS.getLiteral(); |
| boolean _containsName_1 = this.containsName(result, _literal_2); |
| boolean _not_1 = (!_containsName_1); |
| if (_not_1) { |
| String _literal_3 = AxisEnum.ROWS.getLiteral(); |
| DatamartSource _source_6 = datamart.getSource(); |
| IEObjectDescription _create_2 = EObjectDescription.create(_literal_3, ((DatamartEntity) _source_6)); |
| result.add(_create_2); |
| } |
| } else { |
| DatamartSource _source_7 = datamart.getSource(); |
| if ((_source_7 instanceof DatamartTask)) { |
| String _literal_4 = AxisEnum.COLUMNS.getLiteral(); |
| DatamartSource _source_8 = datamart.getSource(); |
| IEObjectDescription _create_3 = EObjectDescription.create(_literal_4, ((DatamartTask) _source_8)); |
| result.add(_create_3); |
| String _literal_5 = AxisEnum.ROWS.getLiteral(); |
| DatamartSource _source_9 = datamart.getSource(); |
| IEObjectDescription _create_4 = EObjectDescription.create(_literal_5, ((DatamartTask) _source_9)); |
| result.add(_create_4); |
| } |
| } |
| } |
| } |
| } |
| return MapBasedScope.createScope(IScope.NULLSCOPE, result); |
| } |
| |
| public void getEntityAxes(final DatamartEntity entity, final ArrayList<IEObjectDescription> result) { |
| EList<DatamartNavigation> _navigations = entity.getNavigations(); |
| for (final DatamartNavigation navigation : _navigations) { |
| { |
| if ((navigation instanceof DatamartMember)) { |
| DatamartEntity _datamartEntity = ((DatamartMember) navigation).getDatamartEntity(); |
| this.getEntityAxes(_datamartEntity, result); |
| DatamartEntity _datamartEntity_1 = ((DatamartMember) navigation).getDatamartEntity(); |
| EList<DatamartProperty> _properties = _datamartEntity_1.getProperties(); |
| for (final DatamartProperty property : _properties) { |
| AxisEnum _axis = property.getAxis(); |
| String _literal = _axis.getLiteral(); |
| boolean _containsName = this.containsName(result, _literal); |
| boolean _not = (!_containsName); |
| if (_not) { |
| AxisEnum _axis_1 = property.getAxis(); |
| String _literal_1 = _axis_1.getLiteral(); |
| IEObjectDescription _create = EObjectDescription.create(_literal_1, ((DatamartAxis) property)); |
| result.add(_create); |
| } |
| } |
| } |
| if ((navigation instanceof DatamartOwner)) { |
| DatamartEntity _datamartEntity_2 = ((DatamartOwner) navigation).getDatamartEntity(); |
| this.getEntityAxes(_datamartEntity_2, result); |
| DatamartEntity _datamartEntity_3 = ((DatamartOwner) navigation).getDatamartEntity(); |
| EList<DatamartProperty> _properties_1 = _datamartEntity_3.getProperties(); |
| for (final DatamartProperty property_1 : _properties_1) { |
| AxisEnum _axis_2 = property_1.getAxis(); |
| String _literal_2 = _axis_2.getLiteral(); |
| boolean _containsName_1 = this.containsName(result, _literal_2); |
| boolean _not_1 = (!_containsName_1); |
| if (_not_1) { |
| AxisEnum _axis_3 = property_1.getAxis(); |
| String _literal_3 = _axis_3.getLiteral(); |
| IEObjectDescription _create_1 = EObjectDescription.create(_literal_3, ((DatamartAxis) property_1)); |
| result.add(_create_1); |
| } |
| } |
| } |
| } |
| } |
| EList<DatamartProperty> _properties = entity.getProperties(); |
| for (final DatamartProperty property : _properties) { |
| AxisEnum _axis = property.getAxis(); |
| boolean _notEquals = (!Objects.equal(_axis, null)); |
| if (_notEquals) { |
| AxisEnum _axis_1 = property.getAxis(); |
| String _literal = _axis_1.getLiteral(); |
| boolean _containsName = this.containsName(result, _literal); |
| boolean _not = (!_containsName); |
| if (_not) { |
| AxisEnum _axis_2 = property.getAxis(); |
| String _literal_1 = _axis_2.getLiteral(); |
| IEObjectDescription _create = EObjectDescription.create(_literal_1, ((DatamartAxis) property)); |
| result.add(_create); |
| } |
| } else { |
| AxisEnum _axis_3 = property.getAxis(); |
| String _literal_2 = _axis_3.getLiteral(); |
| boolean _containsName_1 = this.containsName(result, _literal_2); |
| boolean _not_1 = (!_containsName_1); |
| if (_not_1) { |
| AxisEnum _axis_4 = property.getAxis(); |
| String _literal_3 = _axis_4.getLiteral(); |
| IEObjectDescription _create_1 = EObjectDescription.create(_literal_3, ((DatamartAxis) property)); |
| result.add(_create_1); |
| } |
| } |
| } |
| } |
| |
| public boolean containsName(final ArrayList<IEObjectDescription> list, final String name) { |
| for (final IEObjectDescription obj : list) { |
| { |
| QualifiedName _name = obj.getName(); |
| String oname = _name.toString(); |
| boolean _equals = oname.equals(name); |
| if (_equals) { |
| return true; |
| } |
| } |
| } |
| return false; |
| } |
| |
| public void getEntityProperties(final DatamartEntity entity, final ArrayList<IEObjectDescription> result, final String requestedAxisName) { |
| EList<DatamartNavigation> _navigations = entity.getNavigations(); |
| for (final DatamartNavigation navigation : _navigations) { |
| { |
| if ((navigation instanceof DatamartMember)) { |
| DatamartEntity _datamartEntity = ((DatamartMember) navigation).getDatamartEntity(); |
| this.getEntityProperties(_datamartEntity, result, requestedAxisName); |
| DatamartEntity _datamartEntity_1 = ((DatamartMember) navigation).getDatamartEntity(); |
| EList<DatamartProperty> _properties = _datamartEntity_1.getProperties(); |
| for (final DatamartProperty property : _properties) { |
| AxisEnum _axis = property.getAxis(); |
| String _literal = _axis.getLiteral(); |
| boolean _equals = _literal.equals(requestedAxisName); |
| if (_equals) { |
| String _propertyName = this.datamartInferrer.getPropertyName(property); |
| IEObjectDescription _create = EObjectDescription.create(_propertyName, |
| ((DatamartProperty) property)); |
| result.add(_create); |
| } |
| } |
| } |
| if ((navigation instanceof DatamartOwner)) { |
| DatamartEntity _datamartEntity_2 = ((DatamartOwner) navigation).getDatamartEntity(); |
| this.getEntityProperties(_datamartEntity_2, result, requestedAxisName); |
| DatamartEntity _datamartEntity_3 = ((DatamartOwner) navigation).getDatamartEntity(); |
| EList<DatamartProperty> _properties_1 = _datamartEntity_3.getProperties(); |
| for (final DatamartProperty property_1 : _properties_1) { |
| AxisEnum _axis_1 = property_1.getAxis(); |
| String _literal_1 = _axis_1.getLiteral(); |
| boolean _equals_1 = _literal_1.equals(requestedAxisName); |
| if (_equals_1) { |
| String _propertyName_1 = this.datamartInferrer.getPropertyName(property_1); |
| IEObjectDescription _create_1 = EObjectDescription.create(_propertyName_1, |
| ((DatamartProperty) property_1)); |
| result.add(_create_1); |
| } |
| } |
| } |
| } |
| } |
| EList<DatamartProperty> _properties = entity.getProperties(); |
| for (final DatamartProperty property : _properties) { |
| AxisEnum _axis = property.getAxis(); |
| boolean _notEquals = (!Objects.equal(_axis, null)); |
| if (_notEquals) { |
| AxisEnum _axis_1 = property.getAxis(); |
| String _literal = _axis_1.getLiteral(); |
| boolean _equals = _literal.equals(requestedAxisName); |
| if (_equals) { |
| String _propertyName = this.datamartInferrer.getPropertyName(property); |
| IEObjectDescription _create = EObjectDescription.create(_propertyName, |
| ((DatamartProperty) property)); |
| result.add(_create); |
| } |
| } else { |
| String _propertyName_1 = this.datamartInferrer.getPropertyName(property); |
| IEObjectDescription _create_1 = EObjectDescription.create(_propertyName_1, |
| ((DatamartProperty) property)); |
| result.add(_create_1); |
| } |
| } |
| } |
| |
| public void getTaskColumns(final DatamartTask task, final ArrayList<IEObjectDescription> result, final String requestedAxisName) { |
| EList<DatamartColumn> _columns = task.getColumns(); |
| for (final DatamartColumn column : _columns) { |
| String _literal = AxisEnum.COLUMNS.getLiteral(); |
| boolean _equals = _literal.equals(requestedAxisName); |
| if (_equals) { |
| TaskQueryColumnEnum _columnRef = column.getColumnRef(); |
| String _literal_1 = _columnRef.getLiteral(); |
| IEObjectDescription _create = EObjectDescription.create(_literal_1, column); |
| result.add(_create); |
| } |
| } |
| } |
| |
| public IScope getScope_Table_valueRef(final EObject object, final EReference reference) { |
| ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList(); |
| EObject eObj = object; |
| String requestedAxisName = ""; |
| while ((!(eObj instanceof TableDatamart))) { |
| { |
| EObject _eContainer = eObj.eContainer(); |
| eObj = _eContainer; |
| if ((eObj instanceof TableAxis)) { |
| AxisEnum _axis = ((TableAxis) eObj).getAxis(); |
| String _literal = _axis.getLiteral(); |
| requestedAxisName = _literal; |
| } |
| } |
| } |
| boolean _notEquals = (!Objects.equal(eObj, null)); |
| if (_notEquals) { |
| DatamartDefinition datamart = ((TableDatamart) eObj).getDatamartRef(); |
| boolean _and = false; |
| boolean _notEquals_1 = (!Objects.equal(datamart, null)); |
| if (!_notEquals_1) { |
| _and = false; |
| } else { |
| DatamartSource _source = datamart.getSource(); |
| boolean _notEquals_2 = (!Objects.equal(_source, null)); |
| _and = _notEquals_2; |
| } |
| if (_and) { |
| DatamartSource _source_1 = datamart.getSource(); |
| if ((_source_1 instanceof DatamartCube)) { |
| DatamartSource _source_2 = datamart.getSource(); |
| EList<DatamartCubeElement> _axisslicer = ((DatamartCube) _source_2).getAxisslicer(); |
| for (final DatamartCubeElement axis : _axisslicer) { |
| if ((axis instanceof DatamartAxis)) { |
| AxisEnum _name = ((DatamartAxis) axis).getName(); |
| String _literal = _name.getLiteral(); |
| boolean _equals = _literal.equals(requestedAxisName); |
| if (_equals) { |
| boolean hasMeasures = false; |
| boolean hasHierarchy = false; |
| boolean hasAggregation = false; |
| boolean isCrossjoined = false; |
| EList<DatamartElement> _elements = ((DatamartAxis) axis).getElements(); |
| for (final DatamartElement element : _elements) { |
| boolean _or = false; |
| if ((element instanceof DatamartMeasure)) { |
| _or = true; |
| } else { |
| _or = (element instanceof DatamartDerivedMeasure); |
| } |
| if (_or) { |
| hasMeasures = true; |
| } |
| } |
| EList<DatamartElement> _elements_1 = ((DatamartAxis) axis).getElements(); |
| for (final DatamartElement element_1 : _elements_1) { |
| { |
| if ((element_1 instanceof DatamartHierarchy)) { |
| if (hasHierarchy) { |
| isCrossjoined = true; |
| } else { |
| hasHierarchy = true; |
| } |
| } |
| if ((element_1 instanceof DatamartSetAggregation)) { |
| if (hasAggregation) { |
| isCrossjoined = true; |
| } else { |
| hasAggregation = true; |
| } |
| hasAggregation = true; |
| } |
| } |
| } |
| if ((hasMeasures && (hasHierarchy || hasAggregation))) { |
| isCrossjoined = true; |
| } |
| if ((1 == 1)) { |
| EList<DatamartElement> _elements_2 = ((DatamartAxis) axis).getElements(); |
| for (final DatamartElement element_2 : _elements_2) { |
| { |
| boolean _and_1 = false; |
| if (!(element_2 instanceof DatamartMeasure)) { |
| _and_1 = false; |
| } else { |
| boolean _equals_1 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_MEASURE__VALUE_REF); |
| _and_1 = _equals_1; |
| } |
| if (_and_1) { |
| CubeMeasure _measureRef = ((DatamartMeasure) element_2).getMeasureRef(); |
| boolean _notEquals_3 = (!Objects.equal(_measureRef, null)); |
| if (_notEquals_3) { |
| CubeMeasure _measureRef_1 = ((DatamartMeasure) element_2).getMeasureRef(); |
| String _name_1 = _measureRef_1.getName(); |
| IEObjectDescription _create = EObjectDescription.create(_name_1, element_2); |
| result.add(_create); |
| } |
| } |
| boolean _and_2 = false; |
| if (!(element_2 instanceof DatamartDerivedMeasure)) { |
| _and_2 = false; |
| } else { |
| boolean _equals_2 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_DERIVED__VALUE_REF); |
| _and_2 = _equals_2; |
| } |
| if (_and_2) { |
| DatamartDefineDerivedMeasure _derivedRef = ((DatamartDerivedMeasure) element_2).getDerivedRef(); |
| boolean _notEquals_4 = (!Objects.equal(_derivedRef, null)); |
| if (_notEquals_4) { |
| DatamartDefineDerivedMeasure _derivedRef_1 = ((DatamartDerivedMeasure) element_2).getDerivedRef(); |
| String _name_2 = _derivedRef_1.getName(); |
| IEObjectDescription _create_1 = EObjectDescription.create(_name_2, element_2); |
| result.add(_create_1); |
| } |
| } |
| boolean _and_3 = false; |
| if (!((element_2 instanceof DatamartHierarchy) && (!hasMeasures))) { |
| _and_3 = false; |
| } else { |
| boolean _equals_3 = Objects.equal(reference, TableDSLPackage.Literals.TABLE_HIERARCHY__VALUE_REF); |
| _and_3 = _equals_3; |
| } |
| if (_and_3) { |
| CubeHierarchy _hierarchyRef = ((DatamartHierarchy) element_2).getHierarchyRef(); |
| boolean _notEquals_5 = (!Objects.equal(_hierarchyRef, null)); |
| if (_notEquals_5) { |
| DatamartHierarchy hierarchy = ((DatamartHierarchy) element_2); |
| CubeLevel _levelRef = hierarchy.getLevelRef(); |
| boolean _notEquals_6 = (!Objects.equal(_levelRef, null)); |
| if (_notEquals_6) { |
| boolean _isAll = hierarchy.isAll(); |
| if (_isAll) { |
| CubeLevel _levelRef_1 = hierarchy.getLevelRef(); |
| EObject _eContainer = ((CubeLevel) _levelRef_1).eContainer(); |
| CubeDimensionEntity dimEntity = ((CubeDimensionEntity) _eContainer); |
| EList<CubeLevel> _hierarchLevels = dimEntity.getHierarchLevels(); |
| for (final CubeLevel cubeLevel : _hierarchLevels) { |
| String _name_3 = cubeLevel.getName(); |
| IEObjectDescription _create_2 = EObjectDescription.create(_name_3, cubeLevel); |
| result.add(_create_2); |
| } |
| } else { |
| CubeLevel _levelRef_2 = hierarchy.getLevelRef(); |
| String _name_4 = _levelRef_2.getName(); |
| CubeLevel _levelRef_3 = hierarchy.getLevelRef(); |
| IEObjectDescription _create_3 = EObjectDescription.create(_name_4, ((CubeLevel) _levelRef_3)); |
| result.add(_create_3); |
| } |
| } else { |
| CubeHierarchy _hierarchyRef_1 = hierarchy.getHierarchyRef(); |
| boolean _isAllMemberName = ((CubeHierarchy) _hierarchyRef_1).isAllMemberName(); |
| if (_isAllMemberName) { |
| CubeHierarchy _hierarchyRef_2 = hierarchy.getHierarchyRef(); |
| String _allMemberNameValue = ((CubeHierarchy) _hierarchyRef_2).getAllMemberNameValue(); |
| String _string = _allMemberNameValue.toString(); |
| CubeHierarchy _hierarchyRef_3 = hierarchy.getHierarchyRef(); |
| IEObjectDescription _create_4 = EObjectDescription.create(_string, ((CubeHierarchy) _hierarchyRef_3)); |
| result.add(_create_4); |
| } else { |
| boolean _isDefaultMember = hierarchy.isDefaultMember(); |
| if (_isDefaultMember) { |
| CubeHierarchy _hierarchyRef_4 = hierarchy.getHierarchyRef(); |
| String _defaultMemberValue = ((CubeHierarchy) _hierarchyRef_4).getDefaultMemberValue(); |
| String _string_1 = _defaultMemberValue.toString(); |
| CubeHierarchy _hierarchyRef_5 = hierarchy.getHierarchyRef(); |
| IEObjectDescription _create_5 = EObjectDescription.create(_string_1, ((CubeHierarchy) _hierarchyRef_5)); |
| result.add(_create_5); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } else { |
| DatamartSource _source_3 = datamart.getSource(); |
| if ((_source_3 instanceof DatamartEntity)) { |
| DatamartSource _source_4 = datamart.getSource(); |
| this.getEntityProperties(((DatamartEntity) _source_4), result, requestedAxisName); |
| } else { |
| DatamartSource _source_5 = datamart.getSource(); |
| if ((_source_5 instanceof DatamartTask)) { |
| DatamartSource _source_6 = datamart.getSource(); |
| this.getTaskColumns(((DatamartTask) _source_6), result, requestedAxisName); |
| } |
| } |
| } |
| } |
| } |
| return MapBasedScope.createScope(IScope.NULLSCOPE, result); |
| } |
| |
| public IScope getScope_Table_Aggregation_valueRef(final EObject object) { |
| ArrayList<IEObjectDescription> result = CollectionLiterals.<IEObjectDescription>newArrayList(); |
| String requestedAxisName = ""; |
| EObject eObj = object; |
| while ((!(eObj instanceof TableDatamart))) { |
| { |
| EObject _eContainer = eObj.eContainer(); |
| eObj = _eContainer; |
| if ((eObj instanceof TableAxis)) { |
| AxisEnum _axis = ((TableAxis) eObj).getAxis(); |
| String _literal = _axis.getLiteral(); |
| requestedAxisName = _literal; |
| } |
| } |
| } |
| boolean _notEquals = (!Objects.equal(eObj, null)); |
| if (_notEquals) { |
| DatamartDefinition datamart = ((TableDatamart) eObj).getDatamartRef(); |
| boolean _and = false; |
| boolean _notEquals_1 = (!Objects.equal(datamart, null)); |
| if (!_notEquals_1) { |
| _and = false; |
| } else { |
| DatamartSource _source = datamart.getSource(); |
| boolean _notEquals_2 = (!Objects.equal(_source, null)); |
| _and = _notEquals_2; |
| } |
| if (_and) { |
| DatamartSource _source_1 = datamart.getSource(); |
| if ((_source_1 instanceof DatamartCube)) { |
| DatamartSource _source_2 = datamart.getSource(); |
| EList<DatamartCubeElement> _axisslicer = ((DatamartCube) _source_2).getAxisslicer(); |
| for (final DatamartCubeElement axis : _axisslicer) { |
| if ((axis instanceof DatamartAxis)) { |
| AxisEnum _name = ((DatamartAxis) axis).getName(); |
| String _literal = _name.getLiteral(); |
| boolean _equals = _literal.equals(requestedAxisName); |
| if (_equals) { |
| boolean hasMeasures = false; |
| boolean hasHierarchy = false; |
| boolean hasAggregation = false; |
| boolean isCrossjoined = false; |
| EList<DatamartElement> _elements = ((DatamartAxis) axis).getElements(); |
| for (final DatamartElement element : _elements) { |
| boolean _or = false; |
| if ((element instanceof DatamartMeasure)) { |
| _or = true; |
| } else { |
| _or = (element instanceof DatamartDerivedMeasure); |
| } |
| if (_or) { |
| hasMeasures = true; |
| } |
| } |
| EList<DatamartElement> _elements_1 = ((DatamartAxis) axis).getElements(); |
| for (final DatamartElement element_1 : _elements_1) { |
| { |
| if ((element_1 instanceof DatamartHierarchy)) { |
| if (hasHierarchy) { |
| isCrossjoined = true; |
| } else { |
| hasHierarchy = true; |
| } |
| } |
| if ((element_1 instanceof DatamartSetAggregation)) { |
| if (hasAggregation) { |
| isCrossjoined = true; |
| } else { |
| hasAggregation = true; |
| } |
| hasAggregation = true; |
| } |
| } |
| } |
| if ((hasMeasures && (hasHierarchy || hasAggregation))) { |
| isCrossjoined = true; |
| } |
| if (((!hasMeasures) && (!isCrossjoined))) { |
| EList<DatamartElement> _elements_2 = ((DatamartAxis) axis).getElements(); |
| for (final DatamartElement element_2 : _elements_2) { |
| if ((element_2 instanceof DatamartSetAggregation)) { |
| Expression _left = ((DatamartSetAggregation) element_2).getLeft(); |
| boolean _notEquals_3 = (!Objects.equal(_left, null)); |
| if (_notEquals_3) { |
| Expression _left_1 = ((DatamartSetAggregation) element_2).getLeft(); |
| DatamartAggregationFunctionInterface _aggregation = _left_1.getAggregation(); |
| boolean _notEquals_4 = (!Objects.equal(_aggregation, null)); |
| if (_notEquals_4) { |
| Expression _left_2 = ((DatamartSetAggregation) element_2).getLeft(); |
| DatamartAggregationFunctionInterface _aggregation_1 = _left_2.getAggregation(); |
| DatamartSetAggregationFunction aggregation = ((DatamartSetAggregationFunction) _aggregation_1); |
| SetAggregationEnum _aggregation_2 = aggregation.getAggregation(); |
| String _literal_1 = _aggregation_2.getLiteral(); |
| IEObjectDescription _create = EObjectDescription.create(_literal_1, aggregation); |
| result.add(_create); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| return MapBasedScope.createScope(IScope.NULLSCOPE, result); |
| } |
| } |