summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-01-25 09:29:25 (EST)
committer Sven Rottstock2013-01-25 09:29:25 (EST)
commit6c3fcb53d9ef04e469325d51a756b15962801fd4 (patch)
treefd82b1ad3f07aa1b342221628e693412072cfb3d
parent122e0d03899807ebd15398f03112e8e096ee7ab5 (diff)
downloadorg.eclipse.stardust.ui.web-6c3fcb53d9ef04e469325d51a756b15962801fd4.zip
org.eclipse.stardust.ui.web-6c3fcb53d9ef04e469325d51a756b15962801fd4.tar.gz
org.eclipse.stardust.ui.web-6c3fcb53d9ef04e469325d51a756b15962801fd4.tar.bz2
Jira-ID: CRNT-27174
Added code to retrieve User name display format preference after login using UserUtils.loadDisplayPreferenceForUser git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@62412 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java3
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/UserProfileBean.java25
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java21
3 files changed, 26 insertions, 23 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java
index 3d3c93b..d7e9635 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/login/dialogs/LoginDialogBean.java
@@ -38,6 +38,7 @@ import org.eclipse.stardust.ui.web.viewscommon.beans.ApplicationContext;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.login.InfinityStartup;
import org.eclipse.stardust.ui.web.viewscommon.utils.ExceptionHandler;
+import org.eclipse.stardust.ui.web.viewscommon.utils.UserUtils;
import org.springframework.beans.factory.InitializingBean;
@@ -282,6 +283,8 @@ public class LoginDialogBean implements Serializable, InitializingBean
else
{
sessionCtx.initInternalSession();
+ // User display name preference are not fetched with UserService.getUser()
+ UserUtils.loadDisplayPreferenceForUser(sessionCtx.getUser());
}
}
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/UserProfileBean.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/UserProfileBean.java
index 8a1594e..84a65f6 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/UserProfileBean.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/user/UserProfileBean.java
@@ -345,10 +345,8 @@ public class UserProfileBean extends PopupUIComponentBean implements Confirmatio
validTo = user.getValidTo();
description = user.getDescription();
qaOverride = user.getQualityAssuranceProbability();
- if (null != user.getProperty(UserUtils.USER_NAME_DISPLAY_FORMAT_PREF_ID))
- {
- initUserDisplayPreference();
- }
+ UserUtils.loadDisplayPreferenceForUser(user);
+
if (isModifyProfileConfiguration())
{
myPicturePreference = new MyPicturePreferenceBean(user);
@@ -359,25 +357,6 @@ public class UserProfileBean extends PopupUIComponentBean implements Confirmatio
}
/**
- * Read the user display format preference
- */
- private void initUserDisplayPreference()
- {
- Serializable value = null;
- QueryService queryService = SessionContext.findSessionContext().getServiceFactory().getQueryService();
- List<Preferences> prefs = queryService.getAllPreferences(PreferenceQuery.findPreferencesForUsers(user.getRealm()
- .getId(), user.getId(), UserPreferencesEntries.M_ADMIN_PORTAL, PREFERENCE_ID));
- for (Preferences userPref : prefs)
- {
- value = userPref.getPreferences().get(UserUtils.USER_NAME_DISPLAY_FORMAT_PREF_ID);
- }
- if (value != null)
- {
- user.setProperty(UserUtils.USER_NAME_DISPLAY_FORMAT_PREF_ID, value);
- }
- }
-
- /**
* sets Default realm id
*/
private void setDefaultRealm()
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java
index b115fa7..6830c7b 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/UserUtils.java
@@ -30,6 +30,7 @@ import org.eclipse.stardust.engine.api.model.Participant;
import org.eclipse.stardust.engine.api.model.QualifiedModelParticipantInfo;
import org.eclipse.stardust.engine.api.model.Role;
import org.eclipse.stardust.engine.api.query.FilterOrTerm;
+import org.eclipse.stardust.engine.api.query.PreferenceQuery;
import org.eclipse.stardust.engine.api.query.SubsetPolicy;
import org.eclipse.stardust.engine.api.query.UserDetailsPolicy;
import org.eclipse.stardust.engine.api.query.UserQuery;
@@ -144,6 +145,26 @@ public class UserUtils
}
/**
+ * @param users
+ * @return
+ */
+ public static void loadDisplayPreferenceForUser(User user)
+ {
+ Serializable displayNameFormat = null;
+ QueryService queryService = SessionContext.findSessionContext().getServiceFactory().getQueryService();
+ List<Preferences> prefs = queryService.getAllPreferences(PreferenceQuery.findPreferencesForUsers(user.getRealm()
+ .getId(), user.getId(), UserPreferencesEntries.M_ADMIN_PORTAL, PREFERENCES_ID));
+ for (Preferences userPref : prefs)
+ {
+ displayNameFormat = userPref.getPreferences().get(UserUtils.USER_NAME_DISPLAY_FORMAT_PREF_ID);
+ }
+ if (displayNameFormat != null)
+ {
+ user.setProperty(UserUtils.USER_NAME_DISPLAY_FORMAT_PREF_ID, displayNameFormat);
+ }
+ }
+
+ /**
* Returns true if Participant is part of Team
* @param user
* @param participantList