catch up with branch development

Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSet.java b/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSet.java
index 0c5bfe0..c9873b4 100644
--- a/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSet.java
+++ b/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSet.java
@@ -151,7 +151,7 @@
 	private DerivedCell getCellTableCell( int cellTableIndex ) throws OdaException {
         validateCursorState();
         DerivedCell result = fCellTable.getCell(cellTableIndex, fCursor);
-        fWasNull = result == null ? true : false;
+        fWasNull = result.getValue() == null ? true : false;
         return result;
 	}
 
@@ -220,7 +220,7 @@
 			String exceptionDetails = sw.toString();
 			LOGGER.error("exception occured:{}", exceptionDetails);  		
         }
-        return -1;
+        return 0;
 	}
 
 	/*
@@ -243,7 +243,7 @@
     		LOGGER.debug("resultSetIdx:{} Double from Double:{}", resultSetIndex, ((Double)object).doubleValue());
         	return ((Double)object);
         }
-        return -1.0;
+        return 0.0;
 	}
 
 	/*
@@ -271,7 +271,7 @@
         	LOGGER.debug("resultSetIdx:{} Long from BigDecimal:{}", resultSetIndex, BigDecimal.valueOf((Long)object));
         	return BigDecimal.valueOf((Long)object);
         }
-        return null;
+        return BigDecimal.ZERO;
 	}
 
 	/*
diff --git a/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSetMetaData.java b/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSetMetaData.java
index c0f1a04..3ac5493 100644
--- a/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSetMetaData.java
+++ b/org.eclipse.osbp.xtext.reportdsl.oda.datamart/src/org/eclipse/osbp/xtext/reportdsl/oda/datamart/impl/ResultSetMetaData.java
@@ -14,7 +14,7 @@
  */
 package org.eclipse.osbp.xtext.reportdsl.oda.datamart.impl;
 
-import java.util.HashMap;
+import java.util.Map;
 import java.util.Map.Entry;
 
 import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
@@ -37,7 +37,7 @@
     private String[] columnNames = null;
     private DataTypes[] columnTypes = null;
     private String[] columnLabels = null;
-    private HashMap<String, String> typesPropMap;
+    private Map<String, String> typesPropMap;
 	private static final Logger LOGGER = LoggerFactory.getLogger(ResultSetMetaData.class);
 
     ResultSetMetaData( String[] colNames, DataTypes[] colTypes, String[] colLabels ) {
@@ -54,7 +54,7 @@
         }
     }
     
-    ResultSetMetaData( HashMap<String, EType> typesMap, HashMap<String, String> typesPropMap) {
+    ResultSetMetaData( Map<String, EType> typesMap, Map<String, String> typesPropMap) {
     	this.typesPropMap = typesPropMap;
 		columnNames = typesMap.keySet().toArray(new String[0]); 
 		for(int idx=0; idx<columnNames.length; idx++) {
@@ -71,7 +71,7 @@
 		}
     }
 
-    public HashMap<String, String> getTypesPropMap() {
+    public Map<String, String> getTypesPropMap() {
 		return typesPropMap;
 	}
 
diff --git a/org.eclipse.osbp.xtext.reportdsl.tests/xtend-gen/org/eclipse/osbp/xtext/reportdsl/tests/ReportDSLParsingTest.java b/org.eclipse.osbp.xtext.reportdsl.tests/xtend-gen/org/eclipse/osbp/xtext/reportdsl/tests/ReportDSLParsingTest.java
index 98776a3..1e73ecc 100644
--- a/org.eclipse.osbp.xtext.reportdsl.tests/xtend-gen/org/eclipse/osbp/xtext/reportdsl/tests/ReportDSLParsingTest.java
+++ b/org.eclipse.osbp.xtext.reportdsl.tests/xtend-gen/org/eclipse/osbp/xtext/reportdsl/tests/ReportDSLParsingTest.java
@@ -1,16 +1,5 @@
 /**
- * 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
- * 
+ * generated by Xtext 2.11.0
  */
 package org.eclipse.osbp.xtext.reportdsl.tests;
 
diff --git a/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/BaseReport.java b/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/BaseReport.java
index 105f3e1..222fe61 100644
--- a/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/BaseReport.java
+++ b/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/BaseReport.java
@@ -19,7 +19,6 @@
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.URL;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -45,6 +44,8 @@
 import org.eclipse.e4.core.contexts.IEclipseContext;
 import org.eclipse.e4.ui.di.Focus;
 import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
+import org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveImpl;
 import org.eclipse.e4.ui.model.application.ui.menu.MToolBar;
 import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement;
 import org.eclipse.osbp.dsl.semantic.entity.LEntity;
@@ -55,7 +56,6 @@
 import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent.EventDispatcherDataTag;
 import org.eclipse.osbp.runtime.common.event.IDualData;
 import org.eclipse.osbp.runtime.common.event.IEventDispatcher;
-import org.eclipse.osbp.runtime.common.filter.IDTOServiceWithMutablePersistence;
 import org.eclipse.osbp.ui.api.customfields.IBlobService;
 import org.eclipse.osbp.ui.api.datamart.DatamartFilter;
 import org.eclipse.osbp.ui.api.datamart.DatamartPrimary;
@@ -68,20 +68,17 @@
 import org.eclipse.osbp.ui.api.user.IUser;
 import org.eclipse.osbp.utils.common.EntityUtils;
 import org.eclipse.osbp.utils.constants.ExtendedDate;
-import org.eclipse.osbp.utils.entityhelper.DataType;
 import org.eclipse.osbp.utils.vaadin.PropertyLookup;
 import org.eclipse.osbp.utils.vaadin.ViewLayoutManager;
 import org.eclipse.osbp.xtext.action.ReportActionEnum;
 import org.eclipse.osbp.xtext.action.common.IToolbarAction;
 import org.eclipse.osbp.xtext.datamart.common.DatamartFilterGenerator;
-import org.eclipse.osbp.xtext.datamart.common.DatamartUiFilterFactory;
 import org.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
 import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition;
 import org.eclipse.osbp.xtext.datamartdsl.DatamartEntity;
 import org.eclipse.osbp.xtext.datamartdsl.DatamartNavigation;
 import org.eclipse.osbp.xtext.reportdsl.common.item.BodyItem;
 import org.eclipse.osbp.xtext.reportdsl.jvmmodel.ReportGeneratorWorkSet;
-import org.eclipse.xtext.xbase.lib.Extension;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -302,13 +299,7 @@
 				getClass().getClassLoader().getResource(retcode).openStream();
 			} catch (Exception e1) {
 				// --- or the automatic generated report file ---
-				Collection<String> roles = getAuthenticatedRoles();
-				// for the moment - take the first role
-				if (roles != null && roles.iterator().hasNext()) {
-					retcode = "rptdesign-gen/" + pathName + roles.iterator().next() + RPTDESIGN;
-				} else {
-					retcode = "rptdesign-gen/" + pathName + RPTDESIGN;
-				}
+				retcode = "rptdesign-gen/" + pathName + RPTDESIGN;
 				try {
 					getClass().getClassLoader().getResource(retcode).openStream();
 				} catch (Exception e2) {
@@ -609,6 +600,8 @@
 		if (changedFilter != null) {
 			EventDispatcherEvent evnt = new EventDispatcherEvent(EventDispatcherCommand.SELECT, changedFilter.getName(),
 					getClass().getCanonicalName());
+			PerspectiveImpl perspective = (PerspectiveImpl) getContext().get(MPerspective.class);
+			if(perspective != null){evnt.setPerspective(perspective);}
 			evnt.addData(changedFilter.getSelectedData());
 			eventDispatcher.sendEvent(evnt);
 		}
@@ -619,11 +612,14 @@
 	public void receiveEvent(final EventDispatcherEvent event) {
 		switch (event.getCommand()) {
 		case SELECT:
-			if (!event.getSender().equals(getClass().getCanonicalName())) {
-				for (IDatamartFilterGenerator filterGenerator : filterGeneratorMap.values()) {
-					if(filterGenerator.isPrimaryFilterId(event) && filterGenerator.selectItem(event, getSelectById())) {
-						selectedId = event.getData().get(EventDispatcherDataTag.ID);
-						renderData();
+			PerspectiveImpl perspective = (PerspectiveImpl) getContext().get(MPerspective.class);
+			if(event.getPerspective() == null || (perspective != null && event.getPerspective().equals(perspective))){ 				
+				if (!event.getSender().equals(getClass().getCanonicalName())) {
+					for (IDatamartFilterGenerator filterGenerator : filterGeneratorMap.values()) {
+						if(filterGenerator.isPrimaryFilterId(event) && filterGenerator.selectItem(event, getSelectById())) {
+							selectedId = event.getData().get(EventDispatcherDataTag.ID);
+							renderData();
+						}
 					}
 				}
 			}
diff --git a/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/item/ABaseItem.java b/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/item/ABaseItem.java
index fdac866..29dc3f1 100644
--- a/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/item/ABaseItem.java
+++ b/org.eclipse.osbp.xtext.reportdsl/src/org/eclipse/osbp/xtext/reportdsl/common/item/ABaseItem.java
@@ -66,6 +66,13 @@
 				if (tableAttributeName.equals(datamartAttributeName)){
 					return getBaseItem(tableAttributeName, dataTypeString, datamartAttribute);
 				}
+			} else if(tableElement instanceof TableAggregation){
+				for(DatamartAttribute datamartAttribute:((TableAggregation) tableElement).getAggregation().getValueRefs()){
+					String datamartAttributeName = DatamartAttributeUtil.getAliasedAttributeName(datamartAttribute);
+					if (tableAttributeName.endsWith(datamartAttributeName)){
+						return getBaseItem(tableAttributeName, dataTypeString, datamartAttribute);
+					}
+				}
 			}
 		}
 		return null;
diff --git a/org.eclipse.osbp.xtext.reportdsl/xtend-gen/org/eclipse/osbp/xtext/reportdsl/common/DatatypeUtilities.java b/org.eclipse.osbp.xtext.reportdsl/xtend-gen/org/eclipse/osbp/xtext/reportdsl/common/DatatypeUtilities.java
index b9c7f02..7627687 100644
--- a/org.eclipse.osbp.xtext.reportdsl/xtend-gen/org/eclipse/osbp/xtext/reportdsl/common/DatatypeUtilities.java
+++ b/org.eclipse.osbp.xtext.reportdsl/xtend-gen/org/eclipse/osbp/xtext/reportdsl/common/DatatypeUtilities.java
@@ -1,7 +1,7 @@
 package org.eclipse.osbp.xtext.reportdsl.common;
 
 import com.google.common.base.Objects;
-import java.util.HashMap;
+import java.util.Map;
 import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
 import org.eclipse.osbp.dsl.semantic.common.types.LDataType;
 import org.eclipse.osbp.dsl.semantic.common.types.LDateType;
@@ -27,7 +27,7 @@
   }
   
   public static String getDatatypeName(final IDataMart datamart, final DatamartAttribute datamartAttribute) {
-    HashMap<String, IDataMart.EType> _typesMap = datamart.getTypesMap();
+    Map<String, IDataMart.EType> _typesMap = datamart.getTypesMap();
     StringConcatenation _builder = new StringConcatenation();
     String _name = datamartAttribute.getAttributeRef().getEntity().getName();
     _builder.append(_name);