summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-07-26 06:51:08 (EDT)
committerStephan Born2013-09-23 04:56:04 (EDT)
commit1ab4f375feec7d9b692e034c7ffb2a547af34680 (patch)
treef92d2f246a9b107848588d35a5c76ae9f3b6f25d
parentaa6ee50ae8e755a6fc794b03169530429f1de5d5 (diff)
downloadorg.eclipse.stardust.ui.web-1ab4f375feec7d9b692e034c7ffb2a547af34680.zip
org.eclipse.stardust.ui.web-1ab4f375feec7d9b692e034c7ffb2a547af34680.tar.gz
org.eclipse.stardust.ui.web-1ab4f375feec7d9b692e034c7ffb2a547af34680.tar.bz2
Jira-ID: CRNT-29643
Enchanged ParticipantWorklistCacheManager.ParticipantInfoWrapper to add userParticipantId Used participantInfo, and userParticipantId to distinguish same role at diff Tree Nodes (User-Deputy) git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@66303 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b Signed-off-by: Sidharth Singh <sidharth.singh@sungard.com>
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/OverviewBean.java8
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeModel.java16
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeUserObject.java21
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java33
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheManager.java118
5 files changed, 150 insertions, 46 deletions
diff --git a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/OverviewBean.java b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/OverviewBean.java
index fd2b98e..9353d3e 100644
--- a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/OverviewBean.java
+++ b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/OverviewBean.java
@@ -25,6 +25,7 @@ import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.engine.api.model.ParticipantInfo;
import org.eclipse.stardust.engine.api.query.ActivityInstances;
import org.eclipse.stardust.engine.api.query.Query;
+import org.eclipse.stardust.engine.api.runtime.User;
import org.eclipse.stardust.ui.web.common.app.PortalApplication;
import org.eclipse.stardust.ui.web.common.uielement.AbstractLaunchPanel;
import org.eclipse.stardust.ui.web.processportal.common.PPUtils;
@@ -209,7 +210,7 @@ public class OverviewBean extends AbstractLaunchPanel implements InitializingBea
ParticipantInfo participantInfo = SessionContext.findSessionContext().getUser();
Map<String, Object> params = CollectionUtils.newTreeMap();
- params.put(Query.class.getName(), ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo));
+ params.put(Query.class.getName(), ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo,participantInfo.getId()));
params.put("participantInfo", participantInfo);
params.put("id", participantInfo.getId());
String name = I18nUtils.getParticipantName(ParticipantUtils.getParticipant(participantInfo));
@@ -302,10 +303,11 @@ public class OverviewBean extends AbstractLaunchPanel implements InitializingBea
public String getDirectUserWorkCount()
{
+ User user=SessionContext.findSessionContext().getUser();
Long totalCount = ParticipantWorklistCacheManager.getInstance().getWorklistCount(
- SessionContext.findSessionContext().getUser());
+ user,user.getId());
Long totalCountThreshold = ParticipantWorklistCacheManager.getInstance().getWorklistCountThreshold(
- SessionContext.findSessionContext().getUser());
+ user,user.getId());
if (totalCount < Long.MAX_VALUE)
return totalCount.toString();
else
diff --git a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeModel.java b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeModel.java
index 925afc3..6ffcf65 100644
--- a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeModel.java
+++ b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeModel.java
@@ -166,14 +166,26 @@ public class WorklistsTreeModel extends DefaultTreeModel
* @param rootNode
* @return
*/
- private DefaultMutableTreeNode addChild(ParticipantInfo participantInfo, boolean isLeaf,DefaultMutableTreeNode rootNode)
+ private DefaultMutableTreeNode addChild(ParticipantInfo participantInfo, boolean isLeaf,
+ DefaultMutableTreeNode rootNode)
{
- if (showEmptyWorklist || (ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo) > 0 || !isLeaf))
+ String userParticipantId =null;
+ if(isLeaf)
+ {
+ userParticipantId =((WorklistsTreeUserObject) rootNode.getUserObject()).getParticipantInfo().getId();
+ }
+ else
+ {
+ userParticipantId = participantInfo.getId();
+ }
+ if (showEmptyWorklist
+ || (ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo, userParticipantId) > 0 || !isLeaf))
{
DefaultMutableTreeNode child = new DefaultMutableTreeNode();
WorklistsTreeUserObject childUserObject = new WorklistsTreeUserObject(child);
childUserObject.setModel(participantInfo);
childUserObject.setLeaf(isLeaf);
+ childUserObject.setUserParticipantId(userParticipantId);
child.setUserObject(childUserObject);
rootNode.add(child);
return child;
diff --git a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeUserObject.java b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeUserObject.java
index cb540e0..9906e08 100644
--- a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeUserObject.java
+++ b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeUserObject.java
@@ -50,6 +50,8 @@ public class WorklistsTreeUserObject extends IceUserObject
private boolean refreshWorklistTable;
+ private String userParticipantId;
+
/**
* @param wrapper
*/
@@ -75,7 +77,7 @@ public class WorklistsTreeUserObject extends IceUserObject
if (!leafNode)
{
// Use Activity Instance Query for Unified worklist
- query = ParticipantWorklistCacheManager.getInstance().getActivityInstanceQuery(participantInfo);
+ query = ParticipantWorklistCacheManager.getInstance().getActivityInstanceQuery(participantInfo, userParticipantId);
FilterOrTerm or = query.getFilter().addOrTerm();
User user = (User) ParticipantUtils.getParticipant(participantInfo);
or.add(new PerformingUserFilter(user.getOID()));
@@ -92,10 +94,11 @@ public class WorklistsTreeUserObject extends IceUserObject
}
else
{
- query = ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo);
+ query = ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo, userParticipantId);
}
params.put(Query.class.getName(), query);
params.put("participantInfo", participantInfo);
+ params.put("userParticipantId", userParticipantId);
params.put("id", participant.getQualifiedId());
ParticipantLabel label = ModelHelper.getParticipantLabel(participantInfo);
params.put("name", label.getLabel());
@@ -136,13 +139,23 @@ public class WorklistsTreeUserObject extends IceUserObject
return style;
}
+ public String getUserParticipantId()
+ {
+ return userParticipantId;
+ }
+
+ public void setUserParticipantId(String userParticipantId)
+ {
+ this.userParticipantId = userParticipantId;
+ }
+
public String getActivityCount()
{
if (this.isLeaf())
{
- Long totalCount = ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo);
+ Long totalCount = ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo, userParticipantId);
Long totalCountThreshold = ParticipantWorklistCacheManager.getInstance().getWorklistCountThreshold(
- participantInfo);
+ participantInfo, userParticipantId);
if (totalCount < Long.MAX_VALUE)
return totalCount.toString();
else
diff --git a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java
index 027920b..a325089 100644
--- a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java
+++ b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java
@@ -47,7 +47,6 @@ import org.eclipse.stardust.engine.api.query.HistoricalStatesPolicy;
import org.eclipse.stardust.engine.api.query.ProcessDefinitionFilter;
import org.eclipse.stardust.engine.api.query.Query;
import org.eclipse.stardust.engine.api.query.QueryResult;
-import org.eclipse.stardust.engine.api.query.RawQueryResult;
import org.eclipse.stardust.engine.api.query.Worklist;
import org.eclipse.stardust.engine.api.query.WorklistQuery;
import org.eclipse.stardust.engine.api.runtime.ActivityInstance;
@@ -180,6 +179,8 @@ public class WorklistTableBean extends UIComponentBean
private ParticipantInfo participantInfo;
+ private String userParticipantId;
+
private String worklistId;
private boolean filtersAddedToQuery;
@@ -424,7 +425,14 @@ public class WorklistTableBean extends UIComponentBean
update();
}
- private QueryResult fetchQueryResult(Query query, ParticipantInfo participantInfo)
+ /**
+ *
+ * @param query
+ * @param participantInfo
+ * @param userParticipantId
+ * @return
+ */
+ private QueryResult fetchQueryResult(Query query, ParticipantInfo participantInfo, String userParticipantId)
{
QueryResult queryResult = null;
@@ -433,13 +441,13 @@ public class WorklistTableBean extends UIComponentBean
Worklist worklist = ServiceFactoryUtils.getWorkflowService().getWorklist((WorklistQuery) query);
queryResult = PPUtils.extractParticipantWorklist(worklist, participantInfo);
- if (!filtersAddedToQuery)
- {
- ParticipantWorklistCacheManager.getInstance().setWorklistCount(participantInfo,
- queryResult.getTotalCount());
- ParticipantWorklistCacheManager.getInstance().setWorklistThresholdCount(participantInfo,
- queryResult.getTotalCountThreshold());
- }
+ if (!filtersAddedToQuery)
+ {
+ ParticipantWorklistCacheManager.getInstance().setWorklistCount(participantInfo, userParticipantId,
+ queryResult.getTotalCount());
+ ParticipantWorklistCacheManager.getInstance().setWorklistThresholdCount(participantInfo, userParticipantId,
+ queryResult.getTotalCountThreshold());
+ }
}
else if (query instanceof ActivityInstanceQuery)
{
@@ -488,7 +496,7 @@ public class WorklistTableBean extends UIComponentBean
query = (Query) getParamFromView(Query.class.getName());
participantInfo = (ParticipantInfo) getParamFromView("participantInfo");
processDefintion = (ProcessDefinition) getParamFromView("processDefinition");
-
+ userParticipantId = (String) getParamFromView("userParticipantId");
if (null != processDefintion)
{
preferenceId = UserPreferencesEntries.P_WORKLIST_PROC_CONF;
@@ -533,7 +541,8 @@ public class WorklistTableBean extends UIComponentBean
if (partInfo.getQualifiedId().equals(participantQId))
{
participantInfo = partInfo;
- query = ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo);
+ userParticipantId = entry.getKey();
+ query = ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo,entry.getKey());
view.getViewParams().put(Query.class.getName(), query);
ParticipantLabel label = ModelHelper.getParticipantLabel(participantInfo);
@@ -1054,7 +1063,7 @@ public class WorklistTableBean extends UIComponentBean
@Override
public QueryResult<Object> performSearch(Query query)
{
- QueryResult queryResult = fetchQueryResult(query, participantInfo);
+ QueryResult queryResult = fetchQueryResult(query, participantInfo, userParticipantId);
processInstances = ProcessInstanceUtils.getProcessInstancesAsMap(queryResult, true);
return queryResult;
}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheManager.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheManager.java
index 3c23126..62ef1c1 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheManager.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheManager.java
@@ -75,14 +75,27 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
for (Worklist worklist : entry.getValue())
{
worklistOwner = worklist.getOwner();
- if(entry.getKey().equals(worklistOwner.getId()))
+ if(entry.getKey().equals(worklistOwner.getQualifiedId()))
{
- participantWorklists.put(new ParticipantInfoWrapper(worklistOwner), new ParticipantWorklistCacheEntry(
- worklist.getTotalCount(), WorklistUtils.createWorklistQuery(worklistOwner),WorklistUtils.getAllUserAssignedActivities(),worklist.getTotalCountThreshold(),entry.getKey()));
+ // Using the userParticipantId i.e entry.getKey() along with
+ // worklistOwner- ParticipantInfo
+ // to distinguish same Role present for Deputy
+ participantWorklists.put(
+ new ParticipantInfoWrapper(worklistOwner, entry.getKey()),
+ new ParticipantWorklistCacheEntry(worklist.getTotalCount(), WorklistUtils
+ .createWorklistQuery(worklistOwner), WorklistUtils.getAllUserAssignedActivities(),
+ worklist.getTotalCountThreshold(), entry.getKey()));
}
else
- participantWorklists.put(new ParticipantInfoWrapper(worklistOwner), new ParticipantWorklistCacheEntry(
- worklist.getTotalCount(), WorklistUtils.createWorklistQuery(worklistOwner),worklist.getTotalCountThreshold(),entry.getKey()));
+ {
+ // Using the userParticipantId i.e entry.getKey() along with
+ // worklistOwner- ParticipantInfo
+ // to distinguish same Role present for Deputy
+ participantWorklists.put(
+ new ParticipantInfoWrapper(worklistOwner, entry.getKey()),
+ new ParticipantWorklistCacheEntry(worklist.getTotalCount(), WorklistUtils
+ .createWorklistQuery(worklistOwner), worklist.getTotalCountThreshold(), entry.getKey()));
+ }
}
}
}
@@ -94,27 +107,33 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
}
/**
+ *
* @param participantInfo
+ * @param userParticipantId - The Id of user (Root Node in participant Tree)
* @return
*/
- public long getWorklistCount(ParticipantInfo participantInfo)
+ public long getWorklistCount(ParticipantInfo participantInfo, String userParticipantId)
{
- ParticipantWorklistCacheEntry cacheEntry = participantWorklists.get(new ParticipantInfoWrapper(participantInfo));
+ ParticipantWorklistCacheEntry cacheEntry = participantWorklists.get(new ParticipantInfoWrapper(participantInfo,
+ userParticipantId));
if (null != cacheEntry)
{
return cacheEntry.getCount();
}
-
+
return 0;
}
-
+
/**
+ *
* @param participantInfo
+ * @param userParticipantId- The Id of user (Root Node in participant Tree)
* @return
*/
- public long getWorklistCountThreshold(ParticipantInfo participantInfo)
+ public long getWorklistCountThreshold(ParticipantInfo participantInfo, String userParticipantId)
{
- ParticipantWorklistCacheEntry cacheEntry = participantWorklists.get(new ParticipantInfoWrapper(participantInfo));
+ ParticipantWorklistCacheEntry cacheEntry = participantWorklists.get(new ParticipantInfoWrapper(participantInfo,
+ userParticipantId));
if (null != cacheEntry)
{
return cacheEntry.getTotalCountThreshold();
@@ -133,7 +152,6 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
for (Entry<ParticipantInfoWrapper, ParticipantWorklistCacheEntry> entry : participantWorklists.entrySet())
{
-
Set<ParticipantInfo> worklistParticipants = worklistParticipantMap.get(entry.getValue().getWorklistOwner());
if (null == worklistParticipants)
{
@@ -148,33 +166,47 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
}
/**
+ * ParticipantInfoWrapper uses the participantInfo,UserParticipantId to distingush same
+ * role in Dif hierarchy(User-Deputy)
+ *
* @param participantInfo
+ * @param userParticipantId
+ * - The Id of user (Root Node in participant Tree)
* @return
*/
- public WorklistQuery getWorklistQuery(ParticipantInfo participantInfo)
+ public WorklistQuery getWorklistQuery(ParticipantInfo participantInfo, String userParticipantId)
{
- WorklistQuery worklistQuery = participantWorklists.get(new ParticipantInfoWrapper(participantInfo)).getWorklistQuery();
+ WorklistQuery worklistQuery = participantWorklists.get(
+ new ParticipantInfoWrapper(participantInfo, userParticipantId)).getWorklistQuery();
return (WorklistQuery) QueryUtils.getClonedQuery(worklistQuery);
}
/**
+ * ParticipantInfoWrapper uses the participantInfo,UserParticipantId to distingush same
+ * role in Dif hierarchy(User-Deputy)
+ *
* @param participantInfo
+ * @param userParticipantId
* @return
*/
- public ActivityInstanceQuery getActivityInstanceQuery(ParticipantInfo participantInfo)
+ public ActivityInstanceQuery getActivityInstanceQuery(ParticipantInfo participantInfo, String userParticipantId)
{
- ParticipantWorklistCacheEntry pwc=participantWorklists.get(new ParticipantInfoWrapper(participantInfo));
- ActivityInstanceQuery activityInstanceQuery = participantWorklists.get(new ParticipantInfoWrapper(participantInfo)).getActivityInstanceQuery();
+ ActivityInstanceQuery activityInstanceQuery = participantWorklists.get(new ParticipantInfoWrapper(participantInfo, userParticipantId)).getActivityInstanceQuery();
return (ActivityInstanceQuery) QueryUtils.getClonedQuery(activityInstanceQuery);
}
/**
+ * ParticipantInfoWrapper uses the participantInfo,UserParticipantId to distingush same
+ * role in Dif hierarchy(User-Deputy)
+ *
* @param participantInfo
+ * @param userParticipantId
* @param count
*/
- public void setWorklistCount(ParticipantInfo participantInfo, long count)
+ public void setWorklistCount(ParticipantInfo participantInfo, String userParticipantId, long count)
{
- ParticipantWorklistCacheEntry worklistCacheEntry = participantWorklists.get(new ParticipantInfoWrapper(participantInfo));
+ ParticipantWorklistCacheEntry worklistCacheEntry = participantWorklists.get(new ParticipantInfoWrapper(
+ participantInfo, userParticipantId));
if (null != worklistCacheEntry)
{
worklistCacheEntry.setCount(count);
@@ -182,12 +214,17 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
}
/**
+ * ParticipantInfoWrapper uses the participantInfo,UserParticipantId to distingush same
+ * role in Dif hierarchy(User-Deputy)
+ *
* @param participantInfo
+ * @param userParticipantId
* @param count
*/
- public void setWorklistThresholdCount(ParticipantInfo participantInfo, long count)
+ public void setWorklistThresholdCount(ParticipantInfo participantInfo, String userParticipantId, long count)
{
- ParticipantWorklistCacheEntry worklistCacheEntry = participantWorklists.get(new ParticipantInfoWrapper(participantInfo));
+ ParticipantWorklistCacheEntry worklistCacheEntry = participantWorklists.get(new ParticipantInfoWrapper(
+ participantInfo, userParticipantId));
if (null != worklistCacheEntry)
{
worklistCacheEntry.setTotalCountThreshold(count);
@@ -206,19 +243,20 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
if (null != oldAi) // oldAi can be null if AI is ACTIVATED
{
ParticipantWorklistCacheEntry oldEntry = participantWorklists.get(new ParticipantInfoWrapper(oldAi
- .getCurrentPerformer()));
+ .getCurrentPerformer(),oldAi.getCurrentPerformer().getId()));
if (null != oldEntry && (oldEntry.getCount() > 0 && oldEntry.getCount() < oldEntry.getTotalCountThreshold()))
{
oldEntry.setCount(oldEntry.getCount() - 1);
}
}
-
// Act on NEW AI
ActivityInstance newAi = event.getActivityInstance();
if (null != newAi) // Safety Check
{
+ String userParticipantId = null != newAi.getUserPerformer() ? newAi.getUserPerformer().getId() : oldAi
+ .getCurrentPerformer().getId();
ParticipantWorklistCacheEntry newEntry = participantWorklists.get(new ParticipantInfoWrapper(newAi
- .getCurrentPerformer()));
+ .getCurrentPerformer(),userParticipantId));
if (null != newEntry && newEntry.getCount() < Long.MAX_VALUE)
{
newEntry.setCount(newEntry.getCount() + 1);
@@ -252,6 +290,7 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
{
private static final long serialVersionUID = -2659357845106111645L;
private ParticipantInfo participantInfo;
+ private String userParticipant;
/**
* @param participantInfo
@@ -261,12 +300,31 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
this.participantInfo = participantInfo;
}
+ /**
+ * For role Participant, User Participant Id is used to distingush when same role is
+ * present in Deputy
+ *
+ * @param participantInfo
+ * @param userParticipant
+ */
+ public ParticipantInfoWrapper(ParticipantInfo participantInfo, String userParticipant)
+ {
+ this(participantInfo);
+ this.userParticipant = userParticipant;
+ }
+
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
- String id = (participantInfo == null) ? null : participantInfo.getId();
+ String id = null;
+ if(userParticipant!=null)
+ {
+ id = (participantInfo == null) ? null : participantInfo.getId() + userParticipant;
+ }
+ else
+ id = (participantInfo == null) ? null : participantInfo.getId();
// Note: It is not required that if two objects are unequal according to the
// equals(java.lang.Object) method, then calling the hashCode method on each of
// the two objects must produce distinct integer results.
@@ -298,6 +356,10 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
{
return false;
}
+ else if (userParticipant != null && !(userParticipant.equals(other.userParticipant)))
+ {
+ return false;
+ }
return true;
}
@@ -306,5 +368,11 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
{
return participantInfo;
}
+
+ public String getUserParticipant()
+ {
+ return userParticipant;
+ }
+
}
}