summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-05-04 09:38:36 (EDT)
committer Manik Kishore2012-06-19 07:28:31 (EDT)
commitb039d91cb68d15e4d0503a5e5c10d9bf7054558a (patch)
tree7857f8d7911d0b7dcb2a628e0438f3b7974d3684
parentd3dfb978da60f3cac61c1c15db0ca97fa8f91241 (diff)
downloadorg.eclipse.stardust.ui.web-b039d91cb68d15e4d0503a5e5c10d9bf7054558a.zip
org.eclipse.stardust.ui.web-b039d91cb68d15e4d0503a5e5c10d9bf7054558a.tar.gz
org.eclipse.stardust.ui.web-b039d91cb68d15e4d0503a5e5c10d9bf7054558a.tar.bz2
Jira-ID: CRNT-23229
1)Added new java classes PreferenceManagerBean.java,PreferenceManagerTableEntry.java ,PreferenceBean.java 2)Added xhtml files for Preference view in admin-portal project. 3)Added entries for admin-portal-context.xml, admin-portalUi-context.xml 4)Added I18N messages for Preference Manager View. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@56087 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java226
-rw-r--r--admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceBean.java104
-rw-r--r--admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java391
-rw-r--r--admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerTableEntry.java79
-rw-r--r--admin-portal/src/main/resources/META-INF/spring/admin-portal-context.xml2
-rw-r--r--admin-portal/src/main/resources/META-INF/spring/admin-portalUi-context.xml2
-rw-r--r--admin-portal/src/main/resources/META-INF/xhtml/extensions/launchpad/administrativeViews.xhtml5
-rw-r--r--admin-portal/src/main/resources/META-INF/xhtml/views/createOrModifyPreference.xhtml136
-rw-r--r--admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml28
-rw-r--r--admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml57
-rw-r--r--admin-portal/src/main/resources/admin-portal-messages.properties19
11 files changed, 1047 insertions, 2 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
new file mode 100644
index 0000000..04b35bb
--- /dev/null
+++ b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/CreateOrModifyPreferenceBean.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.stardust.ui.web.admin.views;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+
+import org.eclipse.stardust.engine.api.runtime.AdministrationService;
+import org.eclipse.stardust.engine.api.runtime.User;
+import org.eclipse.stardust.engine.core.preferences.PreferenceScope;
+import org.eclipse.stardust.engine.core.preferences.Preferences;
+import org.eclipse.stardust.ui.web.admin.messages.AdminMessagesPropertiesBean;
+import org.eclipse.stardust.ui.web.admin.views.PreferenceManagerBean.VIEW_TYPE;
+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.viewscommon.beans.SessionContext;
+import org.eclipse.stardust.ui.web.viewscommon.user.UserAutocompleteMultiSelector;
+import org.eclipse.stardust.ui.web.viewscommon.user.UserWrapper;
+
+public class CreateOrModifyPreferenceBean extends PopupUIComponentBean
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private boolean modifyMode;
+
+ private PreferenceBean preferenceBean;
+ private String selectedView;
+ private final SelectItem[] viewSelection = new SelectItem[2];
+ private AdminMessagesPropertiesBean propsBean;
+
+ public CreateOrModifyPreferenceBean()
+ {
+ super();
+ propsBean = AdminMessagesPropertiesBean.getInstance();
+ }
+
+ /**
+ *
+ * @param ae
+ */
+ public void openModifyPrefDialog(ActionEvent ae)
+ {
+ UIComponent source = ae.getComponent();
+ Object obj = source.getAttributes().get("editRow");
+ // If Edit preference is selected , get selected row
+ if (null != obj)
+ {
+ this.modifyMode = true;
+ List<PreferenceManagerTableEntry> prefMngrList = PreferenceManagerBean.getCurrent().getPrefManagerTable()
+ .getList();
+ for (Iterator<PreferenceManagerTableEntry> it = prefMngrList.iterator(); it.hasNext();)
+ {
+ PreferenceManagerTableEntry row = it.next();
+ // Initialize the PreferenceBean with current row selected
+ if (row.isSelected())
+ {
+ this.preferenceBean = new PreferenceBean(row.getScope(), row.getModuleId(), row.getPreferenceId(),
+ row.getPreferenceName(), row.getPreferenceValue(), null);
+ }
+ }
+ if (null == preferenceBean)
+ {
+ MessageDialog.addMessage(MessageType.ERROR, propsBean.getString("views.common.error.label"),
+ propsBean.getString("views.prefManagerBean.modifyPreference.confirmEditPref.error"));
+ return;
+ }
+ }
+ // When add preference is selected , create new Preference Bean object
+ else
+ {
+ this.preferenceBean = new PreferenceBean();
+ this.modifyMode = false;
+ }
+
+ viewSelection[0] = new SelectItem(VIEW_TYPE.TENENT.name(),
+ propsBean.getString("views.prefManagerBean.modifyPreference.tenant.label"));
+ viewSelection[1] = new SelectItem(VIEW_TYPE.USER.name(),
+ propsBean.getString("views.prefManagerBean.modifyPreference.user.label"));
+ selectedView = VIEW_TYPE.TENENT.name();
+ super.openPopup();
+ }
+
+ public void apply()
+ {
+ AdministrationService adminService = SessionContext.findSessionContext().getServiceFactory()
+ .getAdministrationService();
+ Map<String, Serializable> preferenceMap = new HashMap<String, Serializable>();
+ Preferences prefs = null;
+ preferenceMap.put(getPreferenceName(), getPreferenceValue());
+ if (VIEW_TYPE.TENENT.name().equals(selectedView))
+ {
+ if (modifyMode)
+ {
+ prefs = adminService.getPreferences(PreferenceScope.PARTITION, getModuleId(), getPreferenceId());
+ prefs.getPreferences().put(getPreferenceName(), getPreferenceValue());
+ }
+ else
+ {
+ prefs = new Preferences(PreferenceScope.PARTITION, getModuleId(), getPreferenceId(), preferenceMap);
+ }
+
+ }
+ else
+ {
+ if (modifyMode)
+ {
+ prefs = adminService.getPreferences(PreferenceScope.USER, getModuleId(), getPreferenceId());
+ prefs.getPreferences().put(getPreferenceName(), getPreferenceValue());
+ }
+ else
+ {
+ UserWrapper userWrapper = getUserSelector().getSelectedValue();
+ if (userWrapper != null)
+ {
+ User u = userWrapper.getUser();
+ prefs = new Preferences(PreferenceScope.USER, getModuleId(), getPreferenceId(), preferenceMap);
+ prefs.setUserId(u.getId());
+ prefs.setRealmId(u.getRealm().getId());
+ }
+ }
+ }
+ adminService.savePreferences(prefs);
+ PreferenceManagerBean.getCurrent().update();
+ closePopup();
+ }
+
+ @Override
+ public void initialize()
+ {}
+
+ public boolean isModifyMode()
+ {
+ return modifyMode;
+ }
+
+ public String getSelectedView()
+ {
+ return selectedView;
+ }
+
+ public void setSelectedView(String selectedView)
+ {
+ this.selectedView = selectedView;
+ }
+
+ public PreferenceBean getPreferenceBean()
+ {
+ return preferenceBean;
+ }
+
+ public String getModuleId()
+ {
+ return preferenceBean.getModuleId();
+ }
+
+ public void setModuleId(String moduleId)
+ {
+ preferenceBean.setModuleId(moduleId);
+ }
+
+ public String getPreferenceId()
+ {
+ return preferenceBean.getPreferenceId();
+ }
+
+ public void setPreferenceId(String preferenceId)
+ {
+ preferenceBean.setPreferenceId(preferenceId);
+ }
+
+ public String getPreferenceName()
+ {
+ return preferenceBean.getPreferenceName();
+ }
+
+ public void setPreferenceName(String preferenceName)
+ {
+ preferenceBean.setPreferenceName(preferenceName);
+ }
+
+ public String getPreferenceValue()
+ {
+ return preferenceBean.getPreferenceValue();
+ }
+
+ public void setPreferenceValue(String preferenceValue)
+ {
+ preferenceBean.setPreferenceValue(preferenceValue);
+ }
+
+ public UserAutocompleteMultiSelector getUserSelector()
+ {
+ return preferenceBean.getUserSelector();
+ }
+
+ public SelectItem[] getViewSelection()
+ {
+ return viewSelection;
+ }
+
+ public AdminMessagesPropertiesBean getPropsBean()
+ {
+ return propsBean;
+ }
+
+}
diff --git a/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceBean.java b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceBean.java
new file mode 100644
index 0000000..3bd394d
--- /dev/null
+++ b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceBean.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.stardust.ui.web.admin.views;
+
+import org.eclipse.stardust.ui.web.viewscommon.user.UserAutocompleteMultiSelector;
+
+/**
+ *
+ * @author Sidharth.Singh
+ * @version $Revision: $
+ */
+public class PreferenceBean
+{
+
+ private String scope;
+ private String moduleId;
+ private String preferenceId;
+ private String preferenceName;
+ private String preferenceValue;
+ private UserAutocompleteMultiSelector userSelector;
+
+ public PreferenceBean()
+ {
+ super();
+ userSelector = new UserAutocompleteMultiSelector(false, true);
+ userSelector.setShowOnlineIndicator(false);
+ }
+
+ public PreferenceBean(String scope, String moduleId, String preferenceId, String preferenceName,
+ String preferenceValue, UserAutocompleteMultiSelector userSelector)
+ {
+ super();
+ this.scope = scope;
+ this.moduleId = moduleId;
+ this.preferenceId = preferenceId;
+ this.preferenceName = preferenceName;
+ this.preferenceValue = preferenceValue;
+ this.userSelector = userSelector;
+ }
+
+ public String getScope()
+ {
+ return scope;
+ }
+
+ public void setScope(String scope)
+ {
+ this.scope = scope;
+ }
+
+ public String getModuleId()
+ {
+ return moduleId;
+ }
+
+ public void setModuleId(String moduleId)
+ {
+ this.moduleId = moduleId;
+ }
+
+ public String getPreferenceId()
+ {
+ return preferenceId;
+ }
+
+ public void setPreferenceId(String preferenceId)
+ {
+ this.preferenceId = preferenceId;
+ }
+
+ public String getPreferenceName()
+ {
+ return preferenceName;
+ }
+
+ public void setPreferenceName(String preferenceName)
+ {
+ this.preferenceName = preferenceName;
+ }
+
+ public String getPreferenceValue()
+ {
+ return preferenceValue;
+ }
+
+ public void setPreferenceValue(String preferenceValue)
+ {
+ this.preferenceValue = preferenceValue;
+ }
+
+ public UserAutocompleteMultiSelector getUserSelector()
+ {
+ return userSelector;
+ }
+
+}
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
new file mode 100644
index 0000000..75d3793
--- /dev/null
+++ b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerBean.java
@@ -0,0 +1,391 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.stardust.ui.web.admin.views;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+import org.eclipse.stardust.common.CollectionUtils;
+import org.eclipse.stardust.common.StringUtils;
+import org.eclipse.stardust.engine.api.query.PreferenceQuery;
+import org.eclipse.stardust.engine.api.runtime.AdministrationService;
+import org.eclipse.stardust.engine.api.runtime.QueryService;
+import org.eclipse.stardust.engine.api.runtime.User;
+import org.eclipse.stardust.engine.core.preferences.PreferenceScope;
+import org.eclipse.stardust.engine.core.preferences.Preferences;
+import org.eclipse.stardust.ui.web.admin.common.configuration.UserPreferencesEntries;
+import org.eclipse.stardust.ui.web.admin.messages.AdminMessagesPropertiesBean;
+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.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.dialogs.ConfirmationDialog;
+import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialogHandler;
+import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog.DialogActionType;
+import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog.DialogContentType;
+import org.eclipse.stardust.ui.web.common.dialogs.ConfirmationDialog.DialogStyle;
+import org.eclipse.stardust.ui.web.common.event.ViewEvent;
+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.message.MessageDialog;
+import org.eclipse.stardust.ui.web.common.message.MessageDialog.MessageType;
+import org.eclipse.stardust.ui.web.common.table.DataTableRowSelector;
+import org.eclipse.stardust.ui.web.common.table.SortableTable;
+import org.eclipse.stardust.ui.web.common.table.SortableTableComparator;
+import org.eclipse.stardust.ui.web.common.util.FacesUtils;
+import org.eclipse.stardust.ui.web.common.util.ReflectionUtils;
+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;
+
+/**
+ *
+ * @author Sidharth.Singh
+ * @version $Revision: $
+ */
+public class PreferenceManagerBean extends UIComponentBean implements ViewEventHandler, ConfirmationDialogHandler
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private final SelectItem[] viewSelection = new SelectItem[2];
+ private String selectedView;
+ private UserAutocompleteMultiSelector userSelector;
+ private String prefSearchTxt;
+ private SortableTable<PreferenceManagerTableEntry> prefManagerTable;
+ private List<PreferenceManagerTableEntry> prefList;
+ private ConfirmationDialog prefMngrConfirmationDialog;
+ private PreferenceManagerTableEntry selectedPrefMngrObj;
+
+ public PreferenceManagerBean()
+ {
+ super("prefManagerBean");
+ }
+
+ /**
+ * @return
+ */
+ public static PreferenceManagerBean getCurrent()
+ {
+ return (PreferenceManagerBean) FacesUtils.getBeanFromContext("prefManagerBean");
+ }
+
+ public void handleEvent(ViewEvent event)
+ {
+ if (ViewEventType.CREATED == event.getType())
+ {
+ initialize();
+ }
+
+ }
+
+ @Override
+ public void initialize()
+ {
+ userSelector = new UserAutocompleteMultiSelector(false, true);
+ userSelector.setShowOnlineIndicator(false);
+ viewSelection[0] = new SelectItem(VIEW_TYPE.TENENT.name(), getMessages().getString("tenant.label"));
+ viewSelection[1] = new SelectItem(VIEW_TYPE.USER.name(), getMessages().getString("user.label"));
+ selectedView = VIEW_TYPE.TENENT.name();
+ prefList = CollectionUtils.newArrayList();
+ createTable();
+ update();
+ }
+
+ public void update()
+ {
+ fetchPreferences();
+ updatePrefStoreTable(prefList);
+ }
+
+ public void updatePrefStoreTable(List<PreferenceManagerTableEntry> prefTableElements)
+ {
+ prefManagerTable.setList(prefTableElements);
+ prefManagerTable.initialize();
+ }
+
+ /**
+ *
+ */
+ private void fetchPreferences()
+ {
+
+ QueryService qService = SessionContext.findSessionContext().getServiceFactory().getQueryService();
+ List<Preferences> prefs = new ArrayList<Preferences>();
+ prefList.clear();
+ if (VIEW_TYPE.TENENT.name().equals(selectedView))
+ {
+ // fetch all the Partition preferences
+ prefs = qService.getAllPreferences(PreferenceQuery.findAll(PreferenceScope.PARTITION));
+ }
+ else
+ {
+ UserWrapper userWrapper = userSelector.getSelectedValue();
+ if (userWrapper != null)
+ {
+ User u = userWrapper.getUser();
+ // 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(),
+ "*", "*"));
+ }
+
+ }
+ for (Preferences pref : prefs)
+ {
+ Map<String, Serializable> pref11 = pref.getPreferences();
+
+ for (Map.Entry<String, Serializable> entry : pref11.entrySet())
+ {
+ prefList.add(new PreferenceManagerTableEntry(pref.getScope().name(), pref.getModuleId(), pref
+ .getPreferencesId(), entry.getKey(), entry.getValue().toString()));
+ }
+ }
+
+ }
+
+ /**
+ *
+ */
+ private void createTable()
+ {
+ List<ColumnPreference> fixedCols = new ArrayList<ColumnPreference>();
+ ColumnPreference scopeCol = new ColumnPreference("Scope", "scope", ColumnDataType.STRING, getMessages()
+ .getString("scope.label"), null, true, false);
+ fixedCols.add(scopeCol);
+
+ ColumnPreference moduleIdCol = new ColumnPreference("ModuleId", "moduleId", ColumnDataType.STRING, getMessages()
+ .getString("moduleId.label"), null, true, false);
+ fixedCols.add(moduleIdCol);
+
+ ColumnPreference preferenceIdCol = new ColumnPreference("PreferenceId", "preferenceId", ColumnDataType.STRING,
+ getMessages().getString("preferenceId.label"), null, true, false);
+ fixedCols.add(preferenceIdCol);
+
+ ColumnPreference preferenceNameCol = new ColumnPreference("PreferenceName", "preferenceName",
+ ColumnDataType.STRING, getMessages().getString("preferenceName.label"), null, true, false);
+ fixedCols.add(preferenceNameCol);
+
+ ColumnPreference preferenceValueCol = new ColumnPreference("PreferenceValue", "preferenceValue",
+ ColumnDataType.STRING, getMessages().getString("preferenceValue.label"), null, true, false);
+ fixedCols.add(preferenceValueCol);
+
+ List<ColumnPreference> selectableCols = new ArrayList<ColumnPreference>();
+
+ IColumnModel columnModel = new DefaultColumnModel(selectableCols, fixedCols, null,
+ UserPreferencesEntries.M_ADMIN, "prefManagerBean");
+ TableColumnSelectorPopup colSelecpopup = new TableColumnSelectorPopup(columnModel);
+
+ prefManagerTable = new SortableTable<PreferenceManagerTableEntry>(colSelecpopup, null,
+ new SortableTableComparator<PreferenceManagerTableEntry>("moduleId", true));
+ prefManagerTable.setRowSelector(new DataTableRowSelector("selected"));
+ }
+
+ /**
+ *
+ * @param event
+ */
+ public void viewSelectionListener(ValueChangeEvent event)
+ {
+ if (!event.getPhaseId().equals(javax.faces.event.PhaseId.INVOKE_APPLICATION))
+ {
+ event.setPhaseId(javax.faces.event.PhaseId.INVOKE_APPLICATION);
+ event.queue();
+
+ return;
+ }
+ else
+ {
+ update();
+ }
+ }
+
+ /**
+ *
+ * @param event
+ */
+ public void performSearch()
+ {
+ if (StringUtils.isNotEmpty(prefSearchTxt))
+ {
+ if (CollectionUtils.isEmpty(prefList))
+ fetchPreferences();
+ updatePrefStoreTable(polulateSearchResult());
+ }
+ else
+ update();
+ }
+
+ /**
+ *
+ * @param event
+ */
+ public void removePreference(ActionEvent event)
+ {
+ for (Iterator<PreferenceManagerTableEntry> it = prefManagerTable.getList().iterator(); it.hasNext();)
+ {
+ PreferenceManagerTableEntry row = it.next();
+
+ if (row.isSelected())
+ {
+ // Confirmation Dialog on Delete action
+ prefMngrConfirmationDialog = new ConfirmationDialog(DialogContentType.WARNING,
+ DialogActionType.CONTINUE_CANCEL, null, DialogStyle.COMPACT, this);
+ prefMngrConfirmationDialog.setMessage(getMessages().getString("modifyPreference.confirmDelPref.warn"));
+ prefMngrConfirmationDialog.openPopup();
+ }
+ }
+ if (null == selectedPrefMngrObj)
+ {
+ MessageDialog.addMessage(MessageType.ERROR,
+ AdminMessagesPropertiesBean.getInstance().getString("views.common.error.label"), getMessages()
+ .getString("modifyPreference.confirmDelPref.error"));
+ return;
+ }
+ }
+
+ /**
+ * Search the retrieved List for search text entered and return matching
+ * PreferenceManagerTableEntry objects
+ *
+ * @return
+ */
+ private List<PreferenceManagerTableEntry> polulateSearchResult()
+ {
+ List<PreferenceManagerTableEntry> prefTableList = CollectionUtils.newArrayList();
+ try
+ {
+ for (PreferenceManagerTableEntry prefTabList : prefList)
+ {
+ Field[] inputFields = prefTabList.getClass().getDeclaredFields();
+ for (Field field : inputFields)
+ {
+
+ String value = ReflectionUtils.invokeGetterMethod((Object) prefTabList, field.getName()).toString();
+ if (value.toLowerCase().contains(prefSearchTxt.toLowerCase()))
+ {
+ prefTableList.add(prefTabList);
+ break;
+ }
+
+ }
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+ return prefTableList;
+ }
+
+ public boolean accept()
+ {
+ AdministrationService adminService = SessionContext.findSessionContext().getServiceFactory()
+ .getAdministrationService();
+ Preferences selPreference = null;
+ if (VIEW_TYPE.TENENT.name().equals(selectedView))
+ {
+ selPreference = adminService.getPreferences(PreferenceScope.PARTITION, selectedPrefMngrObj.getModuleId(),
+ selectedPrefMngrObj.getPreferenceId());
+ }
+ else
+ selPreference = adminService.getPreferences(PreferenceScope.USER, selectedPrefMngrObj.getModuleId(),
+ selectedPrefMngrObj.getPreferenceId());
+ selPreference.getPreferences().remove(selectedPrefMngrObj.getPreferenceName());
+ adminService.savePreferences(selPreference);
+ update();
+ prefMngrConfirmationDialog = null;
+ return true;
+ }
+
+ public boolean cancel()
+ {
+ prefMngrConfirmationDialog = null;
+ return true;
+ }
+
+ /**
+ *
+ */
+ public static enum VIEW_TYPE {
+ TENENT, USER;
+ }
+
+ public SelectItem[] getViewSelection()
+ {
+ return viewSelection;
+ }
+
+ public String getSelectedView()
+ {
+ return selectedView;
+ }
+
+ public void setSelectedView(String selectedView)
+ {
+ this.selectedView = selectedView;
+ }
+
+ public UserAutocompleteMultiSelector getUserSelector()
+ {
+ return userSelector;
+ }
+
+ public String getPrefSearchTxt()
+ {
+ return prefSearchTxt;
+ }
+
+ public void setPrefSearchTxt(String prefSearchTxt)
+ {
+ this.prefSearchTxt = prefSearchTxt;
+ }
+
+ public SortableTable<PreferenceManagerTableEntry> getPrefManagerTable()
+ {
+ return prefManagerTable;
+ }
+
+ public List<PreferenceManagerTableEntry> getPrefList()
+ {
+ return prefList;
+ }
+
+ public ConfirmationDialog getPrefMngrConfirmationDialog()
+ {
+ return prefMngrConfirmationDialog;
+ }
+
+ public PreferenceManagerTableEntry getSelectedPrefMngrObj()
+ {
+ return selectedPrefMngrObj;
+ }
+
+ public void setSelectedPrefMngrObj(PreferenceManagerTableEntry selectedPrefMngrObj)
+ {
+ this.selectedPrefMngrObj = selectedPrefMngrObj;
+ }
+
+}
diff --git a/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerTableEntry.java b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerTableEntry.java
new file mode 100644
index 0000000..2792e1d
--- /dev/null
+++ b/admin-portal/src/main/java/org/eclipse/stardust/ui/web/admin/views/PreferenceManagerTableEntry.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2011 SunGard CSA LLC and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * SunGard CSA LLC - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.stardust.ui.web.admin.views;
+
+import org.eclipse.stardust.ui.web.common.table.DefaultRowModel;
+
+/**
+ *
+ * @author Sidharth.Singh
+ * @version $Revision: $
+ */
+public class PreferenceManagerTableEntry extends DefaultRowModel
+{
+
+ /**
+ *
+ */
+ private String scope;
+ private String moduleId;
+ private String preferenceId;
+ private String preferenceName;
+ private String preferenceValue;
+ private boolean selected;
+
+ public PreferenceManagerTableEntry(String scope, String moduleId, String preferenceId, String preferenceName,
+ String preferenceValue)
+ {
+ super();
+ this.scope = scope;
+ this.moduleId = moduleId;
+ this.preferenceId = preferenceId;
+ this.preferenceName = preferenceName;
+ this.preferenceValue = preferenceValue;
+ }
+
+ public String getScope()
+ {
+ return scope;
+ }
+
+ public String getModuleId()
+ {
+ return moduleId;
+ }
+
+ public String getPreferenceId()
+ {
+ return preferenceId;
+ }
+
+ public String getPreferenceName()
+ {
+ return preferenceName;
+ }
+
+ public String getPreferenceValue()
+ {
+ return preferenceValue;
+ }
+
+ public boolean isSelected()
+ {
+ return selected;
+ }
+
+ public void setSelected(boolean selected)
+ {
+ this.selected = selected;
+ }
+
+}
diff --git a/admin-portal/src/main/resources/META-INF/spring/admin-portal-context.xml b/admin-portal/src/main/resources/META-INF/spring/admin-portal-context.xml
index 946e8e6..88e9981 100644
--- a/admin-portal/src/main/resources/META-INF/spring/admin-portal-context.xml
+++ b/admin-portal/src/main/resources/META-INF/spring/admin-portal-context.xml
@@ -128,7 +128,7 @@
<bean name="participantMgmtConfigurationBean" class="org.eclipse.stardust.ui.web.admin.views.ParticipantMgmtConfigurationBean"
scope="session">
- </bean>
+ </bean> <bean name="prefManagerBean" class="org.eclipse.stardust.ui.web.admin.views.PreferenceManagerBean" scope="portalTab"> </bean> <bean name="createOrModifyPreference" class="org.eclipse.stardust.ui.web.admin.views.CreateOrModifyPreferenceBean" scope="portalTab"> </bean>
<!-- ********** VIEW SCOPE BEANS ********** --><!--
<bean name="renameDocumentExtensionDialog"
diff --git a/admin-portal/src/main/resources/META-INF/spring/admin-portalUi-context.xml b/admin-portal/src/main/resources/META-INF/spring/admin-portalUi-context.xml
index e7e47d2..f2ed0a4 100644
--- a/admin-portal/src/main/resources/META-INF/spring/admin-portalUi-context.xml
+++ b/admin-portal/src/main/resources/META-INF/spring/admin-portalUi-context.xml
@@ -112,7 +112,7 @@ http://infinity.com/bpm/portal/common/uiDefinition http://infinity.com/bpm/porta
<ippui:view name="qaManagementView"
include="/plugins/admin-portal/views/qualityAssuranceManagementView.xhtml"
- controller="qaManagementBean"/>
+ controller="qaManagementBean"/> <ippui:view name="prefManagerBean" include="/plugins/admin-portal/views/preferenceManagerView.xhtml" controller="prefManagerBean"/>
</ippui:perspective>
diff --git a/admin-portal/src/main/resources/META-INF/xhtml/extensions/launchpad/administrativeViews.xhtml b/admin-portal/src/main/resources/META-INF/xhtml/extensions/launchpad/administrativeViews.xhtml
index 617747c..828d507 100644
--- a/admin-portal/src/main/resources/META-INF/xhtml/extensions/launchpad/administrativeViews.xhtml
+++ b/admin-portal/src/main/resources/META-INF/xhtml/extensions/launchpad/administrativeViews.xhtml
@@ -109,5 +109,10 @@
<ice:outputText value="#{messages_admin['views.qaManagementView.label']} &amp;raquo;"
styleClass="action-link" escape="false" />
</ice:commandLink>
+ <!-- <ice:commandLink action="#{ippPortalApp.openView}">
+ <f:param name="viewId" value="prefManagerBean" />
+ <ice:outputText value="#{messages_admin['views.prefManagerBean.label']} &amp;raquo;"
+ styleClass="action-link" escape="false" />
+ </ice:commandLink> -->
</ice:panelGrid>
</f:view> \ No newline at end of file
diff --git a/admin-portal/src/main/resources/META-INF/xhtml/views/createOrModifyPreference.xhtml b/admin-portal/src/main/resources/META-INF/xhtml/views/createOrModifyPreference.xhtml
new file mode 100644
index 0000000..79c2643
--- /dev/null
+++ b/admin-portal/src/main/resources/META-INF/xhtml/views/createOrModifyPreference.xhtml
@@ -0,0 +1,136 @@
+<f:view xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ice="http://www.icesoft.com/icefaces/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:pc="http://www.sungard.de/carnot/web/portal-plugin/portalcommon">
+
+ <ui:composition>
+ <ice:panelPopup id="#{createOrModifyPreference.beanId}" modal="true"
+ rendered="#{createOrModifyPreference.visible}" draggable="true"
+ autoPosition="manual" positionOnLoadOnly="true"
+ styleClass="popupDialog" clientOnly="true">
+ <f:facet name="header">
+ <ice:panelGroup>
+ <ice:outputText
+ value="#{createOrModifyPreference.modifyMode ? prefManagerBean.messages['modifyPreference.edit.title'] : prefManagerBean.messages['modifyPreference.add.title']}"
+ styleClass="headerText" />
+ <ice:commandButton title="#{common_msgPropsBean['common.close']}"
+ image="/plugins/views-common/images/icons/dialog-windowbttn-close.png"
+ action="#{createOrModifyPreference.closePopup}" immediate="true"
+ styleClass="windowClose" />
+ </ice:panelGroup>
+ </f:facet>
+
+ <f:facet name="body">
+ <ice:panelBorder styleClass="pnlPopUpBrdrDialog" cellpadding="0"
+ cellspacing="0" renderNorth="false" renderEast="false"
+ renderSouth="true" renderWest="false" renderCenter="true">
+ <f:facet name="center">
+ <ice:panelGrid columns="2" headerClass="heading"
+ style="height:#{!createOrModifyPreference.modifyMode ? '230px' : '100px'};vertical-align: top;"
+ columnClasses="table-columnVertical">
+ <ice:outputLabel
+ value="* #{prefManagerBean.messages['moduleId.label']}#{messages_admin['common.colon']}"
+ styleClass="label-form"
+ rendered="#{!createOrModifyPreference.modifyMode}" />
+ <ice:panelGroup
+ rendered="#{!createOrModifyPreference.modifyMode}">
+ <ice:inputText id="moduleId"
+ value="#{createOrModifyPreference.moduleId}" required="true"
+ style="width:215px;" partialSubmit="true">
+ </ice:inputText>
+ <ice:panelGroup styleClass="msgError">
+ <ice:message for="moduleId" />
+ </ice:panelGroup>
+ </ice:panelGroup>
+
+ <ice:outputLabel
+ value="* #{prefManagerBean.messages['preferenceId.label']}#{messages_admin['common.colon']}"
+ styleClass="label-form"
+ rendered="#{!createOrModifyPreference.modifyMode}" />
+ <ice:panelGroup
+ rendered="#{!createOrModifyPreference.modifyMode}">
+ <ice:inputText id="preferenceId"
+ value="#{createOrModifyPreference.preferenceId}"
+ required="true" style="width:215px;" partialSubmit="true">
+ </ice:inputText>
+ <ice:panelGroup styleClass="msgError">
+ <ice:message for="preferenceId" />
+ </ice:panelGroup>
+ </ice:panelGroup>
+
+ <ice:outputLabel
+ value="* #{prefManagerBean.messages['preferenceName.label']}#{messages_admin['common.colon']}"
+ styleClass="label-form"
+ rendered="#{!createOrModifyPreference.modifyMode}" />
+ <ice:panelGroup
+ rendered="#{!createOrModifyPreference.modifyMode}">
+ <ice:inputText id="preferenceName"
+ value="#{createOrModifyPreference.preferenceName}"
+ required="true" style="width:215px;" partialSubmit="true">
+ </ice:inputText>
+ <ice:panelGroup styleClass="msgError">
+ <ice:message for="preferenceName" />
+ </ice:panelGroup>
+ </ice:panelGroup>
+
+ <ice:outputLabel
+ value="#{prefManagerBean.messages['preferenceValue.label']}#{messages_admin['common.colon']}"
+ styleClass="label-form" />
+
+ <ice:inputTextarea id="preferenceValue"
+ value="#{createOrModifyPreference.preferenceValue}"
+ required="true" cols="36" partialSubmit="true">
+ </ice:inputTextarea>
+
+
+ <ice:outputLabel
+ value="#{prefManagerBean.messages['scope.label']}#{messages_admin['common.colon']}"
+ styleClass="label-form"
+ rendered="#{!createOrModifyPreference.modifyMode}" />
+
+ <ice:panelGrid columns="2"
+ rendered="#{!createOrModifyPreference.modifyMode}"
+ style="margin-top:-5px;">
+ <ice:selectOneRadio
+ value="#{createOrModifyPreference.selectedView}"
+ style="text-align: left;" partialSubmit="true"
+ layout="pageDirection" styleClass="label-form">
+ <f:selectItem
+ value="#{createOrModifyPreference.viewSelection[0]}" />
+ <f:selectItem
+ value="#{createOrModifyPreference.viewSelection[1]}" />
+ </ice:selectOneRadio>
+
+ <ice:panelGroup
+ style="padding-top: 10px;width:auto;min-width: 150px; " rendered="#{createOrModifyPreference.selectedView eq 'USER'}">
+ <ui:include
+ src="#{createOrModifyPreference.preferenceBean.userSelector.autocompleteContentUrl}">
+ <ui:param name="component"
+ value="#{createOrModifyPreference.userSelector}" />
+ </ui:include>
+ </ice:panelGroup>
+ </ice:panelGrid>
+ </ice:panelGrid>
+ </f:facet>
+
+ <f:facet name="south">
+ <ice:panelGroup>
+ <ice:commandButton value="#{messages_admin['common.ok']}"
+ action="#{createOrModifyPreference.apply}" id="applyPreference"
+ styleClass="button" title="#{messages_admin['common.ok']}"
+ immediate="true" />
+ <ice:commandButton value="#{messages_admin['common.cancel']}"
+ action="#{createOrModifyPreference.closePopup}" immediate="true"
+ id="cancel" styleClass="button"
+ title="#{messages_admin['common.cancel']}" />
+ </ice:panelGroup>
+ </f:facet>
+ </ice:panelBorder>
+
+ </f:facet>
+ </ice:panelPopup>
+ </ui:composition>
+</f:view> \ No newline at end of file
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
new file mode 100644
index 0000000..b2b4e5a
--- /dev/null
+++ b/admin-portal/src/main/resources/META-INF/xhtml/views/prefManagerViewToolbar.xhtml
@@ -0,0 +1,28 @@
+<f:view xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ice="http://www.icesoft.com/icefaces/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:pc="http://www.sungard.de/carnot/web/portal-plugin/portalcommon">
+
+ <ice:panelGrid columns="3">
+ <ice:commandLink actionListener="#{createOrModifyPreference.openModifyPrefDialog}">
+ <h:graphicImage value="/plugins/views-common/images/icons/add.png"
+ style="border: none;" title="#{prefManagerBean.messages['modifyPreference.add.title']}" />
+ </ice:commandLink>
+
+ <ice:commandLink actionListener="#{prefManagerBean.removePreference}">
+ <h:graphicImage value="/plugins/views-common/images/icons/delete.png"
+ style="border: none;"
+ title="#{prefManagerBean.messages['modifyPreference.delete.label']}" />
+ </ice:commandLink>
+
+ <ice:commandLink actionListener="#{createOrModifyPreference.openModifyPrefDialog}">
+ <h:graphicImage value="/plugins/views-common/images/icons/pencil.png"
+ style="border: none;"
+ title="#{prefManagerBean.messages['modifyPreference.edit.title']}" />
+ <f:attribute name="editRow" value="true" />
+ </ice:commandLink>
+ </ice:panelGrid>
+</f:view> \ No newline at end of file
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
new file mode 100644
index 0000000..c6888fe
--- /dev/null
+++ b/admin-portal/src/main/resources/META-INF/xhtml/views/preferenceManagerView.xhtml
@@ -0,0 +1,57 @@
+<f:view xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ice="http://www.icesoft.com/icefaces/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:pc="http://www.sungard.de/carnot/web/portal-plugin/portalcommon"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions">
+
+ <ice:panelGroup>
+ <ui:include src="createOrModifyPreference.xhtml" />
+ <ui:include
+ src="/plugins/common/views/dialog/confirmationDialog.xhtml">
+ <ui:param name="dialogBean"
+ value="#{prefManagerBean.prefMngrConfirmationDialog}" />
+ </ui:include>
+ </ice:panelGroup>
+
+ <ice:panelGroup>
+ <ice:panelGrid columns="2">
+ <ice:selectOneRadio value="#{prefManagerBean.selectedView}"
+ style="text-align: left;"
+ valueChangeListener="#{prefManagerBean.viewSelectionListener}"
+ partialSubmit="true" layout="pageDirection" styleClass="label-form">
+ <f:selectItem value="#{prefManagerBean.viewSelection[0]}" />
+ <f:selectItem value="#{prefManagerBean.viewSelection[1]}" />
+ </ice:selectOneRadio>
+
+ <ice:panelGroup
+ style="padding-top: 10px;width:auto;min-width: 220px; "
+ rendered="#{prefManagerBean.selectedView eq 'USER'}">
+ <ui:include
+ src="#{prefManagerBean.userSelector.autocompleteContentUrl}">
+ <ui:param name="component" value="#{prefManagerBean.userSelector}" />
+ </ui:include>
+ </ice:panelGroup>
+ </ice:panelGrid>
+
+ <ice:panelGroup styleClass="clearing" />
+ <ice:panelGroup>
+ <ice:inputText value="#{prefManagerBean.prefSearchTxt}"
+ style="width: 90%;margin-left:10px;" partialSubmit="true">
+ </ice:inputText>
+ <ice:commandButton id="submitSearch"
+ value="#{prefManagerBean.messages['searchPrefStore.label']}"
+ action="#{prefManagerBean.performSearch}" styleClass="button" />
+ </ice:panelGroup>
+
+ <ice:panelGroup styleClass="clearing" />
+ <ice:panelGroup style="margin-left:5px;" scrollHeight="450px;">
+ <pc:genericDataTable title="" bean="#{prefManagerBean}"
+ id="prefManagerList" table="#{prefManagerBean.prefManagerTable}"
+ sortSupported="true"
+ toolbarUrl="/plugins/admin-portal/views/prefManagerViewToolbar.xhtml" />
+ </ice:panelGroup>
+
+ </ice:panelGroup>
+</f:view> \ No newline at end of file
diff --git a/admin-portal/src/main/resources/admin-portal-messages.properties b/admin-portal/src/main/resources/admin-portal-messages.properties
index b4ef60f..2565be5 100644
--- a/admin-portal/src/main/resources/admin-portal-messages.properties
+++ b/admin-portal/src/main/resources/admin-portal-messages.properties
@@ -636,3 +636,22 @@ views.qaManagementView.toolbar.restoreQA.title = Clear/Use Model Default
views.qaManagementView.departments.label = Departments
views.qaManagementView.department.label = Department
views.qaManagementView.qaError = Enter a whole percentage between 0 and 100, or leave blank to apply the QA % specified in the model.
+
+#Preference Manager View
+views.prefManagerBean.label=Preference Store Manager
+views.prefManagerBean.tenant.label=Search Tenant Preferences
+views.prefManagerBean.user.label=Search User Preferences
+views.prefManagerBean.scope.label=Scope
+views.prefManagerBean.moduleId.label=Module ID
+views.prefManagerBean.preferenceId.label=Preference ID
+views.prefManagerBean.preferenceName.label=Preference Name
+views.prefManagerBean.preferenceValue.label=Value
+views.prefManagerBean.searchPrefStore.label=Search
+views.prefManagerBean.modifyPreference.add.title=Add Preference
+views.prefManagerBean.modifyPreference.edit.title=Edit Preference
+views.prefManagerBean.modifyPreference.tenant.label=Tenant
+views.prefManagerBean.modifyPreference.user.label=User
+views.prefManagerBean.modifyPreference.delete.label=Delete Preference
+views.prefManagerBean.modifyPreference.confirmDelPref.warn=This will delete the selected preference from the preference store.
+views.prefManagerBean.modifyPreference.confirmDelPref.error=Please select preference to delete.
+views.prefManagerBean.modifyPreference.confirmEditPref.error=Please select preference to edit.