summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2013-02-20 04:26:22 (EST)
committerSven Rottstock2013-03-11 04:54:35 (EDT)
commitc92584fcbb2c31f4533932d2b50b8c6fd658bf21 (patch)
tree873c152c30daa0e7e7ef1ebf594b8a99fb7c9fb3
parent04a751f67209fc1e3b541bc230ebd08ff8f34174 (diff)
downloadorg.eclipse.stardust.engine-c92584fcbb2c31f4533932d2b50b8c6fd658bf21.zip
org.eclipse.stardust.engine-c92584fcbb2c31f4533932d2b50b8c6fd658bf21.tar.gz
org.eclipse.stardust.engine-c92584fcbb2c31f4533932d2b50b8c6fd658bf21.tar.bz2
Jira-ID: CRNT-27983
Performance decrease: If a model having process definitions using Exclude Users is deployed, the time to display a participants worklist is increasing unacceptable with the total count of AIs git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@63109 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RuntimeInstanceQueryEvaluator.java15
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/utils/AbstractAuthorization2Predicate.java95
2 files changed, 70 insertions, 40 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RuntimeInstanceQueryEvaluator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RuntimeInstanceQueryEvaluator.java
index 49ec2a8..f8b66be 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RuntimeInstanceQueryEvaluator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RuntimeInstanceQueryEvaluator.java
@@ -44,6 +44,7 @@ import org.eclipse.stardust.engine.core.runtime.beans.interceptors.PropertyLayer
import org.eclipse.stardust.engine.core.runtime.beans.removethis.SecurityProperties;
import org.eclipse.stardust.engine.core.runtime.setup.DataCluster;
import org.eclipse.stardust.engine.core.runtime.setup.RuntimeSetup;
+import org.eclipse.stardust.engine.core.runtime.utils.AbstractAuthorization2Predicate;
import org.eclipse.stardust.engine.core.runtime.utils.ActivityInstanceAuthorization2Predicate;
import org.eclipse.stardust.engine.core.runtime.utils.Authorization2Predicate;
import org.eclipse.stardust.engine.core.runtime.utils.AuthorizationContext;
@@ -281,7 +282,7 @@ public class RuntimeInstanceQueryEvaluator implements QueryEvaluator
private long getExplicitTotalCount(QueryExtension queryExtension,
FetchPredicate fetchPredicate, boolean useCasePolicy)
{
- if (useCasePolicy)
+ if (useCasePolicy || hasDataPrefetchHintFilter(fetchPredicate))
{
return Long.MAX_VALUE;
}
@@ -292,6 +293,18 @@ public class RuntimeInstanceQueryEvaluator implements QueryEvaluator
}
}
+ private boolean hasDataPrefetchHintFilter(FetchPredicate fetchPredicate)
+ {
+ boolean hasDataPrefetchHints = false;
+ if ((fetchPredicate instanceof AbstractAuthorization2Predicate)
+ && ((AbstractAuthorization2Predicate) fetchPredicate)
+ .hasDataPrefetchHintFilter())
+ {
+ hasDataPrefetchHints = true;
+ }
+ return hasDataPrefetchHints;
+ }
+
private static void applyDistinctOnQueryExtension(QueryExtension queryExtension,
SqlBuilder.ParsedQuery parsedQuery)
{
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 5aab2ee..4f97aa3 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
@@ -112,7 +112,7 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
private ModelManager modelManager;
- Map<String, DataPrefetchHint> dataPrefetchHintFilter = Collections.EMPTY_MAP;
+ Map<String, DataPrefetchHint> dataPrefetchHintFilter = CollectionUtils.newMap();
public AbstractAuthorization2Predicate(AuthorizationContext context)
{
@@ -165,6 +165,11 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
{
return EMPTY;
}
+
+ public boolean hasDataPrefetchHintFilter()
+ {
+ return dataPrefetchHintFilter != null && !dataPrefetchHintFilter.isEmpty();
+ }
public boolean addPrefetchDataHints(Query query)
{
@@ -175,15 +180,14 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
if (!isLegacyEvaluation)
{
this.orderedPrefetchData = CollectionUtils.newArrayList();
- this.dataPrefetchHintFilter = CollectionUtils.newMap();
FilterAndTerm queryFilter = query.getFilter();
if(query instanceof ActivityInstanceQuery)
{
- if(query.getPolicy(ExcludeUserPolicy.class) != null)
+ if (query.getPolicy(ExcludeUserPolicy.class) != null)
{
- getExcludeUserFilter(queryFilter);
- }
+ getExcludeUserFilter(queryFilter);
+ }
}
Collection<IOrganization> restricted = context.getRestricted();
@@ -481,80 +485,92 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
}
public void getExcludeUserFilter(FilterAndTerm queryFilter)
- {
+ {
List<IModel> activeModels = ModelManagerFactory.getCurrent().findActiveModels();
- for(IModel model : activeModels)
+ for (IModel model : activeModels)
{
- String modelId = model.getId();
- for(IProcessDefinition process : model.getProcessDefinitions())
+ String modelId = model.getId();
+ for (IProcessDefinition process : model.getProcessDefinitions())
{
- for(IActivity activity : process.getActivities())
+ for (IActivity activity : process.getActivities())
{
- if (activity.hasEventHandlers(
- PredefinedConstants.ACTIVITY_ON_ASSIGNMENT_CONDITION))
- {
+ if (activity
+ .hasEventHandlers(PredefinedConstants.ACTIVITY_ON_ASSIGNMENT_CONDITION))
+ {
for (int k = 0; k < activity.getEventHandlers().size(); ++k)
{
- IEventHandler handler = (IEventHandler) activity.getEventHandlers().get(k);
+ IEventHandler handler = (IEventHandler) activity.getEventHandlers()
+ .get(k);
if (((IEventConditionType) handler.getType()).getImplementation() != EventType.Pull)
{
for (Iterator l = handler.getAllEventActions(); l.hasNext();)
{
IEventAction action = (IEventAction) l.next();
PluggableType type = action.getType();
- String instanceName = type.getStringAttribute(PredefinedConstants.ACTION_CLASS_ATT);
+ String instanceName = type
+ .getStringAttribute(PredefinedConstants.ACTION_CLASS_ATT);
String excludeUserAction = PredefinedConstants.EXCLUDE_USER_ACTION_CLASS;
- Class classFromClassName = Reflect.getClassFromClassName(excludeUserAction, false);
- if(classFromClassName != null)
+ Class classFromClassName = Reflect.getClassFromClassName(
+ excludeUserAction, false);
+ if (classFromClassName != null)
{
excludeUserAction = classFromClassName.getName();
}
-
- if(instanceName.equals(excludeUserAction))
+
+ if (instanceName.equals(excludeUserAction))
{
Map<String, Object> attributes = action.getAllAttributes();
- String dataId = (String) attributes.get(PredefinedConstants.EXCLUDED_PERFORMER_DATA);
+ String dataId = (String) attributes
+ .get(PredefinedConstants.EXCLUDED_PERFORMER_DATA);
String dataPath = (String) attributes
.get(PredefinedConstants.EXCLUDED_PERFORMER_DATAPATH);
-
+
IData data = getData(model, dataId);
- if(data != null && !isStructuredType(data))
+ if (data != null && !isStructuredType(data))
{
dataPath = null;
- }
-
- Pair<String, String> dataKey = new Pair("{" + modelId + "}" + dataId, dataPath);
- if ( !distinctData.contains(dataKey))
+ }
+
+ Pair<String, String> dataKey = new Pair("{" + modelId + "}"
+ + dataId, dataPath);
+ if (!distinctData.contains(dataKey))
{
distinctData.add(dataKey);
orderedPrefetchData.add(dataKey);
- DataPrefetchHint filter = new DataPrefetchHint("{" + modelId + "}" + dataId,
+ DataPrefetchHint filter = new DataPrefetchHint("{"
+ + modelId + "}" + dataId,
StringUtils.isEmpty(dataPath) ? null : dataPath);
if (trace.isDebugEnabled())
{
trace.debug("Adding prefetch filter: " + filter);
}
-
+
if (!queryFilter.getParts().contains(filter))
{
queryFilter.and(filter);
+ dataPrefetchHintFilter.put(dataId, filter);
}
- if (!dataPrefetchHintFilter.containsKey(dataId))
+ else
{
+ int idx = queryFilter.getParts().indexOf(filter);
+ filter = idx < 0
+ ? filter
+ : (DataPrefetchHint) queryFilter.getParts()
+ .get(idx);
dataPrefetchHintFilter.put(dataId, filter);
}
- }
+ }
}
}
}
}
- }
+ }
}
}
}
- }
-
+ }
+
private IData getData(IModel model, String id)
{
for(IData data : model.getData())
@@ -584,20 +600,21 @@ public abstract class AbstractAuthorization2Predicate implements Authorization2P
return false;
}
- public boolean isExcludedUser(long activityRtOid, long processInstanceOID, long modelOid, Map<String, Long> dataValueOids)
+ public boolean isExcludedUser(long activityRtOid, long processInstanceOID,
+ long modelOid, Map<String, Long> dataValueOids)
{
- if(processInstanceOID == 0)
+ if (processInstanceOID == 0)
{
return false;
}
-
+
long dataValueOid = 0;
- IUser currentUser = SecurityProperties.getUser();
+ IUser currentUser = SecurityProperties.getUser();
long currentPerformer = currentUser.getOID();
-
+
ModelManager mm = getModelManager();
IActivity activity = mm.findActivity(modelOid, activityRtOid);
-
+
if (activity.hasEventHandlers(PredefinedConstants.ACTIVITY_ON_ASSIGNMENT_CONDITION))
{
for (int k = 0; k < activity.getEventHandlers().size(); ++k)