From 87e4a98a9efe97963ec9dd35da3fcdf5fa867d0a Mon Sep 17 00:00:00 2001
From: "Barbara B. Frosik" <bfrosik@aps.anl.gov>
Date: Thu, 12 Feb 2015 19:23:17 +0000
Subject: [PATCH]

---
 .../AllowedPolicyValueController.java         | 173 ++++++++++++++++++
 .../controllers/ExperimentController.java     |  10 +-
 .../ExperimentPolicyController.java           | 133 ++++++++++++++
 .../controllers/PolicyTypeController.java     | 133 ++++++++++++++
 .../model/beans/AllowedPolicyValueFacade.java |  32 ++++
 .../model/beans/ExperimentPolicyFacade.java   |  13 ++
 .../portal/model/beans/PolicyTypeFacade.java  |  21 +++
 .../model/entities/AllowedPolicyValue.java    |  12 +-
 .../DmWebPortal/web/WEB-INF/faces-config.xml  |   4 +-
 .../web/templates/dmViewTemplate.xhtml        |   2 +-
 .../experiment/experimentEditPanelGrid.xhtml  |  15 +-
 .../web/views/experiment/view.xhtml           |   8 +-
 .../experimentTypeCreatePanelGrid.xhtml       |   5 +-
 .../allowedPolicyValueCreatePanelGrid.xhtml   |  26 +++
 .../allowedPolicyValueDestroyDialog.xhtml     |  15 ++
 .../allowedPolicyValueEditPanelGrid.xhtml     |  25 +++
 .../allowedPolicyValueListDataTable.xhtml     |  59 ++++++
 .../allowedPolicyValueViewPanelGrid.xhtml     |  25 +++
 .../roleType/createAllowedPolicyValue.xhtml   |  33 ++++
 .../DmWebPortal/web/views/roleType/edit.xhtml |  42 +++--
 .../roleType/editAllowedPolicyValue.xhtml     |  35 ++++
 .../DmWebPortal/web/views/roleType/list.xhtml |   8 +-
 .../roleType/policyTypeEditPanelGrid.xhtml    |  19 ++
 .../roleType/policyTypeListDataTable.xhtml    |  44 +++++
 .../roleType/policyTypeViewPanelGrid.xhtml    |  20 ++
 .../roleType/viewAllowedPolicyValue.xhtml     |  43 +++++
 .../DmWebPortal/web/views/userInfo/edit.xhtml |   2 +-
 .../userExperimentsListDataTable.xhtml        |   2 +-
 28 files changed, 913 insertions(+), 46 deletions(-)
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/AllowedPolicyValueController.java
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentPolicyController.java
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/PolicyTypeController.java
 create mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueDestroyDialog.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueEditPanelGrid.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueListDataTable.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueViewPanelGrid.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/createAllowedPolicyValue.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/editAllowedPolicyValue.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/policyTypeEditPanelGrid.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/policyTypeListDataTable.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/policyTypeViewPanelGrid.xhtml
 create mode 100644 src/java/DmWebPortal/web/views/roleType/viewAllowedPolicyValue.xhtml

diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/AllowedPolicyValueController.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/AllowedPolicyValueController.java
new file mode 100644
index 00000000..703b87f4
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/AllowedPolicyValueController.java
@@ -0,0 +1,173 @@
+package gov.anl.aps.dm.portal.controllers;
+
+import gov.anl.aps.dm.portal.exceptions.DmPortalException;
+import gov.anl.aps.dm.portal.exceptions.MissingProperty;
+import gov.anl.aps.dm.portal.exceptions.ObjectAlreadyExists;
+import gov.anl.aps.dm.portal.model.entities.AllowedPolicyValue;
+import gov.anl.aps.dm.portal.model.beans.AllowedPolicyValueFacade;
+import gov.anl.aps.dm.portal.model.entities.PolicyType;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.inject.Named;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+import org.apache.log4j.Logger;
+
+@Named("allowedPolicyValueController")
+@SessionScoped
+public class AllowedPolicyValueController extends CrudEntityController<AllowedPolicyValue, AllowedPolicyValueFacade>
+{
+
+    private PolicyType policyType;
+
+    private static final Logger logger = Logger.getLogger(AllowedPolicyValueController.class.getName());
+
+    @EJB
+    private AllowedPolicyValueFacade allowedPolicyValueFacade;
+
+    public AllowedPolicyValueController() {
+    }
+
+    public PolicyType getPolicyType() {
+        return policyType;
+    }
+
+    public void setPolicyType(PolicyType policyType) {
+        this.policyType = policyType;
+        clear();
+    }
+
+    @Override
+    protected AllowedPolicyValueFacade getFacade() {
+        return allowedPolicyValueFacade;
+    }
+
+    @Override
+    protected AllowedPolicyValue createEntityInstance() {
+        return new AllowedPolicyValue();
+    }
+
+    @Override
+    public String getEntityTypeName() {
+        return "allowedPolicyValue";
+    }
+
+    @Override
+    public String getCurrentEntityInstanceName() {
+        if (getCurrent() != null) {
+            return getCurrent().getName();
+        }
+        return "";
+    }
+
+    @Override
+    public String prepareEdit(AllowedPolicyValue allowedPolicyValue) {
+        super.resetListDataModel();
+        super.prepareEdit(allowedPolicyValue);
+        return "editAllowedPolicyValue?faces-redirect=true";
+
+    }
+
+    @Override
+    public void prepareEntityInsert(AllowedPolicyValue allowedPolicyValue) throws ObjectAlreadyExists, MissingProperty {
+        if ((allowedPolicyValue.getName() == null) || (allowedPolicyValue.getName().length() == 0)) {
+            throw new MissingProperty("Name is missing.");
+        }
+        AllowedPolicyValue existingAllowedPolicyValue = allowedPolicyValueFacade.findByName(allowedPolicyValue.getName());
+        if (existingAllowedPolicyValue != null) {
+            throw new ObjectAlreadyExists("Experiment type " + allowedPolicyValue.getName() + " already exists.");
+        }
+        logger.debug("Inserting new experiment type " + allowedPolicyValue.getName());
+    }
+
+    @Override
+    public void prepareEntityUpdate(AllowedPolicyValue allowedPolicyValue) throws DmPortalException {
+        if ((allowedPolicyValue.getName() == null) || (allowedPolicyValue.getName().length() == 0)) {
+            throw new MissingProperty("Name is missing.");
+        }
+    }
+    
+      @Override
+     protected String getObjectAlreadyExistMessage(AllowedPolicyValue allowedPolicyValue)  {
+        if (allowedPolicyValue == null) {
+            return null;
+        }
+        return "Experiment Policy " + allowedPolicyValue.getName() + " already exists."; 
+    }
+
+     @Override
+    public DataModel createListDataModel() {
+        return new ListDataModel((List) allowedPolicyValueFacade.findByPolicyType(policyType.getId()));
+    }
+
+    @Override
+    public List<AllowedPolicyValue> getAvailableItems() {
+        return (List<AllowedPolicyValue>) allowedPolicyValueFacade.findByPolicyType(policyType.getId());
+    }
+    
+    @Override
+     public String prepareView(AllowedPolicyValue entity) {
+        clear();
+        current = entity;
+        return "viewAllowedPolicyValue?faces-redirect=true";
+    }
+     
+    @Override
+    public String prepareCreate() {
+        current = createEntityInstance();
+        current.setPolicyType(policyType);
+        return "createAllowedPolicyValue?faces-redirect=true";
+    }
+     @Override
+     public void clear() {
+         super.resetListDataModel();
+     }
+   
+    @FacesConverter(forClass = AllowedPolicyValue.class)
+    public static class AllowedPolicyValueControllerConverter implements Converter
+    {
+
+        @Override
+        public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
+            if (value == null || value.length() == 0) {
+                return null;
+            }
+            AllowedPolicyValueController controller = (AllowedPolicyValueController) facesContext.getApplication().getELResolver().
+                    getValue(facesContext.getELContext(), null, "allowedPolicyValueController");
+            return controller.getEntity(getKey(value));
+        }
+
+        java.lang.Integer getKey(String value) {
+            java.lang.Integer key;
+            key = Integer.valueOf(value);
+            return key;
+        }
+
+        String getStringKey(java.lang.Integer value) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(value);
+            return sb.toString();
+        }
+
+        @Override
+        public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
+            if (object == null) {
+                return null;
+            }
+            if (object instanceof AllowedPolicyValue) {
+                AllowedPolicyValue o = (AllowedPolicyValue) object;
+                return getStringKey(o.getId());
+            }
+            else {
+                throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + AllowedPolicyValue.class.getName());
+            }
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentController.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentController.java
index e153e8f9..6571b84b 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentController.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentController.java
@@ -438,11 +438,11 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
     public boolean isRestricted() {
         if (current == null) {
             return true;
-        } 
-            int managerRoleId = experimentRoles.get(RoleTypeName.MANAGER).getId();
-            int piRoleId = experimentRoles.get(RoleTypeName.PI).getId();
-            UserInfo logged = (UserInfo) SessionUtility.getUser();
-            return (logged.getExperimetRole(managerRoleId, current.getId()) == null) && (logged.getExperimetRole(piRoleId, current.getId()) == null);
+        }
+        int managerRoleId = experimentRoles.get(RoleTypeName.MANAGER).getId();
+        int piRoleId = experimentRoles.get(RoleTypeName.PI).getId();
+        UserInfo logged = (UserInfo) SessionUtility.getUser();
+        return (logged.getExperimetRole(managerRoleId, current.getId()) == null) && (logged.getExperimetRole(piRoleId, current.getId()) == null);
     }
     
     public boolean canDeleteExperiment(int experimentId) {
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentPolicyController.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentPolicyController.java
new file mode 100644
index 00000000..b6ceaf8f
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/ExperimentPolicyController.java
@@ -0,0 +1,133 @@
+package gov.anl.aps.dm.portal.controllers;
+
+import gov.anl.aps.dm.portal.exceptions.DmPortalException;
+import gov.anl.aps.dm.portal.exceptions.MissingProperty;
+import gov.anl.aps.dm.portal.exceptions.ObjectAlreadyExists;
+import gov.anl.aps.dm.portal.model.entities.ExperimentPolicy;
+import gov.anl.aps.dm.portal.model.beans.ExperimentPolicyFacade;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.inject.Named;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import org.apache.log4j.Logger;
+
+@Named("experimentPolicyController")
+@SessionScoped
+public class ExperimentPolicyController extends CrudEntityController<ExperimentPolicy, ExperimentPolicyFacade>
+{
+
+    private static final Logger logger = Logger.getLogger(ExperimentPolicyController.class.getName());
+
+    @EJB
+    private ExperimentPolicyFacade experimentPolicyFacade;
+
+    public ExperimentPolicyController() {
+    }
+
+    @Override
+    protected ExperimentPolicyFacade getFacade() {
+        return experimentPolicyFacade;
+    }
+
+    @Override
+    protected ExperimentPolicy createEntityInstance() {
+        return new ExperimentPolicy();
+    }
+
+    @Override
+    public String getEntityTypeName() {
+        return "experimentPolicy";
+    }
+
+    @Override
+    public String getCurrentEntityInstanceName() {
+        if (getCurrent() != null) {
+            return getCurrent().getPolicyValue();
+        }
+        return "";
+    }
+
+    @Override
+    public List<ExperimentPolicy> getAvailableItems() {
+        return super.getAvailableItems();
+    }
+
+    @Override
+    public String prepareEdit(ExperimentPolicy experimentPolicy) {
+        return super.prepareEdit(experimentPolicy);
+    }
+
+    @Override
+    public void prepareEntityInsert(ExperimentPolicy experimentPolicy) throws ObjectAlreadyExists, MissingProperty {
+        if ((experimentPolicy.getPolicyValue() == null) || (experimentPolicy.getPolicyValue().length() == 0)) {
+            throw new MissingProperty("Name is missing.");
+        }
+        ExperimentPolicy existingExperimentPolicy = experimentPolicyFacade.findByName(experimentPolicy.getPolicyValue());
+        if (existingExperimentPolicy != null) {
+            throw new ObjectAlreadyExists("Experiment type " + experimentPolicy.getPolicyValue() + " already exists.");
+        }
+        logger.debug("Inserting new experiment type " + experimentPolicy.getPolicyValue());
+    }
+
+    @Override
+    public void prepareEntityUpdate(ExperimentPolicy experimentPolicy) throws DmPortalException {
+        if ((experimentPolicy.getPolicyValue() == null) || (experimentPolicy.getPolicyValue().length() == 0)) {
+            throw new MissingProperty("Name is missing.");
+        }
+    }
+    
+      @Override
+     protected String getObjectAlreadyExistMessage(ExperimentPolicy experimentPolicy)  {
+        if (experimentPolicy == null) {
+            return null;
+        }
+        return "Experiment Policy " + experimentPolicy.getPolicyValue() + " already exists."; 
+    }
+
+    @FacesConverter(forClass = ExperimentPolicy.class)
+    public static class ExperimentPolicyControllerConverter implements Converter
+    {
+
+        @Override
+        public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
+            if (value == null || value.length() == 0) {
+                return null;
+            }
+            ExperimentPolicyController controller = (ExperimentPolicyController) facesContext.getApplication().getELResolver().
+                    getValue(facesContext.getELContext(), null, "experimentPolicyController");
+            return controller.getEntity(getKey(value));
+        }
+
+        java.lang.Integer getKey(String value) {
+            java.lang.Integer key;
+            key = Integer.valueOf(value);
+            return key;
+        }
+
+        String getStringKey(java.lang.Integer value) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(value);
+            return sb.toString();
+        }
+
+        @Override
+        public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
+            if (object == null) {
+                return null;
+            }
+            if (object instanceof ExperimentPolicy) {
+                ExperimentPolicy o = (ExperimentPolicy) object;
+                return getStringKey(o.getId());
+            }
+            else {
+                throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + ExperimentPolicy.class.getName());
+            }
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/PolicyTypeController.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/PolicyTypeController.java
new file mode 100644
index 00000000..d29170cd
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/controllers/PolicyTypeController.java
@@ -0,0 +1,133 @@
+package gov.anl.aps.dm.portal.controllers;
+
+import gov.anl.aps.dm.portal.exceptions.DmPortalException;
+import gov.anl.aps.dm.portal.exceptions.MissingProperty;
+import gov.anl.aps.dm.portal.exceptions.ObjectAlreadyExists;
+import gov.anl.aps.dm.portal.model.entities.PolicyType;
+import gov.anl.aps.dm.portal.model.beans.PolicyTypeFacade;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.inject.Named;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import org.apache.log4j.Logger;
+
+@Named("policyTypeController")
+@SessionScoped
+public class PolicyTypeController extends CrudEntityController<PolicyType, PolicyTypeFacade>
+{
+
+    private static final Logger logger = Logger.getLogger(PolicyTypeController.class.getName());
+
+    @EJB
+    private PolicyTypeFacade policyTypeFacade;
+
+    public PolicyTypeController() {
+    }
+
+    @Override
+    protected PolicyTypeFacade getFacade() {
+        return policyTypeFacade;
+    }
+
+    @Override
+    protected PolicyType createEntityInstance() {
+        return new PolicyType();
+    }
+
+    @Override
+    public String getEntityTypeName() {
+        return "policyType";
+    }
+
+    @Override
+    public String getCurrentEntityInstanceName() {
+        if (getCurrent() != null) {
+            return getCurrent().getName();
+        }
+        return "";
+    }
+
+    @Override
+    public List<PolicyType> getAvailableItems() {
+        return super.getAvailableItems();
+    }
+
+    @Override
+    public String prepareEdit(PolicyType policyType) {
+        return super.prepareEdit(policyType);
+    }
+
+    @Override
+    public void prepareEntityInsert(PolicyType policyType) throws ObjectAlreadyExists, MissingProperty {
+        if ((policyType.getName() == null) || (policyType.getName().length() == 0)) {
+            throw new MissingProperty("Name is missing.");
+        }
+        PolicyType existingPolicyType = policyTypeFacade.findByName(policyType.getName());
+        if (existingPolicyType != null) {
+            throw new ObjectAlreadyExists("Experiment type " + policyType.getName() + " already exists.");
+        }
+        logger.debug("Inserting new experiment type " + policyType.getName());
+    }
+
+    @Override
+    public void prepareEntityUpdate(PolicyType policyType) throws DmPortalException {
+        if ((policyType.getName() == null) || (policyType.getName().length() == 0)) {
+            throw new MissingProperty("Name is missing.");
+        }
+    }
+    
+      @Override
+     protected String getObjectAlreadyExistMessage(PolicyType policyType)  {
+        if (policyType == null) {
+            return null;
+        }
+        return "Experiment Policy " + policyType.getName() + " already exists."; 
+    }
+
+    @FacesConverter(forClass = PolicyType.class)
+    public static class PolicyTypeControllerConverter implements Converter
+    {
+
+        @Override
+        public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
+            if (value == null || value.length() == 0) {
+                return null;
+            }
+            PolicyTypeController controller = (PolicyTypeController) facesContext.getApplication().getELResolver().
+                    getValue(facesContext.getELContext(), null, "policyTypeController");
+            return controller.getEntity(getKey(value));
+        }
+
+        java.lang.Integer getKey(String value) {
+            java.lang.Integer key;
+            key = Integer.valueOf(value);
+            return key;
+        }
+
+        String getStringKey(java.lang.Integer value) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(value);
+            return sb.toString();
+        }
+
+        @Override
+        public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
+            if (object == null) {
+                return null;
+            }
+            if (object instanceof PolicyType) {
+                PolicyType o = (PolicyType) object;
+                return getStringKey(o.getId());
+            }
+            else {
+                throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + PolicyType.class.getName());
+            }
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/AllowedPolicyValueFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/AllowedPolicyValueFacade.java
index a5b38cda..7fcf8f54 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/AllowedPolicyValueFacade.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/AllowedPolicyValueFacade.java
@@ -7,8 +7,10 @@
 package gov.anl.aps.dm.portal.model.beans;
 
 import gov.anl.aps.dm.portal.model.entities.AllowedPolicyValue;
+import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
 import javax.persistence.PersistenceContext;
 
 /**
@@ -30,4 +32,34 @@ public class AllowedPolicyValueFacade extends AbstractFacade<AllowedPolicyValue>
         super(AllowedPolicyValue.class);
     }
     
+    public AllowedPolicyValue findByName(String name) {
+        try {
+            return (AllowedPolicyValue) em.createNamedQuery("AllowedPolicyValue.findByPolicyValue")
+                    .setParameter("policyValue", name)
+                    .getSingleResult();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+
+    public AllowedPolicyValue findById(int id) {
+        try {
+            return (AllowedPolicyValue) em.createNamedQuery("AllowedPolicyValue.findById")
+                    .setParameter("id", id)
+                    .getSingleResult();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+
+    public List<AllowedPolicyValue> findByPolicyType(int id) {
+        try {
+            return (List<AllowedPolicyValue>) em.createNamedQuery("AllowedPolicyValue.findByPolicyTypeId")
+                    .setParameter("policyTypeId", id)
+                    .getResultList();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+
 }
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyFacade.java
index 5b8246e7..8948a0a0 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyFacade.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyFacade.java
@@ -7,8 +7,10 @@
 package gov.anl.aps.dm.portal.model.beans;
 
 import gov.anl.aps.dm.portal.model.entities.ExperimentPolicy;
+import gov.anl.aps.dm.portal.model.entities.ExperimentType;
 import javax.ejb.Stateless;
 import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
 import javax.persistence.PersistenceContext;
 
 /**
@@ -30,4 +32,15 @@ public class ExperimentPolicyFacade extends AbstractFacade<ExperimentPolicy>
         super(ExperimentPolicy.class);
     }
     
+    public ExperimentPolicy findByName(String name) {
+        try {
+            return (ExperimentPolicy) em.createNamedQuery("ExperimentPolicy.findByPolicyValue")
+                    .setParameter("policyValue", name)
+                    .getSingleResult();
+        }
+        catch (NoResultException ex) {
+        }
+        return null;
+    }
+        
 }
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyTypeFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyTypeFacade.java
index 31d5fac4..05668708 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyTypeFacade.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyTypeFacade.java
@@ -9,6 +9,7 @@ package gov.anl.aps.dm.portal.model.beans;
 import gov.anl.aps.dm.portal.model.entities.PolicyType;
 import javax.ejb.Stateless;
 import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
 import javax.persistence.PersistenceContext;
 
 /**
@@ -30,4 +31,24 @@ public class PolicyTypeFacade extends AbstractFacade<PolicyType>
         super(PolicyType.class);
     }
     
+    public PolicyType findByName(String name) {
+        try {
+            return (PolicyType) em.createNamedQuery("PolicyType.findByName")
+                    .setParameter("name", name)
+                    .getSingleResult();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+
+    public PolicyType findById(int id) {
+        try {
+            return (PolicyType) em.createNamedQuery("PolicyType.findById")
+                    .setParameter("id", id)
+                    .getSingleResult();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+    
 }
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/AllowedPolicyValue.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/AllowedPolicyValue.java
index 2a09843f..06f757a8 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/AllowedPolicyValue.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/AllowedPolicyValue.java
@@ -31,7 +31,9 @@ import javax.xml.bind.annotation.XmlRootElement;
     @NamedQuery(name = "AllowedPolicyValue.findAll", query = "SELECT a FROM AllowedPolicyValue a"),
     @NamedQuery(name = "AllowedPolicyValue.findById", query = "SELECT a FROM AllowedPolicyValue a WHERE a.id = :id"),
     @NamedQuery(name = "AllowedPolicyValue.findByPolicyValue", query = "SELECT a FROM AllowedPolicyValue a WHERE a.policyValue = :policyValue"),
-    @NamedQuery(name = "AllowedPolicyValue.findByDescription", query = "SELECT a FROM AllowedPolicyValue a WHERE a.description = :description")})
+    @NamedQuery(name = "AllowedPolicyValue.findByDescription", query = "SELECT a FROM AllowedPolicyValue a WHERE a.description = :description"),
+    @NamedQuery(name = "AllowedPolicyValue.findByPolicyTypeId", query = "SELECT a FROM AllowedPolicyValue a WHERE a.policyType.id = :policyTypeId")})
+                                                           
 public class AllowedPolicyValue extends CloneableEntity
 {
     @Id
@@ -72,6 +74,14 @@ public class AllowedPolicyValue extends CloneableEntity
         this.policyValue = policyValue;
     }
 
+    public String getName() {
+        return policyValue;
+    }
+
+    public void setName(String policyValue) {
+        this.policyValue = policyValue;
+    }
+
     public String getDescription() {
         return description;
     }
diff --git a/src/java/DmWebPortal/web/WEB-INF/faces-config.xml b/src/java/DmWebPortal/web/WEB-INF/faces-config.xml
index 9a85cb2b..a259547c 100644
--- a/src/java/DmWebPortal/web/WEB-INF/faces-config.xml
+++ b/src/java/DmWebPortal/web/WEB-INF/faces-config.xml
@@ -9,8 +9,8 @@
             <var>resources</var>
         </resource-bundle>
     </application>
-<validator>
+<!--<validator>
     <validator-id>checkboxValidator</validator-id>
     <validator-class>gov.anl.aps.dm.portal.controllers.CheckboxValidator</validator-class>
-</validator>
+</validator>-->
 </faces-config>
diff --git a/src/java/DmWebPortal/web/templates/dmViewTemplate.xhtml b/src/java/DmWebPortal/web/templates/dmViewTemplate.xhtml
index bd06b4df..19764018 100644
--- a/src/java/DmWebPortal/web/templates/dmViewTemplate.xhtml
+++ b/src/java/DmWebPortal/web/templates/dmViewTemplate.xhtml
@@ -58,7 +58,7 @@
                                     <p:menuitem value="Experiments" url="/views/experiment/list.xhtml"/> 
                                     <p:menuitem value="Users" url="/views/userInfo/list.xhtml"/>
                                     <p:menuitem value="Experiment Types" url="/views/experimentType/list.xhtml"/>
-                                    <p:menuitem value="Role Types" url="/views/roleType/list.xhtml"/>
+                                    <p:menuitem value="Policies" url="/views/policyType/list.xhtml"/>                                    <p:menuitem value="Role Types" url="/views/roleType/list.xhtml"/>
                                     <p:menuitem value="Login" onclick="PF('loginDialog').show();" rendered="#{!loginController.loggedIn}" icon="ui-icon-person"/>
                                     <p:menuitem value="Logout" action="#{loginController.logout()}" rendered="#{loginController.loggedIn}" icon="ui-icon-close"/>                                </p:menubar>
                             </h:form>
diff --git a/src/java/DmWebPortal/web/views/experiment/experimentEditPanelGrid.xhtml b/src/java/DmWebPortal/web/views/experiment/experimentEditPanelGrid.xhtml
index 47a54382..6224cf4c 100644
--- a/src/java/DmWebPortal/web/views/experiment/experimentEditPanelGrid.xhtml
+++ b/src/java/DmWebPortal/web/views/experiment/experimentEditPanelGrid.xhtml
@@ -3,26 +3,17 @@
 <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:p="http://primefaces.org/ui"
-                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-                xmlns:f="http://xmlns.jcp.org/jsf/core">
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 
     <ui:param name="experimentObject" value="#{experimentController.current}"/>
-    <ui:param name="isFieldWriteable" value="#{loginController.loggedIn}"/>
 
     <p:panelGrid columns="2" > 
 
         <h:outputLabel for="name" value="Name" styleClass="entityDataEmphasizedLabel"/>
         <h:outputText id="name" value="#{experimentObject.name}" title="Name" styleClass="entityDataEmphasizedText"/>
 
-        <h:outputLabel for="experimentType" value="Experiment Type" styleClass="entityDataLabel"/>
-        <p:selectOneMenu id="experimentType" value="#{experimentObject.experimentType}" styleClass="entityDataText">
-            <f:selectItem itemLabel="Select Type" itemValue="" noSelectionOption="true" />
-            <f:selectItems value="#{experimentTypeController.getAvailableItems()}" 
-                           var="experimentType"
-                           itemValue="#{experimentType}"
-                           itemLabel="#{experimentType.name}"
-                           itemDescription="#{experimentType.description}"/>
-        </p:selectOneMenu>
+        <h:outputLabel for="experimentType" value="Type" styleClass="entityDataLabel"/>
+        <h:outputText id="experimentType" value="#{experimentObject.experimentType.name}" title="Name" styleClass="entityDataText"/>
 
         <h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
         <h:inputText id="description" value="#{experimentObject.description}" title="Description" styleClass="entityDataText"/>  
diff --git a/src/java/DmWebPortal/web/views/experiment/view.xhtml b/src/java/DmWebPortal/web/views/experiment/view.xhtml
index 50570664..809a8466 100644
--- a/src/java/DmWebPortal/web/views/experiment/view.xhtml
+++ b/src/java/DmWebPortal/web/views/experiment/view.xhtml
@@ -16,13 +16,17 @@
             </div>
 
             <ui:param name="experimentObject" value="#{experimentController.current}"/>
-            <p:accordionPanel multiple="true" activeIndex="0,1" >
+            <p:accordionPanel multiple="true" activeIndex="0,1,2" >
                 <p:tab title="Experiment Properties">
                     <div class="middleCenterLeftContent">
                         <ui:include src="experimentViewPanelGrid.xhtml"/>
                     </div>
                 </p:tab>
-
+                
+<!--                <p:tab title="Experiment Policies">
+                    <ui:include src="experimentPoliciesViewPanelGrid.xhtml"/>
+                </p:tab>
+-->
                 <p:tab title="Experiment Users">                
                     <ui:include src="experimentUsersListDataTable.xhtml"/>
                 </p:tab>
diff --git a/src/java/DmWebPortal/web/views/experimentType/experimentTypeCreatePanelGrid.xhtml b/src/java/DmWebPortal/web/views/experimentType/experimentTypeCreatePanelGrid.xhtml
index 7e312a82..0dbfd762 100644
--- a/src/java/DmWebPortal/web/views/experimentType/experimentTypeCreatePanelGrid.xhtml
+++ b/src/java/DmWebPortal/web/views/experimentType/experimentTypeCreatePanelGrid.xhtml
@@ -3,10 +3,9 @@
 <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:p="http://primefaces.org/ui"
-                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
 
-    <c:set var="experimentTypeObject" value="#{experimentTypeController.selected}"/>
+    <ui:param name="experimentTypeObject" value="#{experimentTypeController.selected}"/>
 
     <p:panelGrid columns="2" styleClass="createEntityDetails">
 
diff --git a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml
new file mode 100644
index 00000000..360fc7fb
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+
+    <c:set var="allowedPolicyValueObject" value="#{allowedPolicyValueController.selected}"/>
+
+    <p:panelGrid columns="2" styleClass="createEntityDetails">
+
+        <h:outputLabel for="policyValue" value="Policy Value" styleClass="entityDataEmphasizedLabel"/>
+        <h:inputText id="policyValue" value="#{allowedPolicyValueObject.policyValue}" title="Policy Value" styleClass="entityDataEmphasizedText"/> 
+
+        <h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
+        <h:inputText id="description" value="#{allowedPolicyValueObject.description}" title="Description" styleClass="entityDataText"/>        
+
+        <h:outputLabel for="policyType" value="Policy Type" styleClass="entityDataLabel"/>
+        <h:outputText id="policyType" value="#{allowedPolicyValueController.policyType.name}" title="Policy Type" styleClass="entityDataText"/>
+
+    </p:panelGrid>
+
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueDestroyDialog.xhtml b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueDestroyDialog.xhtml
new file mode 100644
index 00000000..c1c3a996
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueDestroyDialog.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+    <p:confirmDialog id="allowedPolicyValueDestroyDialog" message="Delete experiment type #{allowedPolicyValueController.getCurrentEntityInstanceName()}?"
+                     header="Delete Allowed Policy Value" severity="alert" widgetVar="allowedPolicyValueDestroyDialogWidget"
+                     styleClass="dialog">
+        <p:commandButton value="Yes" oncomplete="allowedPolicyValueDestroyDialogWidget.hide()" action="#{policyTypeController.prepareView(allowedPolicyValueController.policyType)}" actionListener="#{allowedPolicyValueController.destroy()}"/>
+        <p:commandButton value="No" onclick="PF('allowedPolicyValueDestroyDialogWidget').hide()" type="button" />
+    </p:confirmDialog>  
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueEditPanelGrid.xhtml b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueEditPanelGrid.xhtml
new file mode 100644
index 00000000..4051206d
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueEditPanelGrid.xhtml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:f="http://xmlns.jcp.org/jsf/core">
+
+    <ui:param name="allowedPolicyValueObject" value="#{allowedPolicyValueController.current}"/>
+
+    <p:panelGrid columns="2" styleClass="editEntityDetails"> 
+
+        <h:outputLabel for="policyValue" value="Policy Value" styleClass="entityDataEmphasizedLabel"/>
+        <h:inputText id="policyValue" value="#{allowedPolicyValueObject.policyValue}" title="Policy Value" styleClass="entityDataEmphasizedText"/> 
+
+        <h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
+        <h:inputText id="description" value="#{allowedPolicyValueObject.description}" title="Description" styleClass="entityDataText"/>        
+
+        <h:outputLabel for="policyType" value="Policy Type" styleClass="entityDataLabel"/>
+        <h:outputText id="policyType" value="#{allowedPolicyValueController.policyType.name}" title="Policy Type" styleClass="entityDataText"/>
+       
+    </p:panelGrid>
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueListDataTable.xhtml b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueListDataTable.xhtml
new file mode 100644
index 00000000..56199da4
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueListDataTable.xhtml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+
+       <div class="actionButton">
+        <p:commandButton id="AllowedPolicyValueAddButton" action="#{allowedPolicyValueController.prepareCreate()}" rendered="#{loginController.admin}" value="Add" alt="Add new AllowedPolicyValue" icon="ui-icon-plus">
+            <p:tooltip for="AllowedPolicyValueAddButton" value="Create new AllowedPolicyValue."/>
+        </p:commandButton>
+        
+        <p:commandButton id="AllowedPolicyValueResetFiltersButton" action="#{policyTypeController.prepareView(allowedPolicyValueController.policyType)}"  actionListener="#{allowedPolicyValueController.resetList()}" alt="Clear Filters" icon="ui-icon-refresh" styleClass="actionButtonRight">
+            <p:tooltip for="AllowedPolicyValueResetFiltersButton" value="Reset list filters."/>
+        </p:commandButton>
+
+        <p:commandButton id="AllowedPolicyValueNoOp" style="visibility:hidden" value="NoOp"/>
+        <p:defaultCommand target="AllowedPolicyValueNoOp"/>
+    </div>
+                
+    <p:dataTable id="allowedPolicyValueListDataTable"                              
+                 var="allowedPolicyValueObject" 
+                 value="#{allowedPolicyValueController.listDataModel}" 
+                 filteredValue="#{allowedPolicyValueController.filteredObjectList}"
+                 paginator="true" 
+                 paginatorAlwaysVisible="false" 
+                 rows="25"
+                 binding="#{allowedPolicyValueController.listDataTable}"
+                 widgetVar="allowedPolicyValueListWidget" 
+                 emptyMessage="No experiment types found.">
+
+        <p:column sortBy="#{allowedPolicyValueObject.id}" headerText="Id" >
+            <h:outputText value="#{allowedPolicyValueObject.id}"/>
+        </p:column>
+
+        <p:column sortBy="#{allowedPolicyValueObject.policyValue}" headerText="Allowed Policy Value" 
+                  filterBy="#{allowedPolicyValueObject.policyValue}" filterMatchMode="contains" >
+            <h:outputText value="#{allowedPolicyValueObject.policyValue}"/>
+        </p:column>
+
+        <p:column sortBy="#{allowedPolicyValueObject.description}" headerText="Description" 
+                  filterBy="#{allowedPolicyValueObject.description}" filterMatchMode="contains">
+            <h:outputText value="#{allowedPolicyValueObject.description}"/>
+        </p:column>
+
+        <p:column headerText="Actions" >
+            <div class="actionLink">
+                <h:commandLink  action="#{allowedPolicyValueController.prepareView(allowedPolicyValueObject)}" styleClass="ui-icon ui-icon-info" title="View"/>
+                <h:commandLink action="#{allowedPolicyValueController.prepareEdit(allowedPolicyValueObject)}" rendered="#{loginController.admin}" styleClass="ui-icon ui-icon-pencil" title="Edit"/>
+                <p:commandLink oncomplete="PF('allowedPolicyValueDestroyDialogWidget').show()" rendered="#{loginController.admin}" styleClass="ui-icon ui-icon-trash" title="Delete" update="@form">
+                    <f:setPropertyActionListener value="#{allowedPolicyValueObject}" target="#{allowedPolicyValueController.current}"/>
+                </p:commandLink>
+            </div>
+        </p:column>
+    </p:dataTable>
+
+</ui:composition>
diff --git a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueViewPanelGrid.xhtml b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueViewPanelGrid.xhtml
new file mode 100644
index 00000000..b78e4d21
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueViewPanelGrid.xhtml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+    <ui:param name="allowedPolicyValueObject" value="#{allowedPolicyValueController.selected}"/>
+
+    <p:panelGrid columns="2" styleClass="viewEntityDetails">
+
+        <h:outputLabel for="allowedPolicyValue" value="Policy Value" styleClass="entityDataEmphasizedLabel"/>
+        <h:outputText id="allowedPolicyValue" value="#{allowedPolicyValueObject.policyValue}" title="Allowed Policy Value" styleClass="entityDataEmphasizedText"/>
+
+        <h:outputLabel for="policyType" value="Policy Type" styleClass="entityDataLabel"/>
+        <h:outputText id="policyType" value="#{allowedPolicyValueObject.policyType.name}" title="Policy Type" styleClass="entityDataText"/>
+ 
+        <h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
+        <h:outputText id="description" value="#{allowedPolicyValueObject.description}" title="Description" styleClass="entityDataText"/>
+ 
+    </p:panelGrid>
+
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/roleType/createAllowedPolicyValue.xhtml b/src/java/DmWebPortal/web/views/roleType/createAllowedPolicyValue.xhtml
new file mode 100644
index 00000000..3e16ea27
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/createAllowedPolicyValue.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+    
+    <h:outputScript library="js/common" name="forwardNotLoggedin.js" rendered="#{!loginController.loggedIn}"/>
+    <h:outputScript library="js/common" name="forwardNotAuthorized.js" rendered="#{!loginController.admin}"/>
+    <ui:composition template="../../templates/dmViewTemplate.xhtml">
+    <ui:define name="middleCenter">
+        <div class="pageTitle">
+            <h1>Add Allowed Policy Value</h1>
+        </div>
+
+        <h:form id="addAllowedPolicyValueForm">
+
+            <ui:include src="allowedPolicyValueCreatePanelGrid.xhtml"/>
+
+            <p/>
+            <div class="actionButton">
+                <p:commandButton action="#{policyTypeController.prepareView(allowedPolicyValueController.policyType)}" actionListener="#{allowedPolicyValueController.create()}" value="Save" alt="Save" icon="ui-icon-check" update="@form"/>
+                <p:commandButton action="#{policyTypeController.prepareView(allowedPolicyValueController.policyType)}" immediate="true" value="Cancel" alt="Cancel" icon="ui-icon-cancel"/>
+            </div>
+        </h:form>
+
+    </ui:define>
+    </ui:composition>
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/roleType/edit.xhtml b/src/java/DmWebPortal/web/views/roleType/edit.xhtml
index ffb705f4..f266ecd4 100644
--- a/src/java/DmWebPortal/web/views/roleType/edit.xhtml
+++ b/src/java/DmWebPortal/web/views/roleType/edit.xhtml
@@ -10,24 +10,38 @@
     <h:outputScript library="js/common" name="forwardNotLoggedin.js" rendered="#{!loginController.loggedIn}"/>
     <h:outputScript library="js/common" name="forwardNotAuthorized.js" rendered="#{!loginController.admin}"/>
     <ui:composition template="../../templates/dmViewTemplate.xhtml">
-    <ui:define name="middleCenter">
-        <h:form id="editRoleTypeForm">
+        <ui:define name="middleCenter">
+            <h:form id="editPolicyTypeForm">
 
-            <div class="middleCenterLeftContent">
-                <div class="pageTitle">
-                    <h1>Edit Role Type</h1>
-                </div>
+                <div class="middleCenterLeftContent">
+                    <div class="pageTitle">
+                        <h1>Edit #{policyTypeController.current.name} Policy Type</h1>
+                    </div>
+
+
+                    <ui:param name="policyTypeObject" value="#{policyTypeController.selected}"/>
+                    <p:accordionPanel multiple="true" activeIndex="0,1" >
+                        <p:tab title="Policy Type Properties">
+                            <div class="middleCenterLeftContent">
+                                <ui:include src="policyTypeEditPanelGrid.xhtml"/>
+                            </div>
+                        </p:tab>
+
+                        <p:tab title="Allowed Policy Values">                
+                            <ui:include src="allowedPolicyValueListDataTable.xhtml"/>
+                        </p:tab>
+                    </p:accordionPanel>
+
+                    <p/>
 
-                <ui:include src="roleTypeEditPanelGrid.xhtml"/>
-                <p/>
-                <div class="actionButton">
-                    <p:commandButton action="#{roleTypeController.update()}" value="Save" alt="Save" icon="ui-icon-check" update="@form"/>
-                    <p:commandButton action="#{roleTypeController.prepareList()}" immediate="true" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
+                    <div class="actionButton">
+                        <p:commandButton action="#{policyTypeController.update()}" actionListener="#{allowedPolicyValueController.clear()}" value="Save" alt="Save" icon="ui-icon-check" update="@form"/>
+                        <p:commandButton action="#{policyTypeController.prepareList()}" immediate="true" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
+                    </div>
                 </div>
-            </div>
 
-        </h:form>
+            </h:form>
 
-    </ui:define>
+        </ui:define>
     </ui:composition>
 </ui:composition>
diff --git a/src/java/DmWebPortal/web/views/roleType/editAllowedPolicyValue.xhtml b/src/java/DmWebPortal/web/views/roleType/editAllowedPolicyValue.xhtml
new file mode 100644
index 00000000..5dad903e
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/editAllowedPolicyValue.xhtml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+    
+    <h:outputScript library="js/common" name="forwardNotLoggedin.js" rendered="#{!loginController.loggedIn}"/>
+    <h:outputScript library="js/common" name="forwardNotAuthorized.js" rendered="#{!loginController.admin}"/>
+    <ui:composition template="../../templates/dmViewTemplate.xhtml">
+    <ui:define name="middleCenter">
+        <h:form id="editAllowedPolicyValueForm">
+
+            <div class="middleCenterLeftContent">
+                <div class="pageTitle">
+                    <h1>Edit Policy</h1>
+                </div>
+
+                <ui:include src="allowedPolicyValueEditPanelGrid.xhtml"/>
+                <p/>
+                <div class="actionButton">
+                    <p:commandButton action="#{allowedPolicyValueController.update()}" value="Save" alt="Save" icon="ui-icon-check"/>
+                    <p:commandButton action="#{policyTypeController.prepareView(allowedPolicyValueController.policyType)}" immediate="true" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
+                </div>
+            </div>
+
+        </h:form>
+
+    </ui:define>
+    </ui:composition>
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/roleType/list.xhtml b/src/java/DmWebPortal/web/views/roleType/list.xhtml
index 13a1a205..702c2df5 100644
--- a/src/java/DmWebPortal/web/views/roleType/list.xhtml
+++ b/src/java/DmWebPortal/web/views/roleType/list.xhtml
@@ -11,11 +11,11 @@
     <ui:composition template="../../templates/dmViewTemplate.xhtml">
     <ui:define name="middleCenter">
         <div class="pageTitle">
-            <h1>Role Types</h1>
+            <h1>Policy Types</h1>
         </div>
 
-        <h:form id="viewRoleTypeListForm">
-            <ui:param name="entityController" value="#{roleTypeController}"/>
+        <h:form id="viewEntityTypeListForm">
+            <ui:param name="entityController" value="#{policyTypeController}"/>
 
             <div class="actionButton">
                 <p:commandButton id="#{entityTypeName}ResetFiltersButton" action="#{entityController.resetList()}" alt="Clear Filters" icon="ui-icon-refresh" styleClass="actionButtonRight">
@@ -26,7 +26,7 @@
             </div>
 
             <h:panelGroup>  
-                <ui:include src="roleTypeListDataTable.xhtml"/>
+                <ui:include src="policyTypeListDataTable.xhtml"/>
             </h:panelGroup>
 
         </h:form>
diff --git a/src/java/DmWebPortal/web/views/roleType/policyTypeEditPanelGrid.xhtml b/src/java/DmWebPortal/web/views/roleType/policyTypeEditPanelGrid.xhtml
new file mode 100644
index 00000000..1e2d94e8
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/policyTypeEditPanelGrid.xhtml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+    <ui:param name="policyTypeObject" value="#{policyTypeController.current}"/>
+
+    <p:panelGrid columns="2" styleClass="editEntityDetails"> 
+
+        <h:outputLabel for="name" value="Name" styleClass="entityDataEmphasizedLabel"/>
+        <h:outputText id="name" value="#{policyTypeObject.name}" title="Name" styleClass="entityDataEmphasizedText"/>
+
+        <h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
+        <h:inputText id="description" value="#{policyTypeObject.description}" title="Description" styleClass="entityDataText"/>     
+        
+    </p:panelGrid>
+</ui:composition>
diff --git a/src/java/DmWebPortal/web/views/roleType/policyTypeListDataTable.xhtml b/src/java/DmWebPortal/web/views/roleType/policyTypeListDataTable.xhtml
new file mode 100644
index 00000000..a7ca6c82
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/policyTypeListDataTable.xhtml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+
+    <p:dataTable id="policyTypeListDataTable"                              
+                 var="policyTypeObject" 
+                 value="#{policyTypeController.listDataModel}" 
+                 filteredValue="#{policyTypeController.filteredObjectList}"
+                 paginator="true" 
+                 paginatorAlwaysVisible="false" 
+                 rows="25"
+                 binding="#{policyTypeController.listDataTable}"
+                 widgetVar="policyTypeListWidget" 
+                 emptyMessage="No role types found." >
+
+
+        <p:column sortBy="#{policyTypeObject.id}" headerText="Id" >
+            <h:outputText value="#{policyTypeObject.id}"/>
+        </p:column>
+
+        <p:column sortBy="#{policyTypeObject.name}" headerText="Policy Type" 
+                  filterBy="#{policyTypeObject.name}" filterMatchMode="contains" >
+            <h:outputText value="#{policyTypeObject.name}"/>
+        </p:column>
+
+        <p:column sortBy="#{policyTypeObject.description}" headerText="Description" 
+                  filterBy="#{policyTypeObject.description}" filterMatchMode="contains">
+            <h:outputText value="#{policyTypeObject.description}"/>
+        </p:column>
+
+        <p:column headerText="Actions" >
+            <div class="actionLink">
+                <p:commandLink action="#{policyTypeController.prepareView(policyTypeObject)}" actionListener="#{allowedPolicyValueController.setPolicyType(policyTypeObject)}" styleClass="ui-icon ui-icon-info" title="View"/>
+                <p:commandLink action="#{policyTypeController.prepareEdit(policyTypeObject)}" actionListener="#{allowedPolicyValueController.setPolicyType(policyTypeObject)}" rendered="#{loginController.admin}" styleClass="ui-icon ui-icon-pencil" title="Edit"/>
+            </div>
+        </p:column>
+    </p:dataTable>
+
+</ui:composition>
diff --git a/src/java/DmWebPortal/web/views/roleType/policyTypeViewPanelGrid.xhtml b/src/java/DmWebPortal/web/views/roleType/policyTypeViewPanelGrid.xhtml
new file mode 100644
index 00000000..25855c5c
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/policyTypeViewPanelGrid.xhtml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
+
+    <ui:param name="policyTypeObject" value="#{policyTypeController.current}"/>
+
+    <p:panelGrid columns="2" styleClass="viewEntityDetails">
+
+        <h:outputLabel for="name" value="Name" styleClass="entityDataEmphasizedLabel"/>
+        <h:outputText id="name" value="#{policyTypeObject.name}" title="Name" styleClass="entityDataEmphasizedText"/>
+
+        <h:outputLabel for="description" value="Description" styleClass="entityDataLabel"/>
+        <h:outputText id="description" value="#{policyTypeObject.description}" title="Description" styleClass="entityDataText"/>
+        
+    </p:panelGrid>
+
+</ui:composition>
\ No newline at end of file
diff --git a/src/java/DmWebPortal/web/views/roleType/viewAllowedPolicyValue.xhtml b/src/java/DmWebPortal/web/views/roleType/viewAllowedPolicyValue.xhtml
new file mode 100644
index 00000000..3f440ec7
--- /dev/null
+++ b/src/java/DmWebPortal/web/views/roleType/viewAllowedPolicyValue.xhtml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:h="http://java.sun.com/jsf/html"
+                xmlns:p="http://primefaces.org/ui"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
+
+    <h:outputScript library="js/common" name="forwardNotLoggedin.js" rendered="#{!loginController.loggedIn}"/>
+    <ui:composition template="../../templates/dmViewTemplate.xhtml">
+    <ui:define name="middleCenter">
+        <h:form id="viewAllowedPolicyValueForm">
+
+            <div class="middleCenterLeftContent">
+                <div class="pageTitle">
+                    <h1>Policy Details</h1>
+                </div>
+
+                <ui:include src="allowedPolicyValueViewPanelGrid.xhtml"/>
+
+                <p/>
+                <ui:param name="allowedPolicyValueObject" value="#{allowedPolicyValueController.selected}"/>
+                <div class="actionButton">
+                    <p:commandButton action="#{allowedPolicyValueController.prepareEdit(allowedPolicyValueObject)}" rendered="#{loginController.admin}" value="Edit" alt="Edit" icon="ui-icon-pencil"/>
+                    <p:commandButton onclick="PF('allowedPolicyValueDestroyDialogWidget').show();" rendered="#{loginController.admin}" value="Delete" alt="Delete" icon="ui-icon-trash">
+                        <f:setPropertyActionListener value="#{allowedPolicyValueObject}" target="#{allowedPolicyValueController.current}"/>
+                    </p:commandButton>  
+                    <p:commandButton action="#{policyTypeController.prepareView(allowedPolicyValueController.policyType)}" value="Return" alt="Return" icon="ui-icon-arrowreturnthick-1-w"/>
+                </div>
+
+                <ui:include src="allowedPolicyValueDestroyDialog.xhtml"/>
+
+            </div>
+
+        </h:form>
+
+    </ui:define>
+    </ui:composition>
+
+</ui:composition>
+
+
diff --git a/src/java/DmWebPortal/web/views/userInfo/edit.xhtml b/src/java/DmWebPortal/web/views/userInfo/edit.xhtml
index 99fa500b..51e1c8b1 100644
--- a/src/java/DmWebPortal/web/views/userInfo/edit.xhtml
+++ b/src/java/DmWebPortal/web/views/userInfo/edit.xhtml
@@ -15,7 +15,7 @@
 
             <div class="middleCenterLeftContent">
                 <div class="pageTitle">
-                    <h1>Edit User</h1>
+                    <h1>Edit User #{userInfoController.current.username}</h1>
                 </div>
 
                 <ui:include src="userInfoEditPanelGrid.xhtml"/>
diff --git a/src/java/DmWebPortal/web/views/userInfo/userExperimentsListDataTable.xhtml b/src/java/DmWebPortal/web/views/userInfo/userExperimentsListDataTable.xhtml
index 627f361a..28d5d490 100644
--- a/src/java/DmWebPortal/web/views/userInfo/userExperimentsListDataTable.xhtml
+++ b/src/java/DmWebPortal/web/views/userInfo/userExperimentsListDataTable.xhtml
@@ -19,7 +19,7 @@
                  filteredValue="#{userInfoController.userExperimentsListTable.filteredObjectList}"
                  paginator="true" 
                  paginatorAlwaysVisible="false" 
-                 rows="6"
+                 rows="25"
                  binding="#{userInfoController.userExperimentsListTable.listDataTable}"
                  widgetVar="userExperimentsListWidget" 
                  emptyMessage="No experiments found.">
-- 
GitLab