catch up with branch daily
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
index 5792be1..92c6c4b 100644
--- a/jenkins.build.config.xml
+++ b/jenkins.build.config.xml
@@ -19,9 +19,7 @@
<jenkins.build.dependency>org.eclipse.osbp.dsl</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.preferences</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency>
- <jenkins.build.dependency>org.eclipse.osbp.runtime.web</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.ui.api</jenkins.build.dependency>
- <jenkins.build.dependency>org.eclipse.osbp.utils</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.xtext.entitymock.common</jenkins.build.dependency>
<jenkins.build.dependency>org.eclipse.osbp.xtext.i18n</jenkins.build.dependency>
</jenkins.build.dependencies>
diff --git a/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF
index f305119..b18683d 100644
--- a/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF
@@ -11,7 +11,6 @@
org.eclipse.core.runtime,
org.eclipse.core.databinding;bundle-version="[1.6.0,1.7.0)",
org.eclipse.core.databinding.beans;bundle-version="[1.3.100,1.4.0)",
- org.eclipse.osbp.runtime.web.vaadin.databinding;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.dsl.entity.xtext;bundle-version="[0.9.0,0.10.0)",
org.eclipse.osbp.dsl.common.xtext;bundle-version="[0.9.0,0.10.0)",
com.vaadin.client;bundle-version="[7.7.6,7.8.0)",
@@ -38,7 +37,6 @@
org.eclipse.osbp.ui.api.themes;version="0.9.0",
org.eclipse.osbp.ui.api.user;version="0.9.0",
org.eclipse.osbp.ui.api.useraccess;version="0.9.0",
- org.eclipse.osbp.utils.entityhelper;version="0.9.0",
org.eclipse.osbp.xtext.entitymock.common.filler;version="0.9.0",
org.eclipse.osbp.xtext.i18n;version="0.9.0",
org.slf4j;resolution:=optional
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ACubeDatamart.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ACubeDatamart.java
index 5d6c7eb..e980d3d 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ACubeDatamart.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ACubeDatamart.java
@@ -35,4 +35,8 @@
public final Map<String, String> getAliasMap() {
return null;
}
+ @Override
+ public final Map<String, AttributeVisibility> getHiddenMap() {
+ return null;
+ }
}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java
index 7b399e9..71db7f4 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java
@@ -1,6 +1,6 @@
/**
*
- * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ * Copyright (c) 2011, 2018 - 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
@@ -14,6 +14,8 @@
*/
package org.eclipse.osbp.xtext.datamart.common;
+import java.sql.Date;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -52,23 +54,33 @@
/* (non-Javadoc)
* @see org.eclipse.osbp.ui.api.datamart.IDataMart#getIdMap()
*/
+ @Override
public abstract Map<String, EType> getIdMap();
/* (non-Javadoc)
* @see org.eclipse.osbp.ui.api.datamart.IDataMart#getAliasMap()
*/
+ @Override
public abstract Map<String, String> getAliasMap();
/* (non-Javadoc)
* @see org.eclipse.osbp.ui.api.datamart.IDataMart#getTypesMap()
*/
+ @Override
public abstract Map<String, EType> getTypesMap();
/* (non-Javadoc)
* @see org.eclipse.osbp.ui.api.datamart.IDataMart#getTypesProp()
*/
+ @Override
public abstract Map<String, String> getTypesProp();
+ /* (non-Javadoc)
+ * @see org.eclipse.osbp.ui.api.datamart.IDataMart#getHiddenMap()
+ */
+ @Override
+ public abstract Map<String, AttributeVisibility> getHiddenMap();
+
/**
* Disconnect.
*
@@ -112,10 +124,24 @@
}
/**
+ * Calls the vendor specific 'to date' sql method.
+ *
+ * @param date the date
+ * @return the vendor 'to date' sql method prefix
+ */
+ protected String vendorConvertToDateSQL( Date date ) {
+ if(dbVendor != null) {
+ return dbVendor.convertToDateSQL(date);
+ }
+ return "to_date('"+date.toString().replace(".0","")+"','YYYY-MM-DD HH24:MI:SS')";
+ }
+
+ /**
* Gets the vendor specific 'to date' sql method prefix.
*
* @return the vendor 'to date' sql method prefix
*/
+ @Deprecated
protected String getVendorToDateSQLMethod() {
if(dbVendor != null) {
return dbVendor.getToDateSQLMethod();
@@ -124,10 +150,24 @@
}
/**
+ * Calls the vendor specific 'to timestamp' sql method.
+ *
+ * @param date the date
+ * @return the vendor 'to date' sql method prefix
+ */
+ protected String vendorConvertToTimestampSQL( Timestamp date ) {
+ if(dbVendor != null) {
+ return dbVendor.convertToTimestampSQL(date);
+ }
+ return "to_timestamp('"+date.toString().replace(".0","")+"','YYYY-MM-DD HH24:MI:SS')";
+ }
+
+ /**
* Gets the vendor specific 'to timestamp' sql method prefix.
*
* @return the vendor 'to timestamp' sql method prefix
*/
+ @Deprecated
protected String getVendorToTimestampSQLMethod() {
if(dbVendor != null) {
return dbVendor.getToTimestampSQLMethod();
@@ -166,7 +206,7 @@
ArrayList<DatamartFilter> filters = getFilters();
if (filters != null) {
DatamartFilter firstFilter = null;
- List<List<String>> filterGroup = new ArrayList<List<String>>();
+ List<List<String>> filterGroup = new ArrayList<>();
for (DatamartFilter filter : filters) {
filter.setCondition(null);
switch (filter.getType()) {
@@ -176,10 +216,14 @@
}
break;
case SINGLE:
- case SINGLEHIERARCHY:
case SINGLESLICER:
+ case SINGLEHIERARCHY:
+ case SINGLEHIERARCHYCHILDREN:
if(!filter.getSelectedData().isEmpty()) {
filter.setCondition(filter.getSelectedData().get(0).getDatabaseSelectionValue());
+ if(filter.getType()==FilterType.SINGLEHIERARCHYCHILDREN) {
+ filter.setCondition(filter.getCondition()+".Children");
+ }
} else { // failsafe - but only if filter is optional
filter.setCondition("'*'");
}
@@ -199,6 +243,7 @@
case EXCEPT:
case MULTIPLE:
case MULTIPLEHIERARCHY:
+ case MULTIPLEHIERARCHYCHILDREN:
String selection = "";
for(IDualData item : filter.getSelectedData()) {
if (item != null) {
@@ -206,10 +251,18 @@
selection += ",";
}
selection += item.getDatabaseSelectionValue();
+ if(filter.getType()==FilterType.MULTIPLEHIERARCHYCHILDREN) {
+ selection += ".Children";
+ }
+
}
}
if(!filter.getSelectedData().isEmpty()) {
- filter.setCondition(selection);
+ if(filter.getType()==FilterType.MULTIPLEHIERARCHYCHILDREN) {
+ filter.setCondition("{"+selection+"}");
+ } else {
+ filter.setCondition(selection);
+ }
} else if(filter.getType() == FilterType.EXCEPT) {
filter.setCondition("");
} else {
@@ -218,7 +271,7 @@
break;
case MULTIPLESLICER:
// all multiple slicer filters are accumulated to the first filter multiple slicer filter
- List<String> myList = new ArrayList<String>();
+ List<String> myList = new ArrayList<>();
for (IDualData item : filter.getSelectedData()) {
if (item != null) {
myList.add(item.getDatabaseSelectionValue());
@@ -235,7 +288,7 @@
}
if(firstFilter != null) {
// calculate every permutation of selection as slices must be created
- List<List<String>> permutations = new ArrayList<List<String>>();
+ List<List<String>> permutations = new ArrayList<>();
int numEntries = 1;
for (List<String> list : filterGroup) {
numEntries *= list.size();
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/AEntityDatamart.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/AEntityDatamart.java
index 16c500e..4c90dbc 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/AEntityDatamart.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/AEntityDatamart.java
@@ -26,25 +26,4 @@
@SuppressWarnings("all")
public abstract class AEntityDatamart extends ADatamart<Connection> {
public abstract DerivedCellSet getResults(Class operativeDtoClass, List<IDto> operativeDtos);
- protected boolean fFillerTextEnabled = false;
-
- /**
- * @param enableFillerText enable using filler text for following calls to {@link #getResults(Map)}
- */
- public void enableFillerText(boolean enableFillerText) {
- fFillerTextEnabled = enableFillerText;
- }
- /**
- * @return the generated filler text result set. Has be generated for each datamart class
- */
- protected ResultSet generateFillerTextResultSet() {
- return null;
- }
- /**
- * @param provider the filler text provider in use
- * @return the generated filler text row. Has be generated for each datamart class
- */
- public Map<String, Object> generateFillerTextRow(FillerTextProvider provider) {
- return null;
- }
}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ATaskDatamart.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ATaskDatamart.java
index 62abe38..e543109 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ATaskDatamart.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ATaskDatamart.java
@@ -26,4 +26,8 @@
public final Map<String, String> getAliasMap() {
return null;
}
+ @Override
+ public final Map<String, AttributeVisibility> getHiddenMap() {
+ return null;
+ }
}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java
index 4f28d07..631494f 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java
@@ -183,16 +183,18 @@
return false;
}
break;
- case SINGLEHIERARCHY:
case SINGLESLICER:
+ case SINGLEHIERARCHY:
+ case SINGLEHIERARCHYCHILDREN:
if(filter.canSelectData(event.getData(), false, true)) {
filter.getSelector().select(filter.getSelectedData().get(0));
return false;
}
break;
case EXCEPT:
- case MULTIPLEHIERARCHY:
case MULTIPLESLICER:
+ case MULTIPLEHIERARCHY:
+ case MULTIPLEHIERARCHYCHILDREN:
if(filter.canSelectData(event.getData(), true, true)) {
filter.getSelector().select(filter.getSelectedData());
return false;
@@ -240,15 +242,17 @@
case BY_ID:
break;
case SINGLE:
- case SINGLEHIERARCHY:
case SINGLESLICER:
+ case SINGLEHIERARCHY:
+ case SINGLEHIERARCHYCHILDREN:
filter.setSelector((IDatamartSelectable)filterFactory.getUiFilter(filter, numMultiRows));
layoutManager.getTopArea().addComponent((Component)filter.getSelector());
break;
case EXCEPT:
case MULTIPLE:
- case MULTIPLEHIERARCHY:
case MULTIPLESLICER:
+ case MULTIPLEHIERARCHY:
+ case MULTIPLEHIERARCHYCHILDREN:
filter.setSelector((IDatamartSelectable)filterFactory.getUiFilter(filter, numMultiRows));
layoutManager.getSideArea().addComponent((Component)filter.getSelector());
break;
@@ -307,8 +311,9 @@
case BY_ID:
break;
case SINGLE:
- case SINGLEHIERARCHY:
case SINGLESLICER:
+ case SINGLEHIERARCHY:
+ case SINGLEHIERARCHYCHILDREN:
if(filter.getSelector().getValue() != null) {
filter.addSelectedItem((IDualData)filter.getSelector().getValue());
} else {
@@ -320,8 +325,9 @@
filter.setSelectedData(filter.getSelector().getSelectedItems());
break;
case MULTIPLE:
- case MULTIPLEHIERARCHY:
case MULTIPLESLICER:
+ case MULTIPLEHIERARCHY:
+ case MULTIPLEHIERARCHYCHILDREN:
filter.setSelectedData(filter.getSelector().getSelectedItems());
if(filter.getSelector().getSelectedItems().isEmpty()) {
allFiltersSet = false;
@@ -405,7 +411,9 @@
}
// notify the listeners of the changed filter
for(FilterChangeListener listener:listeners) {
- listener.filterChanged(changedFilter);
+ if(changedFilter != null) {
+ listener.filterChanged(changedFilter);
+ }
}
}
}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java
index 3d39562..b32c205 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java
@@ -19,6 +19,8 @@
import java.util.List;
import org.eclipse.osbp.runtime.common.event.IDualData;
+//Temporarily not in use to avoid a loop due to the dependency from org.eclipse.osbp.runtime.web to this bundle
+//import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables;
import org.eclipse.osbp.ui.api.datamart.IDatamartSelectable;
import org.eclipse.osbp.ui.api.themes.EnumCssClass;
@@ -72,37 +74,39 @@
* @param options
*/
public void update(Collection<IDualData> options) {
- removeAllItems();
- firstItem = null;
- for (IDualData dd : options) {
- setHierarchy(dd.getHierarchy());
- String item = dd.getSelectionValue();
- if (item != null) {
- if (firstItem == null) {
- firstItem = dd;
+ getUI().getCurrent().access(new Runnable() {
+ @Override
+ public void run() {
+// Temporarily not in use to avoid a loop due to the dependency from org.eclipse.osbp.runtime.web to this bundle
+// VaadinObservables.activateRealm(getUI().getCurrent());
+ removeAllItems();
+ firstItem = null;
+ for (IDualData dd : options) {
+ setHierarchy(dd.getHierarchy());
+ String item = dd.getSelectionValue();
+ if (item != null) {
+ if (firstItem == null) {
+ firstItem = dd;
+ }
+ addItem(dd);
+ setItemCaption(dd, dd.getFormattedValue());
+ }
}
- addItem(dd);
- setItemCaption(dd, dd.getFormattedValue());
+ // always select the first option
+ Collection<IDualData> selectedItems = new ArrayList<IDualData>();
+ if(selectFirst) {
+ selectedItems.add(firstItem);
+ setNullSelectionAllowed(false);
+ } else {
+ setNullSelectionAllowed(true);
+ }
+ setValue(selectedItems);
+ setEnabled(true);
+ setImmediate(true);
}
- }
- // always select the first option
- Collection<IDualData> selectedItems = new ArrayList<IDualData>();
- if(selectFirst) {
- selectedItems.add(firstItem);
- setNullSelectionAllowed(false);
- } else {
- setNullSelectionAllowed(true);
- }
- setValue(selectedItems);
- setEnabled(true);
- super.setWidth(null);
- setImmediate(true);
+ });
}
- public void setWidth(String width) {
- super.setWidth(width);
- }
-
public List<IDualData> getSelectedItems() {
List<IDualData> list = new ArrayList<IDualData>();
for (Object item : (Collection<?>) getValue()) {
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java
index 7018d74..280eec2 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java
@@ -57,31 +57,31 @@
* @param options
*/
public void update(Collection<IDualData> options) {
- removeAllItems();
- firstItem = null;
- for (IDualData dd : options) {
- setHierarchy(dd.getHierarchy());
- String item = dd.getSelectionValue();
- if (item != null) {
- if (firstItem == null) {
- firstItem = dd;
+ getUI().getCurrent().access(new Runnable() {
+ @Override
+ public void run() {
+ removeAllItems();
+ firstItem = null;
+ for (IDualData dd : options) {
+ setHierarchy(dd.getHierarchy());
+ String item = dd.getSelectionValue();
+ if (item != null) {
+ if (firstItem == null) {
+ firstItem = dd;
+ }
+ addItem(dd);
+ setItemCaption(dd, dd.getFormattedValue());
+ }
}
- addItem(dd);
- setItemCaption(dd, dd.getFormattedValue());
+ // always select the first option
+ setValue(firstItem);
+ setEnabled(true);
+ setNullSelectionAllowed(false);
+ setImmediate(true);
}
- }
- // always select the first option
- setValue(firstItem);
- setEnabled(true);
- super.setWidth(null);
- setNullSelectionAllowed(false);
- setImmediate(true);
+ });
}
- public void setWidth(String width) {
- super.setWidth(width);
- }
-
public List<IDualData> getSelectedItems() {
List<IDualData> items = new ArrayList<IDualData>();
items.add((IDualData) getValue());
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java
index a44c583..c767738 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java
@@ -32,6 +32,7 @@
break;
case SINGLE:
case SINGLEHIERARCHY:
+ case SINGLEHIERARCHYCHILDREN:
uiFilters.put(filter.getName(), new DatamartSingleSelect(false, false, filter.getData()));
break;
case SINGLESLICER:
@@ -42,6 +43,7 @@
break;
case MULTIPLE:
case MULTIPLEHIERARCHY:
+ case MULTIPLEHIERARCHYCHILDREN:
uiFilters.put(filter.getName(), new DatamartMultiSelect(numMultiRows, false, false, true, filter.getData()));
break;
case MULTIPLESLICER:
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedLevel.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedLevel.java
index 3ec4ac5..b7630a1 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedLevel.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedLevel.java
@@ -39,11 +39,11 @@
public boolean isVisible() {
if (olapLevel!=null){
- return olapLevel.isVisible();
+ return true;
} else if (mondrianLevel!=null){
return mondrianLevel.isVisible();
}
- return false;
+ return true;
}
public boolean isAll() {
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedPosition.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedPosition.java
index 035847b..10b9cc6 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedPosition.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedPosition.java
@@ -21,6 +21,9 @@
import java.util.Locale;
import mondrian.olap.Member;
+import mondrian.rolap.RolapCubeMember;
+import mondrian.rolap.RolapMember;
+import mondrian.rolap.RolapMemberBase;
public class DerivedPosition {
private DerivedCellSet container;
@@ -43,9 +46,32 @@
// this.mondrianPosition = mondrianPosition;
for (ListIterator<Member> iterator = mondrianPosition.listIterator();iterator.hasNext();) {
mondrian.olap.Member mondrianMember = (mondrian.olap.Member) iterator.next();
+ String caption = createCaption(mondrianMember);
+ if (mondrianMember instanceof RolapCubeMember){
+ // This setCaption is not always used by getCaption() ...
+ ((RolapCubeMember)mondrianMember).setCaption(caption);
+ RolapMember rolapMember = ((RolapCubeMember)mondrianMember).getRolapMember();
+ if (rolapMember instanceof RolapMemberBase) {
+ // ... so this setCaption is done to ensure you get the right caption.
+ ((RolapMemberBase) rolapMember).setCaption(caption);
+ }
+ }
memberList.add(new DerivedMember(mondrianMember));
}
}
+ private String createCaption(mondrian.olap.Member mondrianMember) {
+ String uniqueName = mondrianMember.getUniqueName();
+ String[] splitUniqueName = uniqueName.split("\\.");
+ StringBuffer buf = new StringBuffer();
+ for (int i = 1; i < splitUniqueName.length; i++) {
+ buf.append(splitUniqueName[i].replaceAll("\\p{P}",""));
+ if ( i < splitUniqueName.length-1 ){
+ buf.append(" ");
+ }
+ }
+ String caption = buf.toString();
+ return caption;
+ }
public DerivedCellSet getContainer() {
return container;
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/FillerTextResultSet.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/FillerTextResultSet.java
deleted file mode 100644
index 0fd5d6e..0000000
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/FillerTextResultSet.java
+++ /dev/null
@@ -1,1278 +0,0 @@
-/**
- *
- * 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.sql;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.osbp.xtext.datamart.common.AEntityDatamart;
-import org.eclipse.osbp.xtext.entitymock.common.filler.FillerTextProvider;
-
-public class FillerTextResultSet implements ResultSet {
-
- private final AEntityDatamart fDatamartClass;
- private final FillerTextProvider fProvider;
- private final int fRowCount;
- private final FillerTextResultSetMetaData fMetaData;
- private int fRowPointer;
- private Map<String,Object> fRowData;
-
- public FillerTextResultSet(AEntityDatamart datamartClass, int minRowCount, int maxRowCount) {
- fDatamartClass = datamartClass;
- fMetaData = new FillerTextResultSetMetaData();
- fRowPointer = -1;
- int rowCount = 0;
- FillerTextProvider provider = null;
- try {
- provider = FillerTextProvider.get(Locale.getDefault());
- rowCount = provider.signedinteger(minRowCount, maxRowCount);
- }
- catch (Throwable e) { // NOSONAR - here we want to catch everything. If there is a problem with the translation we dont care.
- System.err.println(e); // NOSONAR
- }
- fProvider = provider;
- fRowCount = rowCount;
- }
-
- public void addColumn(String columnName, Class<?> columnClassName, String columnLabel, int columnType) {
- fMetaData.addColumn(columnName, columnClassName, columnLabel, columnType);
- }
-
- @Override
- public boolean isWrapperFor(Class<?> arg0) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public <T> T unwrap(Class<T> arg0) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean absolute(int row) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void afterLast() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void beforeFirst() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void cancelRowUpdates() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void clearWarnings() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void close() throws SQLException {
- fRowPointer = fRowCount;
- fRowData = null;
- }
-
- @Override
- public void deleteRow() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public int findColumn(String columnLabel) throws SQLException {
- return fMetaData.findColumn(columnLabel);
- }
-
- @Override
- public boolean first() throws SQLException {
- return false;
- }
-
- @Override
- public Array getArray(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Array getArray(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InputStream getAsciiStream(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InputStream getAsciiStream(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- return (object instanceof BigDecimal ? (BigDecimal)object : null);
- }
-
- @Override
- public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BigDecimal getBigDecimal(int columnIndex, int scale)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BigDecimal getBigDecimal(String columnLabel, int scale)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InputStream getBinaryStream(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InputStream getBinaryStream(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Blob getBlob(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Blob getBlob(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean getBoolean(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean getBoolean(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public byte getByte(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public byte getByte(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public byte[] getBytes(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public byte[] getBytes(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Reader getCharacterStream(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Reader getCharacterStream(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Clob getClob(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Clob getClob(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public int getConcurrency() throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public String getCursorName() throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Date getDate(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- if (object instanceof Date) {
- return (Date)object;
- }
- if (object instanceof Timestamp) {
- return new Date(((Timestamp)object).getTime());
- }
- return null;
- }
-
- @Override
- public Date getDate(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Date getDate(int columnIndex, Calendar cal) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Date getDate(String columnLabel, Calendar cal) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public double getDouble(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- if (object instanceof Double) {
- return (Double)object;
- }
- if (object instanceof BigDecimal) {
- return ((BigDecimal)object).doubleValue();
- }
- return 0;
- }
-
- @Override
- public double getDouble(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getFetchDirection() throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getFetchSize() throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public float getFloat(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- return (object instanceof Float ? (Float)object : 0);
- }
-
- @Override
- public float getFloat(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getHoldability() throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getInt(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- return (object instanceof Integer ? (Integer)object : 0);
- }
-
- @Override
- public int getInt(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public long getLong(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public long getLong(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public ResultSetMetaData getMetaData() throws SQLException {
- return fMetaData;
- }
-
- @Override
- public Reader getNCharacterStream(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Reader getNCharacterStream(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public NClob getNClob(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public NClob getNClob(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getNString(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getNString(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Object getObject(int columnIndex) throws SQLException {
- return fRowData.get(fMetaData.getColumnLabel(columnIndex));
- }
-
- @Override
- public Object getObject(String columnLabel) throws SQLException {
- return fRowData.get(columnLabel);
- }
-
- @Override
- public Object getObject(int columnIndex, Map<String, Class<?>> map)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Object getObject(String columnLabel, Map<String, Class<?>> map)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <T> T getObject(String columnLabel, Class<T> type)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Ref getRef(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Ref getRef(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public int getRow() throws SQLException {
- return fRowPointer;
- }
-
- @Override
- public RowId getRowId(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public RowId getRowId(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SQLXML getSQLXML(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SQLXML getSQLXML(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public short getShort(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public short getShort(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public Statement getStatement() throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getString(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- return (object instanceof String ? (String)object : (object == null ? null : object.toString()));
- }
-
- @Override
- public String getString(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Time getTime(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Time getTime(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Time getTime(int columnIndex, Calendar cal) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Time getTime(String columnLabel, Calendar cal) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Timestamp getTimestamp(int columnIndex) throws SQLException {
- Object object = getObject(columnIndex);
- return (object instanceof Timestamp ? (Timestamp)object : null);
- }
-
- @Override
- public Timestamp getTimestamp(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Timestamp getTimestamp(int columnIndex, Calendar cal)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Timestamp getTimestamp(String columnLabel, Calendar cal)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public int getType() throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public URL getURL(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public URL getURL(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InputStream getUnicodeStream(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InputStream getUnicodeStream(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SQLWarning getWarnings() throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void insertRow() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean isAfterLast() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isBeforeFirst() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isClosed() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isFirst() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isLast() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean last() throws SQLException {
- return false;
- }
-
- @Override
- public void moveToCurrentRow() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void moveToInsertRow() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean next() throws SQLException {
- // --- reset the provider to receive new values ---
- fProvider.reset();
- fRowPointer++;
- fRowData = fDatamartClass.generateFillerTextRow(fProvider);
- return (fRowPointer < fRowCount);
- }
-
- @Override
- public boolean previous() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void refreshRow() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean relative(int rows) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean rowDeleted() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean rowInserted() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean rowUpdated() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void setFetchDirection(int direction) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setFetchSize(int rows) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateArray(int columnIndex, Array x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateArray(String columnLabel, Array x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateAsciiStream(int columnIndex, InputStream x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateAsciiStream(String columnLabel, InputStream x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateAsciiStream(int columnIndex, InputStream x, int length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateAsciiStream(String columnLabel, InputStream x, int length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateAsciiStream(int columnIndex, InputStream x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateAsciiStream(String columnLabel, InputStream x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBigDecimal(int columnIndex, BigDecimal x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBigDecimal(String columnLabel, BigDecimal x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBinaryStream(int columnIndex, InputStream x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBinaryStream(String columnLabel, InputStream x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBinaryStream(int columnIndex, InputStream x, int length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBinaryStream(String columnLabel, InputStream x, int length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBinaryStream(int columnIndex, InputStream x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBinaryStream(String columnLabel, InputStream x,
- long length) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBlob(int columnIndex, Blob x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBlob(String columnLabel, Blob x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBlob(int columnIndex, InputStream inputStream)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBlob(String columnLabel, InputStream inputStream)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBlob(int columnIndex, InputStream inputStream, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBlob(String columnLabel, InputStream inputStream,
- long length) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBoolean(int columnIndex, boolean x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBoolean(String columnLabel, boolean x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateByte(int columnIndex, byte x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateByte(String columnLabel, byte x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBytes(int columnIndex, byte[] x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateBytes(String columnLabel, byte[] x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateCharacterStream(int columnIndex, Reader x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateCharacterStream(String columnLabel, Reader reader)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateCharacterStream(int columnIndex, Reader x, int length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateCharacterStream(String columnLabel, Reader reader,
- int length) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateCharacterStream(int columnIndex, Reader x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateCharacterStream(String columnLabel, Reader reader,
- long length) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateClob(int columnIndex, Clob x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateClob(String columnLabel, Clob x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateClob(int columnIndex, Reader reader) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateClob(String columnLabel, Reader reader)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateClob(int columnIndex, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateClob(String columnLabel, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateDate(int columnIndex, Date x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateDate(String columnLabel, Date x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateDouble(int columnIndex, double x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateDouble(String columnLabel, double x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateFloat(int columnIndex, float x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateFloat(String columnLabel, float x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateInt(int columnIndex, int x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateInt(String columnLabel, int x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateLong(int columnIndex, long x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateLong(String columnLabel, long x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNCharacterStream(int columnIndex, Reader x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNCharacterStream(String columnLabel, Reader reader)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNCharacterStream(int columnIndex, Reader x, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNCharacterStream(String columnLabel, Reader reader,
- long length) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNClob(String columnLabel, NClob nClob)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNClob(int columnIndex, Reader reader) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNClob(String columnLabel, Reader reader)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNClob(int columnIndex, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNClob(String columnLabel, Reader reader, long length)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNString(int columnIndex, String nString)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNString(String columnLabel, String nString)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNull(int columnIndex) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateNull(String columnLabel) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateObject(int columnIndex, Object x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateObject(String columnLabel, Object x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateObject(int columnIndex, Object x, int scaleOrLength)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateObject(String columnLabel, Object x, int scaleOrLength)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateRef(int columnIndex, Ref x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateRef(String columnLabel, Ref x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateRow() throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateRowId(int columnIndex, RowId x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateRowId(String columnLabel, RowId x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateSQLXML(int columnIndex, SQLXML xmlObject)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateSQLXML(String columnLabel, SQLXML xmlObject)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateShort(int columnIndex, short x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateShort(String columnLabel, short x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateString(int columnIndex, String x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateString(String columnLabel, String x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateTime(int columnIndex, Time x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateTime(String columnLabel, Time x) throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateTimestamp(int columnIndex, Timestamp x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void updateTimestamp(String columnLabel, Timestamp x)
- throws SQLException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean wasNull() throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/FillerTextResultSetMetaData.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/FillerTextResultSetMetaData.java
deleted file mode 100644
index 40a860c..0000000
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/FillerTextResultSetMetaData.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- *
- * 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.sql;
-
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-
-public class FillerTextResultSetMetaData implements ResultSetMetaData {
-
- private final Map<Integer,String> fColumnNames;
- private final Map<Integer,Class<?>> fColumnClassNames;
- private final Map<Integer,String> fColumnLabels;
- private final Map<String,Integer> fColumnIndexForLabels;
- private final Map<Integer,Integer> fColumnTypes;
-
- public FillerTextResultSetMetaData() {
- fColumnNames = new HashMap<>();
- fColumnClassNames = new HashMap<>();
- fColumnLabels = new HashMap<>();
- fColumnIndexForLabels = new HashMap<>();
- fColumnTypes = new HashMap<>();
- }
-
- @Override
- public boolean isWrapperFor(Class<?> iface) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public <T> T unwrap(Class<T> iface) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getCatalogName(int column) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getColumnClassName(int column) throws SQLException {
- return fColumnClassNames.get(column).getCanonicalName();
- }
-
- @Override
- public int getColumnCount() throws SQLException {
- return fColumnNames.size();
- }
-
- @Override
- public int getColumnDisplaySize(int column) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public String getColumnLabel(int column) throws SQLException {
- return fColumnLabels.get(column);
- }
-
- @Override
- public String getColumnName(int column) throws SQLException {
- return fColumnNames.get(column);
- }
-
- @Override
- public int getColumnType(int column) throws SQLException {
- return fColumnTypes.get(column);
- }
-
- @Override
- public String getColumnTypeName(int column) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public int getPrecision(int column) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int getScale(int column) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public String getSchemaName(int column) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getTableName(int column) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isAutoIncrement(int column) throws SQLException {
- return false;
- }
-
- @Override
- public boolean isCaseSensitive(int column) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isCurrency(int column) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isDefinitelyWritable(int column) throws SQLException {
- return false;
- }
-
- @Override
- public int isNullable(int column) throws SQLException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public boolean isReadOnly(int column) throws SQLException {
- return true;
- }
-
- @Override
- public boolean isSearchable(int column) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isSigned(int column) throws SQLException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isWritable(int column) throws SQLException {
- return false;
- }
-
- public void addColumn(String columnName, Class<?> columnClassName, String columnLabel, int columnType) {
- if (columnLabel == null) {
- columnLabel = columnName;
- }
- int index = fColumnNames.size()+1;
- fColumnNames.put(index, columnName);
- fColumnClassNames.put(index, columnClassName);
- fColumnLabels.put(index, columnLabel);
- fColumnIndexForLabels.put(columnLabel, index);
- fColumnTypes.put(index, columnType);
- }
-
- public int findColumn(String columnLabel) {
- return fColumnIndexForLabels.get(columnLabel);
- }
-}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java
index 7bafd48..4ac74f6 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java
@@ -44,6 +44,8 @@
import org.eclipse.osbp.bpm.api.BPMTaskSummary;
import org.eclipse.osbp.dsl.common.datatypes.IDto;
import org.eclipse.osbp.ui.api.datamart.DatamartPrimary;
+import org.eclipse.osbp.ui.api.datamart.IDataMart;
+import org.eclipse.osbp.ui.api.datamart.IDataMart.AttributeVisibility;
import org.eclipse.osbp.ui.api.datamart.IDataMart.EType;
import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Action;
import org.eclipse.osbp.ui.api.useraccess.AbstractAuthorization.Group;
@@ -113,6 +115,8 @@
private OperativeDtoContainer operativeDtoContainer = null;
private IUserAccessService userAccessService;
+
+ private Map<String, Boolean> columnIsVisible = new HashMap<>();
public SqlCellSet(List<BPMTaskSummary> tasks, Map<Integer,ArrayList<String>> axisMap) {
fCells = new ArrayList<>();
@@ -268,20 +272,19 @@
return idMap.keySet().iterator().hasNext() && columnName.equals(idMap.keySet().iterator().next());
}
- private EType getType(String columnName, Map<String, EType> idMap) {
+ private EType getType(Map<String, EType> idMap) {
if(idMap.keySet().iterator().hasNext()) {
return idMap.get(idMap.keySet().iterator().next());
}
return null;
}
-
- public SqlCellSet(ResultSet rs, Map<Integer,ArrayList<String>> axisMap, Map<String, EType> idMap, Map<String, String> aliasMap, DatamartDtoMapper datamartDtoMapper, Class<?> operativeDtoClass, List<IDto> operativeDtos, List<DatamartPrimary<?>> primaryKeys, IUserAccessService userAccessService) {
- this.userAccessService = userAccessService;
- operativeDtoContainer = null;
+ public SqlCellSet(ResultSet rs, Map<Integer,ArrayList<String>> axisMap, Map<String, EType> idMap, Map<String, String> aliasMap, Map<String, IDataMart.AttributeVisibility> hiddenMap, DatamartDtoMapper datamartDtoMapper, Class<?> operativeDtoClass, List<IDto> operativeDtos, List<DatamartPrimary<?>> primaryKeys, IUserAccessService pUserAccessService) { //NOSONAR
fCells = new ArrayList<>();
fAxes = new ArrayList<>();
sqlAxes = new ArrayList<>();
+ this.userAccessService = pUserAccessService;
+ operativeDtoContainer = null;
Map<String, DatamartPrimary> primaryMap = new HashMap<>();
for(DatamartPrimary<?> pr : primaryKeys) {
pr.clear();
@@ -290,36 +293,39 @@
int numColumns = 0;
SqlCellSetAxis sqlCellSetAxis = null;
try {
- numColumns = rs.getMetaData().getColumnCount();
+ if(!rs.isClosed()) {
+ numColumns = rs.getMetaData().getColumnCount();
+ }
} catch (SQLException e) {
LOGGER.error(e.getLocalizedMessage());
return;
}
try {
- if (!axisMap.keySet().isEmpty()) {
- for (int axisNumber : axisMap.keySet()) {
- sqlCellSetAxis = new SqlCellSetAxis(this, axisNumber);
- if (axisNumber == 0) { // the columns axis
- int ordinal = 0;
- for (String columnLabel : axisMap.get(0)) {
- try {
- int columnIdx = rs.findColumn(columnLabel);
- sqlCellSetAxis.addPosition(axisNumber, ordinal, convertToMemberType(rs, columnIdx), rs.getMetaData().getColumnName(columnIdx), rs.getMetaData().getColumnLabel(columnIdx));
- ordinal ++;
- } catch (SQLException e) {}
+ if(!rs.isClosed()) {
+ if (!axisMap.keySet().isEmpty()) {
+ for (int axisNumber : axisMap.keySet()) {
+ sqlCellSetAxis = new SqlCellSetAxis(this, axisNumber);
+ if (axisNumber == 0) { // the columns axis
+ int ordinal = 0;
+ for (String columnLabel : axisMap.get(0)) {
+ try {
+ int columnIdx = rs.findColumn(columnLabel);
+ sqlCellSetAxis.addPosition(axisNumber, ordinal, convertToMemberType(rs, columnIdx), rs.getMetaData().getColumnName(columnIdx), rs.getMetaData().getColumnLabel(columnIdx));
+ ordinal ++;
+ } catch (SQLException e) {}
+ }
}
+ sqlAxes.add(sqlCellSetAxis);
+ }
+ }
+ else {
+ sqlCellSetAxis = new SqlCellSetAxis(this, 0);
+ for (int idx=1; idx<=numColumns; idx++) {
+ sqlCellSetAxis.addPosition(0, idx-1, convertToMemberType(rs, idx), rs.getMetaData().getColumnName(idx), rs.getMetaData().getColumnLabel(idx));
}
sqlAxes.add(sqlCellSetAxis);
}
}
- else {
- sqlCellSetAxis = new SqlCellSetAxis(this, 0);
- for (int idx=1; idx<=numColumns; idx++) {
- sqlCellSetAxis.addPosition(0, idx-1, convertToMemberType(rs, idx), rs.getMetaData().getColumnName(idx), rs.getMetaData().getColumnLabel(idx));
- }
- sqlAxes.add(sqlCellSetAxis);
- }
-
} catch (SQLException e) {
LOGGER.error(e.getLocalizedMessage());
return;
@@ -332,108 +338,86 @@
if (numColumns > 0) {
try {
- int targetRowNo = 0;
- while (rs.next()) {
- if (operativeDtoContainer == null) {
- operativeDtoContainer = new OperativeDtoContainer(datamartDtoMapper, operativeDtoClass, operativeDtos);
- }
- boolean displayRow = true;
- if (operativeDtoContainer.getOperativeDtoIdColumn() != null) {
- int columnIdx = rs.findColumn(operativeDtoContainer.getOperativeDtoIdColumn());
- Object value = getCastedValue(rs, columnIdx);
- displayRow = (operativeDtoContainer.getOperativeDtoForId(value) != null);
- }
- if (displayRow) {
- Cell[] row = null;
- if (axisMap.keySet().size() > 1) {
- int numCols = 0;
- for (int idx=1; idx<=numColumns; idx++) {
- String columnName = rs.getMetaData().getColumnName(idx).toLowerCase();
- if (!axisMap.get(1).contains(columnName)) {
- numCols ++;
- }
- }
- row = new Cell[numCols];
- }
- else {
- row = new Cell[numColumns];
- }
- int colNo = 0;
- String formattedValue;
- Object value;
- if ( !axisMap.keySet().isEmpty() ) {
- for (int axisNumber : axisMap.keySet()) {
- int ordinal = 0;
- for (String columnLabel : axisMap.get(axisNumber)) {
- try {
- int columnIdx = rs.findColumn(columnLabel);
- formattedValue = "";
- value = null;
- if(aliasMap.containsKey(columnLabel)) {
-
- String colFQN=aliasMap.get(columnLabel);
- String entityFQNArray[] = colFQN.split("\\.");
- String columnName=entityFQNArray[entityFQNArray.length-1];
- String entityFQN=StringUtils.join(ArrayUtils.remove(entityFQNArray, entityFQNArray.length-1),".");
-
- boolean entityOk = userAccessService.isGranted(Group.ENTITY, Action.READABLE, entityFQN);
- boolean attributeOk = !userAccessService.isVetoed(Group.ENTITY, Action.INVISIBLE, entityFQN, columnName);
- if (entityOk && attributeOk) {
+ if(!rs.isClosed()) {
+ int targetRowNo = 0;
+ while (rs.next()) {
+ if (operativeDtoContainer == null) {
+ operativeDtoContainer = new OperativeDtoContainer(datamartDtoMapper, operativeDtoClass, operativeDtos);
+ }
+ boolean displayRow = true;
+ if (operativeDtoContainer.getOperativeDtoIdColumn() != null) {
+ int columnIdx = rs.findColumn(operativeDtoContainer.getOperativeDtoIdColumn());
+ Object value = getCastedValue(rs, columnIdx);
+ displayRow = (operativeDtoContainer.getOperativeDtoForId(value) != null);
+ }
+ if (displayRow) {
+ Cell[] row = null;
+ if (axisMap.keySet().size() > 1) {
+ int numCols = 0;
+ for (int idx=1; idx<=numColumns; idx++) {
+ String columnName = rs.getMetaData().getColumnName(idx).toLowerCase();
+ if (!axisMap.get(1).contains(columnName)) {
+ numCols ++;
+ }
+ }
+ row = new Cell[numCols];
+ }
+ else {
+ row = new Cell[numColumns];
+ }
+ int colNo = 0;
+ String formattedValue;
+ Object value;
+ if ( !axisMap.keySet().isEmpty() ) {
+ for (int axisNumber : axisMap.keySet()) {
+ int ordinal = 0;
+ for (String columnLabel : axisMap.get(axisNumber)) {
+ try {
+ int columnIdx = rs.findColumn(columnLabel);
+ formattedValue = "";
+ value = null;
+ if (isColumnVisible(aliasMap, hiddenMap, columnLabel )) {
formattedValue = getFormattedValue(rs, columnIdx);
value = getCastedValue(rs, columnIdx);
}
- } else {
- formattedValue = getFormattedValue(rs, columnIdx);
- value = getCastedValue(rs, columnIdx);
- }
-
- if(primaryMap.containsKey(columnLabel)) {
- primaryMap.get(columnLabel).add(value);
- }
- if (axisMap.keySet().size() > 1 && axisMap.get(1).contains(columnLabel)) {
- sqlAxes.get(1).addPosition(1, targetRowNo, convertToMemberType(rs, columnIdx), formattedValue, columnLabel);
- }
- else {
- row[ordinal] = new SqlCell(this, targetRowNo, ordinal, value, formattedValue, isId(columnLabel, idMap), getType(columnLabel, idMap));
- ordinal ++;
- }
- } catch (SQLException e) {}
+
+ if(primaryMap.containsKey(columnLabel)) {
+ primaryMap.get(columnLabel).add(value);
+ }
+ if (axisMap.keySet().size() > 1 && axisMap.get(1).contains(columnLabel)) {
+ sqlAxes.get(1).addPosition(1, targetRowNo, convertToMemberType(rs, columnIdx), formattedValue, columnLabel);
+ }
+ else {
+ row[ordinal] = new SqlCell(this, targetRowNo, ordinal, value, formattedValue, isId(columnLabel, idMap), getType(idMap));
+ ordinal ++;
+ }
+ } catch (SQLException e) {}
+ }
}
- }
- }
- else {
- for (int columnIdx=1; columnIdx<=numColumns; columnIdx++) {
- String columnLabel = rs.getMetaData().getColumnLabel(columnIdx);
- formattedValue = "";
- value = null;
- if(aliasMap.containsKey(columnLabel)) {
-
- String colFQN=aliasMap.get(columnLabel);
- String entityFQNArray[] = colFQN.split("\\.");
- String columnName=entityFQNArray[entityFQNArray.length-1];
- String entityFQN=StringUtils.join(ArrayUtils.remove(entityFQNArray, entityFQNArray.length-1),".");
-
- if (userAccessService.isGranted(Group.ENTITY, Action.READABLE, entityFQN) &&
- !userAccessService.isVetoed(Group.ENTITY, Action.INVISIBLE, entityFQN, aliasMap.get(columnName))) {
+ }
+ else {
+ for (int columnIdx=1; columnIdx<=numColumns; columnIdx++) {
+ String columnLabel = rs.getMetaData().getColumnLabel(columnIdx);
+ formattedValue = "";
+ value = null;
+ if (isColumnVisible(aliasMap, hiddenMap, columnLabel)){
+
formattedValue = getFormattedValue(rs, columnIdx);
value = getCastedValue(rs, columnIdx);
}
- } else {
- formattedValue = getFormattedValue(rs, columnIdx);
- value = getCastedValue(rs, columnIdx);
- }
- if(primaryMap.containsKey(columnLabel)) {
- primaryMap.get(columnLabel).add(value);
- }
- row[colNo] = new SqlCell(this, targetRowNo, colNo, value, formattedValue, isId(columnLabel, idMap), getType(columnLabel, idMap));
- colNo ++;
- }
- }
- if (axisMap.keySet().size() < 2) {
- sqlAxes.get(1).addPosition(0, targetRowNo, MemberType.NULL, "", "");
+ if(primaryMap.containsKey(columnLabel)) {
+ primaryMap.get(columnLabel).add(value);
+ }
+ row[colNo] = new SqlCell(this, targetRowNo, colNo, value, formattedValue, isId(columnLabel, idMap), getType(idMap));
+ colNo ++;
+ }
+ }
+ if (axisMap.keySet().size() < 2) {
+ sqlAxes.get(1).addPosition(0, targetRowNo, MemberType.NULL, "", "");
+ }
+ fCells.add(row);
+ targetRowNo++;
}
- fCells.add(row);
- targetRowNo++;
}
}
}
@@ -446,6 +430,33 @@
}
}
+ private boolean isColumnVisible(Map<String, String> aliasMap, Map<String, AttributeVisibility> hiddenMap, String columnLabel) {
+
+ boolean retColumnIsVisible=true;
+ if (columnIsVisible.containsKey(columnLabel)) {
+ retColumnIsVisible = columnIsVisible.get(columnLabel);
+ } else if ( aliasMap.containsKey(columnLabel) ) {
+ String colFQN=aliasMap.get(columnLabel);
+ String entityFQNArray[] = colFQN.split("\\.");
+ String columnName=entityFQNArray[entityFQNArray.length-1];
+ String entityFQN=StringUtils.join(ArrayUtils.remove(entityFQNArray, entityFQNArray.length-1),".");
+
+ boolean entityOk = userAccessService.isGranted(Group.ENTITY, Action.READABLE, entityFQN);
+ boolean beanOk = userAccessService.isGranted(Group.BEAN, Action.READABLE, entityFQN);
+ boolean attributeOk = true;
+ if (entityOk) {
+ attributeOk = !userAccessService.isVetoed(Group.ENTITY, Action.INVISIBLE, entityFQN, columnName);
+ } else if (beanOk) {
+ attributeOk = !userAccessService.isVetoed(Group.BEAN, Action.INVISIBLE, entityFQN, columnName);
+ }
+ boolean attributeHidden = hiddenMap.containsKey(columnName) && hiddenMap.get(columnName) == IDataMart.AttributeVisibility.HIDDEN;
+
+ retColumnIsVisible = ( entityOk || beanOk ) && attributeOk && !attributeHidden;
+ columnIsVisible.put( columnLabel, retColumnIsVisible );
+ }
+ return retColumnIsVisible;
+ }
+
private MemberType convertToMemberType(ResultSet rs, int idx) {
int type;
int scale;
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSetAxis.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSetAxis.java
index 0e2f6aa..50482b4 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSetAxis.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSetAxis.java
@@ -16,8 +16,11 @@
package org.eclipse.osbp.xtext.datamart.common.sql;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
+import java.util.Map;
import org.olap4j.Axis;
import org.olap4j.CellSet;
@@ -32,7 +35,8 @@
private final CellSet fCellSet;
private final Axis fAxis;
- private final List<Position> fPositions;
+// private final List<Position> fPositions;
+ private final Map<Integer,Position> positionByOrdinal;
private Hierarchy fHierarchy;
public Hierarchy getHierarchy() {
@@ -42,37 +46,55 @@
public SqlCellSetAxis(CellSet cellSet, int axisOrdinal) {
fCellSet = cellSet;
fAxis = Axis.Factory.forOrdinal(axisOrdinal);
- fPositions = new ArrayList<Position>();
+// fPositions = new ArrayList<>();
+ positionByOrdinal = new HashMap<>();
fHierarchy = null;
}
- public SqlCellSetAxis(CellSet cellSet, int axisOrdinal, MemberType type, String name, String label) {
+ public SqlCellSetAxis(CellSet cellSet, Integer axisOrdinal, MemberType type, String name, String label) {
this(cellSet, axisOrdinal);
addPosition(axisOrdinal, 0, type, name, label);
}
- public void addPosition(int axis, int ordinal, MemberType type, String name, String label) {
- for (Position pos : fPositions){
- if (pos.getOrdinal() == ordinal) {
- if (axis == 1) { // the row values must be qualified for later decomposition
- if (pos.getMembers().isEmpty()) {
- pos.getMembers().add(new SqlMember(type, name, label, fHierarchy));
- }
- else {
-
- ((SqlMember)pos.getMembers().get(0)).appendLevel(type, name, label);
- }
- }
- else {
+ public void addPosition(int axis, Integer ordinal, MemberType type, String name, String label) {
+ if(positionByOrdinal.containsKey(ordinal)) {
+ Position pos = positionByOrdinal.get(ordinal);
+ if (axis == 1) { // the row values must be qualified for later decomposition
+ if (pos.getMembers().isEmpty()) {
pos.getMembers().add(new SqlMember(type, name, label, fHierarchy));
}
- return;
+ else {
+
+ ((SqlMember)pos.getMembers().get(0)).appendLevel(type, name, label);
+ }
}
+ else {
+ pos.getMembers().add(new SqlMember(type, name, label, fHierarchy));
+ }
+ return;
}
+// for (Position pos : fPositions){
+// if (pos.getOrdinal() == ordinal) {
+// if (axis == 1) { // the row values must be qualified for later decomposition
+// if (pos.getMembers().isEmpty()) {
+// pos.getMembers().add(new SqlMember(type, name, label, fHierarchy));
+// }
+// else {
+//
+// ((SqlMember)pos.getMembers().get(0)).appendLevel(type, name, label);
+// }
+// }
+// else {
+// pos.getMembers().add(new SqlMember(type, name, label, fHierarchy));
+// }
+// return;
+// }
+// }
if (fHierarchy == null) {
fHierarchy = new SqlHierarchy();
}
- fPositions.add(new SqlPosition(ordinal, type, name, label, fHierarchy));
+// fPositions.add(new SqlPosition(ordinal, type, name, label, fHierarchy));
+ positionByOrdinal.put(ordinal, new SqlPosition(ordinal, type, name, label, fHierarchy));
}
@Override
@@ -87,12 +109,16 @@
@Override
public int getPositionCount() {
- return fPositions.size();
+ return positionByOrdinal.size();
+// return fPositions.size();
}
@Override
public List<Position> getPositions() {
- return fPositions;
+ if(positionByOrdinal.isEmpty())
+ return Collections.emptyList();
+ return (new ArrayList<Position>(positionByOrdinal.values()));
+// return fPositions;
}
@Override