summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-06-28 09:08:32 (EDT)
committer Stephan Born2013-08-29 05:00:40 (EDT)
commit172cd2d2ccee9fbf1c3794fd29e23948434093c9 (patch)
treebbc7319eefe863fb5196776419a091090af35d56
parent16b0d802f6eb921c49b65b47f70935f2e97f367a (diff)
downloadorg.eclipse.stardust.ui.web-172cd2d2ccee9fbf1c3794fd29e23948434093c9.zip
org.eclipse.stardust.ui.web-172cd2d2ccee9fbf1c3794fd29e23948434093c9.tar.gz
org.eclipse.stardust.ui.web-172cd2d2ccee9fbf1c3794fd29e23948434093c9.tar.bz2
Jira-ID: CRNT-26814
Made changes to WorklistUtils.getWorklist_anyForUser() for getting DEPUTY worklist seperately Changed return type List<Worklist> to Map<WorklistOwner,List<Worklist>> at WorklistUtils.getWorklist_anyForUser() Made changes to WorklistTreeModel to add subTree to root node. git-svn-id: https://svn.csa.sungard.com/repos/ipp2/product/trunk/stardust/ui.web@65778 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/common/PPUtils.java23
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeModel.java153
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/launchpad/WorklistsTreeUserObject.java69
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java82
-rw-r--r--process-portal/src/main/resources/META-INF/xhtml/processportal/launchpad/worklists.xhtml5
-rw-r--r--process-portal/src/main/resources/processportal_en.properties1
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheEntry.java9
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheManager.java35
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/WorklistUtils.java59
9 files changed, 369 insertions, 67 deletions
diff --git a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/common/PPUtils.java b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/common/PPUtils.java
index 4e4ce25..9d8a94d 100644
--- a/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/common/PPUtils.java
+++ b/process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/common/PPUtils.java
@@ -227,8 +227,27 @@ public class PPUtils
break;
case USER:
- extractedWorklist = worklist;
- break;
+ if (ParticipantUtils.areEqual(participantInfo, worklist.getOwner()))
+ {
+ extractedWorklist = worklist;
+ break;
+ }
+ else
+ {
+ // User-Worklist(Deputy Of) is contained in Sub-worklist of
+ // User worklist(Deputy)
+ Iterator<Worklist> subWorklistIter = worklist.getSubWorklists();
+ Worklist subWorklist1;
+ while (subWorklistIter.hasNext())
+ {
+ subWorklist1 = subWorklistIter.next();
+ if (ParticipantUtils.areEqual(participantInfo, subWorklist1.getOwner()))
+ {
+ extractedWorklist = subWorklist1;
+ break;
+ }
+ }
+ }
}
return extractedWorklist;
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 15e28cf..925afc3 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
@@ -10,13 +10,19 @@
*******************************************************************************/
package org.eclipse.stardust.ui.web.processportal.launchpad;
+import java.util.List;
+import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
+import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.engine.api.model.ParticipantInfo;
-import org.eclipse.stardust.ui.web.common.message.MessageDialog;
+import org.eclipse.stardust.ui.web.processportal.common.MessagePropertiesBean;
+import org.eclipse.stardust.ui.web.viewscommon.common.ModelHelper;
+import org.eclipse.stardust.ui.web.viewscommon.common.ParticipantLabel;
import org.eclipse.stardust.ui.web.viewscommon.utils.ExceptionHandler;
import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantWorklistCacheManager;
@@ -36,6 +42,7 @@ public class WorklistsTreeModel extends DefaultTreeModel
private boolean showEmptyWorklist;
private WorklistsBean worklistsBean;
+ private List<String> expandedUserObjects;
/**
* @param root
@@ -76,9 +83,10 @@ public class WorklistsTreeModel extends DefaultTreeModel
*/
public void clear()
{
+ cacheCurrentNodeState();
root.removeAllChildren();
}
-
+
/**
* @param reload
*/
@@ -91,68 +99,159 @@ public class WorklistsTreeModel extends DefaultTreeModel
{
ParticipantWorklistCacheManager.getInstance().reset();
}
+ Map<String,Set<ParticipantInfo>> participantMap = ParticipantWorklistCacheManager.getInstance().getWorklistParticipants();
- addAssemblyLineChild(reload);
-
- Set<ParticipantInfo> participants = ParticipantWorklistCacheManager.getInstance().getWorklistParticipants();
- for (ParticipantInfo participantInfo : participants)
+ for (Entry<String, Set<ParticipantInfo>> entry : participantMap.entrySet())
{
- if (assemblyLineUserObject.isAssemblyLineMode()
- && assemblyLineUserObject.getAssemblyLineParticipants().contains(participantInfo.getId()))
+ DefaultMutableTreeNode tempRootNode = null;
+ DefaultMutableTreeNode assemblyLineNode = null;
+ Set<ParticipantInfo> participants = entry.getValue();
+ if (null == assemblyLineNode)
{
- continue;
+ assemblyLineNode = initAssemblyLineChild(reload);
+ }
+ for (ParticipantInfo participantInfo : participants)
+ {
+ boolean assemblyNodeCreated = false;
+ if (participantInfo.getId().equals(entry.getKey()))
+ {
+ tempRootNode = addChild(participantInfo, false, root);
+ }
+
+ if (assemblyLineUserObject.isAssemblyLineMode()
+ && assemblyLineUserObject.getAssemblyLineParticipants().contains(participantInfo.getId()))
+ {
+ if (!assemblyNodeCreated)
+ {
+ assemblyLineNode = addAssemblyLineChild(reload, tempRootNode, assemblyLineNode);
+ }
+ assemblyNodeCreated = true;
+ continue;
+ }
+ DefaultMutableTreeNode childNode = addChild(participantInfo, true, tempRootNode);
+ if(null == childNode)
+ {
+ continue;
+ }
+ if(entry.getKey().equals(participantInfo.getId()))
+ {
+ ((WorklistsTreeUserObject)childNode.getUserObject()).setText(MessagePropertiesBean.getInstance().getString("launchPanels.worklists.personalWorklist")+ " :");
+ }
+
}
- addChild(participantInfo, true);
+ if (tempRootNode != null)
+ {
+ WorklistsTreeUserObject rootUserObject = (WorklistsTreeUserObject) tempRootNode.getUserObject();
+ ParticipantLabel label = ModelHelper.getParticipantLabel(rootUserObject.getParticipantInfo());
+ rootUserObject.setText(label.getWrappedLabel() + ": ");
+ }
}
+
+ restoreNodeState();
+
}
catch (Exception e)
{
ExceptionHandler.handleException(e);
}
}
-
- /**
- * @param participantWorklist
- * @param isLeaf
- */
- private void addChild(ParticipantInfo participantInfo, boolean isLeaf)
+
+ /**
+ * Append the child to specified Root Node
+ *
+ * @param participantInfo
+ * @param isLeaf
+ * - For Current User/deputy User -isLeaf is false, else true
+ * @param rootNode
+ * @return
+ */
+ private DefaultMutableTreeNode addChild(ParticipantInfo participantInfo, boolean isLeaf,DefaultMutableTreeNode rootNode)
{
- if (showEmptyWorklist || ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo) > 0)
+ if (showEmptyWorklist || (ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo) > 0 || !isLeaf))
{
DefaultMutableTreeNode child = new DefaultMutableTreeNode();
WorklistsTreeUserObject childUserObject = new WorklistsTreeUserObject(child);
-
childUserObject.setModel(participantInfo);
childUserObject.setLeaf(isLeaf);
-
child.setUserObject(childUserObject);
- root.add(child);
+ rootNode.add(child);
+ return child;
+ }
+ return null;
+ }
+
+ /**
+ * Append the child to specified Root Node
+ * @param reload
+ * @param rootNode
+ * @param child
+ * @return
+ */
+ private DefaultMutableTreeNode addAssemblyLineChild(boolean reload,DefaultMutableTreeNode rootNode,DefaultMutableTreeNode child)
+ {
+
+ if(assemblyLineUserObject.isAssemblyLineMode())
+ {
+ if (showEmptyWorklist || Long.valueOf(assemblyLineUserObject.getActivityCount()) > 0)
+ {
+ child.setUserObject(assemblyLineUserObject);
+ rootNode.add(child);
+ }
+ return child;
}
+
+ return null;
}
/**
+ *
* @param reload
* @return
*/
- private WorklistsTreeAssemblyLineUserObject addAssemblyLineChild(boolean reload)
+ private DefaultMutableTreeNode initAssemblyLineChild(boolean reload)
{
DefaultMutableTreeNode child = new DefaultMutableTreeNode();
if (reload || null == assemblyLineUserObject)
{
assemblyLineUserObject = new WorklistsTreeAssemblyLineUserObject(child, worklistsBean);
}
+ return child;
+ }
- if(assemblyLineUserObject.isAssemblyLineMode())
+ /**
+ * Cache the current Node state while Refresh/Show all worklist -before clean
+ */
+ private void cacheCurrentNodeState()
+ {
+ expandedUserObjects = CollectionUtils.newArrayList();
+ int permissionNodesCount = root.getChildCount();
+ for (int i = 0; i < permissionNodesCount; i++)
{
- if (showEmptyWorklist || Long.valueOf(assemblyLineUserObject.getActivityCount()) > 0)
+ DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) root.getChildAt(i);
+ WorklistsTreeUserObject userObject = (WorklistsTreeUserObject) childNode.getUserObject();
+ if (userObject.isExpanded())
{
- child.setUserObject(assemblyLineUserObject);
- root.add(child);
+ expandedUserObjects.add(userObject.getParticipantInfo().getQualifiedId());
}
}
-
- return assemblyLineUserObject;
+ }
+
+ /**
+ *
+ */
+ private void restoreNodeState()
+ {
+ int permissionNodesCount = root.getChildCount();
+ for (int i = 0; i < permissionNodesCount; i++)
+ {
+ DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) root.getChildAt(i);
+ WorklistsTreeUserObject userObject = (WorklistsTreeUserObject)childNode.getUserObject();
+ if(userObject.getParticipantInfo()!=null && expandedUserObjects.contains(userObject.getParticipantInfo().getQualifiedId()))
+ {
+ userObject.setExpanded(true);
+ }
+ }
}
public boolean isEmpty()
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 5378830..d7a7ebc 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
@@ -10,7 +10,9 @@
*******************************************************************************/
package org.eclipse.stardust.ui.web.processportal.launchpad;
+import java.util.Enumeration;
import java.util.Map;
+import java.util.Set;
import javax.faces.event.ActionEvent;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -18,7 +20,10 @@ import javax.swing.tree.DefaultMutableTreeNode;
import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.engine.api.model.Participant;
import org.eclipse.stardust.engine.api.model.ParticipantInfo;
+import org.eclipse.stardust.engine.api.query.PerformingParticipantFilter;
import org.eclipse.stardust.engine.api.query.Query;
+import org.eclipse.stardust.engine.api.query.WorklistQuery;
+import org.eclipse.stardust.ui.web.common.util.FacesUtils;
import org.eclipse.stardust.ui.web.processportal.common.PPUtils;
import org.eclipse.stardust.ui.web.viewscommon.common.ModelHelper;
import org.eclipse.stardust.ui.web.viewscommon.common.ParticipantLabel;
@@ -26,7 +31,6 @@ import org.eclipse.stardust.ui.web.viewscommon.messages.MessagesViewsCommonBean;
import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantWorklistCacheManager;
-
import com.icesoft.faces.component.tree.IceUserObject;
/**
@@ -42,7 +46,7 @@ public class WorklistsTreeUserObject extends IceUserObject
private boolean disabled;
private boolean refreshWorklistTable;
-
+
/**
* @param wrapper
*/
@@ -63,18 +67,36 @@ public class WorklistsTreeUserObject extends IceUserObject
String viewKey = ParticipantUtils.getWorklistViewKey(participantInfo);
Participant participant= ParticipantUtils.getParticipant(participantInfo);
Map<String, Object> params = CollectionUtils.newTreeMap();
- params.put(Query.class.getName(), ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo));
+ boolean leafNode= Boolean.valueOf((FacesUtils.getRequestParameter("leafNode")));
+ WorklistQuery query = ParticipantWorklistCacheManager.getInstance().getWorklistQuery(participantInfo);
+ if (!leafNode)
+ {
+ Set<ParticipantInfo> partInfo = ParticipantWorklistCacheManager.getInstance().getWorklistParticipants()
+ .get(participantInfo.getId());
+ for (ParticipantInfo participantInfo1 : partInfo)
+ {
+ if (!participantInfo1.getId().equals(participantInfo.getId()))
+ {
+ query.setParticipantContribution(PerformingParticipantFilter.forParticipant(participantInfo1, false));
+ }
+ }
+ // As Personal WL also has same viewKey,append Qualifier Id to make Unique
+ // viewKey at parent Node
+ viewKey = viewKey + participantInfo.getQualifiedId();
+ }
+ params.put(Query.class.getName(), query);
params.put("participantInfo", participantInfo);
params.put("id", participant.getQualifiedId());
ParticipantLabel label = ModelHelper.getParticipantLabel(participantInfo);
params.put("name", label.getLabel());
params.put("wrappedLabel", label.getWrappedLabel());
+ params.put("showAllWorklist", !leafNode);
params.put("refreshWorklistTable", refreshWorklistTable);
PPUtils.openWorklistView("id=" + viewKey, params);
PPUtils.selectWorklist(participantInfo);
refreshWorklistTable = false;
}
-
+
/**
* @param worklist
*/
@@ -85,8 +107,10 @@ public class WorklistsTreeUserObject extends IceUserObject
this.setText(label.getWrappedLabel() + ": ");
this.setTooltip(label.getLabel());
this.setLeafIcon(PPUtils.getParticipantIcon(participantInfo));
+ this.setBranchContractedIcon(PPUtils.getParticipantIcon(participantInfo));
+ this.setBranchExpandedIcon(PPUtils.getParticipantIcon(participantInfo));
}
-
+
public ParticipantInfo getParticipantInfo()
{
return participantInfo;
@@ -104,17 +128,34 @@ public class WorklistsTreeUserObject extends IceUserObject
public String getActivityCount()
{
- Long totalCount = ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo);
- Long totalCountThreshold = ParticipantWorklistCacheManager.getInstance().getWorklistCountThreshold(
- participantInfo);
- if (totalCount < Long.MAX_VALUE)
- return totalCount.toString();
+ if (this.isLeaf())
+ {
+ Long totalCount = ParticipantWorklistCacheManager.getInstance().getWorklistCount(participantInfo);
+ Long totalCountThreshold = ParticipantWorklistCacheManager.getInstance().getWorklistCountThreshold(
+ participantInfo);
+ if (totalCount < Long.MAX_VALUE)
+ return totalCount.toString();
+ else
+ return MessagesViewsCommonBean.getInstance().getParamString("common.notification.worklistCountThreshold",
+ totalCountThreshold.toString());
+ }
else
- return MessagesViewsCommonBean.getInstance().getParamString("common.notification.worklistCountThreshold",
- totalCountThreshold.toString());
-
+ {
+ // Get the child activity count and compute the totalCount for Root Node(User
+ // worklist)
+ Enumeration<DefaultMutableTreeNode> childObjects = (Enumeration<DefaultMutableTreeNode>) this.wrapper
+ .children();
+ Integer count = 0;
+ while (childObjects.hasMoreElements())
+ {
+ count = count
+ + Integer.valueOf(((WorklistsTreeUserObject) childObjects.nextElement().getUserObject())
+ .getActivityCount());
+ }
+ return count.toString();
+ }
}
-
+
public boolean isDisabled()
{
return disabled;
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 70d00e4..81f5a6b 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
@@ -18,6 +18,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
@@ -46,6 +47,8 @@ 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.UserWorklist;
import org.eclipse.stardust.engine.api.query.Worklist;
import org.eclipse.stardust.engine.api.query.WorklistQuery;
import org.eclipse.stardust.engine.api.runtime.ActivityInstance;
@@ -200,6 +203,8 @@ public class WorklistTableBean extends UIComponentBean
private String defaultUserDisplayFormat = null;
+ private Boolean showAllWorklist = false;
+
public WorklistTableBean()
{
super("worklistPanel");
@@ -235,6 +240,7 @@ public class WorklistTableBean extends UIComponentBean
// set wrapped label if provided
String wrappedLabel = (String) getParamFromView("wrappedLabel");
+ showAllWorklist = (Boolean) getParamFromView("showAllWorklist");
if (StringUtils.isNotEmpty(wrappedLabel))
{
this.view.setLabel(getMessages().getString("wrappedLabel", wrappedLabel));
@@ -417,12 +423,29 @@ public class WorklistTableBean extends UIComponentBean
if (query instanceof WorklistQuery)
{
Worklist worklist = ServiceFactoryUtils.getWorkflowService().getWorklist((WorklistQuery) query);
- queryResult = PPUtils.extractParticipantWorklist(worklist, participantInfo);
-
- if (!filtersAddedToQuery)
+ if (showAllWorklist)
{
- ParticipantWorklistCacheManager.getInstance().setWorklistCount(participantInfo, queryResult.getTotalCount());
- ParticipantWorklistCacheManager.getInstance().setWorklistThresholdCount(participantInfo, queryResult.getTotalCountThreshold());
+ List<Object> worklistList = fetchWorklistResult(worklist,participantInfo);
+ queryResult = new RawQueryResult<Object>(worklistList, worklist.getSubsetPolicy(), false,
+ Long.valueOf(worklistList.size()), worklist.getTotalCountThreshold());
+ }
+ else
+ {
+ queryResult = PPUtils.extractParticipantWorklist(worklist, participantInfo);
+ //TODO- Temperory code added to handle scenario when null Sub-Worklist is returned.
+ //Engine should return empty list
+ if(null == queryResult)
+ {
+ queryResult = new RawQueryResult<Object>(worklist, worklist.getSubsetPolicy(), false,
+ Long.valueOf(0), worklist.getTotalCountThreshold());
+ }
+ if (!filtersAddedToQuery)
+ {
+ ParticipantWorklistCacheManager.getInstance().setWorklistCount(participantInfo,
+ queryResult.getTotalCount());
+ ParticipantWorklistCacheManager.getInstance().setWorklistThresholdCount(participantInfo,
+ queryResult.getTotalCountThreshold());
+ }
}
}
else if (query instanceof ActivityInstanceQuery)
@@ -452,6 +475,55 @@ public class WorklistTableBean extends UIComponentBean
}
/**
+ *
+ * @param worklist
+ * @return
+ */
+ private List<Object> fetchWorklistResult(Worklist worklist, ParticipantInfo participant)
+ {
+ List<Object> list = CollectionUtils.newArrayList();
+ if (participant.getId().equals(worklist.getOwner().getId()))
+ {
+ list.addAll(iterateWorklistObjects(worklist.listIterator()));
+ }
+ list.addAll(fetchSubWorklist(worklist, participant));
+ return list;
+ }
+
+ private List<Object> fetchSubWorklist(Worklist worklist, ParticipantInfo participant)
+ {
+ List<Object> list = CollectionUtils.newArrayList();
+ Iterator<Worklist> subWorklistIter = worklist.getSubWorklists();
+ while (subWorklistIter.hasNext())
+ {
+ Worklist subWorklist = subWorklistIter.next();
+ if ((subWorklist instanceof UserWorklist) && (!subWorklist.getOwner().getId().equals(participant.getId())))
+ {
+ continue;
+ }
+ list.addAll(iterateWorklistObjects(subWorklist.listIterator()));
+ list.addAll(fetchSubWorklist(subWorklist, participant));
+ }
+ return list;
+ }
+
+ /**
+ *
+ * @param listIterator
+ * @param list
+ * @return
+ */
+ private List<Object> iterateWorklistObjects(ListIterator<ActivityInstance> listIterator)
+ {
+ List<Object> list=CollectionUtils.newArrayList();
+ while (listIterator.hasNext())
+ {
+ list.add(listIterator.next());
+ }
+ return list;
+ }
+
+ /**
* @return
*
*/
diff --git a/process-portal/src/main/resources/META-INF/xhtml/processportal/launchpad/worklists.xhtml b/process-portal/src/main/resources/META-INF/xhtml/processportal/launchpad/worklists.xhtml
index 2e2a81d..599c48a 100644
--- a/process-portal/src/main/resources/META-INF/xhtml/processportal/launchpad/worklists.xhtml
+++ b/process-portal/src/main/resources/META-INF/xhtml/processportal/launchpad/worklists.xhtml
@@ -28,7 +28,7 @@
<ice:outputLabel value="#{worklistsBean.messages['showEmptyWorklist']}" styleClass="label-item" />
</ice:panelGroup>
<pc:automationTag value="auto-PP-LP-MyAssign-Tree" standAlone="false"/>
- <ice:tree hideRootNode="true" hideNavigation="true" value="#{worklistsBean.treeModel}"
+ <ice:tree hideRootNode="true" hideNavigation="false" value="#{worklistsBean.treeModel}"
var="item" imageDir="../../xmlhttp/css/xp/css-images/" style="padding:7px; display: block;">
<ice:treeNode>
<f:facet name="icon">
@@ -39,13 +39,14 @@
<f:facet name="content">
<ice:panelGroup style="display: inline;">
<ice:outputText value="#{item.userObject.text}" title="#{item.userObject.tooltip}" />
- <ice:commandLink styleClass="action-link"
+ <ice:commandLink styleClass="action-link"
actionListener="#{item.userObject.select}">
<pc:automationTag value="auto-PP-LP-MyAssign-ItemsCnt" standAlone="true"/>
<ice:outputFormat
value="#{worklistsBean.messages['items']}">
<f:param value="#{item.userObject.activityCount}" />
</ice:outputFormat>
+ <f:param name="leafNode" value="#{item.leaf}" />
</ice:commandLink>
</ice:panelGroup>
</f:facet>
diff --git a/process-portal/src/main/resources/processportal_en.properties b/process-portal/src/main/resources/processportal_en.properties
index 19c7a26..faa38eb 100644
--- a/process-portal/src/main/resources/processportal_en.properties
+++ b/process-portal/src/main/resources/processportal_en.properties
@@ -20,6 +20,7 @@ launchPanels.worklists.assemblyLine.title=Assembly Line:
launchPanels.worklists.items={0} item(s)
launchPanels.worklists.button.refresh=Refresh
launchPanels.worklists.showEmptyWorklist=Show Empty Worklists
+launchPanels.worklists.personalWorklist=Personal Worklist
launchPanels.workflowOverview.title=Overview
launchPanels.workflowOverview.directWorkItems=You have ...
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheEntry.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheEntry.java
index 2d29962..8a820e2 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheEntry.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantWorklistCacheEntry.java
@@ -24,6 +24,7 @@ public class ParticipantWorklistCacheEntry implements Serializable
private long count;
private long totalCountThreshold;
private WorklistQuery worklistQuery;
+ private String worklistOwner;
/**
* @param count
@@ -39,10 +40,11 @@ public class ParticipantWorklistCacheEntry implements Serializable
* @param count
* @param worklistQuery
*/
- public ParticipantWorklistCacheEntry(long count, WorklistQuery worklistQuery, long totalCountThreshold)
+ public ParticipantWorklistCacheEntry(long count, WorklistQuery worklistQuery, long totalCountThreshold,String worklistOwner)
{
this(count,worklistQuery);
this.totalCountThreshold = totalCountThreshold;
+ this.worklistOwner = worklistOwner;
}
public long getCount()
@@ -74,6 +76,11 @@ public class ParticipantWorklistCacheEntry implements Serializable
{
this.worklistQuery = worklistQuery;
}
+
+ public String getWorklistOwner()
+ {
+ return worklistOwner;
+ }
@Override
public String toString()
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 3eae8c3..add2fde 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
@@ -68,15 +68,17 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
ParticipantInfo worklistOwner = null;
try
{
- List<Worklist> worklists = WorklistUtils.getWorklist_anyForUser();
- for (Worklist worklist : worklists)
+ Map<String, List<Worklist>> worklistMap = WorklistUtils.getWorklist_anyForUser();
+ for (Entry<String, List<Worklist>> entry : worklistMap.entrySet())
{
- worklistOwner = worklist.getOwner();
-
- participantWorklists.put(new ParticipantInfoWrapper(worklistOwner), new ParticipantWorklistCacheEntry(
- worklist.getTotalCount(), WorklistUtils.createWorklistQuery(worklistOwner),worklist.getTotalCountThreshold()));
+ for (Worklist worklist : entry.getValue())
+ {
+ worklistOwner = worklist.getOwner();
+
+ participantWorklists.put(new ParticipantInfoWrapper(worklistOwner), new ParticipantWorklistCacheEntry(
+ worklist.getTotalCount(), WorklistUtils.createWorklistQuery(worklistOwner),worklist.getTotalCountThreshold(),entry.getKey()));
+ }
}
-
}
catch (Exception e)
{
@@ -115,19 +117,28 @@ public class ParticipantWorklistCacheManager implements InitializingBean, Serial
return Long.MAX_VALUE;
}
+
/**
* @return
*/
- public Set<ParticipantInfo> getWorklistParticipants()
+ public Map<String, Set<ParticipantInfo>> getWorklistParticipants()
{
- Set<ParticipantInfo> worklistParticipants = new LinkedHashSet<ParticipantInfo>();
-
+ Map<String, Set<ParticipantInfo>> worklistParticipantMap = new LinkedHashMap<String, Set<ParticipantInfo>>();
+
for (Entry<ParticipantInfoWrapper, ParticipantWorklistCacheEntry> entry : participantWorklists.entrySet())
{
+
+ Set<ParticipantInfo> worklistParticipants = worklistParticipantMap.get(entry.getValue().getWorklistOwner());
+ if (null == worklistParticipants)
+ {
+ worklistParticipants = new LinkedHashSet<ParticipantInfo>();
+ worklistParticipantMap.put(entry.getValue().getWorklistOwner(), worklistParticipants);
+ }
worklistParticipants.add(entry.getKey().getParticipantInfo());
+ //
}
-
- return worklistParticipants;
+
+ return worklistParticipantMap;
}
/**
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/WorklistUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/WorklistUtils.java
index 20fd83e..606f473 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/WorklistUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/WorklistUtils.java
@@ -13,6 +13,7 @@ package org.eclipse.stardust.ui.web.viewscommon.utils;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -47,11 +48,13 @@ import org.eclipse.stardust.engine.api.query.Query;
import org.eclipse.stardust.engine.api.query.SubsetPolicy;
import org.eclipse.stardust.engine.api.query.UserDetailsPolicy;
import org.eclipse.stardust.engine.api.query.Worklist;
+import org.eclipse.stardust.engine.api.query.WorklistLayoutPolicy;
import org.eclipse.stardust.engine.api.query.WorklistQuery;
import org.eclipse.stardust.engine.api.runtime.ActivityInstanceState;
import org.eclipse.stardust.engine.api.runtime.Grant;
import org.eclipse.stardust.engine.api.runtime.User;
import org.eclipse.stardust.engine.api.runtime.UserGroup;
+import org.eclipse.stardust.engine.api.runtime.UserInfo;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.common.constant.ProcessPortalConstants;
import org.eclipse.stardust.ui.web.viewscommon.common.constant.TaskAssignmentConstants;
@@ -327,25 +330,71 @@ public class WorklistUtils
*
* @return
*/
- public static List<Worklist> getWorklist_anyForUser()
+ public static Map<String, List<Worklist>> getWorklist_anyForUser()
{
SubsetPolicy policy = new SubsetPolicy(0, true);
WorklistQuery query = new WorklistQuery();
query.setUserContribution(policy);
query.setParticipantContribution(PerformingParticipantFilter.ANY_FOR_USER, policy);
-
+ query.setPolicy(WorklistLayoutPolicy.SEPARATE_DEPUTY);
applyFilterProviders(query);
+ Map<String, List<Worklist>> worklistMap = new LinkedHashMap<String, List<Worklist>>();
List<Worklist> worklists = CollectionUtils.newArrayList();
+
Worklist worklist = ServiceFactoryUtils.getWorkflowService().getWorklist(query);
+ // Worklist map is used for maintaining relation of 'Worklist Owner-worklist Set', used while
+ // creating worklist tree
+ worklistMap.put(worklist.getOwnerID(), worklists);
worklists.add(worklist);
+ getSubWorklist(worklist, worklistMap,worklists);
+ return worklistMap;
+ }
+
+ /**
+ * Following methods returns all Sub-Worklist for top level UserWorklist Also store the
+ * Worklist as Map <UserWorklist-OwnerId,Set<ParticipantWorklist1>>
+ * Worklist Tree has following structure
+ * (top level) UserWorklist containing own workitems,
+ * ..(sub) ParticipantWorklist1 (own or inherited grant),
+ * (sub) userWorklist1 (for 1st user being deputy of)
+ * ..(sub) ParticipantWorklist1_1 (inherited grant)
+ *
+ * @param worklist
+ * @param worklistMap
+ * @return
+ */
+ private static void getSubWorklist(Worklist worklist, Map<String, List<Worklist>> worklistMap,List<Worklist> worklists)
+ {
@SuppressWarnings("unchecked")
Iterator<Worklist> subworklists = worklist.getSubWorklists();
while (subworklists.hasNext())
{
- worklists.add(subworklists.next());
+ Worklist subws = subworklists.next();
+ // For every sub-userWorklist (deputy), a new Map<ownerId,List<Worklists>> is
+ // maintained
+ if (!(subws.getOwner() instanceof UserInfo))
+ {
+ // For Participant worklist new <key,value> is not created,
+ worklists = worklistMap.get(worklist.getOwner().getId());
+ }
+ else
+ {
+ // For user worklist, create new map entry
+ worklists = worklistMap.get(subws.getOwnerID());
+ }
+ if (CollectionUtils.isEmpty(worklists))
+ {
+ worklists = CollectionUtils.newArrayList();
+ worklistMap.put(subws.getOwnerID(), worklists);
+ }
+ worklists.add(subws);
+ if (subws.getSubWorklists().hasNext()) // If additional Sub-Worklist are present
+ {
+ getSubWorklist(subws, worklistMap,worklists);
+ }
}
- return worklists;
+
}
/**
@@ -388,6 +437,8 @@ public class WorklistUtils
case USER:
query.setUserContribution(true);
+ // Deputy should be retrieved seperate from User worklist
+ query.setPolicy(WorklistLayoutPolicy.SEPARATE_DEPUTY);
break;
}