summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-05-11 10:13:52 (EDT)
committerManik Kishore2012-06-19 07:29:30 (EDT)
commit1995c4161c28aaa4751110d85a330185f835b634 (patch)
tree92fbfaacfc98915655c7375a2ea120dc629a1960
parent6aaf325cb89ab4e9ca0f69fff1bf5e087c798da8 (diff)
downloadorg.eclipse.stardust.ui.web-1995c4161c28aaa4751110d85a330185f835b634.zip
org.eclipse.stardust.ui.web-1995c4161c28aaa4751110d85a330185f835b634.tar.gz
org.eclipse.stardust.ui.web-1995c4161c28aaa4751110d85a330185f835b634.tar.bz2
Jira-ID: CRNT-23229
-Made changes to CreateOrModifyPreferenceBean.java for showing the In Scope User. -Made changes in PreferenceManagerBean.java to show the logged in User on User AutoComplete git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@56248 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java42
-rw-r--r--admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java64
-rw-r--r--admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml2
-rw-r--r--admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml22
-rw-r--r--admin-portal/src/main/resources/admin-portal-messages.properties1
5 files changed, 100 insertions, 31 deletions
diff --git a/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java
index 0d95005..32ea77f 100644
--- a/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java
+++ b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java
@@ -31,6 +31,7 @@ import org.eclipse.stardust.ui.web.admin.views.PreferenceManagerBean.PREF_VIEW_T
import org.eclipse.stardust.ui.web.common.PopupUIComponentBean;
import org.eclipse.stardust.ui.web.common.message.MessageDialog;
import org.eclipse.stardust.ui.web.common.message.MessageDialog.MessageType;
+import org.eclipse.stardust.ui.web.common.util.StringUtils;
import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.user.UserAutocompleteMultiSelector;
import org.eclipse.stardust.ui.web.viewscommon.user.UserWrapper;
@@ -49,7 +50,8 @@ public class CreateOrModifyPreferenceBean extends PopupUIComponentBean
private AdminMessagesPropertiesBean propsBean;
private PreferenceBean preferenceBean;
private UserAutocompleteMultiSelector userSelector;
- AdministrationService adminService;
+ private AdministrationService adminService;
+ private UserWrapper userWrapperObj;
public CreateOrModifyPreferenceBean()
{
@@ -67,6 +69,13 @@ public class CreateOrModifyPreferenceBean extends PopupUIComponentBean
userValidationMsg = null;
preferenceBean = null;
Object obj = source.getAttributes().get("editRow");
+ // Get the preference selected in Preference Manager View, to populate the Scope in
+ // Add Preference
+ String selPrefView = (String) source.getAttributes().get("selectedView");
+ selectedView = selPrefView;
+ // Get the User selected in Preference Manager View, to populate the Scoped User in
+ // Add Preference
+ userWrapperObj = (UserWrapper) source.getAttributes().get("selectedUser");
// If Edit preference is selected , get selected row
if (null != obj)
{
@@ -102,10 +111,15 @@ public class CreateOrModifyPreferenceBean extends PopupUIComponentBean
propsBean.getString("views.prefManagerBean.modifyPreference.tenant.label"));
viewSelection[1] = new SelectItem(PREF_VIEW_TYPE.USER.name(),
propsBean.getString("views.prefManagerBean.modifyPreference.user.label"));
- selectedView = PREF_VIEW_TYPE.PARTITION.name();
+
}
userSelector = new UserAutocompleteMultiSelector(false, true);
userSelector.setShowOnlineIndicator(false);
+ // Auto populate the User Select Autocomplete text
+ if (null != userWrapperObj)
+ {
+ userSelector.setSearchValue(userWrapperObj.getFullName());
+ }
super.openPopup();
}
@@ -133,6 +147,7 @@ public class CreateOrModifyPreferenceBean extends PopupUIComponentBean
private Preferences updatePreference(PreferenceScope prefScope, boolean partitionPrefSelected)
{
Preferences prefs = null;
+ User user = null;
Map<String, Serializable> preferenceMap = new HashMap<String, Serializable>();
preferenceMap.put(preferenceBean.getPreferenceName(), preferenceBean.getPreferenceValue());
UserWrapper userWrapper = getUserSelector().getSelectedValue();
@@ -144,17 +159,32 @@ public class CreateOrModifyPreferenceBean extends PopupUIComponentBean
// Add Preference with User selection
if (!modifyMode && null != userWrapper)
{
- User u = userWrapper.getUser();
- preferenceBean.setUserId(u.getId());
- preferenceBean.setRealmId(u.getRealm().getId());
+ user = userWrapper.getUser();
+ userWrapperObj = userWrapper;
+ }
+ else if (!modifyMode && StringUtils.isNotEmpty(getUserSelector().getSearchValue()) && null != userWrapperObj)
+ {
+ if(userWrapperObj.getFullName().equals(getUserSelector().getSearchValue()))
+ {
+ user = userWrapperObj.getUser();
+ }
+
}
- else if (!modifyMode && null == userWrapper)
+
+ if (!modifyMode && null == user)
{
// When no user selection is made in 'Add' for User Preference Scope , return
// null with error msg
userValidationMsg = propsBean.getString("views.prefManagerBean.modifyPreference.confirmAddPref.error");
return null;
}
+
+ if (null != user)
+ {
+ preferenceBean.setUserId(user.getId());
+ preferenceBean.setRealmId(user.getRealm().getId());
+ }
+
List<Preferences> userPrefList = CollectionUtils.newArrayList();
// AdminServiceImpl does not have method to retrieve specific preference for User
// , we use QueryService call to get preference for User selected
diff --git a/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java
index 66b2c22..eef8612 100644
--- a/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java
+++ b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java
@@ -74,9 +74,11 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
private String prefSearchTxt;
private SortableTable<PreferenceManagerTableEntry> prefManagerTable;
private List<PreferenceManagerTableEntry> prefList;
+ private List<PreferenceManagerTableEntry> partitionCacheList;
private ConfirmationDialog prefMngrConfirmationDialog;
private PreferenceManagerTableEntry selectedPrefMngrObj;
private QueryService qService;
+ private UserWrapper userWrapperObj;
public PreferenceManagerBean()
{
@@ -105,12 +107,17 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
{
userSelector = new UserAutocompleteMultiSelector(false, true);
userSelector.setShowOnlineIndicator(false);
+ User user = SessionContext.findSessionContext().getUser();
+ userWrapperObj = new UserWrapper(user, false);
+ userSelector.setSearchValue(userWrapperObj.getFullName());
viewSelection[0] = new SelectItem(PREF_VIEW_TYPE.PARTITION.name(), getMessages().getString("tenant.label"));
viewSelection[1] = new SelectItem(PREF_VIEW_TYPE.USER.name(), getMessages().getString("user.label"));
selectedView = PREF_VIEW_TYPE.PARTITION.name();
prefList = CollectionUtils.newArrayList();
createTable();
update();
+ partitionCacheList = CollectionUtils.newArrayList();
+ partitionCacheList.addAll(prefList);
}
public void update()
@@ -133,8 +140,9 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
qService = SessionContext.findSessionContext().getServiceFactory().getQueryService();
List<Preferences> prefs = new ArrayList<Preferences>();
- prefList.clear();
+ User user = null;
String userFullName = null;
+ prefList.clear();
if (PREF_VIEW_TYPE.PARTITION.name().equals(selectedView))
{
// fetch all the Partition preferences
@@ -143,16 +151,26 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
else
{
UserWrapper userWrapper = userSelector.getSelectedValue();
- if (userWrapper != null)
+ if (null != userWrapper)
{
- User u = userWrapper.getUser();
+ user = userWrapper.getUser();
userFullName = userWrapper.getFullName();
+ userWrapperObj = userWrapper;
+ }
+ // Use the Current Logged In User Details initialized at page creation
+ else if (StringUtils.isNotEmpty(getUserSelector().getSearchValue()) && null != userWrapperObj)
+ {
+ user = userWrapperObj.getUser();
+ userFullName = userWrapperObj.getFullName();
+ }
+ if (null != user)
+ {
// fetch all preference store entries for User, the moduleId and PreferenceId
// can be passed as '*'
- prefs = qService.getAllPreferences(PreferenceQuery.findPreferencesForUsers(u.getRealm().getId(), u.getId(),
- "*", "*"));
- }
+ prefs = qService.getAllPreferences(PreferenceQuery.findPreferencesForUsers(user.getRealm().getId(),
+ user.getId(), "*", "*"));
+ }
}
for (Preferences pref : prefs)
{
@@ -220,7 +238,7 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
}
else
{
- update();
+ performSearch();
}
}
@@ -230,14 +248,15 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
*/
public void performSearch()
{
- if (StringUtils.isNotEmpty(prefSearchTxt))
+ if (StringUtils.isNotEmpty(prefSearchTxt) || PREF_VIEW_TYPE.USER.name().equals(selectedView))
{
- if (CollectionUtils.isEmpty(prefList))
- fetchPreferences();
+ fetchPreferences();
updatePrefStoreTable(polulateSearchResult());
}
else
- update();
+ {
+ updatePrefStoreTable(partitionCacheList);
+ }
}
/**
@@ -287,13 +306,15 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
for (Field field : inputFields)
{
- String value = ReflectionUtils.invokeGetterMethod((Object) prefTabList, field.getName()).toString();
- if (value.toLowerCase().contains(prefSearchTxt.toLowerCase()))
+ if (!field.getName().equals("selected"))
{
- prefTableList.add(prefTabList);
- break;
+ Object value = ReflectionUtils.invokeGetterMethod((Object) prefTabList, field.getName());
+ if (null != value && value.toString().toLowerCase().contains(prefSearchTxt.toLowerCase()))
+ {
+ prefTableList.add(prefTabList);
+ break;
+ }
}
-
}
}
}
@@ -302,6 +323,7 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
}
catch (Exception e)
{
+ e.printStackTrace();
}
return prefTableList;
}
@@ -406,4 +428,14 @@ public class PreferenceManagerBean extends UIComponentBean implements ViewEventH
return qService;
}
+ public UserWrapper getUserWrapperObj()
+ {
+ return userWrapperObj;
+ }
+
+ public void setUserWrapperObj(UserWrapper userWrapperObj)
+ {
+ this.userWrapperObj = userWrapperObj;
+ }
+
}
diff --git a/admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml b/admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml
index b2b4e5a..619817b 100644
--- a/admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml
+++ b/admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml
@@ -10,6 +10,8 @@
<ice:commandLink actionListener="#{createOrModifyPreference.openModifyPrefDialog}">
<h:graphicImage value="/plugins/views-common/images/icons/add.png"
style="border: none;" title="#{prefManagerBean.messages['modifyPreference.add.title']}" />
+ <f:attribute name="selectedView" value="#{prefManagerBean.selectedView}" />
+ <f:attribute name="selectedUser" value="#{prefManagerBean.userWrapperObj}" />
</ice:commandLink>
<ice:commandLink actionListener="#{prefManagerBean.removePreference}">
diff --git a/admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml b/admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml
index b6c1430..2720ac9 100644
--- a/admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml
+++ b/admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml
@@ -20,11 +20,11 @@
<ice:selectOneRadio value="#{prefManagerBean.selectedView}"
style="text-align: left;"
valueChangeListener="#{prefManagerBean.viewSelectionListener}"
- partialSubmit="true" layout="pageDirection" >
+ partialSubmit="true" layout="pageDirection">
<f:selectItem value="#{prefManagerBean.viewSelection[0]}" />
<f:selectItem value="#{prefManagerBean.viewSelection[1]}" />
<pc:automationTag value="auto-ADM-PrefMngrView-SelView"
- standAlone="false" requiredValue="label-form"/>
+ standAlone="false" requiredValue="label-form" />
</ice:selectOneRadio>
<ice:panelGroup
@@ -39,23 +39,27 @@
<ice:panelGroup styleClass="clearing" />
<ice:panelGroup>
+ <ice:outputLabel
+ value="#{prefManagerBean.messages['search.filter']}#{messages_admin['common.colon']}"
+ styleClass="label-form" style="margin-left:5px;"/>
<ice:inputText value="#{prefManagerBean.prefSearchTxt}"
- style="width: 305px;margin-left:10px;margin-right:10px;"
+ style="width: 350px;margin-right:10px;"
partialSubmit="true">
<pc:automationTag value="auto-ADM-PrefMngrView-PrefSearchTxt"
standAlone="false" />
</ice:inputText>
- <ice:commandButton
+ </ice:panelGroup>
+ <ice:panelGroup styleClass="clearing" />
+ <ice:commandButton
value="#{prefManagerBean.messages['searchPrefStore.label']}"
- action="#{prefManagerBean.performSearch}">
+ action="#{prefManagerBean.performSearch}" style="margin-left:5px;">
<pc:automationTag value="auto-ADM-PrefMngrView-SearchPrefBtn"
- standAlone="false" requiredValue="button"/>
- </ice:commandButton>
- </ice:panelGroup>
+ standAlone="false" requiredValue="button" />
+ </ice:commandButton>
<ice:panelGroup styleClass="clearing" />
<ice:panelGroup style="margin-left:5px;">
- <pc:automationTag value="auto-ADM-PrefMngrView-DataTable"/>
+ <pc:automationTag value="auto-ADM-PrefMngrView-DataTable" />
<pc:genericDataTable title="" bean="#{prefManagerBean}"
id="prefManagerList" table="#{prefManagerBean.prefManagerTable}"
sortSupported="true"
diff --git a/admin-portal/src/main/resources/admin-portal-messages.properties b/admin-portal/src/main/resources/admin-portal-messages.properties
index 49aa8af..ab39a09 100644
--- a/admin-portal/src/main/resources/admin-portal-messages.properties
+++ b/admin-portal/src/main/resources/admin-portal-messages.properties
@@ -641,6 +641,7 @@ views.qaManagementView.qaError = Enter a whole percentage between 0 and 100, or
views.prefManagerBean.label=Preference Store Manager
views.prefManagerBean.tenant.label=Search Tenant Preferences
views.prefManagerBean.user.label=Search User Preferences
+views.prefManagerBean.search.filter=Filter
views.prefManagerBean.scope.label=Scope
views.prefManagerBean.moduleId.label=Module ID
views.prefManagerBean.preferenceId.label=Preference ID