summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-01-25 04:59:51 (EST)
committer Sven Rottstock2013-01-25 04:59:51 (EST)
commit43d0b967ac3a17bc611d65f8c70b41e233bb921f (patch)
tree123e53e734746a476f38b837dcb71ed94a576451
parent80f59d60e9d0b905f59815c8b674f8111d4bc45b (diff)
downloadorg.eclipse.stardust.ui.web-43d0b967ac3a17bc611d65f8c70b41e233bb921f.zip
org.eclipse.stardust.ui.web-43d0b967ac3a17bc611d65f8c70b41e233bb921f.tar.gz
org.eclipse.stardust.ui.web-43d0b967ac3a17bc611d65f8c70b41e233bb921f.tar.bz2
Jira-ID: CRNT-27442
Cached defaultUserDisplayFormat in WorklistTableBean and used the same for setting UserLabel in I18nUtils.getUserLabel() for lastPerformer. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@62364 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--process-portal/src/main/java/org/eclipse/stardust/ui/web/processportal/view/WorklistTableBean.java24
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/ModelHelper.java26
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ActivityInstanceUtils.java4
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/I18nUtils.java33
4 files changed, 71 insertions, 16 deletions
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 0ef3636..439e38c 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
@@ -57,24 +57,24 @@ import org.eclipse.stardust.ui.web.common.UIComponentBean;
import org.eclipse.stardust.ui.web.common.app.PortalApplication;
import org.eclipse.stardust.ui.web.common.app.View;
import org.eclipse.stardust.ui.web.common.column.ColumnPreference;
+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.column.IColumnModelListener;
-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.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.filter.ITableDataFilter;
+import org.eclipse.stardust.ui.web.common.filter.ITableDataFilter.DataType;
+import org.eclipse.stardust.ui.web.common.filter.ITableDataFilter.FilterCriteria;
import org.eclipse.stardust.ui.web.common.filter.ITableDataFilterBetween;
import org.eclipse.stardust.ui.web.common.filter.ITableDataFilterPickList;
+import org.eclipse.stardust.ui.web.common.filter.ITableDataFilterPickList.RenderType;
import org.eclipse.stardust.ui.web.common.filter.TableDataFilterDate;
import org.eclipse.stardust.ui.web.common.filter.TableDataFilterNumber;
import org.eclipse.stardust.ui.web.common.filter.TableDataFilterPickList;
import org.eclipse.stardust.ui.web.common.filter.TableDataFilterPopup;
-import org.eclipse.stardust.ui.web.common.filter.ITableDataFilter.DataType;
-import org.eclipse.stardust.ui.web.common.filter.ITableDataFilter.FilterCriteria;
-import org.eclipse.stardust.ui.web.common.filter.ITableDataFilterPickList.RenderType;
import org.eclipse.stardust.ui.web.common.table.DataTable;
import org.eclipse.stardust.ui.web.common.table.DataTableRowSelector;
import org.eclipse.stardust.ui.web.common.table.DataTableSortModel;
@@ -93,9 +93,9 @@ import org.eclipse.stardust.ui.web.processportal.common.UserPreferencesEntries;
import org.eclipse.stardust.ui.web.processportal.view.worklistConfiguration.WorklistColumnPreferenceHandler;
import org.eclipse.stardust.ui.web.processportal.view.worklistConfiguration.WorklistConfigurationUtil;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
-import org.eclipse.stardust.ui.web.viewscommon.common.ProcessActivityDataFilter;
import org.eclipse.stardust.ui.web.viewscommon.common.PriorityAutoCompleteItem;
import org.eclipse.stardust.ui.web.viewscommon.common.PriorityAutocompleteTableDataFilter;
+import org.eclipse.stardust.ui.web.viewscommon.common.ProcessActivityDataFilter;
import org.eclipse.stardust.ui.web.viewscommon.common.criticality.CriticalityAutocompleteItem;
import org.eclipse.stardust.ui.web.viewscommon.common.criticality.CriticalityAutocompleteTableDataFilter;
import org.eclipse.stardust.ui.web.viewscommon.common.criticality.CriticalityConfigurationUtil;
@@ -122,6 +122,7 @@ import org.eclipse.stardust.ui.web.viewscommon.utils.ProcessWorklistCacheManager
import org.eclipse.stardust.ui.web.viewscommon.utils.QueryUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ServiceFactoryUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.SpecialWorklistCacheManager;
+import org.eclipse.stardust.ui.web.viewscommon.utils.UserUtils;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
@@ -184,6 +185,8 @@ public class WorklistTableBean extends UIComponentBean
private String preferenceId;
+ private String defaultUserDisplayFormat = null;
+
public WorklistTableBean()
{
super("worklistPanel");
@@ -204,7 +207,7 @@ public class WorklistTableBean extends UIComponentBean
{
case CREATED:
this.view = event.getView();
- currentPerformerOID = ServiceFactoryUtils.getUserService().getUser().getOID();
+ currentPerformerOID = SessionContext.findSessionContext().getUser().getOID();
initViewParams();
break;
@@ -711,10 +714,13 @@ public class WorklistTableBean extends UIComponentBean
List<Note> notes = ProcessInstanceUtils.getNotes(pi);
int notesSize = null != notes ? ProcessInstanceUtils.getNotes(pi).size() : 0;
-
+ defaultUserDisplayFormat = null == defaultUserDisplayFormat
+ ? UserUtils.getDefaultUserNameDisplayFormat()
+ : defaultUserDisplayFormat;
+
worklistTableEntry = new WorklistTableEntry(I18nUtils.getActivityName(ai.getActivity()),
processDescriptorsList, ActivityInstanceUtils.isActivatable(ai),
- ActivityInstanceUtils.getLastPerformer(ai), pi.getPriority(), ai.getStartTime(),
+ ActivityInstanceUtils.getLastPerformer(ai, defaultUserDisplayFormat), pi.getPriority(), ai.getStartTime(),
ai.getLastModificationTime(), ai.getOID(), this.getDuration(ai), notesSize, descriptorValues,
ai.getProcessInstanceOID(), ai, currentPerformerOID);
}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/ModelHelper.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/ModelHelper.java
index 5532724..7c7c7f6 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/ModelHelper.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/ModelHelper.java
@@ -23,6 +23,8 @@ import org.eclipse.stardust.engine.api.model.Role;
import org.eclipse.stardust.engine.api.model.RoleInfo;
import org.eclipse.stardust.engine.api.runtime.Department;
import org.eclipse.stardust.engine.api.runtime.DepartmentInfo;
+import org.eclipse.stardust.engine.api.runtime.User;
+import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.utils.I18nUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils;
import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantUtils;
@@ -48,7 +50,7 @@ public class ModelHelper
public static ParticipantLabel getParticipantLabel(ParticipantInfo participantInfo)
{
ParticipantLabel participantlabel = new ParticipantLabel();
-
+ User loggedInUser = SessionContext.findSessionContext().getUser();
if (participantInfo instanceof ModelParticipantInfo)
{
ModelParticipantInfo modelParticipantInfo = (ModelParticipantInfo) participantInfo;
@@ -78,14 +80,28 @@ public class ModelHelper
}
else
{
- participantlabel.setParticipantName(I18nUtils.getParticipantName(ParticipantUtils
- .getParticipant(participantInfo)));
+ if (participantInfo.getId().equals(loggedInUser.getId()))
+ {
+ participantlabel.setParticipantName(I18nUtils.getParticipantName(loggedInUser));
+ }
+ else
+ {
+ participantlabel.setParticipantName(I18nUtils.getParticipantName(ParticipantUtils
+ .getParticipant(participantInfo)));
+ }
}
}
else if (participantInfo instanceof DynamicParticipantInfo)
{
- participantlabel.setParticipantName(I18nUtils.getParticipantName(ParticipantUtils
- .getParticipant(participantInfo)));
+ if (participantInfo.getId().equals(loggedInUser.getId()))
+ {
+ participantlabel.setParticipantName(I18nUtils.getParticipantName(loggedInUser));
+ }
+ else
+ {
+ participantlabel.setParticipantName(I18nUtils.getParticipantName(ParticipantUtils
+ .getParticipant(participantInfo)));
+ }
}
return participantlabel;
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ActivityInstanceUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ActivityInstanceUtils.java
index 65c556c..3522fd0 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ActivityInstanceUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ActivityInstanceUtils.java
@@ -278,14 +278,14 @@ public class ActivityInstanceUtils
* @param ai
* @return
*/
- public static String getLastPerformer(ActivityInstance ai)
+ public static String getLastPerformer(ActivityInstance ai, String defaultDisplayFormat)
{
for (HistoricalState hs : ai.getHistoricalStates())
{
Participant performer = hs.getPerfomer();
if (performer instanceof User && hs.getState() == ActivityInstanceState.Application)
{
- return I18nUtils.getUserLabel((User) performer);
+ return I18nUtils.getUserLabel((User) performer, defaultDisplayFormat);
}
}
return null;
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/I18nUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/I18nUtils.java
index 098df57..473f4ef 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/I18nUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/I18nUtils.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.stardust.ui.web.viewscommon.utils;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
@@ -120,6 +121,38 @@ public class I18nUtils
return label;
}
+ /**
+ *
+ * @param user
+ * @param defaultUserDisplayFormat
+ * @return
+ */
+ public static String getUserLabel(User user, String defaultUserDisplayFormat)
+ {
+ String label = "";
+
+ if (null != user)
+ {
+ String userDisplayFormat = (String) user.getProperty(USER_NAME_DISPLAY_FORMAT_PREF_ID);
+ if (StringUtils.isNotEmpty(userDisplayFormat))
+ {
+ label = MessageFormat.format(userDisplayFormat, user.getFirstName(), user.getLastName(), user.getAccount());
+ }
+ else
+ {
+ label = MessageFormat.format(defaultUserDisplayFormat, user.getFirstName(), user.getLastName(),
+ user.getAccount());
+ }
+ }
+
+ if (StringUtils.isEmpty(label))
+ {
+ label = getUserLabelDefault(user);
+ }
+
+ return label;
+ }
+
public static String getProcessName(ProcessDefinition process)
{
return getProcessLabel(process, "<Unknown Process>", ModelElementLocalizerKey.KEY_NAME);