From 96a710e56dc5f7eff863e8450577b042c2509aa3 Mon Sep 17 00:00:00 2001
From: "Barbara B. Frosik" <bfrosik@aps.anl.gov>
Date: Fri, 13 Feb 2015 15:42:40 +0000
Subject: [PATCH] abc

---
 .../controllers/ExperimentController.java     | 140 +++++++++++++++++-
 .../dm/portal/model/entities/Experiment.java  |  11 +-
 .../web/views/experiment/edit.xhtml           |   4 +
 .../web/views/experiment/view.xhtml           |   6 +-
 .../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 ---
 16 files changed, 170 insertions(+), 342 deletions(-)
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueDestroyDialog.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueEditPanelGrid.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueListDataTable.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/allowedPolicyValueViewPanelGrid.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/createAllowedPolicyValue.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/editAllowedPolicyValue.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/policyTypeEditPanelGrid.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/policyTypeListDataTable.xhtml
 delete mode 100644 src/java/DmWebPortal/web/views/roleType/policyTypeViewPanelGrid.xhtml

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 6571b84b..a39e381a 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
@@ -6,17 +6,23 @@ import gov.anl.aps.dm.portal.exceptions.DmPortalException;
 import gov.anl.aps.dm.portal.exceptions.ObjectAlreadyExists;
 import gov.anl.aps.dm.portal.exceptions.InvalidDate;
 import gov.anl.aps.dm.portal.exceptions.MissingProperty;
+import gov.anl.aps.dm.portal.model.beans.AllowedPolicyValueFacade;
 import gov.anl.aps.dm.portal.model.entities.Experiment;
 import gov.anl.aps.dm.portal.model.beans.ExperimentFacade;
+import gov.anl.aps.dm.portal.model.beans.PolicyTypeFacade;
 import gov.anl.aps.dm.portal.model.beans.RoleTypeFacade;
 import gov.anl.aps.dm.portal.model.beans.UserExperimentRoleFacade;
 import gov.anl.aps.dm.portal.model.beans.UserInfoFacade;
+import gov.anl.aps.dm.portal.model.entities.AllowedPolicyValue;
 import gov.anl.aps.dm.portal.model.entities.CloneableEntity;
+import gov.anl.aps.dm.portal.model.entities.ExperimentPolicy;
+import gov.anl.aps.dm.portal.model.entities.PolicyType;
 import gov.anl.aps.dm.portal.model.entities.RoleType;
 import gov.anl.aps.dm.portal.model.entities.UserExperimentRole;
 import gov.anl.aps.dm.portal.model.entities.UserInfo;
 import gov.anl.aps.dm.portal.utilities.SessionUtility;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -46,9 +52,48 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
     @EJB
     private RoleTypeFacade roleTypeFacade;
     
+    @EJB
+    private PolicyTypeFacade policyTypeFacade;
+    
+    @EJB
+    private AllowedPolicyValueFacade allowedPolicyValueFacade;
+    
     @EJB
     private UserExperimentRoleFacade userExperimentRoleFacade;
     
+    public class ExperimentPolicyType extends CloneableEntity {
+        PolicyType type;
+        private ExperimentPolicy policy;
+        
+        public ExperimentPolicyType(PolicyType type) {
+            this.type= type;
+        }
+
+        public ExperimentPolicy getPolicy() {
+            return policy;
+        }
+
+        public void setPolicy(ExperimentPolicy policy) {
+            this.policy = policy;
+        }
+        
+        public PolicyType getPolicyType() {
+            return type;
+        }
+        
+        public ExperimentPolicy getPolicyValue() {
+            return policy;
+        }
+        
+        public String getPolicyName() {
+            if (policy == null) {
+                return "none";
+            }
+            return policy.getPolicyValue();
+        }
+
+    }
+    
     public class ExperimentUser extends CloneableEntity {
 
         String name;
@@ -125,6 +170,59 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
         }
     }
 
+    class ExperimentPoliciesTable extends DataTableController<ExperimentPolicy> {
+
+        @Override
+        public String getClassName() {
+            return "ExperimentPolicy";
+        }
+
+        @Override
+        public List<ExperimentPolicy> findAll() {
+            return getCurrent().getExperimentPolicyList();
+        }
+        
+        @Override
+        public String getTableName() {
+            return "experimentPoliciesTable";
+        }
+    }
+
+    class ExperimentPoliciesTypeTable extends DataTableController<ExperimentPolicyType> {
+
+        @Override
+        public String getClassName() {
+            return "ExperimentPolicyType";
+        }
+
+        @Override
+        public List<ExperimentPolicyType> findAll() {
+            if (!initialized) {
+                initializeTables();
+            }
+            Collection<PolicyType> list = policies.keySet();
+            return convertExperimentPolicyTypes(list);
+        }
+        
+        List<ExperimentPolicyType> convertExperimentPolicyTypes(Collection<PolicyType> list) {
+            List<ExperimentPolicyType> newList = new ArrayList<>();
+            ExperimentPolicyType experimentPolicyType;
+            ExperimentPolicy policy;
+            for (PolicyType type : list) {
+                experimentPolicyType = new ExperimentPolicyType(type);
+                newList.add(experimentPolicyType);
+                policy = getCurrent().getPolicyForType(type);
+                experimentPolicyType.setPolicy(policy);
+            }
+            return newList;
+        }
+        
+        @Override
+        public String getTableName() {
+            return "experimentPoliciesTable";
+        }
+    }
+
     class ExperimentUsersTable extends DataTableController<ExperimentUser> {
 
         @Override
@@ -140,7 +238,7 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
         
         List<ExperimentUser> convertExperimentUsers(List<UserInfo> list) {
             if (!initialized) {
-                initializeRoleTypes();
+                initializeTables();
             }
             logger.debug("converting ExperimentUser ");
             ExperimentUser experimentUser;
@@ -186,8 +284,12 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
     private ExperimentController.ExperimentUsersTable experimentUsersListTable = new ExperimentController.ExperimentUsersTable();
     private ExperimentController.ExperimentUsersTable experimentUsersEditTable = new ExperimentController.ExperimentUsersTable();
     private ExperimentController.NoExperimentUsersTypeTable noExperimentUsersTypeTable = new ExperimentController.NoExperimentUsersTypeTable();
+    private ExperimentController.ExperimentPoliciesTable experimentPoliciesTable = new ExperimentPoliciesTable();
+    private ExperimentController.ExperimentPoliciesTypeTable experimentPoliciesTypeTable = new ExperimentPoliciesTypeTable();
+
     final private Map<UserInfo, ExperimentUser> experimentUsers = new HashMap<>();
     final private Map<String, RoleType> experimentRoles = new HashMap<>();
+    final private Map<PolicyType, List<AllowedPolicyValue>> policies = new HashMap<>();
     int maxExperimentRoleTypeId = 0;
     boolean initialized = false;
 
@@ -229,12 +331,12 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
     public String prepareEdit(Experiment experiment) {
         clear();
         if (!initialized) {
-            initializeRoleTypes();
+            initializeTables();
         }
         return super.prepareEdit(experiment);
     }
 
-    private void initializeRoleTypes() {
+    private void initializeTables() {
         List<RoleType> roleTypesList = roleTypeFacade.findAll();
         for (RoleType roleType : roleTypesList) {
             if (!roleType.isIsSystemRole()) {
@@ -244,6 +346,13 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
                 }
             }
         }
+        for (PolicyType policyType : policyTypeFacade.findAll()) {
+            List<AllowedPolicyValue> list = new ArrayList<>();
+            for (AllowedPolicyValue allowedPolicyValue : (List<AllowedPolicyValue>) allowedPolicyValueFacade.findByPolicyType(policyType.getId())) {
+                list.add(allowedPolicyValue);
+            }
+            policies.put(policyType, list);
+        }
         initialized = true;
     }
 
@@ -296,6 +405,7 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
         experimentUsersEditTable.resetList();
         experimentUsers.clear();
         noExperimentUsersTypeTable.resetList();
+        experimentPoliciesTable.resetList();
     }
     
     public ExperimentController.ExperimentUsersTable getExperimentUsersListTable() {
@@ -322,6 +432,26 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
         this.noExperimentUsersTypeTable = noExperimentUsersTypeTable;
     }
         
+    public ExperimentPoliciesTable getExperimentPoliciesTable() {
+        return experimentPoliciesTable;
+    }
+
+    public void setExperimentPoliciesTable(ExperimentPoliciesTable experimentPoliciesTable) {
+        this.experimentPoliciesTable = experimentPoliciesTable;
+    }
+
+    public ExperimentPoliciesTypeTable getExperimentPoliciesTypeTable() {
+        return experimentPoliciesTypeTable;
+    }
+
+    public void setExperimentPoliciesTypeTable(ExperimentPoliciesTypeTable experimentPoliciesTypeTable) {
+        this.experimentPoliciesTypeTable = experimentPoliciesTypeTable;
+    }
+    
+    public List<AllowedPolicyValue> getAllowedPolicies(PolicyType policyType) {
+        return policies.get(policyType);
+    }
+         
     public void updateRemovedExperimentRoles() {
         UserExperimentRole userExperimentRole;
         for (UserInfo user : experimentUsers.keySet()) {
@@ -426,7 +556,7 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
     
     public boolean canEditExperiment(int experimentId) {
         if (!initialized) {
-            initializeRoleTypes();
+            initializeTables();
         }
         // user that is Manager or PI can edit experiment
         int managerRoleId = experimentRoles.get(RoleTypeName.MANAGER).getId();
@@ -447,7 +577,7 @@ public class ExperimentController extends CrudEntityController<Experiment, Exper
     
     public boolean canDeleteExperiment(int experimentId) {
         if (!initialized) {
-            initializeRoleTypes();
+            initializeTables();
         }
         int managerRoleId = experimentRoles.get(RoleTypeName.MANAGER).getId();
         UserInfo logged = (UserInfo) SessionUtility.getUser();
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/Experiment.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/Experiment.java
index 31a21e85..fd3d12c0 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/Experiment.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/Experiment.java
@@ -160,8 +160,17 @@ public class Experiment extends CloneableEntity
     public void setExperimentType(ExperimentType experimentType) {
         this.experimentType = experimentType;
     }
+    
+    public ExperimentPolicy getPolicyForType(PolicyType type) {
+        for (ExperimentPolicy experimentPolicy : experimentPolicyList) {
+            if (experimentPolicy.getPolicyType().getId() == type.getId()) {
+                return experimentPolicy;
+            }
+        }
+        return null;
+    }
 
-     @Override
+    @Override
     public int hashCode() {
         int hash = 0;
         hash += (id != null ? id.hashCode() : 0);
diff --git a/src/java/DmWebPortal/web/views/experiment/edit.xhtml b/src/java/DmWebPortal/web/views/experiment/edit.xhtml
index 94e0c53d..1669275e 100644
--- a/src/java/DmWebPortal/web/views/experiment/edit.xhtml
+++ b/src/java/DmWebPortal/web/views/experiment/edit.xhtml
@@ -25,6 +25,10 @@
                     </div>
 
                 </p:tab>
+                
+                <p:tab title="Experiment Policies">
+                    <ui:include src="experimentPoliciesEditSelection.xhtml"/>
+                </p:tab>
 
                 <p:tab title="Experiment Users" id="usersTab">                
                     <ui:include src="experimentUsersEditDataTable.xhtml"/>
diff --git a/src/java/DmWebPortal/web/views/experiment/view.xhtml b/src/java/DmWebPortal/web/views/experiment/view.xhtml
index 809a8466..aea85d98 100644
--- a/src/java/DmWebPortal/web/views/experiment/view.xhtml
+++ b/src/java/DmWebPortal/web/views/experiment/view.xhtml
@@ -23,10 +23,10 @@
                     </div>
                 </p:tab>
                 
-<!--                <p:tab title="Experiment Policies">
-                    <ui:include src="experimentPoliciesViewPanelGrid.xhtml"/>
+                <p:tab title="Experiment Policies">
+                    <ui:include src="experimentPoliciesViewListDataTable.xhtml"/>
                 </p:tab>
--->
+
                 <p:tab title="Experiment Users">                
                     <ui:include src="experimentUsersListDataTable.xhtml"/>
                 </p:tab>
diff --git a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml b/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml
deleted file mode 100644
index 360fc7fb..00000000
--- a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueCreatePanelGrid.xhtml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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
deleted file mode 100644
index c1c3a996..00000000
--- a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueDestroyDialog.xhtml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?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
deleted file mode 100644
index 4051206d..00000000
--- a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueEditPanelGrid.xhtml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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
deleted file mode 100644
index 56199da4..00000000
--- a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueListDataTable.xhtml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?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
deleted file mode 100644
index b78e4d21..00000000
--- a/src/java/DmWebPortal/web/views/roleType/allowedPolicyValueViewPanelGrid.xhtml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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
deleted file mode 100644
index 3e16ea27..00000000
--- a/src/java/DmWebPortal/web/views/roleType/createAllowedPolicyValue.xhtml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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 f266ecd4..ffb705f4 100644
--- a/src/java/DmWebPortal/web/views/roleType/edit.xhtml
+++ b/src/java/DmWebPortal/web/views/roleType/edit.xhtml
@@ -10,38 +10,24 @@
     <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="editPolicyTypeForm">
+    <ui:define name="middleCenter">
+        <h:form id="editRoleTypeForm">
 
-                <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/>
+            <div class="middleCenterLeftContent">
+                <div class="pageTitle">
+                    <h1>Edit Role Type</h1>
+                </div>
 
-                    <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>
+                <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>
+            </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
deleted file mode 100644
index 5dad903e..00000000
--- a/src/java/DmWebPortal/web/views/roleType/editAllowedPolicyValue.xhtml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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 702c2df5..13a1a205 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>Policy Types</h1>
+            <h1>Role Types</h1>
         </div>
 
-        <h:form id="viewEntityTypeListForm">
-            <ui:param name="entityController" value="#{policyTypeController}"/>
+        <h:form id="viewRoleTypeListForm">
+            <ui:param name="entityController" value="#{roleTypeController}"/>
 
             <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="policyTypeListDataTable.xhtml"/>
+                <ui:include src="roleTypeListDataTable.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
deleted file mode 100644
index 1e2d94e8..00000000
--- a/src/java/DmWebPortal/web/views/roleType/policyTypeEditPanelGrid.xhtml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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
deleted file mode 100644
index a7ca6c82..00000000
--- a/src/java/DmWebPortal/web/views/roleType/policyTypeListDataTable.xhtml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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
deleted file mode 100644
index 25855c5c..00000000
--- a/src/java/DmWebPortal/web/views/roleType/policyTypeViewPanelGrid.xhtml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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
-- 
GitLab