summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntje Fuhrmann2013-03-01 05:43:56 (EST)
committer Sven Rottstock2013-03-11 04:55:23 (EDT)
commit15f99b31a3b44aa71e65683ffd0addb4aca72957 (patch)
treeca9fce945843ed7de8b935053739250ad5a3d3cf
parentf035d45f98e45e0000a3ddf092897513a417e1be (diff)
downloadorg.eclipse.stardust.engine-15f99b31a3b44aa71e65683ffd0addb4aca72957.zip
org.eclipse.stardust.engine-15f99b31a3b44aa71e65683ffd0addb4aca72957.tar.gz
org.eclipse.stardust.engine-15f99b31a3b44aa71e65683ffd0addb4aca72957.tar.bz2
Jira-ID: CRNT-28100
Modify Kernel interfaces as required to support displaying "more items exist" only if a certain number of items is exceeded. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/engine@63387 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/AbstractQueryResult.java20
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ActivityInstances.java4
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DocumentResultIterator.java6
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ParticipantWorklist.java23
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessInstances.java4
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessQueryPostprocessor.java14
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/QueryResult.java10
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RawQueryResult.java14
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RuntimeInstanceQueryEvaluator.java29
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/TotalCountDecorator.java11
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/UserWorklist.java13
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorkItemQueryEvaluator.java7
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/Worklist.java19
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorklistQueryEvaluator.java30
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/EmptyResultSetIterator.java7
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/ResultIterator.java4
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/Session.java16
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/ResultSetIterator.java7
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/Session.java70
-rw-r--r--stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/removethis/KernelTweakingProperties.java2
20 files changed, 253 insertions, 57 deletions
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/AbstractQueryResult.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/AbstractQueryResult.java
index c334fd9..b2ead38 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/AbstractQueryResult.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/AbstractQueryResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,14 +28,23 @@ public abstract class AbstractQueryResult<T> extends AbstractList<T>
protected final boolean hasMore;
private final Long totalCount;
+ private final long totalCountThreshold;
- protected AbstractQueryResult(Query query, List<T> items, boolean hasMore, Long totalCount)
+ protected AbstractQueryResult(Query query, List<T> items, boolean hasMore,
+ Long totalCount)
+ {
+ this(query, items, hasMore, totalCount, Long.MAX_VALUE);
+ }
+
+ protected AbstractQueryResult(Query query, List<T> items, boolean hasMore,
+ Long totalCount, long totalCountThreshold)
{
this.query = query;
this.items = items;
this.hasMore = hasMore;
-
+
this.totalCount = totalCount;
+ this.totalCountThreshold = totalCountThreshold;
}
public T get(int index)
@@ -76,4 +85,9 @@ public abstract class AbstractQueryResult<T> extends AbstractList<T>
{
return hasMore;
}
+
+ public long getTotalCountThreshold()
+ {
+ return totalCountThreshold;
+ }
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ActivityInstances.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ActivityInstances.java
index 601b9e8..ee5b3d4 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ActivityInstances.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ActivityInstances.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,7 +28,7 @@ public class ActivityInstances extends AbstractQueryResult<ActivityInstance>
{
super(query, result.getItemList(), result.hasMore(), result.hasTotalCount()
? result.getTotalCount()
- : null);
+ : null, result.getTotalCountThreshold());
}
protected ActivityInstances(ActivityInstanceQuery query)
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DocumentResultIterator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DocumentResultIterator.java
index 25bce65..498ef8e 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DocumentResultIterator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/DocumentResultIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -95,4 +95,8 @@ public class DocumentResultIterator implements ResultIterator
return totalCount.longValue();
}
+ public long getTotalCountThreshold()
+ {
+ return Long.MAX_VALUE;
+ }
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ParticipantWorklist.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ParticipantWorklist.java
index f0a581b..82ffae7 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ParticipantWorklist.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ParticipantWorklist.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,8 +38,15 @@ public class ParticipantWorklist extends Worklist
ParticipantWorklist(ParticipantInfo owner, WorklistQuery query, SubsetPolicy subset,
List items, boolean moreAvailable, Long totalCount)
{
- super(query, subset, items, moreAvailable, totalCount);
-
+ this(owner, query, subset, items, moreAvailable, totalCount, Long.MAX_VALUE);
+ }
+
+ public ParticipantWorklist(ParticipantInfo owner, WorklistQuery query,
+ SubsetPolicy subset, List items, boolean moreAvailable, Long totalCount,
+ long totalCountThreshold)
+ {
+ super(query, subset, items, moreAvailable, totalCount, totalCountThreshold);
+
this.ownerID = owner.getId();
this.owner = owner;
}
@@ -47,8 +54,14 @@ public class ParticipantWorklist extends Worklist
ParticipantWorklist(String ownerID, WorklistQuery query, SubsetPolicy subset,
List items, boolean moreAvailable, Long totalCount)
{
- super(query, subset, items, moreAvailable, totalCount);
-
+ this(ownerID, query, subset, items, moreAvailable, totalCount, Long.MAX_VALUE);
+ }
+
+ ParticipantWorklist(String ownerID, WorklistQuery query, SubsetPolicy subset,
+ List items, boolean moreAvailable, Long totalCount, long totalCountThreshold)
+ {
+ super(query, subset, items, moreAvailable, totalCount, totalCountThreshold);
+
this.ownerID = ownerID;
this.owner = null;
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessInstances.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessInstances.java
index 8036d94..e929fe5 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessInstances.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessInstances.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,7 +28,7 @@ public class ProcessInstances extends AbstractQueryResult<ProcessInstance>
{
super(query, result.getItemList(), result.hasMore(), result.hasTotalCount()
? result.getTotalCount()
- : null);
+ : null, result.getTotalCountThreshold());
}
protected ProcessInstances(ProcessInstanceQuery query)
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessQueryPostprocessor.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessQueryPostprocessor.java
index b127d4c..4839f8e 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessQueryPostprocessor.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/ProcessQueryPostprocessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -310,7 +310,7 @@ public class ProcessQueryPostprocessor
queryResult.getSubsetPolicy(), queryResult.hasMore(),
queryResult.hasTotalCount() //
? new Long(queryResult.getTotalCount())
- : null));
+ : null, queryResult.getTotalCountThreshold()));
}
finally
{
@@ -503,9 +503,11 @@ public class ProcessQueryPostprocessor
List activityDetails = DetailsFactory.createCollection(queryResult.iterator(),
IActivityInstance.class, ActivityInstanceDetails.class);
- return new ActivityInstances(query, new RawQueryResult(activityDetails,
- queryResult.getSubsetPolicy(), queryResult.hasMore(),
- queryResult.hasTotalCount() ? new Long(queryResult.getTotalCount()) : null));
+ return new ActivityInstances(query,
+ new RawQueryResult(activityDetails, queryResult.getSubsetPolicy(),
+ queryResult.hasMore(), queryResult.hasTotalCount() ? new Long(
+ queryResult.getTotalCount()) : null,
+ queryResult.getTotalCountThreshold()));
}
finally
{
@@ -591,7 +593,7 @@ public class ProcessQueryPostprocessor
return new RawQueryResult(result, subset, hasMore, rawResult.hasTotalCount()
? new Long(rawResult.getTotalCount())
- : null);
+ : null, rawResult.getTotalCountThreshold());
}
private static void prefetchStartingUsers(Iterator piItr, int timeout)
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/QueryResult.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/QueryResult.java
index 0f011e4..79ca111 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/QueryResult.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/QueryResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,4 +63,12 @@ public interface QueryResult<T> extends List<T>, Serializable
* @see #getSubsetPolicy
*/
public boolean hasMore();
+
+ /**
+ * This returns the configured threshold up to which total count is counted exactly. If this value is
+ * exceeded then #getTotalCount() will return {Long.MAX_VALUE)
+ *
+ * @return {Long.MAX_VALUE} if no threshold value is configured. Otherwise configured value.
+ */
+ public long getTotalCountThreshold();
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RawQueryResult.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RawQueryResult.java
index 072fd8a..3216a21 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RawQueryResult.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/RawQueryResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,13 +25,19 @@ public final class RawQueryResult<T> extends AbstractQueryResult<T>
public RawQueryResult(List<T> itemList, SubsetPolicy subset, boolean hasMore)
{
- this(itemList, subset, hasMore, null);
+ this(itemList, subset, hasMore, null, Long.MAX_VALUE);
}
-
+
public RawQueryResult(List<T> itemList, SubsetPolicy subset, boolean hasMore,
Long totalCount)
{
- super(null, new ArrayList<T>(itemList), hasMore, totalCount);
+ this(itemList, subset, hasMore, totalCount, Long.MAX_VALUE);
+ }
+
+ public RawQueryResult(List<T> itemList, SubsetPolicy subset, boolean hasMore,
+ Long totalCount, long totalCountThreshold)
+ {
+ super(null, new ArrayList<T>(itemList), hasMore, totalCount, totalCountThreshold);
this.subset = subset;
this.hasTotalCount = (null != totalCount);
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 0396ce8..8cf0619 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -262,12 +262,15 @@ public class RuntimeInstanceQueryEvaluator implements QueryEvaluator
int size = isEmpty(selectExtension) ? 0 : -selectExtension.size();
authPred.setSelectionExtension(size, selectExtension);
}
+
+ long totalCountThreshold = getTotalCountThreshold(fetchPredicate);
final long totalCount = countImplicitly
? result.getTotalCount()
- : getExplicitTotalCount(queryExtension, fetchPredicate, casePolicy != null);
+ : getExplicitTotalCount(queryExtension, fetchPredicate,
+ casePolicy != null, totalCountThreshold);
- return new TotalCountDecorator(totalCount, result);
+ return new TotalCountDecorator(totalCount, totalCountThreshold, result);
}
else
{
@@ -282,17 +285,31 @@ public class RuntimeInstanceQueryEvaluator implements QueryEvaluator
}
}
+ private long getTotalCountThreshold(FetchPredicate fetchPredicate)
+ {
+ long totalCountThreshold = Long.MAX_VALUE;
+ if (Parameters.instance().getBoolean(
+ KernelTweakingProperties.ENGINE_EXCLUDE_USER_EVALUATION, false)
+ && hasDataPrefetchHintFilter(fetchPredicate))
+ {
+ totalCountThreshold = Parameters.instance().getLong(
+ KernelTweakingProperties.EXCLUDE_USER_MAX_WORKLIST_COUNT, 100);
+ }
+ return totalCountThreshold;
+ }
+
private long getExplicitTotalCount(QueryExtension queryExtension,
- FetchPredicate fetchPredicate, boolean useCasePolicy)
+ FetchPredicate fetchPredicate, boolean useCasePolicy, long totalCountThreshold)
{
- if (useCasePolicy || hasDataPrefetchHintFilter(fetchPredicate))
+ if (useCasePolicy)
{
return Long.MAX_VALUE;
}
else
{
return SessionFactory.getSession(SessionFactory.AUDIT_TRAIL).getCount(type,
- queryExtension, fetchPredicate, QueryUtils.getTimeOut(query));
+ queryExtension, fetchPredicate, QueryUtils.getTimeOut(query),
+ totalCountThreshold);
}
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/TotalCountDecorator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/TotalCountDecorator.java
index efffe82..42c0acd 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/TotalCountDecorator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/TotalCountDecorator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,10 +20,12 @@ public class TotalCountDecorator implements ResultIterator
{
private final long totalCount;
private final ResultIterator target;
+ private final long totalCountThreshold;
- public TotalCountDecorator(long totalCount, ResultIterator target)
+ public TotalCountDecorator(long totalCount, long totalCountThreshold, ResultIterator target)
{
this.totalCount = totalCount;
+ this.totalCountThreshold = totalCountThreshold;
this.target = target;
}
@@ -66,6 +68,11 @@ public class TotalCountDecorator implements ResultIterator
{
target.remove();
}
+
+ public long getTotalCountThreshold()
+ {
+ return totalCountThreshold;
+ }
public void close()
{
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/UserWorklist.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/UserWorklist.java
index 12f032a..b2780ff 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/UserWorklist.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/UserWorklist.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,12 +34,19 @@ public class UserWorklist extends Worklist
UserWorklist(UserInfo owner, WorklistQuery query, SubsetPolicy subset, List items,
boolean moreAvailable, List subDetails, Long totalCount)
{
- super(query, subset, items, moreAvailable, totalCount);
+ this(owner, query, subset, items, moreAvailable, subDetails, totalCount,
+ Long.MAX_VALUE);
+ }
+
+ UserWorklist(UserInfo owner, WorklistQuery query, SubsetPolicy subset, List items,
+ boolean moreAvailable, List subDetails, Long totalCount, long totalCountThreshold)
+ {
+ super(query, subset, items, moreAvailable, totalCount, totalCountThreshold);
this.owner = owner;
this.subDetails = subDetails;
}
-
+
/**
* Retrieves the owning user of this worklist.
*
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorkItemQueryEvaluator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorkItemQueryEvaluator.java
index 2781c2d..fdffaec 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorkItemQueryEvaluator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorkItemQueryEvaluator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -97,5 +97,10 @@ public class WorkItemQueryEvaluator extends RuntimeInstanceQueryEvaluator
{
delegate.remove();
}
+
+ public long getTotalCountThreshold()
+ {
+ return delegate.getTotalCountThreshold();
+ }
}
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/Worklist.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/Worklist.java
index 92caf77..1a6e167 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/Worklist.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/Worklist.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,17 +39,25 @@ public abstract class Worklist extends AbstractList implements QueryResult
private final boolean moreAvailable;
private final Long totalCount;
-
+ private final long totalCountThreshold;
+
Worklist(WorklistQuery query, SubsetPolicy subset, List items, boolean moreAvailable,
Long totalCount)
{
+ this(query, subset, items, moreAvailable, totalCount, Long.MAX_VALUE);
+ }
+
+ Worklist(WorklistQuery query, SubsetPolicy subset, List items, boolean moreAvailable,
+ Long totalCount, long totalCountThreshold)
+ {
this.query = query;
this.subsetPolicy = subset;
this.items = new ArrayList(items);
this.moreAvailable = moreAvailable;
-
+
this.totalCount = totalCount;
+ this.totalCountThreshold = totalCountThreshold;
}
/**
@@ -250,4 +258,9 @@ public abstract class Worklist extends AbstractList implements QueryResult
return result;
}
+
+ public long getTotalCountThreshold()
+ {
+ return totalCountThreshold;
+ }
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorklistQueryEvaluator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorklistQueryEvaluator.java
index 10ebaf0..680755a 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorklistQueryEvaluator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/api/query/WorklistQueryEvaluator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -323,8 +323,9 @@ public class WorklistQueryEvaluator
final UserInfo owner = DetailsFactory.create(context.getUser(), IUser.class,
UserInfoDetails.class);
return new UserWorklist(owner, query, userWorklist.subset,
- userWorklist.retrievedItems, userWorklist.hasMore, subWorklists, userWorklist
- .hasTotalCount() ? new Long(userWorklist.getTotalCount()) : null);
+ userWorklist.retrievedItems, userWorklist.hasMore, subWorklists,
+ userWorklist.hasTotalCount() ? new Long(userWorklist.getTotalCount()) : null,
+ userWorklist.getTotalCountThreshold());
}
/**
@@ -529,6 +530,7 @@ public class WorklistQueryEvaluator
if (worklistItems.hasTotalCount())
{
worklist.setTotalCount(worklistItems.getTotalCount());
+ worklist.setTotalCountThreshold(worklistItems.getTotalCountThreshold());
}
}
finally
@@ -608,14 +610,16 @@ public class WorklistQueryEvaluator
if (null != owner)
{
return new ParticipantWorklist(owner, query, collector.subset,
- collector.retrievedItems, collector.hasMore,
- collector.hasTotalCount() ? new Long(collector.getTotalCount()) : null);
+ collector.retrievedItems, collector.hasMore, collector.hasTotalCount()
+ ? new Long(collector.getTotalCount())
+ : null, collector.getTotalCountThreshold());
}
else
{
return new ParticipantWorklist(participant.getId(), query, collector.subset,
- collector.retrievedItems, collector.hasMore,
- collector.hasTotalCount() ? new Long(collector.getTotalCount()) : null);
+ collector.retrievedItems, collector.hasMore, collector.hasTotalCount()
+ ? new Long(collector.getTotalCount())
+ : null, collector.getTotalCountThreshold());
}
}
@@ -675,6 +679,8 @@ public class WorklistQueryEvaluator
private Long totalCount;
+ private long totalCountThreshold;
+
public String toString()
{
return "Worklist: " + participant.getId() + " [" + subset + "]";
@@ -761,6 +767,16 @@ public class WorklistQueryEvaluator
totalCount = new Long(totalCount.longValue() + count);
}
}
+
+ public void setTotalCountThreshold(long totalCountThreshold)
+ {
+ this.totalCountThreshold = totalCountThreshold;
+ }
+
+ public long getTotalCountThreshold()
+ {
+ return totalCountThreshold;
+ }
}
private static final class ScopedParticipantInfo extends Pair<Long, Long> implements Comparable<ScopedParticipantInfo>
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/EmptyResultSetIterator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/EmptyResultSetIterator.java
index 4a48a73..233db37 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/EmptyResultSetIterator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/EmptyResultSetIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -58,4 +58,9 @@ public class EmptyResultSetIterator implements ResultIterator
{
throw new UnsupportedOperationException("Total item count not available.");
}
+
+ public long getTotalCountThreshold()
+ {
+ return 0;
+ }
} \ No newline at end of file
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/ResultIterator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/ResultIterator.java
index 0c2a038..d381d6f 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/ResultIterator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/ResultIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,4 +25,6 @@ public interface ResultIterator<E> extends ClosableIterator<E>
boolean hasTotalCount();
long getTotalCount() throws UnsupportedOperationException;
+
+ long getTotalCountThreshold();
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/Session.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/Session.java
index 17ce5ad..24b1c14 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/Session.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/Session.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -110,6 +110,20 @@ public interface Session
FetchPredicate fetchPredicate, int timeout);
/**
+ * Counts all objects of a specified type which match the condition specified by the
+ * <tt>queryExtension</tt> argument.
+ *
+ * @param type the type of objects which have to be counted
+ * @param queryExtension specification of additional relations, predicates, order etc.
+ * @param fetchPredicate optional predicate applied before rows are included into count
+ * @param timeout
+ * @param totalCountThreshold the maximum value of total count items
+ * @return the number of records of the specified type
+ */
+ public long getCount(Class type, QueryExtension queryExtension,
+ FetchPredicate fetchPredicate, int timeOut, long totalCountThreshold);
+
+ /**
* Fires a query against the database and returns an iterator containing all
* persistent object of the specified type.
*
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/ResultSetIterator.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/ResultSetIterator.java
index 0ed2dbe..4e4858f 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/ResultSetIterator.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/ResultSetIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -307,4 +307,9 @@ public class ResultSetIterator implements ResultIterator
}
return totalCount.longValue();
}
+
+ public long getTotalCountThreshold()
+ {
+ return Long.MAX_VALUE;
+ }
}
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/Session.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/Session.java
index e8c2beb..96abac7 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/Session.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/persistence/jdbc/Session.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 SunGard CSA LLC and others.
+ * Copyright (c) 2011, 2013 SunGard CSA LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,11 +12,27 @@ package org.eclipse.stardust.engine.core.persistence.jdbc;
import java.io.Serializable;
import java.lang.reflect.Field;
-import java.sql.*;
+import java.sql.BatchUpdateException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
import java.text.MessageFormat;
-import java.util.*;
-import java.util.Map.Entry;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Vector;
import javax.sql.DataSource;
@@ -56,9 +72,30 @@ import org.eclipse.stardust.engine.core.persistence.jdbc.sequence.CachingSequenc
import org.eclipse.stardust.engine.core.persistence.jdbc.sequence.SequenceGenerator;
import org.eclipse.stardust.engine.core.persistence.jdbc.transientpi.TransientProcessInstanceStorage.PersistentKey;
import org.eclipse.stardust.engine.core.persistence.jdbc.transientpi.TransientProcessInstanceSupport;
-import org.eclipse.stardust.engine.core.persistence.jms.*;
+import org.eclipse.stardust.engine.core.persistence.jms.BlobBuilder;
+import org.eclipse.stardust.engine.core.persistence.jms.BlobReader;
+import org.eclipse.stardust.engine.core.persistence.jms.ByteArrayBlobBuilder;
+import org.eclipse.stardust.engine.core.persistence.jms.ByteArrayBlobReader;
+import org.eclipse.stardust.engine.core.persistence.jms.JmsBytesMessageBuilder;
+import org.eclipse.stardust.engine.core.persistence.jms.ProcessBlobAuditTrailPersistor;
+import org.eclipse.stardust.engine.core.persistence.jms.ProcessBlobWriter;
import org.eclipse.stardust.engine.core.runtime.audittrail.management.ProcessInstanceUtils;
-import org.eclipse.stardust.engine.core.runtime.beans.*;
+import org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean;
+import org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceHistoryBean;
+import org.eclipse.stardust.engine.core.runtime.beans.BpmRuntimeEnvironment;
+import org.eclipse.stardust.engine.core.runtime.beans.ClobDataBean;
+import org.eclipse.stardust.engine.core.runtime.beans.Constants;
+import org.eclipse.stardust.engine.core.runtime.beans.DataValueBean;
+import org.eclipse.stardust.engine.core.runtime.beans.DepartmentBean;
+import org.eclipse.stardust.engine.core.runtime.beans.EventBindingBean;
+import org.eclipse.stardust.engine.core.runtime.beans.IDepartment;
+import org.eclipse.stardust.engine.core.runtime.beans.IProcessInstance;
+import org.eclipse.stardust.engine.core.runtime.beans.IUser;
+import org.eclipse.stardust.engine.core.runtime.beans.ModelManager;
+import org.eclipse.stardust.engine.core.runtime.beans.ModelManagerFactory;
+import org.eclipse.stardust.engine.core.runtime.beans.ProcessInstanceBean;
+import org.eclipse.stardust.engine.core.runtime.beans.ProcessInstanceScopeBean;
+import org.eclipse.stardust.engine.core.runtime.beans.WorkItemBean;
import org.eclipse.stardust.engine.core.runtime.beans.interceptors.PropertyLayerProviderInterceptor;
import org.eclipse.stardust.engine.core.runtime.beans.removethis.KernelTweakingProperties;
import org.eclipse.stardust.engine.core.runtime.internal.changelog.ChangeLogDigester;
@@ -1248,10 +1285,24 @@ public class Session implements org.eclipse.stardust.engine.core.persistence.Ses
{
return getCount(type, queryExtension, false, fetchPredicate, timeout);
}
-
+
+ public long getCount(Class type, QueryExtension queryExtension,
+ FetchPredicate fetchPredicate, int timeout, long totalCountThreshold)
+ {
+ return getCount(type, queryExtension, false, fetchPredicate, timeout,
+ totalCountThreshold);
+ }
+
private long getCount(Class type, QueryExtension queryExtension, boolean mayFail,
FetchPredicate fetchPredicate, int timeout)
{
+ return getCount(type, queryExtension, mayFail, fetchPredicate, timeout,
+ Long.MAX_VALUE);
+ }
+
+ public long getCount(Class type, QueryExtension queryExtension, boolean mayFail,
+ FetchPredicate fetchPredicate, int timeout, long totalCountThreshold)
+ {
boolean useTimeout = false;
if ((mayFail && getDBDescriptor().useQueryTimeout()) || timeout > NO_TIMEOUT)
{
@@ -1353,6 +1404,11 @@ public class Session implements org.eclipse.stardust.engine.core.persistence.Ses
count += partialCount;
}
}
+ if (count > totalCountThreshold)
+ {
+ count = Long.MAX_VALUE;
+ break;
+ }
}
return count;
diff --git a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/removethis/KernelTweakingProperties.java b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/removethis/KernelTweakingProperties.java
index 77848ad..4afc4aa 100644
--- a/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/removethis/KernelTweakingProperties.java
+++ b/stardust-engine-core/src/main/java/org/eclipse/stardust/engine/core/runtime/beans/removethis/KernelTweakingProperties.java
@@ -211,4 +211,6 @@ public final class KernelTweakingProperties
public static final String INFINITY_DMS_SHARED_DATA_EXIST = "Infinity.Dms.SharedDataExist";
public static final String ENGINE_EXCLUDE_USER_EVALUATION = "Engine.Tuning.Query.ExcludeUser.Evaluation";
+
+ public static final String EXCLUDE_USER_MAX_WORKLIST_COUNT = "Stardust.Engine.Tuning.Query.ExcludeUser.MaximumWorklistCount";
} \ No newline at end of file