summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Mishra2012-03-21 04:46:45 (EDT)
committer Manik Kishore2012-06-19 07:22:26 (EDT)
commit70ba0a8f0380ec619c2671bccccd79337f661f47 (patch)
treebfcbcdc8b5470ef28e912de5e7886025b2c7d9da
parent3bff7b191debc72aeba4dcec47fdec8f6a97d790 (diff)
downloadorg.eclipse.stardust.ui.web-70ba0a8f0380ec619c2671bccccd79337f661f47.zip
org.eclipse.stardust.ui.web-70ba0a8f0380ec619c2671bccccd79337f661f47.tar.gz
org.eclipse.stardust.ui.web-70ba0a8f0380ec619c2671bccccd79337f661f47.tar.bz2
Jira-ID: CRNT-24074
1)using unique key to create team leader list 2)Now ParticipantInfo object to used to get PerformanceStatistics. 3)corrected label for team member name value. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@54713 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/WorkflowFacade.java73
-rw-r--r--business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/views/PerformanceTeamLeaderBean.java258
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java59
3 files changed, 220 insertions, 170 deletions
diff --git a/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/WorkflowFacade.java b/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/WorkflowFacade.java
index 31b82b0..d064082 100644
--- a/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/WorkflowFacade.java
+++ b/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/WorkflowFacade.java
@@ -12,7 +12,6 @@ package org.eclipse.stardust.ui.web.bcc;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -66,9 +65,9 @@ import org.eclipse.stardust.engine.api.runtime.UserService;
import org.eclipse.stardust.engine.api.runtime.WorkflowService;
import org.eclipse.stardust.engine.core.compatibility.extensions.dms.DmsConstants;
import org.eclipse.stardust.engine.core.query.statistics.api.WorklistStatistics;
-import org.eclipse.stardust.engine.core.query.statistics.api.WorklistStatisticsQuery;
import org.eclipse.stardust.engine.core.query.statistics.api.WorklistStatistics.ParticipantStatistics;
import org.eclipse.stardust.engine.core.query.statistics.api.WorklistStatistics.UserStatistics;
+import org.eclipse.stardust.engine.core.query.statistics.api.WorklistStatisticsQuery;
import org.eclipse.stardust.engine.core.runtime.beans.AbortScope;
import org.eclipse.stardust.ui.web.bcc.jsf.BusinessControlCenterLocalizerKey;
import org.eclipse.stardust.ui.web.bcc.jsf.InvalidServiceException;
@@ -85,6 +84,7 @@ import org.eclipse.stardust.ui.web.viewscommon.helper.activityTable.ActivityInst
import org.eclipse.stardust.ui.web.viewscommon.helper.processTable.ProcessInstanceTableEntry;
import org.eclipse.stardust.ui.web.viewscommon.utils.ModelCache;
import org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils;
+import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ProcessInstanceUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ServiceFactoryUtils;
@@ -173,52 +173,51 @@ public class WorkflowFacade implements Resetable
@SuppressWarnings("unchecked")
private void buildRoleAndUserItemList()
{
- UserQuery query = UserQuery.findActive();
- query.setPolicy(new UserDetailsPolicy(UserDetailsLevel.Core));
- List/* <User> */users = getQueryService().getAllUsers(query);
- List/* <Role> */roles = new ArrayList/* <Role> */();
+
+
+ List<ModelParticipantInfo> roles = CollectionUtils.newArrayList();
+
ModelCache modelCache = ModelCache.findModelCache();
- List/* <Participant> */participants = modelCache != null ? new ArrayList(modelCache
- .getAllParticipants()) : Collections.EMPTY_LIST;
- for (Iterator<Participant> pIter = participants.iterator(); pIter.hasNext();)
- {
- Participant p = (Participant) pIter.next();
+ for (Participant p:modelCache.getAllParticipants())
+ {
this.participants.put(p.getQualifiedId(), p);
if (p instanceof Role || p instanceof Organization)
{
ModelParticipantInfo mp = (ModelParticipantInfo) p;
- if (!mp.isDepartmentScoped())
+ roles.add(mp);
+
+ boolean isTeamLead = isTeamLead(mp);
+
+ if (isTeamLead)
{
- roles.add(p);
- List teams = (p instanceof Role) ? ((Role) p).getTeams() : new ArrayList();
- if (!teams.isEmpty())
- {
- // this is a team lead role
- ParticipantDepartmentPair key = ParticipantDepartmentPair.getParticipantDepartmentPair(mp);
- teamleadRoles.put(key, p);
- }
+ teamleadRoles.put(ParticipantUtils.getParticipantUniqueKey(p), p);
}
- else
+
+ if (mp.isDepartmentScoped())
{
- roles.add(p);//add default department and role
+
List<ModelParticipantInfo> runtimeScopes = getRuntimeScopes((ModelParticipantInfo) p);
for (ModelParticipantInfo modelParticipantInfo : runtimeScopes)
{
roles.add(modelParticipantInfo);
- List teams = (p instanceof Role) ? ((Role) p).getTeams() : new ArrayList();
- if (!teams.isEmpty())
- {
- // this is a team lead role
- ParticipantDepartmentPair key = ParticipantDepartmentPair
- .getParticipantDepartmentPair(modelParticipantInfo);
- teamleadRoles.put(key, modelParticipantInfo);
+ if (isTeamLead)// this is a team lead role
+ {
+ String participantKey = ParticipantUtils.getParticipantUniqueKey(modelParticipantInfo);
+ teamleadRoles.put(participantKey, modelParticipantInfo);
+
}
}
}
+
}
- }
+ }
+
+ UserQuery query = UserQuery.findActive();
+ query.setPolicy(new UserDetailsPolicy(UserDetailsLevel.Core));
+ List<User> users = getQueryService().getAllUsers(query);
+
Pair/* <Map<String, RoleItem>, Map<Long, UserItem>> */pair = getWorklistStatistics(roles, users);
ParticipantDepartmentPairComparator pairComparator = new ParticipantDepartmentPairComparator();
roleItems = new TreeMap(pairComparator);
@@ -226,6 +225,16 @@ public class WorkflowFacade implements Resetable
userItems = (Map) pair.getSecond();
}
+
+ private boolean isTeamLead(ModelParticipantInfo participant)
+ {
+ if (participant instanceof Role)
+ {
+ Role role = (Role) participant;
+ return !role.getTeams().isEmpty();
+ }
+ return false;
+ }
/**
* @param modelParticipantInfo
@@ -1144,8 +1153,8 @@ public class WorkflowFacade implements Resetable
modelParticipantInfo = role;
}
- if (teamleadRoles.containsKey(ParticipantDepartmentPair
- .getParticipantDepartmentPair(modelParticipantInfo)))
+ String participantKey = ParticipantUtils.getParticipantUniqueKey(modelParticipantInfo);
+ if (teamleadRoles.containsKey(participantKey))
{
filter.add(ParticipantAssociationFilter
.forTeamLeader((RoleInfo) modelParticipantInfo));
diff --git a/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/views/PerformanceTeamLeaderBean.java b/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/views/PerformanceTeamLeaderBean.java
index 5fc2b38..c487ee6 100644
--- a/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/views/PerformanceTeamLeaderBean.java
+++ b/business-control-center/src/main/java/org/eclipse/stardust/ui/web/bcc/views/PerformanceTeamLeaderBean.java
@@ -12,15 +12,12 @@ package org.eclipse.stardust.ui.web.bcc.views;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.stardust.common.CollectionUtils;
-import org.eclipse.stardust.engine.api.dto.RoleDetails;
import org.eclipse.stardust.engine.api.dto.RoleInfoDetails;
import org.eclipse.stardust.engine.api.dto.UserDetailsLevel;
import org.eclipse.stardust.engine.api.model.Model;
@@ -30,6 +27,7 @@ import org.eclipse.stardust.engine.api.model.Participant;
import org.eclipse.stardust.engine.api.model.ProcessDefinition;
import org.eclipse.stardust.engine.api.model.QualifiedRoleInfo;
import org.eclipse.stardust.engine.api.model.Role;
+import org.eclipse.stardust.engine.api.model.RoleInfo;
import org.eclipse.stardust.engine.api.query.FilterTerm;
import org.eclipse.stardust.engine.api.query.ParticipantAssociationFilter;
import org.eclipse.stardust.engine.api.query.UserDetailsPolicy;
@@ -39,9 +37,9 @@ import org.eclipse.stardust.engine.api.runtime.DeployedModel;
import org.eclipse.stardust.engine.api.runtime.Grant;
import org.eclipse.stardust.engine.api.runtime.User;
import org.eclipse.stardust.engine.core.query.statistics.api.UserPerformanceStatistics;
-import org.eclipse.stardust.engine.core.query.statistics.api.UserPerformanceStatisticsQuery;
import org.eclipse.stardust.engine.core.query.statistics.api.UserPerformanceStatistics.Contribution;
import org.eclipse.stardust.engine.core.query.statistics.api.UserPerformanceStatistics.PerformanceStatistics;
+import org.eclipse.stardust.engine.core.query.statistics.api.UserPerformanceStatisticsQuery;
import org.eclipse.stardust.ui.web.bcc.ResourcePaths;
import org.eclipse.stardust.ui.web.bcc.WorkflowFacade;
import org.eclipse.stardust.ui.web.bcc.common.configuration.UserPreferencesEntries;
@@ -49,21 +47,23 @@ import org.eclipse.stardust.ui.web.bcc.jsf.IQueryExtender;
import org.eclipse.stardust.ui.web.bcc.jsf.UserItem;
import org.eclipse.stardust.ui.web.common.UIComponentBean;
import org.eclipse.stardust.ui.web.common.column.ColumnPreference;
-import org.eclipse.stardust.ui.web.common.column.DefaultColumnModel;
-import org.eclipse.stardust.ui.web.common.column.IColumnModel;
import org.eclipse.stardust.ui.web.common.column.ColumnPreference.ColumnAlignment;
import org.eclipse.stardust.ui.web.common.column.ColumnPreference.ColumnDataType;
+import org.eclipse.stardust.ui.web.common.column.DefaultColumnModel;
+import org.eclipse.stardust.ui.web.common.column.IColumnModel;
import org.eclipse.stardust.ui.web.common.columnSelector.TableColumnSelectorPopup;
import org.eclipse.stardust.ui.web.common.event.ViewEvent;
-import org.eclipse.stardust.ui.web.common.event.ViewEventHandler;
import org.eclipse.stardust.ui.web.common.event.ViewEvent.ViewEventType;
+import org.eclipse.stardust.ui.web.common.event.ViewEventHandler;
import org.eclipse.stardust.ui.web.common.filter.TableDataFilterPopup;
import org.eclipse.stardust.ui.web.common.filter.TableDataFilterSearch;
import org.eclipse.stardust.ui.web.common.table.SortableTable;
import org.eclipse.stardust.ui.web.common.table.SortableTableComparator;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
+import org.eclipse.stardust.ui.web.viewscommon.common.ModelHelper;
import org.eclipse.stardust.ui.web.viewscommon.utils.I18nUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ModelCache;
+import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ProcessDefinitionUtils;
@@ -83,7 +83,8 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
private WorkflowFacade facade;
- private Map teamMap;
+ private Map<String,List<Participant>> teamMap;
+ private Map<String,QualifiedRoleInfo> roleInfoMap;
private SortableTable<TeamLeaderTableEntry> teamLeaderTable;
@@ -114,57 +115,36 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
{
processes = ProcessDefinitionUtils.getAllBusinessRelevantProcesses();
- teamMap = new HashMap();
+ teamMap = CollectionUtils.newHashMap();
UserQuery query = UserQuery.findActive();
facade = WorkflowFacade.getWorkflowFacade();
FilterTerm filter = query.getFilter().addOrTerm();
- Iterator<QualifiedRoleInfo> iter = facade.getTeamleadRoles().iterator();
- ModelCache modelCache = ModelCache.findModelCache();
- while (iter.hasNext())
+ roleInfoMap = CollectionUtils.newHashMap();
+
+ for (Object leadRole : facade.getTeamleadRoles())
{
- Role teamLeadRole = null;
- QualifiedRoleInfo teamLeadRoleInfo = iter.next();
- if (teamLeadRoleInfo instanceof RoleDetails)
+ QualifiedRoleInfo teamLeadRoleInfo = (QualifiedRoleInfo) leadRole;
+
+ String participantKey = ParticipantUtils.getParticipantUniqueKey(teamLeadRoleInfo);
+ roleInfoMap.put(participantKey, teamLeadRoleInfo);
+
+ List<Participant> teams = teamMap.get(participantKey);
+ if (teams == null)
{
- RoleDetails role = (RoleDetails) teamLeadRoleInfo;
- DeployedModel model = modelCache.getModel(role.getModelOID());
- teamLeadRole = (Role) model.getParticipant(teamLeadRoleInfo.getId());
-
+ teams = CollectionUtils.newArrayList();
+ teamMap.put(participantKey, teams);
}
- else if (teamLeadRoleInfo instanceof RoleInfoDetails)
- {
- RoleInfoDetails roleInfo = (RoleInfoDetails) teamLeadRoleInfo;
+ filter.add(ParticipantAssociationFilter.forParticipant(teamLeadRoleInfo));
- for (DeployedModel model : modelCache.getAllModels())
- {
- String modelId = org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils.extractModelId(roleInfo
- .getQualifiedId());
- if (model.getId().equals(modelId))
- {
- teamLeadRole = (Role) model.getParticipant(roleInfo.getId());
- if (teamLeadRole.getRuntimeElementOID() == roleInfo.getRuntimeElementOID())
- {
- break;
- }
- }
- }
- }
+ Role teamLeadRole = getRole(teamLeadRoleInfo);
- if (teamLeadRole != null)
+ if (null != teamLeadRole)
{
- filter.add(ParticipantAssociationFilter.forParticipant(teamLeadRoleInfo));
- Iterator teamIter = teamLeadRole.getTeams().iterator();
- while (teamIter.hasNext())
+ for (Object teamIter : teamLeadRole.getTeams())
{
- Participant team = (Participant) teamIter.next();
- List teams = (List) teamMap.get(teamLeadRole.getQualifiedId());
- if (teams == null)
- {
- teams = new ArrayList();
- teamMap.put(teamLeadRole.getQualifiedId(), teams);
- }
- teams.add(team);
+ Participant teamMember = (Participant) teamIter;
+ teams.add(teamMember);
}
}
}
@@ -177,6 +157,38 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
createTeamLeaderList(query);
}
+ /**
+ *
+ * @param teamLeadRoleInfo
+ * @return
+ */
+ private Role getRole(QualifiedRoleInfo qRoleInfo)
+ {
+ if (qRoleInfo instanceof Role)
+ {
+ return (Role) qRoleInfo;
+ }
+ else
+ {
+ RoleInfoDetails roleInfo = (RoleInfoDetails) qRoleInfo;
+ ModelCache modelCache = ModelCache.findModelCache();
+ for (DeployedModel model : modelCache.getAllModels())
+ {
+ String modelId = org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils.extractModelId(roleInfo
+ .getQualifiedId());
+ if (model.getId().equals(modelId))
+ {
+ Role teamLeadRole = (Role) model.getParticipant(roleInfo.getId());
+ if (teamLeadRole.getRuntimeElementOID() == roleInfo.getRuntimeElementOID())
+ {
+ return teamLeadRole;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
private void createTable()
{
@@ -213,7 +225,7 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
* Refresh the table
*/
public void update()
- {
+ {
createTable();
initialize();
}
@@ -224,8 +236,7 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
* @param query
*/
private void createTeamLeaderList(UserQuery query)
- {
- List data = new ArrayList();//remove this variable
+ {
Users teamleader = null;
if (teamMap.size() > 0)
{
@@ -236,70 +247,64 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
UserQuery.ACCOUNT);
}
teamleader = facade.getAllUsers((UserQuery) query);
- List userItems = facade.getAllUsersAsUserItems(teamleader);
- Iterator uIter = userItems.iterator();
- Set teamleaders = CollectionUtils.newSet();
- ModelCache modelCache = ModelCache.findModelCache();
- while (uIter.hasNext())
+ List<UserItem> userItems = facade.getAllUsersAsUserItems(teamleader);
+ Set<Teamleader> teamleaders = CollectionUtils.newSet();
+
+ //iterate team lead
+ for (UserItem userItem : userItems)
{
- UserItem userItem = (UserItem) uIter.next();
User user = userItem.getUser();
- Iterator gIter = user.getAllGrants().iterator();
- while (gIter.hasNext())
+ for (Grant grant : user.getAllGrants())
{
- Grant grant = (Grant) gIter.next();
- List teams = (List) teamMap.get(grant.getQualifiedId());
- Model model = modelCache.getActiveModel(grant);
- Participant p = model != null ? model.getParticipant(grant.getId()) : null;
- Role teamleaderRole = null;
- if (p instanceof Role)
+
+ List<Participant> teams = teamMap.get(ParticipantUtils.getGrantUniqueKey(grant));
+ //Grant key and Participant key is suppose to same
+ QualifiedRoleInfo roleInfo = roleInfoMap.get(ParticipantUtils.getGrantUniqueKey(grant));
+
+ //find role from model
+ if (null == roleInfo)
{
- teamleaderRole = (Role) p;
+ roleInfo = findRole(grant);
}
- if (teams != null && teamleaderRole != null)
+ //create row for each Organization(as same user can be leader in many Organizations)
+ if (teams != null && null != roleInfo)
{
- Iterator teamIter = teams.iterator();
- while (teamIter.hasNext())
+ List<Organization> orgs = findOrganizations(teams);
+ for (Organization org : orgs)
{
- p = (Participant) teamIter.next();
- if (p instanceof Organization)
- {
- teamleaders.add(new Teamleader(userItem, teamleaderRole,
- (Organization) p));
- }
+ teamleaders.add(new Teamleader(userItem, roleInfo, org));
}
}
}
}
- Map tStatistics = getTeamStatistics(teamleaders);
- Iterator tlIter = tStatistics.entrySet().iterator();
-
- while (tlIter.hasNext())
- {
- Entry entry = (Entry) tlIter.next();
- Map objectData = (Map) entry.getValue();
+ buildTeamStatistics(teamleaders);
+ }
- Iterator itr = objectData.keySet().iterator();
- while (itr.hasNext())
- {
- String pId = (String) itr.next();
- List<CompletedActivityStatistics> tempList = new ArrayList<CompletedActivityStatistics>();
- if (objectData.get(pId) instanceof CompletedActivityStatistics)
- {
- CompletedActivityStatistics cas = (CompletedActivityStatistics) objectData
- .get(pId);
- tempList.add(new CompletedActivityStatistics(cas.getCountToday(), cas
- .getCountWeek(), cas.getCountMonth(), pId));
- }
-
- }
- data.add(entry.getKey());
+ }
+ private Role findRole(Grant grant)
+ {
+ ModelCache modelCache = ModelCache.findModelCache();
+ Model model = modelCache.getActiveModel(grant);
+ Participant p = model != null ? model.getParticipant(grant.getId()) : null;
+ if (p instanceof Role)
+ {
+ return (Role) p;
+ }
+ return null;
+ }
+
+ private List<Organization> findOrganizations(List<Participant> teams)
+ {
+ List<Organization> orgs = CollectionUtils.newArrayList();
+ for (Participant participant : teams)
+ {
+ if (participant instanceof Organization)
+ {
+ orgs.add((Organization) participant);
}
-
}
-
-
+ return orgs;
}
/**
@@ -310,34 +315,28 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
*
*/
//TODO: code cleanup /optimization
- private Map getTeamStatistics(Set teamleaders)
+ private void buildTeamStatistics(Set<Teamleader> teamleaders)
{
// The following map should have a predictable iteration order
// so that the ordering of the teamleader list is not destroyed
- Map tStatistics = new LinkedHashMap();
+ Map<Teamleader,Map> tStatistics = new LinkedHashMap<Teamleader,Map>();
List<TeamLeaderTableEntry> teamLeaderList = new ArrayList<TeamLeaderTableEntry>();
List<ColumnPreference> selCols = teamLeaderTable.getColumnModel()
.getSelectableColumns();
- if (teamleaders != null)
+ if (CollectionUtils.isNotEmpty(teamleaders))
{
- // ****** DATA
-
- Iterator tlIter = teamleaders.iterator();
- while (tlIter.hasNext())
+ for (Teamleader tl:teamleaders)
{
- List<CompletedActivityStatisticsTableEntry> activityStatisticsList =null;
- Teamleader tl = (Teamleader) tlIter.next();
+ List<CompletedActivityStatisticsTableEntry> activityStatisticsList =null;
Map pStatistics = new HashMap();
tStatistics.put(tl, pStatistics);
- Iterator teamIter = getTeamMember(tl).iterator();
-
- while (teamIter.hasNext())
- {
- activityStatisticsList = new ArrayList<CompletedActivityStatisticsTableEntry>();
- User user = (User) teamIter.next();
- setCompletedProcessStatisticsForUser(pStatistics, user,
- activityStatisticsList);
+ List<User> teamMembers = getTeamMember(tl);
+
+ for (User user : teamMembers)
+ {
+ activityStatisticsList = CollectionUtils.newArrayList();
+ setCompletedProcessStatisticsForUser(pStatistics, user, activityStatisticsList);
}
if (CollectionUtils.isEmpty(activityStatisticsList))
@@ -395,7 +394,7 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
teamLeaderTable.setList(teamLeaderList);
teamLeaderTable.initialize();
}
- return tStatistics;
+
}
/**
@@ -451,7 +450,7 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
* @param tl
* @return list of teamLeadersRole
*/
- private List getTeamMember(Teamleader tl)
+ private List<User> getTeamMember(Teamleader tl)
{
UserQuery query = UserQuery.findAll();
query.getFilter().add(
@@ -546,24 +545,28 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
this.processDefinitionName = processDefinitionName;
}
}
-
+ /**
+ *
+ *
+ * @version $Revision: $
+ */
public static class Teamleader
{
private UserItem user;
private ModelParticipant team;
- private Role teamleaderRole;
+ private RoleInfo teamleaderRole;
private String teamName;
private List<CompletedActivityStatistics> statisticsList;
- protected Teamleader(UserItem user, Role teamleaderRole, ModelParticipant team)
+ protected Teamleader(UserItem user, RoleInfo teamleaderRole, ModelParticipant team)
{
this.user = user;
this.team = team;
- teamName = I18nUtils.getParticipantName(team);
+ this.teamName = ModelHelper.getParticipantName(teamleaderRole);
this.teamleaderRole = teamleaderRole;
}
@@ -587,7 +590,7 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
return team;
}
- public Role getTeamleaderRole()
+ public RoleInfo getTeamleaderRole()
{
return teamleaderRole;
}
@@ -598,7 +601,6 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
{
Teamleader tl = (Teamleader) obj;
return user.getUser().getOID() == tl.user.getUser().getOID()
- && user.getUser().getRealmOID() == tl.user.getUser().getRealmOID()
&& team.getRuntimeElementOID() == tl.team.getRuntimeElementOID();
}
return false;
@@ -606,8 +608,10 @@ public class PerformanceTeamLeaderBean extends UIComponentBean implements Resour
public int hashCode()
{
- return (int) user.getUser().getOID() | (int) user.getUser().getRealmOID()
- | (int) team.getRuntimeElementOID();
+ int hash = 7;
+ hash = 31 * hash + (int) user.getUser().getOID();
+ hash = 31 * hash + (int) team.getRuntimeElementOID();
+ return hash;
}
public List<CompletedActivityStatistics> getStatisticsList()
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java
index 2889da0..822c113 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java
@@ -583,23 +583,60 @@ public class ParticipantUtils
if (participantInfo instanceof ModelParticipantInfo)
{
ModelParticipantInfo modelParticipantInfo = (ModelParticipantInfo) participantInfo;
- if (modelParticipantInfo.isDepartmentScoped())
+ return getParticipantUniqueKey(modelParticipantInfo);
+ }
+ return participantInfo.getQualifiedId();
+ }
+ /**
+ * method return unique key for Participant
+ * @param participantInfo
+ * @return
+ */
+ public static String getParticipantUniqueKey(ModelParticipantInfo participantInfo)
+ {
+ ModelParticipantInfo modelParticipantInfo = (ModelParticipantInfo) participantInfo;
+ if (modelParticipantInfo.isDepartmentScoped())
+ {
+ DepartmentInfo departmentInfo = modelParticipantInfo.getDepartment();
+ if (null != departmentInfo)
{
- DepartmentInfo departmentInfo = modelParticipantInfo.getDepartment();
- if (null != departmentInfo)
+ if (departmentInfo instanceof OrganizationInfo)
{
- if (departmentInfo instanceof OrganizationInfo)
- {
- OrganizationInfo organizationInfo = (OrganizationInfo) departmentInfo;
- return modelParticipantInfo.getQualifiedId() + " (" + organizationInfo.getId() + "-"
- + departmentInfo.getId() + " )";
- }
-
- return modelParticipantInfo.getQualifiedId() + "-" + departmentInfo.getId();
+ OrganizationInfo organizationInfo = (OrganizationInfo) departmentInfo;
+ return modelParticipantInfo.getQualifiedId() + " (" + organizationInfo.getId() + "-"
+ + departmentInfo.getId() + " )";
}
+
+ return modelParticipantInfo.getQualifiedId() + "-" + departmentInfo.getId();
}
}
return participantInfo.getQualifiedId();
}
+ /**
+ * method return unique key for Grant
+ *
+ * @param role
+ * @return
+ */
+ public static String getGrantUniqueKey(Grant grant)
+ {
+
+ if (null != grant.getDepartment())
+ {
+ DepartmentInfo departmentInfo = grant.getDepartment();
+ if (null != departmentInfo)
+ {
+ if (departmentInfo instanceof OrganizationInfo)
+ {
+ OrganizationInfo organizationInfo = (OrganizationInfo) departmentInfo;
+ return grant.getQualifiedId() + " (" + organizationInfo.getId() + "-" + departmentInfo.getId() + " )";
+ }
+
+ return grant.getQualifiedId() + "-" + departmentInfo.getId();
+ }
+ }
+
+ return grant.getQualifiedId();
+ }
}