summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2013-02-27 04:04:59 (EST)
committerSven Rottstock2013-03-11 04:55:15 (EDT)
commit5a9cd3f53310e97f44826ede3adc6c61f139b4f1 (patch)
tree02b32092a0d2ff2a4d50600851bf8b5da0720fcc
parent7215ed3941f3999393457f4296194fda25f26a5d (diff)
downloadorg.eclipse.stardust.engine-5a9cd3f53310e97f44826ede3adc6c61f139b4f1.zip
org.eclipse.stardust.engine-5a9cd3f53310e97f44826ede3adc6c61f139b4f1.tar.gz
org.eclipse.stardust.engine-5a9cd3f53310e97f44826ede3adc6c61f139b4f1.tar.bz2
Jira-ID: CRNT-27825
ActivityInstanceQuery with ExcludeUserPolicy.EXCLUDE_USER applied still does perform extra SQL fetches for ProcessInstances if StructuredDataValue with XPath to primitive leaf node is used git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@63291 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DataPrefetchHint.java21
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/InlinedDataFilterSqlBuilder.java4
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java13
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java25
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java6
5 files changed, 35 insertions, 34 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DataPrefetchHint.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DataPrefetchHint.java
index 08878f3..4c7e0bc 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DataPrefetchHint.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DataPrefetchHint.java
@@ -10,15 +10,11 @@
*******************************************************************************/
package org.eclipse.stardust.engine.api.query;
-import java.util.List;
-
-import org.eclipse.stardust.engine.core.persistence.FieldRef;
-import org.eclipse.stardust.engine.core.runtime.beans.DataValueBean;
public class DataPrefetchHint extends AbstractDataFilter
{
private static final long serialVersionUID = 1L;
- private String prefetchNumberValueColumnName;
+ private int prefetchNumberValueColumnIdx;
public DataPrefetchHint(String dataId)
{
@@ -83,20 +79,13 @@ public class DataPrefetchHint extends AbstractDataFilter
return true;
}
- public void setPrefetchSelectExtension(List<FieldRef> prefetchSelectExtension)
+ public int getPrefetchNumberValueColumnIdx()
{
- for (FieldRef fieldRef : prefetchSelectExtension)
- {
- String columnName = fieldRef.toString();
- if (columnName.contains(DataValueBean.FIELD__NUMBER_VALUE))
- {
- prefetchNumberValueColumnName = columnName;
- }
- }
+ return prefetchNumberValueColumnIdx;
}
- public String getPrefetchNumberValueColumnName()
+ public void setPrefetchNumberValueColumnIdx(int colIdx)
{
- return prefetchNumberValueColumnName;
+ prefetchNumberValueColumnIdx = colIdx;
}
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/InlinedDataFilterSqlBuilder.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/InlinedDataFilterSqlBuilder.java
index e6d62de..0306a25 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/InlinedDataFilterSqlBuilder.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/InlinedDataFilterSqlBuilder.java
@@ -131,9 +131,7 @@ public class InlinedDataFilterSqlBuilder extends SqlBuilderBase
if (isPrefetchHint)
{
final List<FieldRef> selectExtension = context.getSelectExtension();
- List<FieldRef> prefetchSelectExtension = dataFilterExtension.getPrefetchSelectExtension(dvJoin);
- selectExtension.addAll(prefetchSelectExtension);
- ((DataPrefetchHint) filter).setPrefetchSelectExtension(prefetchSelectExtension);
+ selectExtension.addAll(dataFilterExtension.getPrefetchSelectExtension(dvJoin));
return NOTHING;
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java
index 9ed60b7..301c7b9 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java
@@ -285,6 +285,8 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
String dataId = prefetchData.getFirst();
String dataPath = prefetchData.getSecond();
context.setPrefetchedDataValue(dataId, dataPath, value == null ? null : value.toString());
+
+ addExcludeUserDataPrefetchColIdx(dataId, absExtIndex + i * 3 + 2);
}
}
catch (SQLException e)
@@ -297,6 +299,17 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
return true;
}
+ private void addExcludeUserDataPrefetchColIdx(String dataId, int colIdx)
+ {
+ int idx = dataId.indexOf("}");
+ dataId = dataId.substring(idx + 1);
+ DataPrefetchHint dataPrefetchHint = dataPrefetchHintFilter.get(dataId);
+ if (dataPrefetchHint != null)
+ {
+ dataPrefetchHint.setPrefetchNumberValueColumnIdx(colIdx);
+ }
+ }
+
private Map<Pair<String, String>, IOrganization> initTracing()
{
if (trace.isDebugEnabled())
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java
index 27c9c68..54d8d5e 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/ActivityInstanceAuthorization2Predicate.java
@@ -88,21 +88,22 @@ public class ActivityInstanceAuthorization2Predicate extends AbstractAuthorizati
if (excludeUserPolicy)
{
Map<String, Long> dataValueOids = CollectionUtils.newMap();
- try
+ for (String dataId : dataPrefetchHintFilter.keySet())
{
- for (String dataId : dataPrefetchHintFilter.keySet())
+ DataPrefetchHint dataPrefetchHint = dataPrefetchHintFilter
+ .get(dataId);
+ int colIdx = dataPrefetchHint.getPrefetchNumberValueColumnIdx();
+ long dataValueOid = 0;
+ try
{
- DataPrefetchHint dataPrefetchHint = dataPrefetchHintFilter
- .get(dataId);
- String columnName = dataPrefetchHint
- .getPrefetchNumberValueColumnName();
- long dataValueOid = rs.getLong(columnName);
- dataValueOids.put(dataId, dataValueOid);
+ dataValueOid = rs.getLong(colIdx);
}
- }
- catch (SQLException x)
- {
- // leave it to 0 if column cannot be found
+ catch (SQLException x)
+ {
+ // leave it to 0 if column cannot be found
+ trace.warn("", x);
+ }
+ dataValueOids.put(dataId, dataValueOid);
}
if (isExcludedUser(activityRtOid, processInstanceOid, modelOid,
dataValueOids))
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java
index 75d4c29..7a51f48 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/WorkItemAuthorization2Predicate.java
@@ -94,15 +94,15 @@ public class WorkItemAuthorization2Predicate extends AbstractAuthorization2Predi
{
DataPrefetchHint dataPrefetchHint = dataPrefetchHintFilter
.get(dataId);
- String columnName = dataPrefetchHint
- .getPrefetchNumberValueColumnName();
- long dataValueOid = rs.getLong(columnName);
+ int columnIdx = dataPrefetchHint.getPrefetchNumberValueColumnIdx();
+ long dataValueOid = rs.getLong(columnIdx);
dataValueOids.put(dataId, dataValueOid);
}
}
catch (SQLException x)
{
// leave it to 0 if column cannot be found
+ trace.warn("", x);
}
long departmentOid = rs.getLong(WorkItemBean.FIELD__DEPARTMENT);