From 175ddf4763aff7b9bb10aae82fe9b6ef4470c8f5 Mon Sep 17 00:00:00 2001
From: "Barbara B. Frosik" <bfrosik@aps.anl.gov>
Date: Mon, 2 Mar 2015 16:42:52 +0000
Subject: [PATCH] policies database

---
 sbin/create_dm_db.sh                          |   3 +-
 .../AllowedPolicyValueController.java         | 115 +----------
 .../ExperimentPolicyController.java           |  17 +-
 .../model/beans/AllowedPolicyValueFacade.java |   6 +-
 .../model/beans/ExperimentPolicyFacade.java   |  19 +-
 .../ExperimentPolicyPropertyValueFacade.java  |  59 ++++++
 .../model/beans/PolicyPropertyFacade.java     |  66 ++++++
 .../model/beans/TemplatePolicyFacade.java     |  33 ---
 .../model/beans/TemplatePolicySetFacade.java  |  33 ---
 .../model/entities/AllowedPolicyValue.java    |  14 +-
 .../model/entities/ExperimentPolicy.java      |  52 ++---
 .../ExperimentPolicyPropertyValue.java        | 120 +++++++++++
 .../portal/model/entities/PolicyProperty.java | 195 ++++++++++++++++++
 .../dm/portal/model/entities/PolicyType.java  |  49 +----
 .../portal/model/entities/TemplatePolicy.java | 130 ------------
 .../model/entities/TemplatePolicySet.java     | 123 -----------
 .../web/views/experiment/view.xhtml           |   6 +-
 17 files changed, 503 insertions(+), 537 deletions(-)
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyPropertyValueFacade.java
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyPropertyFacade.java
 delete mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicyFacade.java
 delete mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicySetFacade.java
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicyPropertyValue.java
 create mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyProperty.java
 delete mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicy.java
 delete mode 100644 src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicySet.java

diff --git a/sbin/create_dm_db.sh b/sbin/create_dm_db.sh
index 355d13a1..0ef2a305 100755
--- a/sbin/create_dm_db.sh
+++ b/sbin/create_dm_db.sh
@@ -180,8 +180,7 @@ DM_DB_TABLES="\
   user_info \
   role_type \
   user_system_role \
-  policy_type \
-  allowed_policy_type
+  policy_type 
 "
 for dbTable in $DM_DB_TABLES; do
     dbFile=populate_$dbTable.sql
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
index b3db07ac..e5761e72 100644
--- 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
@@ -5,27 +5,16 @@ 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
@@ -34,15 +23,6 @@ public class AllowedPolicyValueController extends CrudEntityController<AllowedPo
     public AllowedPolicyValueController() {
     }
 
-    public PolicyType getPolicyType() {
-        return policyType;
-    }
-
-    public void setPolicyType(PolicyType policyType) {
-        this.policyType = policyType;
-        clear();
-    }
-
     @Override
     protected AllowedPolicyValueFacade getFacade() {
         return allowedPolicyValueFacade;
@@ -55,13 +35,13 @@ public class AllowedPolicyValueController extends CrudEntityController<AllowedPo
 
     @Override
     public String getEntityTypeName() {
-        return "allowedPolicyValue";
+        return "AllowedPolicyValue";
     }
 
     @Override
     public String getCurrentEntityInstanceName() {
         if (getCurrent() != null) {
-            return getCurrent().getName();
+            return getCurrent().getPolicyValue();
         }
         return "";
     }
@@ -76,97 +56,16 @@ public class AllowedPolicyValueController extends CrudEntityController<AllowedPo
 
     @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());
+        logger.debug("Inserting new experiment allowed policy value " );
     }
 
     @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";
+    protected String getObjectAlreadyExistMessage(AllowedPolicyValue entity) {
+        return null;
     }
-     
-    @Override
-    public String prepareCreate() {
-        current = createEntityInstance();
-        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
+    
\ No newline at end of file
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
index b6ceaf8f..dc4565df 100644
--- 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
@@ -46,9 +46,6 @@ public class ExperimentPolicyController extends CrudEntityController<ExperimentP
 
     @Override
     public String getCurrentEntityInstanceName() {
-        if (getCurrent() != null) {
-            return getCurrent().getPolicyValue();
-        }
         return "";
     }
 
@@ -64,21 +61,11 @@ public class ExperimentPolicyController extends CrudEntityController<ExperimentP
 
     @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());
+        logger.debug("Inserting new experiment policy ");
     }
 
     @Override
     public void prepareEntityUpdate(ExperimentPolicy experimentPolicy) throws DmPortalException {
-        if ((experimentPolicy.getPolicyValue() == null) || (experimentPolicy.getPolicyValue().length() == 0)) {
-            throw new MissingProperty("Name is missing.");
-        }
     }
     
       @Override
@@ -86,7 +73,7 @@ public class ExperimentPolicyController extends CrudEntityController<ExperimentP
         if (experimentPolicy == null) {
             return null;
         }
-        return "Experiment Policy " + experimentPolicy.getPolicyValue() + " already exists."; 
+        return "Experiment Policy " + " already exists."; 
     }
 
     @FacesConverter(forClass = ExperimentPolicy.class)
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 7fcf8f54..ad890b5d 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
@@ -52,10 +52,10 @@ public class AllowedPolicyValueFacade extends AbstractFacade<AllowedPolicyValue>
         return null;
     }
 
-    public List<AllowedPolicyValue> findByPolicyType(int id) {
+    public List<AllowedPolicyValue> findByPolicyProperty(int id) {
         try {
-            return (List<AllowedPolicyValue>) em.createNamedQuery("AllowedPolicyValue.findByPolicyTypeId")
-                    .setParameter("policyTypeId", id)
+            return (List<AllowedPolicyValue>) em.createNamedQuery("AllowedPolicyValue.findByPolicyPropertyId")
+                    .setParameter("policyPropertyId", id)
                     .getResultList();
         } catch (NoResultException ex) {
         }
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 8948a0a0..758d6979 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,7 +7,7 @@
 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 java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.EntityManager;
 import javax.persistence.NoResultException;
@@ -32,10 +32,10 @@ public class ExperimentPolicyFacade extends AbstractFacade<ExperimentPolicy>
         super(ExperimentPolicy.class);
     }
     
-    public ExperimentPolicy findByName(String name) {
+    public ExperimentPolicy findById(int id) {
         try {
-            return (ExperimentPolicy) em.createNamedQuery("ExperimentPolicy.findByPolicyValue")
-                    .setParameter("policyValue", name)
+            return (ExperimentPolicy) em.createNamedQuery("ExperimentPolicy.findById")
+                    .setParameter("id", id)
                     .getSingleResult();
         }
         catch (NoResultException ex) {
@@ -43,4 +43,15 @@ public class ExperimentPolicyFacade extends AbstractFacade<ExperimentPolicy>
         return null;
     }
         
+    public List<ExperimentPolicy> findByExperimentId(int id) {
+        try {
+            return (List<ExperimentPolicy>) em.createNamedQuery("ExperimentPolicy.findByExperimentId")
+                    .setParameter("experimentId", id)
+                    .getResultList();
+        }
+        catch (NoResultException ex) {
+        }
+        return null;
+    }
+                
 }
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyPropertyValueFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyPropertyValueFacade.java
new file mode 100644
index 00000000..8b8e8189
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/ExperimentPolicyPropertyValueFacade.java
@@ -0,0 +1,59 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+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.ExperimentPolicyPropertyValue;
+import java.util.List;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.PersistenceContext;
+
+/**
+ *
+ * @author bfrosik
+ */
+@Stateless
+public class ExperimentPolicyPropertyValueFacade extends AbstractFacade<ExperimentPolicyPropertyValue>
+{
+
+    @PersistenceContext(unitName = "DmWebPortalPU")
+    private EntityManager em;
+
+    @Override
+    protected EntityManager getEntityManager() {
+        return em;
+    }
+
+    public ExperimentPolicyPropertyValueFacade() {
+        super(ExperimentPolicyPropertyValue.class);
+    }
+    
+    public ExperimentPolicyPropertyValue findById(int id) {
+        try {
+            return (ExperimentPolicyPropertyValue) em.createNamedQuery("ExperimentPolicyPropertyValue.findById")
+                    .setParameter("id", id)
+                    .getSingleResult();
+        }
+        catch (NoResultException ex) {
+        }
+        return null;
+    }
+        
+    public List<ExperimentPolicyPropertyValue> findByExperimentPolicyId(int id) {
+        try {
+            return (List<ExperimentPolicyPropertyValue>) em.createNamedQuery("ExperimentPolicyPropertyValue.findByExperimentPolicyId")
+                    .setParameter("experimentPolicyId", id)
+                    .getResultList();
+        }
+        catch (NoResultException ex) {
+        }
+        return null;
+    }
+        
+}
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyPropertyFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyPropertyFacade.java
new file mode 100644
index 00000000..32473fec
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/PolicyPropertyFacade.java
@@ -0,0 +1,66 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package gov.anl.aps.dm.portal.model.beans;
+
+import gov.anl.aps.dm.portal.model.entities.PolicyProperty;
+import java.util.List;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.PersistenceContext;
+
+/**
+ *
+ * @author bfrosik
+ */
+@Stateless
+public class PolicyPropertyFacade extends AbstractFacade<PolicyProperty>
+{
+    @PersistenceContext(unitName = "DmWebPortalPU")
+    private EntityManager em;
+
+    @Override
+    protected EntityManager getEntityManager() {
+        return em;
+    }
+
+    public PolicyPropertyFacade() {
+        super(PolicyProperty.class);
+    }
+    
+    public PolicyProperty findByName(String name) {
+        try {
+            return (PolicyProperty) em.createNamedQuery("PolicyProperty.findByName")
+                    .setParameter("name", name)
+                    .getSingleResult();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+
+    public PolicyProperty findById(int id) {
+        try {
+            return (PolicyProperty) em.createNamedQuery("PolicyProperty.findById")
+                    .setParameter("id", id)
+                    .getSingleResult();
+        } catch (NoResultException ex) {
+        }
+        return null;
+    }
+    
+    public List<PolicyProperty> findByPolicyTypeId(int id) {
+        try {
+            return (List<PolicyProperty>) em.createNamedQuery("PolicyProperty.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/TemplatePolicyFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicyFacade.java
deleted file mode 100644
index c83d3829..00000000
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicyFacade.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package gov.anl.aps.dm.portal.model.beans;
-
-import gov.anl.aps.dm.portal.model.entities.TemplatePolicy;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-/**
- *
- * @author sveseli
- */
-@Stateless
-public class TemplatePolicyFacade extends AbstractFacade<TemplatePolicy>
-{
-    @PersistenceContext(unitName = "DmWebPortalPU")
-    private EntityManager em;
-
-    @Override
-    protected EntityManager getEntityManager() {
-        return em;
-    }
-
-    public TemplatePolicyFacade() {
-        super(TemplatePolicy.class);
-    }
-    
-}
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicySetFacade.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicySetFacade.java
deleted file mode 100644
index 8652d193..00000000
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/beans/TemplatePolicySetFacade.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package gov.anl.aps.dm.portal.model.beans;
-
-import gov.anl.aps.dm.portal.model.entities.TemplatePolicySet;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-/**
- *
- * @author sveseli
- */
-@Stateless
-public class TemplatePolicySetFacade extends AbstractFacade<TemplatePolicySet>
-{
-    @PersistenceContext(unitName = "DmWebPortalPU")
-    private EntityManager em;
-
-    @Override
-    protected EntityManager getEntityManager() {
-        return em;
-    }
-
-    public TemplatePolicySetFacade() {
-        super(TemplatePolicySet.class);
-    }
-    
-}
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 76f89cbb..be28189c 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
@@ -32,7 +32,7 @@ import javax.xml.bind.annotation.XmlRootElement;
     @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.findByPolicyTypeId", query = "SELECT a FROM AllowedPolicyValue a WHERE a.policyType.id = :policyTypeId")})
+    @NamedQuery(name = "AllowedPolicyValue.findByPolicyPropertyId", query = "SELECT a FROM AllowedPolicyValue a WHERE a.policyProperty.id = :policyPropertyId")})
                                                            
 public class AllowedPolicyValue extends CloneableEntity
 {
@@ -47,9 +47,9 @@ public class AllowedPolicyValue extends CloneableEntity
     @Size(max = 2147483647)
     @Column(name = "description")
     private String description;
-    @JoinColumn(name = "policy_type_id", referencedColumnName = "id")
+    @JoinColumn(name = "policy_property_id", referencedColumnName = "id")
     @ManyToOne(optional = false)
-    private PolicyType policyType;
+    private PolicyProperty policyProperty;
 
     public AllowedPolicyValue() {
     }
@@ -90,12 +90,12 @@ public class AllowedPolicyValue extends CloneableEntity
         this.description = description;
     }
 
-    public PolicyType getPolicyType() {
-        return policyType;
+    public PolicyProperty getPolicyProperty() {
+        return policyProperty;
     }
 
-    public void setPolicyType(PolicyType policyType) {
-        this.policyType = policyType;
+    public void setPolicyProperty(PolicyProperty policyProperty) {
+        this.policyProperty = policyProperty;
     }
 
     @Override
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicy.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicy.java
index c60480a9..dbfb60fb 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicy.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicy.java
@@ -6,7 +6,9 @@
 
 package gov.anl.aps.dm.portal.model.entities;
 
+import java.util.List;
 import javax.persistence.Basic;
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -16,9 +18,10 @@ import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
 import javax.persistence.Table;
-import javax.validation.constraints.Size;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
 
 /**
  *
@@ -30,8 +33,9 @@ import javax.xml.bind.annotation.XmlRootElement;
 @NamedQueries({
     @NamedQuery(name = "ExperimentPolicy.findAll", query = "SELECT e FROM ExperimentPolicy e"),
     @NamedQuery(name = "ExperimentPolicy.findById", query = "SELECT e FROM ExperimentPolicy e WHERE e.id = :id"),
-    @NamedQuery(name = "ExperimentPolicy.findByPolicyValue", query = "SELECT e FROM ExperimentPolicy e WHERE e.policyValue = :policyValue"),
-    @NamedQuery(name = "ExperimentPolicy.findByDescription", query = "SELECT e FROM ExperimentPolicy e WHERE e.description = :description")})
+    @NamedQuery(name = "ExperimentPolicy.findByExperimentId", query = "SELECT e FROM ExperimentPolicy e WHERE e.experiment.id = :experimentId"),
+    @NamedQuery(name = "ExperimentPolicy.findByPolicyTypeId", query = "SELECT e FROM ExperimentPolicy e WHERE e.policyType.id = :policyTypeId")})
+
 public class ExperimentPolicy extends CloneableEntity
 {
     @Id
@@ -39,19 +43,15 @@ public class ExperimentPolicy extends CloneableEntity
     @Basic(optional = false)
     @Column(name = "id")
     private Integer id;
-    @Basic(optional = false)
-    @Size(min = 1, max = 2147483647)
-    @Column(name = "policy_value")
-    private String policyValue;
-    @Size(max = 2147483647)
-    @Column(name = "description")
-    private String description;
     @JoinColumn(name = "policy_type_id", referencedColumnName = "id")
     @ManyToOne(optional = false)
     private PolicyType policyType;
     @JoinColumn(name = "experiment_id", referencedColumnName = "id")
     @ManyToOne(optional = false)
     private Experiment experiment;
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "experimentPolicy")
+    private List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList;
+   
 
     public ExperimentPolicy() {
     }
@@ -60,11 +60,6 @@ public class ExperimentPolicy extends CloneableEntity
         this.id = id;
     }
 
-    public ExperimentPolicy(Integer id, String value) {
-        this.id = id;
-        this.policyValue = value;
-    }
-
     public Integer getId() {
         return id;
     }
@@ -73,22 +68,6 @@ public class ExperimentPolicy extends CloneableEntity
         this.id = id;
     }
 
-    public String getPolicyValue() {
-        return policyValue;
-    }
-
-    public void setPolicyValue(String policyValue) {
-        this.policyValue = policyValue;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
     public PolicyType getPolicyType() {
         return policyType;
     }
@@ -97,7 +76,7 @@ public class ExperimentPolicy extends CloneableEntity
         this.policyType = policyType;
     }
 
-    public Experiment getExperiment() {
+     public Experiment getExperiment() {
         return experiment;
     }
 
@@ -105,6 +84,15 @@ public class ExperimentPolicy extends CloneableEntity
         this.experiment = experiment;
     }
 
+    @XmlTransient
+    public List<ExperimentPolicyPropertyValue> getExperimentPolicyPropertyValueList() {
+        return experimentPolicyPropertyValueList;
+    }
+
+    public void setExperimentPolicyPropertyValue(List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList) {
+        this.experimentPolicyPropertyValueList = experimentPolicyPropertyValueList;
+    }
+
     @Override
     public int hashCode() {
         int hash = 0;
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicyPropertyValue.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicyPropertyValue.java
new file mode 100644
index 00000000..1dfa666e
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/ExperimentPolicyPropertyValue.java
@@ -0,0 +1,120 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package gov.anl.aps.dm.portal.model.entities;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+/**
+ *
+ * @author bfrosik
+ */
+@Entity
+@Table(name = "experiment_policy")
+@XmlRootElement
+@NamedQueries({
+    @NamedQuery(name = "ExperimentPolicyPropertyValue.findAll", query = "SELECT e FROM ExperimentPolicyPropertyValue e"),
+    @NamedQuery(name = "ExperimentPolicyPropertyValue.findById", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.id = :id"),
+    @NamedQuery(name = "ExperimentPolicyPropertyValue.findByPolicyPropertyValue", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.policyPropertyValue = :policyPropertyValue"),
+    @NamedQuery(name = "ExperimentPolicyPropertyValue.findByPolicyPropertyId", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.policyProperty.id = :policyPropertyId"),
+    @NamedQuery(name = "ExperimentPolicyPropertyValue.findByExperimentPolicyId", query = "SELECT e FROM ExperimentPolicyPropertyValue e WHERE e.experimentPolicy.id = :experimentPolicyId")})
+
+public class ExperimentPolicyPropertyValue extends CloneableEntity 
+{
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Basic(optional = false)
+    @Column(name = "id")
+    private Integer id;
+    @Basic(optional = false)
+    @Size(min = 1, max = 2147483647)
+    @Column(name = "policy_property_value")
+    private String policyPropertyValue;
+    @JoinColumn(name = "policy_property_id", referencedColumnName = "id")
+    @ManyToOne(optional = false)
+    private PolicyProperty policyProperty;
+    @JoinColumn(name = "experiment_policy_id", referencedColumnName = "id")
+    @ManyToOne(optional = false)
+    private ExperimentPolicy experimentPolicy;
+
+    public ExperimentPolicyPropertyValue() {
+    }
+
+    public ExperimentPolicyPropertyValue(Integer id) {
+        this.id = id;
+    }
+
+    public ExperimentPolicyPropertyValue(Integer id, String value) {
+        this.id = id;
+        this.policyPropertyValue = value;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getPolicyPropertyValue() {
+        return policyPropertyValue;
+    }
+
+    public void setPolicyPropertyValue(String policyPropertyValue) {
+        this.policyPropertyValue = policyPropertyValue;
+    }
+
+    public PolicyProperty getPolicyProperty() {
+        return policyProperty;
+    }
+
+    public void setPolicyProperty(PolicyProperty policyProperty) {
+        this.policyProperty = policyProperty;
+    }
+
+    public ExperimentPolicy getExperimentPolicy() {
+        return experimentPolicy;
+    }
+
+    public void setExperimentPolicy(ExperimentPolicy experimentPolicy) {
+        this.experimentPolicy = experimentPolicy;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        hash += (id != null ? id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields are not set
+        if (!(object instanceof ExperimentPolicyPropertyValue)) {
+            return false;
+        }
+        ExperimentPolicyPropertyValue other = (ExperimentPolicyPropertyValue) object;
+        return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
+    }
+
+    @Override
+    public String toString() {
+        return "gov.anl.aps.dm.portal.model.entities.ExperimentPolicyPropertyValue[ id=" + id + " ]";
+    }
+        
+}
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyProperty.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyProperty.java
new file mode 100644
index 00000000..80dd823e
--- /dev/null
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyProperty.java
@@ -0,0 +1,195 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package gov.anl.aps.dm.portal.model.entities;
+
+import java.util.List;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ *
+ * @author bfrosik
+ */
+@Entity
+@Table(name = "policy_type")
+@XmlRootElement
+@NamedQueries({
+    @NamedQuery(name = "PolicyProperty.findAll", query = "SELECT p FROM PolicyProperty p"),
+    @NamedQuery(name = "PolicyProperty.findById", query = "SELECT p FROM PolicyProperty p WHERE p.id = :id"),
+    @NamedQuery(name = "PolicyProperty.findByName", query = "SELECT p FROM PolicyProperty p WHERE p.name = :name"),
+    @NamedQuery(name = "PolicyProperty.findByDescription", query = "SELECT p FROM PolicyProperty p WHERE p.description = :description"),
+    @NamedQuery(name = "PolicyProperty.findByUnits", query = "SELECT p FROM PolicyProperty p WHERE p.units = :units"),
+    @NamedQuery(name = "PolicyProperty.findByPolicyTypeId", query = "SELECT p FROM PolicyProperty p WHERE p.policyType.id = :policyTypeId")})
+
+public class PolicyProperty extends CloneableEntity
+{
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Basic(optional = false)
+    @Column(name = "id")
+    private Integer id;
+    @Basic(optional = false)
+    @NotNull
+    @Size(min = 1, max = 2147483647)
+    @Column(name = "name")
+    private String name;
+    @Size(max = 2147483647)
+    @Column(name = "units")
+    private String units;
+    @Size(max = 2147483647)
+    @Column(name = "lower_limit")
+    private String lowerLimit;
+    @Size(max = 2147483647)
+    @Column(name = "upper_limit")
+    private String upperLimit;
+    @Size(max = 2147483647)
+    @Column(name = "default_value")
+    private String defaultValue;
+    @Size(max = 2147483647)
+    @Column(name = "description")
+    private String description;
+    @JoinColumn(name = "policy_type_id", referencedColumnName = "id")
+    @ManyToOne(optional = false)
+    private PolicyType policyType;
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "policyProperty")
+    private List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList;
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "policyProperty")
+    private List<AllowedPolicyValue> allowedPolicyValueList;
+
+    public PolicyProperty() {
+    }
+
+    public PolicyProperty(Integer id) {
+        this.id = id;
+    }
+
+    public PolicyProperty(Integer id, String name) {
+        this.id = id;
+        this.name = name;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getUnits() {
+        return units;
+    }
+
+    public void setUnits(String units) {
+        this.units = units;
+    }
+
+    public String getLowerLimit() {
+        return lowerLimit;
+    }
+
+    public void setLowerLimit(String lowerLimit) {
+        this.lowerLimit = lowerLimit;
+    }
+
+    public String getUpperLimit() {
+        return upperLimit;
+    }
+
+    public void setUpperLimit(String upperLimit) {
+        this.upperLimit = upperLimit;
+    }
+
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+
+    public void setDefaultValue(String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
+
+    public PolicyType getPolicyType() {
+        return policyType;
+    }
+
+    public void setPolicyType(PolicyType policyType) {
+        this.policyType = policyType;
+    }
+
+    @XmlTransient
+    public List<ExperimentPolicyPropertyValue> getExperimentPolicyPropertyValueList() {
+        return experimentPolicyPropertyValueList;
+    }
+
+    public void setExperimentPolicyPropertyValueList(List<ExperimentPolicyPropertyValue> experimentPolicyPropertyValueList) {
+        this.experimentPolicyPropertyValueList = experimentPolicyPropertyValueList;
+    }
+
+    @XmlTransient
+    public List<AllowedPolicyValue> getAllowedPolicyValueList() {
+        return allowedPolicyValueList;
+    }
+
+    public void setAllowedPolicyValueList(List<AllowedPolicyValue> allowedPolicyValueList) {
+        this.allowedPolicyValueList = allowedPolicyValueList;
+    }
+ 
+    @Override
+    public int hashCode() {
+        int hash = 0;
+        hash += (id != null ? id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        // TODO: Warning - this method won't work in the case the id fields are not set
+        if (!(object instanceof PolicyProperty)) {
+            return false;
+        }
+        PolicyProperty other = (PolicyProperty) object;
+        return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
+    }
+
+    @Override
+    public String toString() {
+        return "gov.anl.aps.dm.portal.model.entities.PolicyProperty[ id=" + id + " ]";
+    }
+
+
+}
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyType.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyType.java
index a664fbf9..8ac6881b 100644
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyType.java
+++ b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/PolicyType.java
@@ -15,7 +15,6 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
@@ -37,9 +36,8 @@ import javax.xml.bind.annotation.XmlTransient;
     @NamedQuery(name = "PolicyType.findAll", query = "SELECT p FROM PolicyType p"),
     @NamedQuery(name = "PolicyType.findById", query = "SELECT p FROM PolicyType p WHERE p.id = :id"),
     @NamedQuery(name = "PolicyType.findByName", query = "SELECT p FROM PolicyType p WHERE p.name = :name"),
-    @NamedQuery(name = "PolicyType.findByDescription", query = "SELECT p FROM PolicyType p WHERE p.description = :description"),
-    @NamedQuery(name = "PolicyType.findByHandlerName", query = "SELECT p FROM PolicyType p WHERE p.handlerName = :handlerName"),
-    @NamedQuery(name = "PolicyType.findByDefaultPolicyValue", query = "SELECT p FROM PolicyType p WHERE p.defaultPolicyValue = :defaultPolicyValue")})
+    @NamedQuery(name = "PolicyType.findByDescription", query = "SELECT p FROM PolicyType p WHERE p.description = :description")})
+
 public class PolicyType extends CloneableEntity
 {
     @Id
@@ -55,19 +53,10 @@ public class PolicyType extends CloneableEntity
     @Size(max = 2147483647)
     @Column(name = "description")
     private String description;
-    @Size(max = 2147483647)
-    @Column(name = "handler_name")
-    private String handlerName;
-    @Size(max = 2147483647)
-    @JoinColumn(name = "default_policy_value", referencedColumnName = "policy_value")
-    @OneToOne
-    private AllowedPolicyValue defaultPolicyValue;
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "policyType")
     private List<ExperimentPolicy> experimentPolicyList;
     @OneToMany(cascade = CascadeType.ALL, mappedBy = "policyType")
-    private List<TemplatePolicy> templatePolicyList;
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "policyType")
-    private List<AllowedPolicyValue> allowedPolicyValueList;
+    private List<PolicyProperty> policyPropertyList;
 
     public PolicyType() {
     }
@@ -105,22 +94,6 @@ public class PolicyType extends CloneableEntity
         this.description = description;
     }
 
-    public String getHandlerName() {
-        return handlerName;
-    }
-
-    public void setHandlerName(String handlerName) {
-        this.handlerName = handlerName;
-    }
-
-    public AllowedPolicyValue getDefaultPolicyValue() {
-        return defaultPolicyValue;
-    }
-
-    public void setDefaultPolicyValue(AllowedPolicyValue defaultPolicyValue) {
-        this.defaultPolicyValue = defaultPolicyValue;
-    }
-
     @XmlTransient
     public List<ExperimentPolicy> getExperimentPolicyList() {
         return experimentPolicyList;
@@ -131,22 +104,14 @@ public class PolicyType extends CloneableEntity
     }
 
     @XmlTransient
-    public List<TemplatePolicy> getTemplatePolicyList() {
-        return templatePolicyList;
+    public List<PolicyProperty> getPolicyPropertyList() {
+        return policyPropertyList;
     }
 
-    public void setTemplatePolicyList(List<TemplatePolicy> templatePolicyList) {
-        this.templatePolicyList = templatePolicyList;
+    public void setPolicyPropertyList(List<PolicyProperty> policyPropertyList) {
+        this.policyPropertyList = policyPropertyList;
     }
 
-    @XmlTransient
-    public List<AllowedPolicyValue> getAllowedPolicyValueList() {
-        return allowedPolicyValueList;
-    }
-
-    public void setAllowedPolicyValueList(List<AllowedPolicyValue> allowedPolicyValueList) {
-        this.allowedPolicyValueList = allowedPolicyValueList;
-    }
 
     @Override
     public int hashCode() {
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicy.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicy.java
deleted file mode 100644
index e966180b..00000000
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicy.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package gov.anl.aps.dm.portal.model.entities;
-
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.Table;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- * @author sveseli
- */
-@Entity
-@Table(name = "template_policy")
-@XmlRootElement
-@NamedQueries({
-    @NamedQuery(name = "TemplatePolicy.findAll", query = "SELECT t FROM TemplatePolicy t"),
-    @NamedQuery(name = "TemplatePolicy.findById", query = "SELECT t FROM TemplatePolicy t WHERE t.id = :id"),
-    @NamedQuery(name = "TemplatePolicy.findByPolicyValue", query = "SELECT t FROM TemplatePolicy t WHERE t.policyValue = :policyValue"),
-    @NamedQuery(name = "TemplatePolicy.findByDescription", query = "SELECT t FROM TemplatePolicy t WHERE t.description = :description")})
-public class TemplatePolicy extends CloneableEntity
-{
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Basic(optional = false)
-    @Column(name = "id")
-    private Integer id;
-    @Basic(optional = false)
-    @Size(min = 1, max = 2147483647)
-    @Column(name = "policy_value")
-    private String policyValue;
-    @Size(max = 2147483647)
-    @Column(name = "description")
-    private String description;
-    @JoinColumn(name = "template_policy_set_id", referencedColumnName = "id")
-    @ManyToOne(optional = false)
-    private TemplatePolicySet templatePolicySet;
-    @JoinColumn(name = "policy_type_id", referencedColumnName = "id")
-    @ManyToOne(optional = false)
-    private PolicyType policyType;
-
-    public TemplatePolicy() {
-    }
-
-    public TemplatePolicy(Integer id) {
-        this.id = id;
-    }
-
-    public TemplatePolicy(Integer id, String value) {
-        this.id = id;
-        this.policyValue = value;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getPolicyValue() {
-        return policyValue;
-    }
-
-    public void setPolicyValue(String policyValue) {
-        this.policyValue = policyValue;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public TemplatePolicySet getTemplatePolicySet() {
-        return templatePolicySet;
-    }
-
-    public void setTemplatePolicySet(TemplatePolicySet templatePolicySet) {
-        this.templatePolicySet = templatePolicySet;
-    }
-
-    public PolicyType getPolicyType() {
-        return policyType;
-    }
-
-    public void setPolicyType(PolicyType policyType) {
-        this.policyType = policyType;
-    }
-
-    @Override
-    public int hashCode() {
-        int hash = 0;
-        hash += (id != null ? id.hashCode() : 0);
-        return hash;
-    }
-
-    @Override
-    public boolean equals(Object object) {
-        // TODO: Warning - this method won't work in the case the id fields are not set
-        if (!(object instanceof TemplatePolicy)) {
-            return false;
-        }
-        TemplatePolicy other = (TemplatePolicy) object;
-        return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
-    }
-
-    @Override
-    public String toString() {
-        return "gov.anl.aps.dm.portal.model.entities.TemplatePolicy[ id=" + id + " ]";
-    }
-    
-}
diff --git a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicySet.java b/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicySet.java
deleted file mode 100644
index 55117db5..00000000
--- a/src/java/DmWebPortal/src/java/gov/anl/aps/dm/portal/model/entities/TemplatePolicySet.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package gov.anl.aps.dm.portal.model.entities;
-
-import java.util.List;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-/**
- *
- * @author sveseli
- */
-@Entity
-@Table(name = "template_policy_set")
-@XmlRootElement
-@NamedQueries({
-    @NamedQuery(name = "TemplatePolicySet.findAll", query = "SELECT t FROM TemplatePolicySet t"),
-    @NamedQuery(name = "TemplatePolicySet.findById", query = "SELECT t FROM TemplatePolicySet t WHERE t.id = :id"),
-    @NamedQuery(name = "TemplatePolicySet.findByName", query = "SELECT t FROM TemplatePolicySet t WHERE t.name = :name"),
-    @NamedQuery(name = "TemplatePolicySet.findByDescription", query = "SELECT t FROM TemplatePolicySet t WHERE t.description = :description")})
-public class TemplatePolicySet extends CloneableEntity
-{
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Basic(optional = false)
-    @Column(name = "id")
-    private Integer id;
-    @Basic(optional = false)
-    @NotNull
-    @Size(min = 1, max = 2147483647)
-    @Column(name = "name")
-    private String name;
-    @Size(max = 2147483647)
-    @Column(name = "description")
-    private String description;
-    @OneToMany(cascade = CascadeType.ALL, mappedBy = "templatePolicySet")
-    private List<TemplatePolicy> templatePolicyList;
-
-    public TemplatePolicySet() {
-    }
-
-    public TemplatePolicySet(Integer id) {
-        this.id = id;
-    }
-
-    public TemplatePolicySet(Integer id, String name) {
-        this.id = id;
-        this.name = name;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    @XmlTransient
-    public List<TemplatePolicy> getTemplatePolicyList() {
-        return templatePolicyList;
-    }
-
-    public void setTemplatePolicyList(List<TemplatePolicy> templatePolicyList) {
-        this.templatePolicyList = templatePolicyList;
-    }
-
-    @Override
-    public int hashCode() {
-        int hash = 0;
-        hash += (id != null ? id.hashCode() : 0);
-        return hash;
-    }
-
-    @Override
-    public boolean equals(Object object) {
-        // TODO: Warning - this method won't work in the case the id fields are not set
-        if (!(object instanceof TemplatePolicySet)) {
-            return false;
-        }
-        TemplatePolicySet other = (TemplatePolicySet) object;
-        return (this.id != null || other.id == null) && (this.id == null || this.id.equals(other.id));
-    }
-
-    @Override
-    public String toString() {
-        return "gov.anl.aps.dm.portal.model.entities.TemplatePolicySet[ id=" + id + " ]";
-    }
-    
-}
diff --git a/src/java/DmWebPortal/web/views/experiment/view.xhtml b/src/java/DmWebPortal/web/views/experiment/view.xhtml
index ac0c9b29..41bcf85a 100644
--- a/src/java/DmWebPortal/web/views/experiment/view.xhtml
+++ b/src/java/DmWebPortal/web/views/experiment/view.xhtml
@@ -16,17 +16,13 @@
             </div>
 
             <ui:param name="experimentObject" value="#{experimentController.current}"/>
-            <p:accordionPanel multiple="true" activeIndex="0,1,2" >
+            <p:accordionPanel multiple="true" activeIndex="0,1" >
                 <p:tab title="Experiment Properties">
                     <div class="middleCenterLeftContent">
                         <ui:include src="experimentViewPanelGrid.xhtml"/>
                     </div>
                 </p:tab>
                 
-                <p:tab title="Experiment Policies">
-                    
-                </p:tab>
-
                 <p:tab title="Experiment Users">                
                     <ui:include src="experimentUsersListDataTable.xhtml"/>
                 </p:tab>
-- 
GitLab