diff --git a/ECOMP-PAP-REST/src/main/java/hibernate.cfg.xml b/ECOMP-PAP-REST/src/main/java/hibernate.cfg.xml
index 33f5177..a898c57 100644
--- a/ECOMP-PAP-REST/src/main/java/hibernate.cfg.xml
+++ b/ECOMP-PAP-REST/src/main/java/hibernate.cfg.xml
@@ -44,6 +44,8 @@
 		<mapping class="org.openecomp.policy.rest.jpa.EcompName"/>
 		<mapping class="org.openecomp.policy.rest.jpa.EnforcingType"/>
 		<mapping class="org.openecomp.policy.rest.jpa.FirewallDictionaryList"/>
+		<mapping class="org.openecomp.policy.rest.jpa.FWTag"/>
+        <mapping class="org.openecomp.policy.rest.jpa.FWTagPicker"/>
 		<mapping class="org.openecomp.policy.rest.jpa.FunctionDefinition"/>
 		<mapping class="org.openecomp.policy.rest.jpa.FunctionArgument"/>
 		<mapping class="org.openecomp.policy.rest.jpa.GroupPolicyScopeList"/>
@@ -56,8 +58,10 @@
 		<mapping class="org.openecomp.policy.rest.jpa.PolicyScopeResource"/>
 		<mapping class="org.openecomp.policy.rest.jpa.PolicyScopeType"/>
 		<mapping class="org.openecomp.policy.rest.jpa.PolicyScopeService"/>
+		<mapping class="org.openecomp.policy.rest.jpa.PolicyEditorScopes"/>
+		<mapping class="org.openecomp.policy.rest.jpa.PolicyVersion"/>
 		<mapping class="org.openecomp.policy.rest.jpa.PortList"/>
-		<mapping class="org.openecomp.policy.rest.jpa.PREFIXLIST"/>
+		<mapping class="org.openecomp.policy.rest.jpa.PrefixList"/>
 		<mapping class="org.openecomp.policy.rest.jpa.ProtocolList"/>
 		<mapping class="org.openecomp.policy.rest.jpa.ServiceList"/>
 		<mapping class="org.openecomp.policy.rest.jpa.SecurityZone"/>
@@ -69,5 +73,9 @@
 		<mapping class="org.openecomp.policy.rest.jpa.Zone"/>
 		<mapping class="org.openecomp.policy.rest.jpa.RiskType"/>
 		<mapping class="org.openecomp.policy.rest.jpa.SafePolicyWarning"/>
+		<mapping class="org.openecomp.policy.rest.jpa.ClosedLoops"/>
+        <mapping class="org.openecomp.policy.rest.jpa.BRMSController"/>
+        <mapping class="org.openecomp.policy.rest.jpa.BRMSDependency"/>
+        <mapping class="org.openecomp.policy.rest.jpa.MicroServiceAttribute"/>
 	</session-factory>
 </hibernate-configuration>
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
index 17babfa..4d872c3 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/HibernateSession.java
@@ -25,12 +25,14 @@
 import org.hibernate.SessionFactory;
 import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
 import org.hibernate.cfg.Configuration;
-
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 
 public class HibernateSession{
+	
+	private static final Logger LOGGER	= FlexLogger.getLogger(HibernateSession.class);
 	private static SessionFactory xacmlsessionFactory;
-
-
+	
 	static {
 		try {
 			Configuration configuration= new Configuration();
@@ -45,14 +47,18 @@
 			configuration.setProperty("hibernate.c3p0.max_size", "200");
 			configuration.setProperty("hibernate.c3p0.timeout", "3600");
 			configuration.setProperty("hibernate.c3p0.idle_test_period", "3600");
+			configuration.setProperty("hibernate.cache.use.query_cache", "false");
+			configuration.setProperty("hibernate.cache.use_second_level_cache", "false");
 			
 			StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
 			xacmlsessionFactory = configuration.configure("/hibernate.cfg.xml").buildSessionFactory(builder.build());
 			
 		} catch (Throwable ex) {
+			LOGGER.error("Exception Occured While Creating Hiberante Session Factory"+ex);
 			throw new ExceptionInInitializerError(ex);
 		}
 	}
+	
 	public static Session getSessionFactory() throws HibernateException {
 		return xacmlsessionFactory.openSession();
 	}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/PAPRestConfig.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/PAPRestConfig.java
new file mode 100644
index 0000000..8013873
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/PAPRestConfig.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+@EnableWebMvc
+@EnableTransactionManagement
+@ComponentScan(basePackages = { "org.openecomp.*", "com.*" })
+public class PAPRestConfig extends WebMvcConfigurerAdapter {
+
+
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/WebConfig.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/WebConfig.java
index b84049c..069d1ba 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/WebConfig.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/WebConfig.java
@@ -20,61 +20,24 @@
 
 package org.openecomp.policy.pap.xacml.rest;
 
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Base64;
-import java.util.Properties;
-
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRegistration;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.springframework.web.WebApplicationInitializer;
-import org.springframework.web.context.support.XmlWebApplicationContext;
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
 import org.springframework.web.servlet.DispatcherServlet;
 
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-
 public class WebConfig implements WebApplicationInitializer {
 	
-	private static final Log logger	= LogFactory.getLog(WebConfig.class);
-	
 	@Override
 	public void onStartup(ServletContext container) {
-		
-		//need to get properties for userid and password on the pap to get authorization string used in URI Mapping
-		Properties prop = new Properties();
-		String propFileName = "xacml.pap.properties";
-		
-		try {
-			InputStream is = new FileInputStream(propFileName);
-			prop.load(is);
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "property file '" + propFileName + "' not found in the classpath");
-		}
-		
-		String papID = prop.getProperty("xacml.rest.pap.userid");
-		String papPass = prop.getProperty("xacml.rest.pap.password");
-		
-		String usernameAndPassword = papID+":"+papPass;		
-		String authorizationString = Base64.getEncoder().encodeToString(usernameAndPassword.getBytes());
-		
-		
-		XmlWebApplicationContext appContext = new XmlWebApplicationContext();
-		appContext.setConfigLocation("classpath:spring.xml");
-		
-		System.out.println("Spring XML File Location: " + appContext.getConfigLocations());
-		logger.info("Spring XML File Location: " + appContext.getConfigLocations());
-
-		ServletRegistration.Dynamic dispatcher =
-				container.addServlet("dispatcher", new DispatcherServlet(appContext));
+		AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
+		ctx.register(PAPRestConfig.class);
+		ctx.setServletContext(container);
+		ctx.refresh();
+		ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(ctx));
 		dispatcher.setLoadOnStartup(1);
-		dispatcher.addMapping("/@Auth@"+authorizationString+"/ecomp/*");
+		dispatcher.addMapping("/ecomp/*");
 	}
 
-
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
index efc7070..c39ae8c 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServlet.java
@@ -20,45 +20,36 @@
 
 package org.openecomp.policy.pap.xacml.rest;
 
-import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
-import java.io.Writer;
 import java.net.ConnectException;
 import java.net.HttpURLConnection;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.SocketTimeoutException;
-import java.net.URI;
 import java.net.URL;
 import java.net.URLDecoder;
 import java.net.UnknownHostException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.sql.Timestamp;
 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import javax.persistence.EntityManager;
-import javax.persistence.Persistence;
-import javax.persistence.Query;
 import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.persistence.PersistenceException;
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -67,133 +58,100 @@
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
-
-import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-import org.openecomp.policy.pap.xacml.rest.components.ActionPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.AutoPushPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.ClosedLoopPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.ConfigPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.CreateBrmsParamPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.CreateBrmsRawPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.CreateClosedLoopPerformanceMetrics;
-import org.openecomp.policy.pap.xacml.rest.components.CreateNewMicroSerivceModel;
-import org.openecomp.policy.pap.xacml.rest.components.DecisionPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.FirewallConfigPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.MicroServiceConfigPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.Policy;
-import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao;
-import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
-import org.openecomp.policy.pap.xacml.rest.model.RemoveGroupPolicy;
-import org.openecomp.policy.pap.xacml.rest.util.JPAUtils;
-import org.openecomp.policy.pap.xacml.restAuth.CheckPDP;
-import org.openecomp.policy.rest.XACMLRest;
-import org.openecomp.policy.rest.XACMLRestProperties;
-import org.openecomp.policy.rest.jpa.ActionPolicyDict;
-import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
-import org.openecomp.policy.rest.jpa.MicroServiceModels;
-import org.openecomp.policy.rest.jpa.PolicyEditorScopes;
-import org.openecomp.policy.rest.jpa.PolicyScore;
-import org.openecomp.policy.rest.jpa.PolicyVersion;
-import org.openecomp.policy.rest.jpa.UserInfo;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import javax.persistence.PersistenceException;
-
+import org.openecomp.policy.common.ia.IntegrityAudit;
+import org.openecomp.policy.common.im.AdministrativeStateException;
+import org.openecomp.policy.common.im.ForwardProgressException;
+import org.openecomp.policy.common.im.IntegrityMonitor;
+import org.openecomp.policy.common.im.IntegrityMonitorProperties;
+import org.openecomp.policy.common.im.StandbyStatusException;
 import org.openecomp.policy.common.logging.ECOMPLoggingContext;
 import org.openecomp.policy.common.logging.ECOMPLoggingUtils;
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.components.AutoPushPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao;
+import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
+import org.openecomp.policy.pap.xacml.rest.handler.APIRequestHandler;
+import org.openecomp.policy.pap.xacml.rest.handler.PushPolicyHandler;
+import org.openecomp.policy.pap.xacml.rest.handler.SavePolicyHandler;
+import org.openecomp.policy.pap.xacml.restAuth.CheckPDP;
+import org.openecomp.policy.rest.XACMLRest;
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.utils.PolicyUtils;
 import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.openecomp.policy.xacml.api.pap.ECOMPPapEngineFactory;
 import org.openecomp.policy.xacml.api.pap.EcompPDP;
 import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
 import org.openecomp.policy.xacml.api.pap.PAPPolicyEngine;
-
-import com.att.research.xacml.api.pap.PAPException;
-//import com.att.research.xacml.api.pap.PDP;
-//import com.att.research.xacml.api.pap.PDPGroup;
-import com.att.research.xacml.api.pap.PDPPolicy;
-import com.att.research.xacml.api.pap.PDPStatus;
 import org.openecomp.policy.xacml.std.pap.StdPAPPolicy;
 import org.openecomp.policy.xacml.std.pap.StdPDP;
 import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
+import org.openecomp.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
 import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
 import org.openecomp.policy.xacml.std.pap.StdPDPStatus;
-import org.openecomp.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
-import org.openecomp.policy.xacml.util.XACMLPolicyScanner;
 
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.api.pap.PDPStatus;
 import com.att.research.xacml.util.FactoryException;
 import com.att.research.xacml.util.XACMLProperties;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Joiner;
 import com.google.common.base.Splitter;
-import org.openecomp.policy.common.im.AdministrativeStateException;
-import org.openecomp.policy.common.im.ForwardProgressException;
-
-//IntegrityMontitor
-import org.openecomp.policy.common.im.IntegrityMonitor;
-import org.openecomp.policy.common.im.IntegrityMonitorProperties;
-import org.openecomp.policy.common.im.StandbyStatusException;
-//IntegrityAudit
-import org.openecomp.policy.common.ia.IntegrityAudit;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-
 
 /**
  * Servlet implementation class XacmlPapServlet
- * 
- * 
  */
 @WebServlet(
 		description = "Implements the XACML PAP RESTful API.", 
 		urlPatterns = { "/" }, 
 		loadOnStartup=1,
 		initParams = {
-				@WebInitParam(name = "XACML_PROPERTIES_NAME", value = "xacml.pap.properties", description = "The location of the properties file holding configuration information.")
+			@WebInitParam(name = "XACML_PROPERTIES_NAME", value = "xacml.pap.properties", description = "The location of the properties file holding configuration information.")
 		})
-
 public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeListener, Runnable {
 	private static final long serialVersionUID = 1L;
-	private static final Logger logger	= FlexLogger.getLogger(XACMLPapServlet.class);
-
-	private static String CONFIG_HOME = getConfigHome();
-	private static String ACTION_HOME = getActionHome();
-
-	// audit (transaction) logger
+	private static final Logger LOGGER	= FlexLogger.getLogger(XACMLPapServlet.class);
+	// audit (transaction) LOGGER
 	private static final Logger auditLogger = FlexLogger.getLogger("auditLogger");
-
-	private IntegrityMonitor im;
-	private IntegrityAudit ia;
-
+	//Persistence Unit for JPA 
+	private static final String PERSISTENCE_UNIT = "XACML-PAP-REST";
+	private static final String AUDIT_PAP_PERSISTENCE_UNIT = "auditPapPU";
+	// Client Headers. 
+	private static final String ENVIRONMENT_HEADER = "Environment";
 	/*
+	 * List of Admin Console URLs.
+	 * Used to send notifications when configuration changes.
 	 * 
-	 * papEngine - This is our engine workhorse that manages the PDP Groups and Nodes.
+	 * The CopyOnWriteArrayList *should* protect from concurrency errors.
+	 * This list is seldom changed but often read, so the costs of this approach make sense.
 	 */
-	private PAPPolicyEngine papEngine = null;
+	private static final CopyOnWriteArrayList<String> adminConsoleURLStringList = new CopyOnWriteArrayList<String>();	
+	
+	private static String CONFIG_HOME;
+	private static String ACTION_HOME;
 	/*
 	 * This PAP instance's own URL.
-	 * 
 	 * Need this when creating URLs to send to the PDPs so they can GET the Policy files from this process. 
 	 */
 	private static String papURL = null;
-
+	// The heartbeat thread.
+	private static Heartbeat heartbeat = null;
+	private static Thread heartbeatThread = null;
+	//The entity manager factory for JPA access
+	private static EntityManagerFactory emf;
+	private static PolicyDBDao policyDBDao;
+	/*
+	 * papEngine - This is our engine workhorse that manages the PDP Groups and Nodes.
+	 */
+	private static PAPPolicyEngine papEngine = null;
 	/*
 	 * These are the parameters needed for DB access from the PAP
 	 */
+	private static int papIntegrityAuditPeriodSeconds = -1;
 	public static String papDbDriver = null;
 	public static String papDbUrl = null;
 	public static String papDbUser = null;
@@ -212,142 +170,98 @@
 	private static String papSiteName=null;
 	private static String papNodeType=null;	
 	private static String papDependencyGroups = null;
-	private String storedRequestId = null;
-	private static int papIntegrityAuditPeriodSeconds = -1;
 	private static String[] papDependencyGroupsFlatArray = null;
-
-	//The entity manager factory for JPA access
-	private EntityManagerFactory emf;
-
-	//Persistence Unit for JPA 
-	private static final String PERSISTENCE_UNIT = "XACML-PAP-REST";
-	private static final String AUDIT_PAP_PERSISTENCE_UNIT = "auditPapPU";
-
-
-	/*
-	 * List of Admin Console URLs.
-	 * Used to send notifications when configuration changes.
-	 * 
-	 * The CopyOnWriteArrayList *should* protect from concurrency errors.
-	 * This list is seldom changed but often read, so the costs of this approach make sense.
-	 */
-	private static final CopyOnWriteArrayList<String> adminConsoleURLStringList = new CopyOnWriteArrayList<String>();
-
-	// Mike M 11/24 Client Headers. 
-	private static final String ENVIRONMENT_HEADER = "Environment";
 	private static String environment = null;
-
+	private static String pdpFile = null;
+	
+	private String storedRequestId = null;
+	private IntegrityMonitor im;
+	private IntegrityAudit ia;
+	
+	//MicroService Model Properties
+	public static String msEcompName;
+	public static String msPolicyName;
 	/*
 	 * This thread may be invoked upon startup to initiate sending PDP policy/pip configuration when
 	 * this servlet starts. Its configurable by the admin.
 	 */
 	private Thread initiateThread = null;
-
-	/*
-	// The heartbeat thread.
-	 */
-	private static Heartbeat heartbeat = null;
-	private static Thread heartbeatThread = null;
-
 	private ECOMPLoggingContext baseLoggingContext = null;
-
-	private PolicyDBDao policyDBDao;
 	private AutoPushPolicy autoPushPolicy;
+	
 	/**
 	 * @see HttpServlet#HttpServlet()
 	 */
 	public XACMLPapServlet() {
 		super();
 	}
-	/*
-	 * PDP FIle
-	 */
-	private static String pdpFile = null;
-	public static String getPDPFile(){
-		return XACMLPapServlet.pdpFile;
-	}
 
 	/**
 	 * @see Servlet#init(ServletConfig)
 	 */
 	public void init(ServletConfig config) throws ServletException {
-
-
 		try {
-			//
-			// Logging stuff....
-			//
+			// Logging
 			baseLoggingContext = new ECOMPLoggingContext();
 			// fixed data that will be the same in all logging output goes here
 			try {
 				String hostname = InetAddress.getLocalHost().getCanonicalHostName();
 				baseLoggingContext.setServer(hostname);
 			} catch (UnknownHostException e) {
-				logger.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get hostname for logging");
+				LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get hostname for logging");
 			}
-
-			//
 			// Initialize
-			//
 			XACMLRest.xacmlInit(config);
-			//
 			// Load the properties
-			//
 			XACMLRest.loadXacmlProperties(null, null);
-
 			/*
-			 * Retrieve the property values for db access and audits from the xacml.pap.properties
+			 * Retrieve the property values
 			 */
-			//Null string occurs when a property is not present
-			try{
-				papDbDriver = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_DRIVER);
-				if(papDbDriver == null){
-					throw new PAPException("papDbDriver is null");
-				}
+			CONFIG_HOME = getConfigHome();
+			ACTION_HOME = getActionHome();
+			papDbDriver = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_DRIVER);
+			if(papDbDriver == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papDbDriver property entry");
+				throw new PAPException("papDbDriver is null");
 			}
-			catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
+			papDbUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_URL);
+			if(papDbUrl == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papDbUrl property entry");
+				throw new PAPException("papDbUrl is null");
 			}
-			try{
-				papDbUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_URL);
-				if(papDbUrl == null){
-					throw new PAPException("papDbUrl is null");
-				}
-			} catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
+			papDbUser = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_USER);
+			if(papDbUser == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papDbUser property entry");
+				throw new PAPException("papDbUser is null");
 			}
-			try{
-				papDbUser = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_USER);
-				if(papDbUser == null){
-					throw new PAPException("papDbUser is null");
-				}
-			}catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
+			papDbPassword = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_PASSWORD);
+			if(papDbPassword == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papDbPassword property entry");
+				throw new PAPException("papDbPassword is null");
 			}
-			try{
-				papDbPassword = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_PASSWORD);
-				if(papDbPassword == null){
-					throw new PAPException("papDbPassword is null");
-				}
-			}catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
+			papResourceName = XACMLProperties.getProperty(XACMLRestProperties.PAP_RESOURCE_NAME);
+			if(papResourceName == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papResourceName property entry");
+				throw new PAPException("papResourceName is null");
 			}
-
+			papSiteName = XACMLProperties.getProperty(XACMLRestProperties.PAP_SITE_NAME);
+			if(papSiteName == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papSiteName property entry");
+				throw new PAPException("papSiteName is null");
+			}
+			papNodeType = XACMLProperties.getProperty(XACMLRestProperties.PAP_NODE_TYPE);
+			if(papNodeType == null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE,"XACMLPapServlet", " ERROR: Bad papNodeType property entry");
+				throw new PAPException("papNodeType is null");
+			}
 			environment = XACMLProperties.getProperty("ENVIRONMENT", "DEVL");
-
 			//Integer will throw an exception of anything is missing or unrecognized
 			papTransWait = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_TRANS_WAIT));
 			papTransTimeout = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_TRANS_TIMEOUT));
 			papAuditTimeout = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_AUDIT_TIMEOUT));
-
 			//Boolean will default to false if anything is missing or unrecognized
 			papAuditFlag = Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_RUN_AUDIT_FLAG));
 			papFileSystemAudit = Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_AUDIT_FLAG));
-
 			//PAP Auto Push 
 			autoPushFlag = Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PUSH_FLAG));
 			// if Auto push then Load with properties. 
@@ -358,51 +272,21 @@
 					if(file.endsWith(".properties")){
 						autoPushPolicy = new AutoPushPolicy(file);
 					}else{
-						throw new Exception();
+						throw new PAPException();
 					}
 				}catch(Exception e){
 					PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Missing property or not a proper property file check for: " + XACMLRestProperties.PROP_PAP_PUSH_FILE );  
-					logger.info("Overriding the autoPushFlag to False...");
+					LOGGER.info("Overriding the autoPushFlag to False...");
 					autoPushFlag = false;
 				}
 			}
-
-			try{
-				papResourceName = XACMLProperties.getProperty(XACMLRestProperties.PAP_RESOURCE_NAME);
-				if(papResourceName == null){
-					throw new PAPException("papResourceName is null");
-				}
-			}catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
-			}
-
-			try{
-				papSiteName = XACMLProperties.getProperty(XACMLRestProperties.PAP_SITE_NAME);
-				if(papSiteName == null){
-					throw new PAPException("papSiteName is null");
-				}
-			}catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
+			papDependencyGroups = XACMLProperties.getProperty(XACMLRestProperties.PAP_DEPENDENCY_GROUPS);
+			if(papDependencyGroups == null){
+				throw new PAPException("papDependencyGroups is null");
 			}
 			try{
-				papNodeType = XACMLProperties.getProperty(XACMLRestProperties.PAP_NODE_TYPE);
-				if(papNodeType == null){
-					throw new PAPException("papNodeType is null");
-				}
-			}catch(Exception e){
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
-				throw e;
-			}
-			try{
-				papDependencyGroups = XACMLProperties.getProperty(XACMLRestProperties.PAP_DEPENDENCY_GROUPS);
-				if(papDependencyGroups == null){
-					throw new PAPException("papDependencyGroups is null");
-				}
 				//Now we have flattened the array into a simple comma-separated list
 				papDependencyGroupsFlatArray = papDependencyGroups.split("[;,]");
-
 				//clean up the entries
 				for (int i = 0 ; i < papDependencyGroupsFlatArray.length ; i ++){
 					papDependencyGroupsFlatArray[i] = papDependencyGroupsFlatArray[i].trim();
@@ -410,12 +294,10 @@
 				try{
 					if(XACMLProperties.getProperty(XACMLRestProperties.PAP_INTEGRITY_AUDIT_PERIOD_SECONDS) != null){
 						papIntegrityAuditPeriodSeconds = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PAP_INTEGRITY_AUDIT_PERIOD_SECONDS).trim());
-					}else{
-						//nothing to do.  The parameter is optional
 					}
 				}catch(Exception e){
 					String msg = "integrity_audit_period_seconds ";
-					logger.error("\n\nERROR: " + msg + "Bad property entry: " + e.getMessage() + "\n");
+					LOGGER.error("\n\nERROR: " + msg + "Bad property entry: " + e.getMessage() + "\n");
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: " + msg +"Bad property entry");
 					throw e;
 				}
@@ -423,14 +305,12 @@
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
 				throw e;
 			}
-
 			//Integer will throw an exception of anything is missing or unrecognized
 			fpMonitorInterval = Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL));
 			failedCounterThreshold = Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD));
 			testTransInterval = Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL));
 			writeFpcInterval = Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL));
-
-			logger.debug("\n\n\n**************************************"
+			LOGGER.debug("\n\n\n**************************************"
 					+ "\n**************************************"
 					+ "\n"
 					+ "\n   papDbDriver = " + papDbDriver
@@ -454,153 +334,91 @@
 					+ "\n   papIntegrityAuditPeriodSeconds = " + papIntegrityAuditPeriodSeconds
 					+ "\n\n**************************************"
 					+ "\n**************************************");
-
-			//
 			// Pull custom persistence settings
-			//
-
 			Properties properties;
 			try {
-				properties = XACMLProperties.getProperties();//XACMLRestProperties.getProperties();
-				logger.debug("\n\n\n**************************************"
+				properties = XACMLProperties.getProperties();
+				LOGGER.debug("\n\n\n**************************************"
 						+ "\n**************************************"
 						+ "\n\n"
 						+ "properties = " + properties
 						+ "\n\n**************************************");
-
 			} catch (IOException e) {
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPapServlet", " Error loading properties with: "
 						+ "XACMLProperties.getProperties()");
 				throw new ServletException(e.getMessage(), e.getCause());
 			}
-
+			//Micro Service Properties
+			msEcompName=properties.getProperty("xacml.policy.msEcompName");
+			msPolicyName=properties.getProperty("xacml.policy.msPolicyName");
+			// PDPId File location 
+			XACMLPapServlet.pdpFile = XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_IDFILE);
+			if (XACMLPapServlet.pdpFile == null) {
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " The PDP Id Authentication File Property is not valid: "
+					+ XACMLRestProperties.PROP_PDP_IDFILE);
+				throw new PAPException("The PDP Id Authentication File Property :"+ XACMLRestProperties.PROP_PDP_IDFILE+ " is not Valid. ");
+			}
 			// Create an IntegrityMonitor
 			im = IntegrityMonitor.getInstance(papResourceName,properties);
-
 			// Create an IntegrityAudit
 			ia = new IntegrityAudit(papResourceName, AUDIT_PAP_PERSISTENCE_UNIT, properties);
 			ia.startAuditThread();
-
-			//
 			// Create the entity manager factory
-			//
 			emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT, properties);
-			//
-			// Did it get created?
-			//
 			if (emf == null) {
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Error creating entity manager factory with persistence unit: "
 						+ PERSISTENCE_UNIT);
 				throw new ServletException("Unable to create Entity Manager Factory");
 			}
-			//
 			// we are about to call the PDPs and give them their configuration.
 			// To do that we need to have the URL of this PAP so we can construct the Policy file URLs
-			//
 			XACMLPapServlet.papURL = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
-			/*
-			 * Create the PolicyDBDao singleton
-			 */		
 			//Create the policyDBDao
 			policyDBDao = PolicyDBDao.getPolicyDBDaoInstance(getEmf());
-			boolean performFileToDatabaseAudit = false;
-			if (Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_RUN_AUDIT_FLAG))){
-				if (Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_AUDIT_FLAG))){
-					//get an AuditTransaction to lock out all other transactions
-					PolicyDBDaoTransaction auditTrans = policyDBDao.getNewAuditTransaction();
-					policyDBDao.auditLocalFileSystem();
-					//release the transaction lock
-					auditTrans.close();
-				}else{
-					performFileToDatabaseAudit = true;					
-				}
-			}
-
-
-
-			//
 			// Load our PAP engine, first create a factory
-			//
 			ECOMPPapEngineFactory factory = ECOMPPapEngineFactory.newInstance(XACMLProperties.getProperty(XACMLProperties.PROP_PAP_PAPENGINEFACTORY));
-			//
 			// The factory knows how to go about creating a PAP Engine
-			//
-			this.papEngine = (PAPPolicyEngine) factory.newEngine();
+			XACMLPapServlet.papEngine = (PAPPolicyEngine) factory.newEngine();
 			PolicyDBDaoTransaction addNewGroup = null;
 			try{
-
 				if(((org.openecomp.policy.xacml.std.pap.StdEngine)papEngine).wasDefaultGroupJustAdded){
 					addNewGroup = policyDBDao.getNewTransaction();
 					EcompPDPGroup group = papEngine.getDefaultGroup();
 					addNewGroup.createGroup(group.getId(), group.getName(), group.getDescription(), "automaticallyAdded");
 					addNewGroup.commitTransaction();
-					addNewGroup = policyDBDao.getNewTransaction();					
+					addNewGroup = policyDBDao.getNewTransaction();
 					addNewGroup.changeDefaultGroup(group, "automaticallyAdded");
-					addNewGroup.commitTransaction();				
+					addNewGroup.commitTransaction();
 				}
-
 			} catch(Exception e){
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " Error creating new default group in the database");
 				if(addNewGroup != null){
 					addNewGroup.rollbackTransaction();
 				}
 			}
-
-			policyDBDao.setPapEngine((PAPPolicyEngine) this.papEngine);
-
-
-			if(performFileToDatabaseAudit){
-				//get an AuditTransaction to lock out all other transactions
-				PolicyDBDaoTransaction auditTrans = policyDBDao.getNewAuditTransaction();
-				policyDBDao.auditLocalDatabase((PAPPolicyEngine) this.papEngine);
-				//release the transaction lock
-				auditTrans.close();
-			}
-
-			//
-			// PDPId File location 
-			//
-			XACMLPapServlet.pdpFile = XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_IDFILE);
-			if (XACMLPapServlet.pdpFile == null) {
-				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + 
-						" The PDP Id Authentication File Property is not valid: "
-						+ XACMLRestProperties.PROP_PDP_IDFILE);
-				throw new PAPException("The PDP Id Authentication File Property :"+ XACMLRestProperties.PROP_PDP_IDFILE+ " is not Valid. ");
-			}
-			//
-			// Sanity check that a URL was defined somewhere, its essential.
-			//
-			// How to check that its valid? We can validate the form, but since we are in the init() method we
-			// are not fully loaded yet so we really couldn't ping ourself to see if the URL will work. One
-			// will have to look for errors in the PDP logs to determine if they are failing to initiate a
-			// request to this servlet.
-			//
+			policyDBDao.setPapEngine((PAPPolicyEngine) XACMLPapServlet.papEngine);
+			// Sanity check for URL.
 			if (XACMLPapServlet.papURL == null) {
-
 				throw new PAPException("The property " + XACMLRestProperties.PROP_PAP_URL + " is not valid: " + XACMLPapServlet.papURL);
 			}
-			//
 			// Configurable - have the PAP servlet initiate sending the latest PDP policy/pip configuration
 			// to all its known PDP nodes.
-			//
-			// Note: parseBoolean will return false if there is no property defined. This is fine for a default.
-			//
 			if (Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_INITIATE_PDP_CONFIG))) {
 				this.initiateThread = new Thread(this);
 				this.initiateThread.start();
 			}
-			//
-			// After startup, the PAP does Heartbeats to each of the PDPs periodically
-			//
-			XACMLPapServlet.heartbeat = new Heartbeat((PAPPolicyEngine) this.papEngine);
+			// After startup, the PAP does Heartbeat's to each of the PDPs periodically
+			XACMLPapServlet.heartbeat = new Heartbeat((PAPPolicyEngine) XACMLPapServlet.papEngine);
 			XACMLPapServlet.heartbeatThread = new Thread(XACMLPapServlet.heartbeat);
 			XACMLPapServlet.heartbeatThread.start();
+
 		} catch (FactoryException | PAPException e) {
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Failed to create engine");
 			throw new ServletException (XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP not initialized; error: "+e);
 		} catch (Exception e) {
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Failed to create engine - unexpected error");
-			throw new ServletException (XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP not initialized; unexpected error: "+e);		}
+			throw new ServletException (XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP not initialized; unexpected error: "+e);
+		}
 	}
 
 	/**
@@ -609,13 +427,10 @@
 	 */
 	@Override
 	public void run() {
-		//
 		// send the current configuration to all the PDPs that we know about
-		//
 		changed();
 	}
 
-
 	/**
 	 * @see Servlet#destroy()
 	 * 
@@ -623,13 +438,9 @@
 	 * For now we assume that we do care.
 	 */
 	public void destroy() {
-		//
 		// Make sure our threads are destroyed
-		//
 		if (XACMLPapServlet.heartbeatThread != null) {
-			//
 			// stop the heartbeat
-			//
 			try {
 				if (XACMLPapServlet.heartbeat != null) {
 					XACMLPapServlet.heartbeat.terminate();
@@ -651,7 +462,6 @@
 	}
 
 	/**
-	 * 
 	 * Called by:
 	 * 	- PDP nodes to register themselves with the PAP, and
 	 * 	- Admin Console to make changes in the PDP Groups.
@@ -660,9 +470,8 @@
 	 */
 	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 		ECOMPLoggingContext loggingContext = ECOMPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
-
 		loggingContext.transactionStarted();
-		loggingContext.setServiceName("PAP.post"); // we may set a more specific value later
+		loggingContext.setServiceName("PAP.post");
 		if ((loggingContext.getRequestID() == null) || (loggingContext.getRequestID() == "")){
 			UUID requestID = UUID.randomUUID();
 			loggingContext.setRequestID(requestID.toString());
@@ -670,139 +479,86 @@
 		} else {
 			PolicyLogger.info("requestID was provided in call to XACMLPapSrvlet (doPost)");
 		}
-		// dummy metric.log example posted below as proof of concept
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 1 of 2");
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 2 of 2");
-		// dummy metric.log example posted above as proof of concept
 		PolicyDBDaoTransaction pdpTransaction = null;
-
-		//This im.startTransaction() covers all Post transactions
 		try {
 			im.startTransaction();
 		} catch (AdministrativeStateException ae){
 			String message = "POST interface called for PAP " + papResourceName + " but it has an Administrative"
 					+ " state of " + im.getStateManager().getAdminState()
 					+ "\n Exception Message: " + ae.getMessage();
-			logger.info(message);
+			LOGGER.info(message);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
-
 			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 			return;
 		}catch (StandbyStatusException se) {
-			se.printStackTrace();
 			String message = "POST interface called for PAP " + papResourceName + " but it has a Standby Status"
 					+ " of " + im.getStateManager().getStandbyStatus()
 					+ "\n Exception Message: " + se.getMessage();
-			logger.info(message);
+			LOGGER.info(message);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
-
 			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 			return;
 		}
-
 		try {
-
 			XACMLRest.dumpRequest(request);
-
 			// since getParameter reads the content string, explicitly get the content before doing that.
 			// Simply getting the inputStream seems to protect it against being consumed by getParameter.
 			request.getInputStream();
-
-
 			String groupId = request.getParameter("groupId");
 			String apiflag = request.getParameter("apiflag");
-
-			if (groupId != null) {
+			if(groupId != null) {
 				// Is this from the Admin Console or API?
-				if(apiflag!=null) {
-					if (apiflag.equalsIgnoreCase("api")) {
-						// this is from the API so we need to check the client credentials before processing the request
-						if(authorizeRequest(request)){
-							doACPost(request, response, groupId, loggingContext);
-							// Mike B - ended loggingContext transacton & added EELF 'Success' EELF Audit.log message
-							loggingContext.transactionEnded();
-							PolicyLogger.audit("Transaction Ended Successfully");
-							im.endTransaction();
-							return;
-						} else {
-							String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
-							PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
-							loggingContext.transactionEnded();
-
-							PolicyLogger.audit("Transaction Failed - See Error.log");
-
-							response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
-							im.endTransaction();
-							return;
-						}
+				if(apiflag!=null && apiflag.equalsIgnoreCase("api")) {
+					// this is from the API so we need to check the client credentials before processing the request
+					if(!authorizeRequest(request)){
+						String message = "PEP not Authorized for making this Request!!";
+						PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
+						loggingContext.transactionEnded();
+						PolicyLogger.audit("Transaction Failed - See Error.log");
+						response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
+						im.endTransaction();
+						return;
 					}
 				}
-
-				// this is from the Admin Console, so handle separately
 				doACPost(request, response, groupId, loggingContext);
 				loggingContext.transactionEnded();
 				PolicyLogger.audit("Transaction Ended Successfully");
 				im.endTransaction();
 				return;
-
 			}
-
-
-			//
-			//  Request is from a PDP.
-			//	It is coming up and asking for its config
-			//
+			// Request is from a PDP asking for its config.
 			loggingContext.setServiceName("PDP:PAP.register");
-
-
-			//
 			// Get the PDP's ID
-			//
 			String id = this.getPDPID(request);
 			String jmxport = this.getPDPJMX(request);
-			//logger.info("doPost from: " + id);
-			logger.info("Request(doPost) from PDP coming up: " + id);
-			//
+			LOGGER.info("Request(doPost) from PDP coming up: " + id);
 			// Get the PDP Object
-			//
-			EcompPDP pdp = this.papEngine.getPDP(id);
-			//
+			EcompPDP pdp = XACMLPapServlet.papEngine.getPDP(id);
 			// Is it known?
-			//
 			if (pdp == null) {
-				logger.info("Unknown PDP: " + id);
-				// PDP ID Check is performed Here. 
+				LOGGER.info("Unknown PDP: " + id);
+				// Check PDP ID
 				if(CheckPDP.validateID(id)){
 					pdpTransaction = policyDBDao.getNewTransaction();
 					try {
-						//this.papEngine.newPDP(id, this.papEngine.getDefaultGroup(), id, "Registered on first startup");
-						pdpTransaction.addPdpToGroup(id, this.papEngine.getDefaultGroup().getId(), id, "Registered on first startup", Integer.parseInt(jmxport), "PDP autoregister");
-						this.papEngine.newPDP(id, this.papEngine.getDefaultGroup(), id, "Registered on first startup", Integer.parseInt(jmxport));
+						pdpTransaction.addPdpToGroup(id, XACMLPapServlet.papEngine.getDefaultGroup().getId(), id, "Registered on first startup", Integer.parseInt(jmxport), "PDP autoregister");
+						XACMLPapServlet.papEngine.newPDP(id, XACMLPapServlet.papEngine.getDefaultGroup(), id, "Registered on first startup", Integer.parseInt(jmxport));
 					} catch (NullPointerException | PAPException | IllegalArgumentException | IllegalStateException | PersistenceException e) {
 						pdpTransaction.rollbackTransaction();
 						String message = "Failed to create new PDP for id: " + id;
 						PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " " + message);
 						loggingContext.transactionEnded();
-
 						PolicyLogger.audit("Transaction Failed - See Error.log");
-
-						PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " " + message);
 						response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
 						im.endTransaction();
 						return;
 					}
 					// get the PDP we just created
-					pdp = this.papEngine.getPDP(id);
+					pdp = XACMLPapServlet.papEngine.getPDP(id);
 					if (pdp == null) {
 						if(pdpTransaction != null){
 							pdpTransaction.rollbackTransaction();
@@ -810,7 +566,6 @@
 						String message = "Failed to create new PDP for id: " + id;
 						PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " " + message);
 						loggingContext.transactionEnded();
-
 						PolicyLogger.audit("Transaction Failed - See Error.log");
 						response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 						im.endTransaction();
@@ -825,35 +580,17 @@
 					im.endTransaction();
 					return;
 				}
-				// get the PDP we just created
-				pdp = this.papEngine.getPDP(id);
-				if (pdp == null) {
-					if(pdpTransaction != null){
-						pdpTransaction.rollbackTransaction();
-					}
-					String message = "Failed to create new PDP for id: " + id;
-					PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
-					loggingContext.transactionEnded();
-					PolicyLogger.audit("Transaction Failed - See Error.log");
-					response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
-					im.endTransaction();
-					return;
-				}
 				try{
 					pdpTransaction.commitTransaction();
 				} catch(Exception e){
 					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", "Could not commit transaction to put pdp in the database");
 				}
 			}
-
 			if (jmxport != null && jmxport != ""){
 				((StdPDP) pdp).setJmxPort(Integer.valueOf(jmxport));
 			}
-
-			//
 			// Get the PDP's Group
-			//
-			EcompPDPGroup group = this.papEngine.getPDPGroup((EcompPDP) pdp);
+			EcompPDPGroup group = XACMLPapServlet.papEngine.getPDPGroup((EcompPDP) pdp);
 			if (group == null) {
 				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " PDP not associated with any group, even the default");
 				loggingContext.transactionEnded();
@@ -862,67 +599,42 @@
 				im.endTransaction();
 				return;
 			}
-			//
 			// Determine what group the PDP node is in and get
 			// its policy/pip properties.
-			//
 			Properties policies = group.getPolicyProperties();
 			Properties pipconfig = group.getPipConfigProperties();
-			//
 			// Get the current policy/pip configuration that the PDP has
-			//
 			Properties pdpProperties = new Properties();
 			pdpProperties.load(request.getInputStream());
-			logger.info("PDP Current Properties: " + pdpProperties.toString());
-			logger.info("Policies: " + (policies != null ? policies.toString() : "null"));
-			logger.info("Pip config: " + (pipconfig != null ? pipconfig.toString() : "null"));
-			//
+			LOGGER.info("PDP Current Properties: " + pdpProperties.toString());
+			LOGGER.info("Policies: " + (policies != null ? policies.toString() : "null"));
+			LOGGER.info("Pip config: " + (pipconfig != null ? pipconfig.toString() : "null"));
 			// Validate the node's properties
-			//
 			boolean isCurrent = this.isPDPCurrent(policies, pipconfig, pdpProperties);
-			//
 			// Send back current configuration
-			//
 			if (isCurrent == false) {
-				//
 				// Tell the PDP we are sending back the current policies/pip config
-				//
-				logger.info("PDP configuration NOT current.");
+				LOGGER.info("PDP configuration NOT current.");
 				if (policies != null) {
-					//
 					// Put URL's into the properties in case the PDP needs to
 					// retrieve them.
-					//
 					this.populatePolicyURL(request.getRequestURL(), policies);
-					//
 					// Copy the properties to the output stream
-					//
 					policies.store(response.getOutputStream(), "");
 				}
 				if (pipconfig != null) {
-					//
 					// Copy the properties to the output stream
-					//
 					pipconfig.store(response.getOutputStream(), "");
 				}
-				//
 				// We are good - and we are sending them information
-				//
 				response.setStatus(HttpServletResponse.SC_OK);
-
 				setPDPSummaryStatus(pdp, PDPStatus.Status.OUT_OF_SYNCH);
 			} else {
-				//
 				// Tell them they are good
-				//
 				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-
 				setPDPSummaryStatus(pdp, PDPStatus.Status.UP_TO_DATE);
-
 			}
-			//
 			// tell the AC that something changed
-			//
 			notifyAC();
 			loggingContext.transactionEnded();
 			auditLogger.info("Success");
@@ -931,11 +643,9 @@
 			if(pdpTransaction != null){
 				pdpTransaction.rollbackTransaction();
 			}
-			logger.debug(XACMLErrorConstants.ERROR_PROCESS_FLOW + "POST exception: " + e, e);
+			LOGGER.debug(XACMLErrorConstants.ERROR_PROCESS_FLOW + "POST exception: " + e, e);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
-
 			response.sendError(500, e.getMessage());
 			im.endTransaction();
 			return;
@@ -952,7 +662,7 @@
 	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 		ECOMPLoggingContext loggingContext = ECOMPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
 		loggingContext.transactionStarted();
-		loggingContext.setServiceName("PAP.get"); // we may set a more specific value later
+		loggingContext.setServiceName("PAP.get");
 		if ((loggingContext.getRequestID() == null) || (loggingContext.getRequestID() == "")){
 			UUID requestID = UUID.randomUUID();
 			loggingContext.setRequestID(requestID.toString());
@@ -960,98 +670,17 @@
 		} else {
 			PolicyLogger.info("requestID was provided in call to XACMLPapSrvlet (doGet)");
 		}
-		// dummy metric.log example posted below as proof of concept
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 1 of 2");
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 2 of 2");
-		// dummy metric.log example posted above as proof of concept
 		try {
 			XACMLRest.dumpRequest(request);
 			String pathInfo = request.getRequestURI();
-			logger.info("path info: " + pathInfo);
+			LOGGER.info("path info: " + pathInfo);
 			if (pathInfo != null){
 				//DO NOT do a im.startTransaction for the test request
 				if (pathInfo.equals("/pap/test")) {
-					logger.info("Test request received");
-					try {
-						im.evaluateSanity();
-						//If we make it this far, all is well
-						String message = "GET:/pap/test called and PAP " + papResourceName + " is OK";
-						logger.info(message);
-						loggingContext.transactionEnded();
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						response.setStatus(HttpServletResponse.SC_OK);
-						return;
-					}catch (ForwardProgressException fpe){
-						//No forward progress is being made
-						String message = "GET:/pap/test called and PAP " + papResourceName + " is not making forward progress."
-								+ " Exception Message: " + fpe.getMessage();
-						logger.info(message);
-						PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
-						loggingContext.transactionEnded();
-
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
-						return;
-					}catch (AdministrativeStateException ase){
-						//Administrative State is locked
-						String message = "GET:/pap/test called and PAP " + papResourceName + " Administrative State is LOCKED "
-								+ " Exception Message: " + ase.getMessage();
-						logger.info(message);
-						PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
-						loggingContext.transactionEnded();
-
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
-						return;
-					}catch (StandbyStatusException sse){
-						//Administrative State is locked
-						String message = "GET:/pap/test called and PAP " + papResourceName + " Standby Status is NOT PROVIDING SERVICE "
-								+ " Exception Message: " + sse.getMessage();
-						logger.info(message);
-						PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
-						loggingContext.transactionEnded();
-
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
-						return;
-					}catch (Exception e) {
-						//A subsystem is not making progress, is locked, standby or is not responding
-						String eMsg = e.getMessage();
-						if(eMsg == null){
-							eMsg = "No Exception Message";
-						}
-						String message = "GET:/pap/test called and PAP " + papResourceName + " has had a subsystem failure."
-								+ " Exception Message: " + eMsg;
-						logger.info(message);
-						PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
-						loggingContext.transactionEnded();
-
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						//Get the specific list of subsystems that failed
-						String ssFailureList = null;
-						for(String failedSS : papDependencyGroupsFlatArray){
-							if(eMsg.contains(failedSS)){
-								if(ssFailureList == null){
-									ssFailureList = failedSS;
-								}else{
-									ssFailureList = ssFailureList.concat(","+failedSS);
-								}
-							}
-						}
-						if(ssFailureList == null){
-							ssFailureList = "UnknownSubSystem";
-						}
-						response.addHeader("X-ECOMP-SubsystemFailure", ssFailureList);
-						response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
-						return;
-					}
+					testService(loggingContext, response);
+					return;
 				}
 			}
-
 			//This im.startTransaction() covers all other Get transactions
 			try {
 				im.startTransaction();
@@ -1059,76 +688,43 @@
 				String message = "GET interface called for PAP " + papResourceName + " but it has an Administrative"
 						+ " state of " + im.getStateManager().getAdminState()
 						+ "\n Exception Message: " + ae.getMessage();
-				logger.info(message);
+				LOGGER.info(message);
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 				return;
 			}catch (StandbyStatusException se) {
-				se.printStackTrace();
 				String message = "GET interface called for PAP " + papResourceName + " but it has a Standby Status"
 						+ " of " + im.getStateManager().getStandbyStatus()
 						+ "\n Exception Message: " + se.getMessage();
-				logger.info(message);
+				LOGGER.info(message);
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 				return;
 			}
-
-
 			// Request from the API to get the gitPath
 			String apiflag = request.getParameter("apiflag");
 			if (apiflag!=null) {
 				if(authorizeRequest(request)){
-
-
-					// Request from the API to get the gitPath
-					if (apiflag.equalsIgnoreCase("gitPath")) {
-						getGitPath(request, response);
-						// Mike B - ended loggingContext transacton & added EELF 'Success' EELF Audit.log message
-						loggingContext.transactionEnded();
-						PolicyLogger.audit("Transaction Ended Successfully");
-						im.endTransaction();
-						return;
-					}
-
-					// Request from the API to get the ActiveVersion from the PolicyVersion table
-					if (apiflag.equalsIgnoreCase("version")){
-						getActiveVersion(request, response);
-						loggingContext.transactionEnded();
-						PolicyLogger.audit("Transaction Ended Successfully");
-						im.endTransaction();
-						return;
-					}
-
-					// Request from the API to get the URI from the gitpath
-					if (apiflag.equalsIgnoreCase("uri")){
-						getSelectedURI(request, response);
-						loggingContext.transactionEnded();
-						PolicyLogger.audit("Transaction Ended Successfully");
-						im.endTransaction();
-						return;
-					}
-
+					APIRequestHandler apiRequestHandler = new APIRequestHandler();
+					apiRequestHandler.doGet(request,response, apiflag);
+					loggingContext.transactionEnded();
+					PolicyLogger.audit("Transaction Ended Successfully");
+					im.endTransaction();
+					return;
 				} else {
 					String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
 					PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
 					loggingContext.transactionEnded();
-
 					PolicyLogger.audit("Transaction Failed - See Error.log");
 					response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
 					im.endTransaction();
 					return;
 				}
-
 			}
-
-
 			// Is this from the Admin Console?
 			String groupId = request.getParameter("groupId");
 			if (groupId != null) {
@@ -1139,32 +735,20 @@
 				im.endTransaction();
 				return;
 			}
-
-			//
 			// Get the PDP's ID
-			//
 			String id = this.getPDPID(request);
-			logger.info("doGet from: " + id);
-			//
+			LOGGER.info("doGet from: " + id);
 			// Get the PDP Object
-			//
-			EcompPDP pdp = this.papEngine.getPDP(id);
-			//
+			EcompPDP pdp = XACMLPapServlet.papEngine.getPDP(id);
 			// Is it known?
-			//
 			if (pdp == null) {
-				//
 				// Check if request came from localhost
-				//
 				if (request.getRemoteHost().equals("localhost") ||
 						request.getRemoteHost().equals("127.0.0.1") ||
 						request.getRemoteHost().equals(request.getLocalAddr())) {
-					//
 					// Return status information - basically all the groups
-					//
 					loggingContext.setServiceName("PAP.getGroups");
 					Set<EcompPDPGroup> groups = papEngine.getEcompPDPGroups();
-
 					// convert response object to JSON and include in the response
 					ObjectMapper mapper = new ObjectMapper();
 					mapper.writeValue(response.getOutputStream(),  groups);
@@ -1178,38 +762,29 @@
 				String message = "Unknown PDP: " + id + " from " + request.getRemoteHost() + " us: " + request.getLocalAddr();
 				PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
 				im.endTransaction();
 				return;
 			}
-
 			loggingContext.setServiceName("PAP.getPolicy");
-
-			//
 			// Get the PDP's Group
-			//
-			EcompPDPGroup group = this.papEngine.getPDPGroup((EcompPDP) pdp);
+			EcompPDPGroup group = XACMLPapServlet.papEngine.getPDPGroup((EcompPDP) pdp);
 			if (group == null) {
 				String message = "No group associated with pdp " + pdp.getId();
-				logger.warn(XACMLErrorConstants.ERROR_PERMISSIONS + message);
+				LOGGER.warn(XACMLErrorConstants.ERROR_PERMISSIONS + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
 				im.endTransaction();
 				return;
 			}
-			//
 			// Which policy do they want?
-			//
 			String policyId = request.getParameter("id");
 			if (policyId == null) {
 				String message = "Did not specify an id for the policy";
-				logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + message);
+				LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
 				im.endTransaction();
@@ -1218,30 +793,23 @@
 			PDPPolicy policy = group.getPolicy(policyId);
 			if (policy == null) {
 				String message = "Unknown policy: " + policyId;
-				logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + message);
+				LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
 				im.endTransaction();
 				return;
 			}
-			//
-			// Get its stream
-			//
-			logger.warn("PolicyDebugging: Policy Validity: " + policy.isValid() + "\n "
-					+ "Policy Name : " + policy.getName() + "\n Policy URI: " + policy.getLocation().toString() );
-			try (InputStream is = policy.getStream(); OutputStream os = response.getOutputStream()) {
-				//
+			LOGGER.warn("PolicyDebugging: Policy Validity: " + policy.isValid() + "\n "
+					+ "Policy Name : " + policy.getName() + "\n Policy URI: " + policy.getLocation().toString());
+			try (InputStream is = new FileInputStream(((StdPDPGroup)group).getDirectory().toString()+File.separator+policyId); OutputStream os = response.getOutputStream()) {
 				// Send the policy back
-				//
 				IOUtils.copy(is, os);
-
 				response.setStatus(HttpServletResponse.SC_OK);
 				loggingContext.transactionEnded();
 				auditLogger.info("Success");
 				PolicyLogger.audit("Transaction Ended Successfully");
-			} catch (PAPException e) {
+			} catch (IOException e) {
 				String message = "Failed to open policy id " + policyId;
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
 				loggingContext.transactionEnded();
@@ -1251,7 +819,6 @@
 		}  catch (PAPException e) {
 			PolicyLogger.error(MessageCodes.ERROR_UNKNOWN, e, "XACMLPapServlet", " GET exception");
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
 			response.sendError(500, e.getMessage());
 			im.endTransaction();
@@ -1261,394 +828,7 @@
 		PolicyLogger.audit("Transaction Ended");
 		im.endTransaction();
 	}
-
-
-	/**
-	 * Requests from the PolicyEngine API to update the PDP Group with pushed policy
-	 * 
-	 * @param request
-	 * @param response
-	 * @param groupId
-	 * @param loggingContext 
-	 * @throws ServletException
-	 * @throws IOException
-	 */
-	private void updateGroupsFromAPI(HttpServletRequest request, HttpServletResponse response, String groupId, ECOMPLoggingContext loggingContext) throws IOException {
-		PolicyDBDaoTransaction acPutTransaction = policyDBDao.getNewTransaction();
-		try {
-
-
-			// for PUT operations the group may or may not need to exist before the operation can be done
-			StdPDPGroup group = (StdPDPGroup) papEngine.getGroup(groupId);
-
-			// get the request content into a String
-			String json = null;
-
-			// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
-			java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
-			scanner.useDelimiter("\\A");
-			json =  scanner.hasNext() ? scanner.next() : "";
-			scanner.close();
-			logger.info("JSON request from PolicyEngine API: " + json);
-
-			// convert Object sent as JSON into local object
-			ObjectMapper mapper = new ObjectMapper();
-
-			Object objectFromJSON = mapper.readValue(json, StdPDPPolicy.class);
-
-			StdPDPPolicy policy = (StdPDPPolicy) objectFromJSON;
-
-			Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
-
-			if(policy!=null){
-				policies.add(policy);
-			}
-
-			//Get the current policies from the Group and Add the new one
-			Set<PDPPolicy> currentPoliciesInGroup = new HashSet<PDPPolicy>();
-			currentPoliciesInGroup = group.getPolicies();
-
-			//If the selected policy is in the group we must remove it because the name is default
-			Iterator<PDPPolicy> policyIterator = policies.iterator();
-			logger.debug("policyIterator....." + policies);
-			while (policyIterator.hasNext()) {
-				PDPPolicy selPolicy = policyIterator.next();
-				for (PDPPolicy existingPolicy : currentPoliciesInGroup) {
-					if (existingPolicy.getId().equals(selPolicy.getId())) {
-						group.removePolicyFromGroup(existingPolicy);
-						logger.debug("Removing policy: " + existingPolicy);
-						break;
-					}
-				}
-			}
-
-			if(currentPoliciesInGroup!=null){
-				policies.addAll(currentPoliciesInGroup);
-			}
-			group.setPolicies(policies);
-
-			// Assume that this is an update of an existing PDP Group
-			loggingContext.setServiceName("PolicyEngineAPI:PAP.updateGroup");
-
-			try{
-				acPutTransaction.updateGroup(group, "XACMLPapServlet.doACPut");
-			} catch(Exception e){
-				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Error while updating group in the database: "
-						+"group="+group.getId());
-				throw new PAPException(e.getMessage());	
-			}
-
-			papEngine.updateGroup(group);
-			response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-			response.addHeader("operation", "push");
-			response.addHeader("policyId", policy.getId());
-			response.addHeader("groupId", groupId);
-			if (logger.isDebugEnabled()) {		
-				logger.debug("Group '" + group.getId() + "' updated");
-			}
-
-			acPutTransaction.commitTransaction();
-
-			notifyAC();
-
-			// Group changed, which might include changing the policies	
-			groupChanged(group);
-			loggingContext.transactionEnded();
-			auditLogger.info("Success");
-			PolicyLogger.audit("Transaction Ended Successfully");
-			return;
-		} catch (PAPException e) {
-			acPutTransaction.rollbackTransaction();
-			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " API PUT exception");
-			loggingContext.transactionEnded();
-
-			PolicyLogger.audit("Transaction Failed - See Error.log");
-
-			String message = XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception in request to update group from API - See Error.log on on the PAP.";
-			response.sendError(500, e.getMessage());
-			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-			response.addHeader("error","addGroupError");
-			response.addHeader("message", message);
-			return;
-		}
-
-	}
-
-	private void getActiveVersion(HttpServletRequest request, HttpServletResponse response) {
-		//Setup EntityManager to communicate with the PolicyVersion table of the DB
-		EntityManager em = null;
-		em = (EntityManager) emf.createEntityManager();
-
-		if (em==null){
-			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Error creating entity manager with persistence unit: " + PERSISTENCE_UNIT);
-			try {
-				throw new Exception("Unable to create Entity Manager Factory");
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-
-		String policyScope = request.getParameter("policyScope");
-		String filePrefix = request.getParameter("filePrefix");
-		String policyName = request.getParameter("policyName");
-
-		String pvName = policyScope + File.separator + filePrefix + policyName;
-		int activeVersion = 0;
-
-
-		//Get the Active Version to use in the ID
-		em.getTransaction().begin();
-		Query query = em.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
-		query.setParameter("pname", pvName);
-
-		@SuppressWarnings("rawtypes")
-		List result = query.getResultList();
-		PolicyVersion versionEntity = null;
-		if (!result.isEmpty()) {
-			versionEntity = (PolicyVersion) result.get(0);
-			em.persist(versionEntity);
-			activeVersion = versionEntity.getActiveVersion();
-			em.getTransaction().commit();
-		} else {
-			logger.debug("No PolicyVersion using policyName found");
-		}
-
-		//clean up connection
-		em.close();
-		if (String.valueOf(activeVersion)!=null || !String.valueOf(activeVersion).equalsIgnoreCase("")) {							
-			response.setStatus(HttpServletResponse.SC_OK);								
-			response.addHeader("version", String.valueOf(activeVersion));								
-		} else {						
-			response.setStatus(HttpServletResponse.SC_NOT_FOUND);								
-		}	
-
-
-	}
-
-	private void getSelectedURI(HttpServletRequest request,
-			HttpServletResponse response) {
-
-		String gitPath = request.getParameter("gitPath");
-
-		File file = new File(gitPath);
-
-		logger.debug("The fileItem is : " + file.toString());
-
-		URI selectedURI = file.toURI();
-
-		String uri = selectedURI.toString();
-
-		if (!uri.equalsIgnoreCase("")) {							
-			response.setStatus(HttpServletResponse.SC_OK);								
-			response.addHeader("selectedURI", uri);								
-		} else {						
-			response.setStatus(HttpServletResponse.SC_NOT_FOUND);								
-		}						
-	}
-
-	/*
-	 * getGitPath() method to get the gitPath using data from the JSON string 
-	 * when deleting policies using doAPIDelete()
-	 */
-	private File getPolicyFile(String policyName){
-
-		Path workspacePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE), "admin");
-		Path repositoryPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
-		Path gitPath = Paths.get(workspacePath.toString(), repositoryPath.getFileName().toString());
-
-		//getting the fullpath of the gitPath and convert to string
-		String fullGitPath = gitPath.toAbsolutePath().toString();
-		String finalGitPath = null;
-
-		//creating the parentPath directory for the Admin Console use
-		if(fullGitPath.contains("\\")){
-			finalGitPath = fullGitPath.replace("ECOMP-PAP-REST", "ecomp-sdk-app");
-		}else{
-			finalGitPath = fullGitPath.replace("pap",  "console");
-		}
-
-		finalGitPath += File.separator + policyName;
-
-		File file = new File(finalGitPath);
-
-		return file;
-
-	}
-
-	/*
-	 * getGitPath() method to get the gitPath using data from the http request
-	 * and send back in response when pushing policies
-	 */
-	private void getGitPath(HttpServletRequest request,
-			HttpServletResponse response) {
-
-		String policyScope = request.getParameter("policyScope");
-		String filePrefix = request.getParameter("filePrefix");
-		String policyName = request.getParameter("policyName");
-		String activeVersion = request.getParameter("activeVersion");
-
-		Path workspacePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE), "admin");
-		Path repositoryPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
-		Path gitPath = Paths.get(workspacePath.toString(), repositoryPath.getFileName().toString());
-
-		//getting the fullpath of the gitPath and convert to string
-		String fullGitPath = gitPath.toAbsolutePath().toString();
-		String finalGitPath = null;
-
-		//creating the parentPath directory for the Admin Console use
-		if(fullGitPath.contains("\\")){
-			finalGitPath = fullGitPath.replace("ECOMP-PAP-REST", "ecomp-sdk-app");
-		}else{
-			finalGitPath = fullGitPath.replace("pap",  "console");
-		}
-
-		finalGitPath += File.separator + policyScope + File.separator + filePrefix + policyName + "." + activeVersion + ".xml";
-		File file = new File(finalGitPath);
-		URI uri = file.toURI();
-		
-		//
-		// Extract XACML policy information
-		//
-		Boolean isValid = false;
-		String policyId = null;
-		String description = null;
-		String	version = null;
-
-		URL url;
-		try {
-			url = uri.toURL();
-			Object rootElement = XACMLPolicyScanner.readPolicy(url.openStream());
-			if (rootElement == null ||
-					(
-							! (rootElement instanceof PolicySetType) &&
-							! (rootElement instanceof PolicyType)
-							)	) {
-				logger.warn("No root policy element in URI: " + uri.toString() + " : " + rootElement);
-				isValid = false;
-			} else {
-				if (rootElement instanceof PolicySetType) {
-					policyId = ((PolicySetType)rootElement).getPolicySetId();
-					description = ((PolicySetType)rootElement).getDescription();
-					isValid = true;
-					version = ((PolicySetType)rootElement).getVersion();
-				} else if (rootElement instanceof PolicyType) {
-					policyId = ((PolicyType)rootElement).getPolicyId();
-					description = ((PolicyType)rootElement).getDescription();
-					version = ((PolicyType)rootElement).getVersion();
-					isValid = true;
-				} else {
-					PolicyLogger.error("Unknown root element: " + rootElement.getClass().getCanonicalName());
-				}
-			}
-		} catch (Exception e) {
-			logger.error("Exception Occured While Extracting Policy Information");
-		} 
-
-		if (!finalGitPath.equalsIgnoreCase("") || policyId!=null || description!=null || version!=null || isValid!=null) {							
-			response.setStatus(HttpServletResponse.SC_OK);								
-			response.addHeader("gitPath", finalGitPath);
-			response.addHeader("policyId", policyId);
-			response.addHeader("description", description);
-			response.addHeader("version", version);
-			response.addHeader("isValid", isValid.toString());
-		} else {						
-			response.setStatus(HttpServletResponse.SC_NOT_FOUND);								
-		}						
-
-	}
-
-	/**
-	 * Given a version string consisting of integers with dots between them, convert it into an array of ints.
-	 * 
-	 * @param version
-	 * @return
-	 * @throws NumberFormatException
-	 */
-	public static int[] versionStringToArray(String version) throws NumberFormatException {
-		if (version == null || version.length() == 0) {
-			return new int[0];
-		}
-		String[] stringArray = version.split("\\.");
-		int[] resultArray = new int[stringArray.length];
-		for (int i = 0; i < stringArray.length; i++) {
-			resultArray[i] = Integer.parseInt(stringArray[i]);
-		}
-		return resultArray;
-	}
-
-	protected String	getPDPID(HttpServletRequest request) {
-		String pdpURL = request.getHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID);
-		if (pdpURL == null || pdpURL.isEmpty()) {
-			//
-			// Should send back its port for identification
-			//
-			logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP did not send custom header");
-			pdpURL = "";
-		}
-		return  pdpURL;
-	}
-
-	protected String getPDPJMX(HttpServletRequest request) {
-		String pdpJMMX = request.getHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_JMX_PORT);
-		if (pdpJMMX == null || pdpJMMX.isEmpty()) {
-			//
-			// Should send back its port for identification
-			//
-			logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP did not send custom header for JMX Port so the value of 0 is assigned");
-			return null;
-		}
-		return pdpJMMX;
-	}
-	private boolean isPDPCurrent(Properties policies, Properties pipconfig, Properties pdpProperties) {
-		String localRootPolicies = policies.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
-		String localReferencedPolicies = policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
-		if (localRootPolicies == null || localReferencedPolicies == null) {
-			logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing property on PAP server: RootPolicies="+localRootPolicies+"  ReferencedPolicies="+localReferencedPolicies);
-			return false;
-		}
-		//
-		// Compare the policies and pipconfig properties to the pdpProperties
-		//
-		try {
-			//
-			// the policy properties includes only xacml.rootPolicies and 
-			// xacml.referencedPolicies without any .url entries
-			//
-			Properties pdpPolicies = XACMLProperties.getPolicyProperties(pdpProperties, false);
-			Properties pdpPipConfig = XACMLProperties.getPipProperties(pdpProperties);
-			if (localRootPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_ROOTPOLICIES)) &&
-					localReferencedPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES)) &&
-					pdpPipConfig.equals(pipconfig)) {
-				//
-				// The PDP is current
-				//
-				return true;
-			}
-		} catch (Exception e) {
-			// we get here if the PDP did not include either xacml.rootPolicies or xacml.pip.engines,
-			// or if there are policies that do not have a corresponding ".url" property.
-			// Either of these cases means that the PDP is not up-to-date, so just drop-through to return false.
-			PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPapServlet", " PDP Error");
-		}
-		return false;
-	}
-
-	private void populatePolicyURL(StringBuffer urlPath, Properties policies) {
-		String lists[] = new String[2];
-		lists[0] = policies.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
-		lists[1] = policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
-		for (String list : lists) {
-			if (list != null && list.isEmpty() == false) {
-				for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(list)) {
-					String url = urlPath + "?id=" + id;
-					logger.info("Policy URL for " + id + ": " + url);
-					policies.setProperty(id + ".url", url);
-				}
-			}
-		}
-	}
-
-
+	
 	/**
 	 * @see HttpServlet#doPut(HttpServletRequest request, HttpServletResponse response)
 	 */
@@ -1656,7 +836,7 @@
 		ECOMPLoggingContext loggingContext = ECOMPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
 		storedRequestId = loggingContext.getRequestID();
 		loggingContext.transactionStarted();
-		loggingContext.setServiceName("PAP.put"); // we may set a more specific value later
+		loggingContext.setServiceName("PAP.put");
 		if ((loggingContext.getRequestID() == null) || (loggingContext.getRequestID() == "")){
 			UUID requestID = UUID.randomUUID();
 			loggingContext.setRequestID(requestID.toString());
@@ -1664,52 +844,32 @@
 		} else {
 			PolicyLogger.info("requestID was provided in call to XACMLPapSrvlet (doPut)");
 		}
-		// dummy metric.log example posted below as proof of concept
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 1 of 2");
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 2 of 2");
-		//This im.startTransaction() covers all Put transactions
 		try {
 			im.startTransaction();
 		} catch (AdministrativeStateException ae){
 			String message = "PUT interface called for PAP " + papResourceName + " but it has an Administrative"
 					+ " state of " + im.getStateManager().getAdminState()
 					+ "\n Exception Message: " + ae.getMessage();
-			logger.info(message);
+			LOGGER.info(message);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
 			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 			return;
 		}catch (StandbyStatusException se) {
-			se.printStackTrace();
 			String message = "PUT interface called for PAP " + papResourceName + " but it has a Standby Status"
 					+ " of " + im.getStateManager().getStandbyStatus()
 					+ "\n Exception Message: " + se.getMessage();
-			logger.info(message);
+			LOGGER.info(message);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
 			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 			return;
 		}
-
 		XACMLRest.dumpRequest(request);
-
-		//
-		// since getParameter reads the content string, explicitly get the content before doing that.
-		// Simply getting the inputStream seems to protect it against being consumed by getParameter.
-		//
-		request.getInputStream();
-
 		//need to check if request is from the API or Admin console
 		String apiflag = request.getParameter("apiflag");
-
 		//This would occur if a PolicyDBDao notification was received
 		String policyDBDaoRequestUrl = request.getParameter("policydbdaourl");
 		if(policyDBDaoRequestUrl != null){
@@ -1731,19 +891,18 @@
 			im.endTransaction();
 			return;
 		}
-
 		//This would occur if we received a notification of a policy creation or update
 		String policyToCreateUpdate = request.getParameter("policyToCreateUpdate");
 		if(policyToCreateUpdate != null){
-			if(logger.isDebugEnabled()){
-				logger.debug("\nXACMLPapServlet.doPut() - before decoding"
+			if(LOGGER.isDebugEnabled()){
+				LOGGER.debug("\nXACMLPapServlet.doPut() - before decoding"
 						+ "\npolicyToCreateUpdate = " + policyToCreateUpdate);
 			}
 			//decode it
 			try{
 				policyToCreateUpdate = URLDecoder.decode(policyToCreateUpdate, "UTF-8");
-				if(logger.isDebugEnabled()){
-					logger.debug("\nXACMLPapServlet.doPut() - after decoding"
+				if(LOGGER.isDebugEnabled()){
+					LOGGER.debug("\nXACMLPapServlet.doPut() - after decoding"
 							+ "\npolicyToCreateUpdate = " + policyToCreateUpdate);
 				}
 			} catch(UnsupportedEncodingException e){
@@ -1756,7 +915,6 @@
 				im.endTransaction();
 				return;
 			}
-
 			//send it to PolicyDBDao
 			PolicyDBDaoTransaction createUpdateTransaction = policyDBDao.getNewTransaction();
 			try{
@@ -1773,13 +931,13 @@
 			createUpdateTransaction.commitTransaction();
 			// Before sending Ok. Lets call AutoPush. 
 			if(autoPushFlag){
-				Set<StdPDPGroup> changedGroups = autoPushPolicy.checkGroupsToPush(policyToCreateUpdate,  this.papEngine);
+				Set<StdPDPGroup> changedGroups = autoPushPolicy.checkGroupsToPush(policyToCreateUpdate,  XACMLPapServlet.papEngine);
 				if(!changedGroups.isEmpty()){
 					for(StdPDPGroup group: changedGroups){
 						try{
 							papEngine.updateGroup(group);
-							if (logger.isDebugEnabled()) {		
-								logger.debug("Group '" + group.getId() + "' updated");
+							if (LOGGER.isDebugEnabled()) {		
+								LOGGER.debug("Group '" + group.getId() + "' updated");
 							}
 							notifyAC();
 							// Group changed, which might include changing the policies	
@@ -1796,21 +954,19 @@
 			im.endTransaction();
 			return;
 		}
-
 		/*
-		 * Request for Micro Service Import
+		 * Request for ImportService 
 		 */
-		String microServiceCreation = request.getParameter("importService");
-		if (microServiceCreation != null) {
-			if(authorizeRequest(request)){   
-				if (microServiceCreation.contains("MICROSERVICE")){
-					doImportMicroServicePut(request, response);
-					im.endTransaction();
-					return;
-				}
+		String importService = request.getParameter("importService");
+		if (importService != null) {
+			if(authorizeRequest(request)){
+				APIRequestHandler apiRequestHandler = new APIRequestHandler();
+				apiRequestHandler.doPut(request, response, importService);
+				im.endTransaction();
+				return;
 			} else {
 				String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
-				logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + message );
+				LOGGER.error(XACMLErrorConstants.ERROR_PERMISSIONS + message );
 				loggingContext.transactionEnded();
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
@@ -1821,16 +977,16 @@
 		String oldPolicyName = request.getParameter("oldPolicyName");
 		String newPolicyName = request.getParameter("newPolicyName");
 		if(oldPolicyName != null && newPolicyName != null){
-			if(logger.isDebugEnabled()){
-				logger.debug("\nXACMLPapServlet.doPut() - before decoding"
+			if(LOGGER.isDebugEnabled()){
+				LOGGER.debug("\nXACMLPapServlet.doPut() - before decoding"
 						+ "\npolicyToCreateUpdate = " + " ");
 			}
 			//decode it
 			try{
 				oldPolicyName = URLDecoder.decode(oldPolicyName, "UTF-8");
 				newPolicyName = URLDecoder.decode(newPolicyName, "UTF-8");
-				if(logger.isDebugEnabled()){
-					logger.debug("\nXACMLPapServlet.doPut() - after decoding"
+				if(LOGGER.isDebugEnabled()){
+					LOGGER.debug("\nXACMLPapServlet.doPut() - after decoding"
 							+ "\npolicyToCreateUpdate = " + " ");
 				}
 			} catch(UnsupportedEncodingException e){
@@ -1863,22 +1019,18 @@
 			im.endTransaction();
 			return;
 		}
-
-
 		//
 		// See if this is Admin Console registering itself with us
 		//
 		String acURLString = request.getParameter("adminConsoleURL");
 		if (acURLString != null) {
 			loggingContext.setServiceName("AC:PAP.register");
-			//
 			// remember this Admin Console for future updates
-			//
 			if ( ! adminConsoleURLStringList.contains(acURLString)) {
 				adminConsoleURLStringList.add(acURLString);
 			}
-			if (logger.isDebugEnabled()) {
-				logger.debug("Admin Console registering with URL: " + acURLString);
+			if (LOGGER.isDebugEnabled()) {
+				LOGGER.debug("Admin Console registering with URL: " + acURLString);
 			}
 			response.setStatus(HttpServletResponse.SC_NO_CONTENT);
 			loggingContext.transactionEnded();
@@ -1887,15 +1039,22 @@
 			im.endTransaction();
 			return;
 		}
-
 		/*
 		 * This is to update the PDP Group with the policy/policies being pushed
-		 * Part of a 2 step process to push policie to the PDP that can now be done 
+		 * Part of a 2 step process to push policies to the PDP that can now be done 
 		 * From both the Admin Console and the PolicyEngine API
 		 */
 		String groupId = request.getParameter("groupId");
 		if (groupId != null) {
 			if(apiflag!=null){
+				if(!authorizeRequest(request)){
+					String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+					PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
+					loggingContext.transactionEnded();
+					PolicyLogger.audit("Transaction Failed - See Error.log");
+					response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
+					return;
+				}
 				if(apiflag.equalsIgnoreCase("addPolicyToGroup")){
 					updateGroupsFromAPI(request, response, groupId, loggingContext);
 					loggingContext.transactionEnded();
@@ -1904,61 +1063,47 @@
 					return;
 				}
 			}
-			//
 			// this is from the Admin Console, so handle separately
-			//
 			doACPut(request, response, groupId, loggingContext);
 			loggingContext.transactionEnded();
 			PolicyLogger.audit("Transaction Ended Successfully");
 			im.endTransaction();
 			return;
 		}
-
 		//
 		// Request is for policy validation and creation
 		//
 		if (apiflag != null && apiflag.equalsIgnoreCase("admin")){
-			/*
-			 * this request is from the Admin Console
-			 */
+			// this request is from the Admin Console
+			SavePolicyHandler savePolicyHandler = SavePolicyHandler.getInstance();
+			savePolicyHandler.doPolicyAPIPut(request, response);
 			loggingContext.transactionEnded();
 			PolicyLogger.audit("Transaction Ended Successfully");
-			doACPolicyPut(request, response);
 			im.endTransaction();
 			return;
-
 		} else if (apiflag != null && apiflag.equalsIgnoreCase("api")) {
-			/*
-			 * this request is from the Policy Creation API
-			 */
-			// Authenticating the Request here. 
+			// this request is from the Policy Creation API 
 			if(authorizeRequest(request)){
+				APIRequestHandler apiRequestHandler = new APIRequestHandler();
+				apiRequestHandler.doPut(request, response, request.getHeader("ClientScope"));
 				loggingContext.transactionEnded();
 				PolicyLogger.audit("Transaction Ended Successfully");
-				doPolicyAPIPut(request, response);
 				im.endTransaction();
 				return;
 			} else {
-				String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+				String message = "PEP not Authorized for making this Request!!";
 				PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
 				im.endTransaction();
 				return;
 			}
-
 		}
-
-
-		//
 		// We do not expect anything from anywhere else.
 		// This method is here in case we ever need to support other operations.
-		//
-		logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Request does not have groupId or apiflag");
+		LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Request does not have groupId or apiflag");
 		loggingContext.transactionEnded();
-
 		PolicyLogger.audit("Transaction Failed - See Error.log");
 		response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Request does not have groupId or apiflag");
 		loggingContext.transactionEnded();
@@ -1972,7 +1117,7 @@
 	protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 		ECOMPLoggingContext loggingContext = ECOMPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
 		loggingContext.transactionStarted();
-		loggingContext.setServiceName("PAP.delete"); // we may set a more specific value later
+		loggingContext.setServiceName("PAP.delete");
 		if ((loggingContext.getRequestID() == null) || (loggingContext.getRequestID() == "")){
 			UUID requestID = UUID.randomUUID();
 			loggingContext.setRequestID(requestID.toString());
@@ -1980,106 +1125,455 @@
 		} else {
 			PolicyLogger.info("requestID was provided in call to XACMLPapSrvlet (doDelete)");
 		}
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 1 of 2");
-		loggingContext.metricStarted();
-		loggingContext.metricEnded();
-		PolicyLogger.metrics("Metric example posted here - 2 of 2");	
-
-		//This im.startTransaction() covers all Delete transactions
 		try {
 			im.startTransaction();
 		} catch (AdministrativeStateException ae){
 			String message = "DELETE interface called for PAP " + papResourceName + " but it has an Administrative"
 					+ " state of " + im.getStateManager().getAdminState()
 					+ "\n Exception Message: " + ae.getMessage();
-			logger.info(message);
+			LOGGER.info(message);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
 			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 			return;
 		}catch (StandbyStatusException se) {
-			se.printStackTrace();
 			String message = "PUT interface called for PAP " + papResourceName + " but it has a Standby Status"
 					+ " of " + im.getStateManager().getStandbyStatus()
 					+ "\n Exception Message: " + se.getMessage();
-			logger.info(message);
+			LOGGER.info(message);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
-
 			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
 			return;
 		}
-
 		XACMLRest.dumpRequest(request);
-
 		String groupId = request.getParameter("groupId");
 		String apiflag = request.getParameter("apiflag");
-
 		if (groupId != null) {
 			// Is this from the Admin Console or API?
 			if(apiflag!=null) {
-				if (apiflag.equalsIgnoreCase("deletePapApi")) {
-					// this is from the API so we need to check the client credentials before processing the request
-					if(authorizeRequest(request)){
-						doAPIDeleteFromPAP(request, response, loggingContext);
-						return;
-					} else {
-						String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
-						PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
-						loggingContext.transactionEnded();
-
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
-						return;
-					}
-				} else if (apiflag.equalsIgnoreCase("deletePdpApi")) {
-					if(authorizeRequest(request)){
-						doAPIDeleteFromPDP(request, response, loggingContext);
-						return;
-					} else {
-						String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
-						PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
-						loggingContext.transactionEnded();
-
-						PolicyLogger.audit("Transaction Failed - See Error.log");
-						response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
-						return;
-					}
+				if(!authorizeRequest(request)){
+					String message = "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+					PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
+					loggingContext.transactionEnded();
+					PolicyLogger.audit("Transaction Failed - See Error.log");
+					response.sendError(HttpServletResponse.SC_FORBIDDEN, message);
+					return;
 				}
+				APIRequestHandler apiRequestHandler = new APIRequestHandler();
+				try {
+					apiRequestHandler.doDelete(request, response, loggingContext, apiflag);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+				if(apiRequestHandler.getNewGroup()!=null){
+					groupChanged(apiRequestHandler.getNewGroup());
+				}
+				return;
 			}
-
 			// this is from the Admin Console, so handle separately
 			doACDelete(request, response, groupId, loggingContext);
 			loggingContext.transactionEnded();
 			PolicyLogger.audit("Transaction Ended Successfully");
 			im.endTransaction();
 			return;
-
 		}
-		//
-		// We do not expect anything from anywhere else.
-		// This method is here in case we ever need to support other operations.
-		//
+		//Catch anything that fell through
 		PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Request does not have groupId");
 		loggingContext.transactionEnded();
-
 		PolicyLogger.audit("Transaction Failed - See Error.log");
-
 		response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Request does not have groupId");
-
-		//Catch anything that fell through
 		im.endTransaction();
-
 	}
-	//
-	// Admin Console request handling
-	//
+
+	private boolean isPDPCurrent(Properties policies, Properties pipconfig, Properties pdpProperties) {
+		String localRootPolicies = policies.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
+		String localReferencedPolicies = policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
+		if (localRootPolicies == null || localReferencedPolicies == null) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing property on PAP server: RootPolicies="+localRootPolicies+"  ReferencedPolicies="+localReferencedPolicies);
+			return false;
+		}
+		// Compare the policies and pipconfig properties to the pdpProperties
+		try {
+			// the policy properties includes only xacml.rootPolicies and 
+			// xacml.referencedPolicies without any .url entries
+			Properties pdpPolicies = XACMLProperties.getPolicyProperties(pdpProperties, false);
+			Properties pdpPipConfig = XACMLProperties.getPipProperties(pdpProperties);
+			if (localRootPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_ROOTPOLICIES)) &&
+					localReferencedPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES)) &&
+					pdpPipConfig.equals(pipconfig)) {
+				// The PDP is current
+				return true;
+			}
+		} catch (Exception e) {
+			// we get here if the PDP did not include either xacml.rootPolicies or xacml.pip.engines,
+			// or if there are policies that do not have a corresponding ".url" property.
+			// Either of these cases means that the PDP is not up-to-date, so just drop-through to return false.
+			PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPapServlet", " PDP Error");
+		}
+		return false;
+	}
+
+	private void populatePolicyURL(StringBuffer urlPath, Properties policies) {
+		String lists[] = new String[2];
+		lists[0] = policies.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
+		lists[1] = policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
+		for (String list : lists) {
+			if (list != null && list.isEmpty() == false) {
+				for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(list)) {
+					String url = urlPath + "?id=" + id;
+					LOGGER.info("Policy URL for " + id + ": " + url);
+					policies.setProperty(id + ".url", url);
+				}
+			}
+		}
+	}
+
+	protected String getPDPID(HttpServletRequest request) {
+		String pdpURL = request.getHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID);
+		if (pdpURL == null || pdpURL.isEmpty()) {
+			// Should send back its port for identification
+			LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP did not send custom header");
+			pdpURL = "";
+		}
+		return pdpURL;
+	}
+
+	protected String getPDPJMX(HttpServletRequest request) {
+		String pdpJMMX = request.getHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_JMX_PORT);
+		if (pdpJMMX == null || pdpJMMX.isEmpty()) {
+			// Should send back its port for identification
+			LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP did not send custom header for JMX Port so the value of 0 is assigned");
+			return null;
+		}
+		return pdpJMMX;
+	}
+	
+	/**
+	 * Requests from the PolicyEngine API to update the PDP Group with pushed policy
+	 * 
+	 * @param request
+	 * @param response
+	 * @param groupId
+	 * @param loggingContext 
+	 * @throws ServletException
+	 * @throws IOException
+	 */
+	public void updateGroupsFromAPI(HttpServletRequest request, HttpServletResponse response, String groupId, ECOMPLoggingContext loggingContext) throws IOException {
+		PolicyDBDaoTransaction acPutTransaction = policyDBDao.getNewTransaction();
+		try {
+			// for PUT operations the group may or may not need to exist before the operation can be done
+			StdPDPGroup group = (StdPDPGroup) papEngine.getGroup(groupId);
+			// get the request input stream content into a String
+			String json = null;
+			java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
+			scanner.useDelimiter("\\A");
+			json =  scanner.hasNext() ? scanner.next() : "";
+			scanner.close();
+			PolicyLogger.info("JSON request from PolicyEngine API: " + json);
+			// convert Object sent as JSON into local object
+			StdPDPPolicy policy = PolicyUtils.jsonStringToObject(json, StdPDPPolicy.class);
+			Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+			if(policy!=null){
+				policies.add(policy);
+			}
+			//Get the current policies from the Group and Add the new one
+			Set<PDPPolicy> currentPoliciesInGroup = new HashSet<PDPPolicy>();
+			currentPoliciesInGroup = group.getPolicies();
+			//If the selected policy is in the group we must remove it because the name is default
+			Iterator<PDPPolicy> policyIterator = policies.iterator();
+			LOGGER.debug("policyIterator....." + policies);
+			while (policyIterator.hasNext()) {
+				PDPPolicy selPolicy = policyIterator.next();
+				for (PDPPolicy existingPolicy : currentPoliciesInGroup) {
+					if (existingPolicy.getId().equals(selPolicy.getId())) {
+						group.removePolicyFromGroup(existingPolicy);
+						LOGGER.debug("Removing policy: " + existingPolicy);
+						break;
+					}
+				}
+			}
+			//Update the PDP Group after removing old version of policy
+			Set<PDPPolicy> updatedPoliciesInGroup = new HashSet<PDPPolicy>();
+			updatedPoliciesInGroup = group.getPolicies();
+			//need to remove the policy with default name from group
+			for (PDPPolicy updatedPolicy : currentPoliciesInGroup) {
+				if (updatedPolicy.getName().equalsIgnoreCase("default")) {
+					group.removePolicyFromGroup(updatedPolicy);
+					break;
+				}
+			}
+			if(updatedPoliciesInGroup!=null){
+				policies.addAll(updatedPoliciesInGroup);
+			}
+			group.setPolicies(policies);
+			// Assume that this is an update of an existing PDP Group
+			loggingContext.setServiceName("PolicyEngineAPI:PAP.updateGroup");
+			try{
+				acPutTransaction.updateGroup(group, "XACMLPapServlet.doACPut");
+			} catch(Exception e){
+				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Error while updating group in the database: "
+						+"group="+group.getId());
+				throw new PAPException(e.getMessage());	
+			}
+			papEngine.updateGroup(group);
+			response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+			response.addHeader("operation", "push");
+			response.addHeader("policyId", policy.getId());
+			response.addHeader("groupId", groupId);
+			if (LOGGER.isDebugEnabled()) {		
+				LOGGER.debug("Group '" + group.getId() + "' updated");
+			}
+			acPutTransaction.commitTransaction();
+			notifyAC();
+			// Group changed, which might include changing the policies	
+			groupChanged(group);
+			loggingContext.transactionEnded();
+			auditLogger.info("Success");
+
+			if ((policy.getId().contains("Config_MS_")) || (policy.getId().contains("BRMS_Param"))) {
+				PushPolicyHandler pushPolicyHandler = PushPolicyHandler.getInstance();
+				if (pushPolicyHandler.preSafetyCheck(policy, CONFIG_HOME)) {
+					LOGGER.debug("Precheck Successful.");
+				}
+			}
+
+			PolicyLogger.audit("Transaction Ended Successfully");
+			return;
+		} catch (PAPException e) {
+			acPutTransaction.rollbackTransaction();
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " API PUT exception");
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			String message = XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception in request to update group from API - See Error.log on on the PAP.";
+			response.sendError(500, e.getMessage());
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			response.addHeader("error","addGroupError");
+			response.addHeader("message", message);
+			return;
+		}
+	}
+
+	/**
+	 * Requests from the Admin Console for operations not on single specific objects
+	 * 
+	 * @param request
+	 * @param response
+	 * @param groupId
+	 * @param loggingContext
+	 * @throws ServletException
+	 * @throws IOException
+	 */
+	private void doACPost(HttpServletRequest request, HttpServletResponse response, String groupId, ECOMPLoggingContext loggingContext) throws ServletException, IOException {
+		PolicyDBDaoTransaction doACPostTransaction = null;
+		try {
+			String groupName = request.getParameter("groupName");
+			String groupDescription = request.getParameter("groupDescription");
+			String apiflag = request.getParameter("apiflag");
+			if (groupName != null && groupDescription != null) {
+				// Args:	      group=<groupId> groupName=<name> groupDescription=<description>            <= create a new group
+				loggingContext.setServiceName("AC:PAP.createGroup");
+				String unescapedName = URLDecoder.decode(groupName, "UTF-8");
+				String unescapedDescription = URLDecoder.decode(groupDescription, "UTF-8");
+				PolicyDBDaoTransaction newGroupTransaction = policyDBDao.getNewTransaction();
+				try {					
+					newGroupTransaction.createGroup(PolicyDBDao.createNewPDPGroupId(unescapedName), unescapedName, unescapedDescription,"XACMLPapServlet.doACPost");
+					papEngine.newGroup(unescapedName, unescapedDescription);
+					newGroupTransaction.commitTransaction();
+				} catch (Exception e) {
+					newGroupTransaction.rollbackTransaction();
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Unable to create new group");
+					loggingContext.transactionEnded();
+	
+					PolicyLogger.audit("Transaction Failed - See Error.log");
+					response.sendError(500, "Unable to create new group '" + groupId + "'");
+					return;
+				}
+				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("New Group '" + groupId + "' created");
+				}
+				// tell the Admin Consoles there is a change
+				notifyAC();
+				// new group by definition has no PDPs, so no need to notify them of changes
+				loggingContext.transactionEnded();
+				PolicyLogger.audit("Transaction Failed - See Error.log");
+				auditLogger.info("Success");
+				PolicyLogger.audit("Transaction Ended Successfully");
+				return;
+			}
+			// for all remaining POST operations the group must exist before the operation can be done
+			EcompPDPGroup group = papEngine.getGroup(groupId);
+			if (group == null) {
+				String message = "Unknown groupId '" + groupId + "'";
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
+				loggingContext.transactionEnded();
+				PolicyLogger.audit("Transaction Failed - See Error.log");
+				if (apiflag!=null){
+					response.addHeader("error", "unknownGroupId");
+					response.addHeader("operation", "push");
+					response.addHeader("message", message);
+					response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+				} else {
+					response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
+				}
+				return;
+			}
+			// determine the operation needed based on the parameters in the request
+			if (request.getParameter("policyId") != null) {
+				//	Args:        group=<groupId> policy=<policyId>		<= copy file
+				// copy a policy from the request contents into a file in the group's directory on this machine
+				if(apiflag!=null){
+					loggingContext.setServiceName("PolicyEngineAPI:PAP.postPolicy");
+				} else {
+					loggingContext.setServiceName("AC:PAP.postPolicy");
+				}
+				String policyId = request.getParameter("policyId");
+				PolicyDBDaoTransaction addPolicyToGroupTransaction = policyDBDao.getNewTransaction();
+				try {
+					InputStream is = null;
+					File temp= null;
+					if (apiflag != null){
+						// get the request content into a String if the request is from API 
+						String json = null;
+						// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
+						java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
+						scanner.useDelimiter("\\A");
+						json =  scanner.hasNext() ? scanner.next() : "";
+						scanner.close();
+						LOGGER.info("JSON request from API: " + json);
+						// convert Object sent as JSON into local object
+						ObjectMapper mapper = new ObjectMapper();
+						Object objectFromJSON = mapper.readValue(json, StdPAPPolicy.class);
+						StdPAPPolicy policy = (StdPAPPolicy) objectFromJSON;
+						temp = new File(policy.getLocation());
+						is = new FileInputStream(temp);
+					} else {
+						is = request.getInputStream();
+					}
+					addPolicyToGroupTransaction.addPolicyToGroup(group.getId(), policyId,"XACMLPapServlet.doACPost");
+	                if (apiflag != null){
+	                    ((StdPDPGroup) group).copyPolicyToFile(policyId,"API", is);
+	                } else {
+	                	String name = null;
+	                	if (policyId.endsWith(".xml")) {
+	                		name = policyId.replace(".xml", "");
+	                		name = name.substring(0, name.lastIndexOf("."));
+						}
+	                	((StdPDPGroup) group).copyPolicyToFile(policyId, name, is);
+	                }
+	                if(is!=null && temp!=null){
+		                is.close();
+						temp.delete();
+	                }
+					addPolicyToGroupTransaction.commitTransaction();
+				} catch (Exception e) {
+					addPolicyToGroupTransaction.rollbackTransaction();
+					String message = "Policy '" + policyId + "' not copied to group '" + groupId +"': " + e;
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " " + message);
+					loggingContext.transactionEnded();
+					PolicyLogger.audit("Transaction Failed - See Error.log");
+					if (apiflag!=null){
+						response.addHeader("error", "policyCopyError");
+						response.addHeader("message", message);
+						response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+					} else {
+						response.sendError(500, message);
+					}
+					return;
+				}
+				// policy file copied ok and the Group was updated on the PDP
+				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+				response.addHeader("operation", "push");
+				response.addHeader("policyId", policyId);
+				response.addHeader("groupId", groupId);
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("policy '" + policyId + "' copied to directory for group '" + groupId + "'");
+				}
+				loggingContext.transactionEnded();
+				auditLogger.info("Success");
+				PolicyLogger.audit("Transaction Ended Successfully");
+				return;
+			} else if (request.getParameter("default") != null) {
+				// Args:       group=<groupId> default=true               <= make default
+				// change the current default group to be the one identified in the request.
+				loggingContext.setServiceName("AC:PAP.setDefaultGroup");
+				// This is a POST operation rather than a PUT "update group" because of the side-effect that the current default group is also changed.
+				// It should never be the case that multiple groups are currently marked as the default, but protect against that anyway.
+				PolicyDBDaoTransaction setDefaultGroupTransaction = policyDBDao.getNewTransaction();
+				try {
+					setDefaultGroupTransaction.changeDefaultGroup(group, "XACMLPapServlet.doACPost");
+					papEngine.SetDefaultGroup(group);
+					setDefaultGroupTransaction.commitTransaction();
+				} catch (Exception e) {
+					setDefaultGroupTransaction.rollbackTransaction();
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Unable to set group");
+					loggingContext.transactionEnded();
+	
+					PolicyLogger.audit("Transaction Failed - See Error.log");
+					response.sendError(500, "Unable to set group '" + groupId + "' to default");
+					return;
+				}
+				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("Group '" + groupId + "' set to be default");
+				}
+				// Notify the Admin Consoles that something changed
+				// For now the AC cannot handle anything more detailed than the whole set of PDPGroups, so just notify on that
+				//TODO - Future: FIGURE OUT WHAT LEVEL TO NOTIFY: 2 groups or entire set - currently notify AC to update whole configuration of all groups
+				notifyAC();
+				// This does not affect any PDPs in the existing groups, so no need to notify them of this change
+				loggingContext.transactionEnded();
+				auditLogger.info("Success");
+				PolicyLogger.audit("Transaction Ended Successfully");
+				return;
+			} else if (request.getParameter("pdpId") != null) {
+				doACPostTransaction = policyDBDao.getNewTransaction();
+				// Args:       group=<groupId> pdpId=<pdpId>               <= move PDP to group
+				loggingContext.setServiceName("AC:PAP.movePDP");
+				String pdpId = request.getParameter("pdpId");
+				EcompPDP pdp = papEngine.getPDP(pdpId);
+				EcompPDPGroup originalGroup = papEngine.getPDPGroup((EcompPDP) pdp);
+				try{
+					doACPostTransaction.movePdp(pdp, group, "XACMLPapServlet.doACPost");
+				}catch(Exception e){	
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", 
+							" Error while moving pdp in the database: "
+									+"pdp="+pdp.getId()+",to group="+group.getId());
+					throw new PAPException(e.getMessage());
+				}
+				papEngine.movePDP((EcompPDP) pdp, group);
+				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("PDP '" + pdp.getId() +"' moved to group '" + group.getId() + "' set to be default");
+				}
+				// update the status of both the original group and the new one
+				((StdPDPGroup)originalGroup).resetStatus();
+				((StdPDPGroup)group).resetStatus();
+				// Notify the Admin Consoles that something changed
+				// For now the AC cannot handle anything more detailed than the whole set of PDPGroups, so just notify on that
+				notifyAC();
+				// Need to notify the PDP that it's config may have changed
+				pdpChanged(pdp);
+				doACPostTransaction.commitTransaction();
+				loggingContext.transactionEnded();
+				auditLogger.info("Success");
+				PolicyLogger.audit("Transaction Ended Successfully");
+				return;
+			}
+		} catch (PAPException e) {
+			if(doACPostTransaction != null){
+				doACPostTransaction.rollbackTransaction();
+			}
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " AC POST exception");
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.sendError(500, e.getMessage());
+			return;
+		}
+	}
 
 	/**
 	 * Requests from the Admin Console to GET info about the Groups and PDPs
@@ -2101,15 +1595,12 @@
 				if (parameterDefault != null) {
 					// Request is for the Default group (whatever its id)
 					loggingContext.setServiceName("AC:PAP.getDefaultGroup");
-
 					EcompPDPGroup group = papEngine.getDefaultGroup();
-
 					// convert response object to JSON and include in the response
 					ObjectMapper mapper = new ObjectMapper();
 					mapper.writeValue(response.getOutputStream(),  group);
-
-					if (logger.isDebugEnabled()) {
-						logger.debug("GET Default group req from '" + request.getRequestURL() + "'");
+					if (LOGGER.isDebugEnabled()) {
+						LOGGER.debug("GET Default group req from '" + request.getRequestURL() + "'");
 					}
 					response.setStatus(HttpServletResponse.SC_OK);
 					response.setHeader("content-type", "application/json");
@@ -2118,21 +1609,17 @@
 					auditLogger.info("Success");
 					PolicyLogger.audit("Transaction Ended Successfully");
 					return;
-
 				} else if (pdpId != null) {
 					// Request is related to a PDP
 					if (pdpGroup == null) {
-						// Request is for the PDP itself
 						// Request is for the (unspecified) group containing a given PDP
 						loggingContext.setServiceName("AC:PAP.getPDP");
 						EcompPDP pdp = papEngine.getPDP(pdpId);
-
 						// convert response object to JSON and include in the response
 						ObjectMapper mapper = new ObjectMapper();
 						mapper.writeValue(response.getOutputStream(),  pdp);
-
-						if (logger.isDebugEnabled()) {
-							logger.debug("GET pdp '" + pdpId + "' req from '" + request.getRequestURL() + "'");
+						if (LOGGER.isDebugEnabled()) {
+							LOGGER.debug("GET pdp '" + pdpId + "' req from '" + request.getRequestURL() + "'");
 						}
 						response.setStatus(HttpServletResponse.SC_OK);
 						response.setHeader("content-type", "application/json");
@@ -2141,19 +1628,16 @@
 						auditLogger.info("Success");
 						PolicyLogger.audit("Transaction Ended Successfully");
 						return;
-
 					} else {
 						// Request is for the group containing a given PDP
 						loggingContext.setServiceName("AC:PAP.getGroupForPDP");
 						EcompPDP pdp = papEngine.getPDP(pdpId);
 						EcompPDPGroup group = papEngine.getPDPGroup((EcompPDP) pdp);
-
 						// convert response object to JSON and include in the response
 						ObjectMapper mapper = new ObjectMapper();
 						mapper.writeValue(response.getOutputStream(),  group);
-
-						if (logger.isDebugEnabled()) {
-							logger.debug("GET PDP '" + pdpId + "' Group req from '" + request.getRequestURL() + "'");
+						if (LOGGER.isDebugEnabled()) {
+							LOGGER.debug("GET PDP '" + pdpId + "' Group req from '" + request.getRequestURL() + "'");
 						}
 						response.setStatus(HttpServletResponse.SC_OK);
 						response.setHeader("content-type", "application/json");
@@ -2163,18 +1647,15 @@
 						PolicyLogger.audit("Transaction Ended Successfully");
 						return;
 					}
-
 				} else {
 					// request is for top-level properties about all groups
 					loggingContext.setServiceName("AC:PAP.getAllGroups");
 					Set<EcompPDPGroup> groups = papEngine.getEcompPDPGroups();
-
 					// convert response object to JSON and include in the response
 					ObjectMapper mapper = new ObjectMapper();
 					mapper.writeValue(response.getOutputStream(),  groups);
-
-					if (logger.isDebugEnabled()) {
-						logger.debug("GET All groups req");
+					if (LOGGER.isDebugEnabled()) {
+						LOGGER.debug("GET All groups req");
 					}
 					response.setStatus(HttpServletResponse.SC_OK);
 					response.setHeader("content-type", "application/json");
@@ -2185,7 +1666,6 @@
 					return;
 				}
 			}
-
 			// for all other GET operations the group must exist before the operation can be done
 			EcompPDPGroup group = papEngine.getGroup(groupId);
 			if (group == null) {
@@ -2197,34 +1677,24 @@
 				response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
 				return;
 			}
-
-
 			// Figure out which request this is based on the parameters
 			String policyId = request.getParameter("policyId");
-
 			if (policyId != null) {
 				// retrieve a policy
 				loggingContext.setServiceName("AC:PAP.getPolicy");
-				//
 				// convert response object to JSON and include in the response
-				//
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " GET Policy not implemented");
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
-
 				response.sendError(HttpServletResponse.SC_BAD_REQUEST, "GET Policy not implemented");
-
 			} else {
 				// No other parameters, so return the identified Group
 				loggingContext.setServiceName("AC:PAP.getGroup");
-
 				// convert response object to JSON and include in the response
 				ObjectMapper mapper = new ObjectMapper();
 				mapper.writeValue(response.getOutputStream(),  group);
-
-				if (logger.isDebugEnabled()) {
-					logger.debug("GET group '" + group.getId() + "' req from '" + request.getRequestURL() + "'");
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("GET group '" + group.getId() + "' req from '" + request.getRequestURL() + "'");
 				}
 				response.setStatus(HttpServletResponse.SC_OK);
 				response.setHeader("content-type", "application/json");
@@ -2234,952 +1704,25 @@
 				PolicyLogger.audit("Transaction Ended Successfully");
 				return;
 			}
-
-			//
 			// Currently there are no other GET calls from the AC.
 			// The AC uses the "GET All Groups" operation to fill its local cache and uses that cache for all other GETs without calling the PAP.
 			// Other GETs that could be called:
 			//				Specific Group	(groupId=<groupId>)
 			//				A Policy		(groupId=<groupId> policyId=<policyId>)
 			//				A PDP			(groupId=<groupId> pdpId=<pdpId>)
-
 			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " UNIMPLEMENTED ");
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
-
 			response.sendError(HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
 		} catch (PAPException e) {
 			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " AC Get exception");
 			loggingContext.transactionEnded();
-
-			PolicyLogger.audit("Transaction Failed - See Error.log");
-			response.sendError(500, e.getMessage());
-			return;
-		}
-
-	}
-
-	/**
-	 * Requests from the Admin Console for validating and creating policies
-	 * 
-	 * @param request
-	 * @param response
-	 * @param groupId
-	 * @throws JsonMappingException 
-	 * @throws JsonParseException 
-	 * @throws ServletException
-	 * @throws IOException
-	 */
-	private void doACPolicyPut(HttpServletRequest request,
-			HttpServletResponse response) throws JsonParseException, JsonMappingException, IOException {
-
-		String operation = request.getParameter("operation");
-		String policyType = request.getParameter("policyType");
-		String apiflag = request.getParameter("apiflag"); 
-
-		if ( policyType != null ) {
-			PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
-			Policy newPolicy = null;
-			// get the request content into a String
-			String json = null;
-			// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
-			java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
-			scanner.useDelimiter("\\A");
-			json =  scanner.hasNext() ? scanner.next() : "";
-			scanner.close();
-			logger.info("JSON request from AC: " + json);
-			// convert Object sent as JSON into local object
-			ObjectMapper mapper = new ObjectMapper();
-			Object objectFromJSON = mapper.readValue(json, StdPAPPolicy.class);
-
-			StdPAPPolicy policy = (StdPAPPolicy) objectFromJSON;
-
-			//Set policyAdapter values including parentPath (Common to all policy types)
-			//Set values for policy adapter
-			try {
-				if (operation.equalsIgnoreCase("validate")) {
-					policyAdapter.setPolicyName(policy.getPolicyName());
-					policyAdapter.setConfigType(policy.getConfigType());
-					policyAdapter.setConfigBodyData(policy.getConfigBodyData());
-				} else {
-					policyAdapter = setDataToPolicyAdapter(policy, policyType, apiflag);
-				}
-			} catch (Exception e1) {
-				logger.error("Exception occured While Setting Values for Policy Adapter"+e1);
-			}
-			// Calling Component class per policy type
-			if (policyType.equalsIgnoreCase("Config")) {
-				String configPolicyType = policy.getConfigPolicyType();
-				if (configPolicyType != null && configPolicyType.equalsIgnoreCase("Firewall Config")) {
-					newPolicy = new FirewallConfigPolicy(policyAdapter);
-				} 
-				else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("BRMS_Raw")) {
-					newPolicy = new CreateBrmsRawPolicy(policyAdapter);
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("BRMS_Param")) {
-					policyAdapter.setBrmsParamBody(policy.getDrlRuleAndUIParams());
-					newPolicy = new CreateBrmsParamPolicy(policyAdapter);
-				}
-				else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("Base")) {
-					newPolicy =  new ConfigPolicy(policyAdapter);
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("ClosedLoop_Fault")) {
-					newPolicy = new ClosedLoopPolicy(policyAdapter);
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("ClosedLoop_PM")) {
-					newPolicy = new CreateClosedLoopPerformanceMetrics(policyAdapter);	
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("DCAE Micro Service")) {	
-					newPolicy = new MicroServiceConfigPolicy(policyAdapter);
-				}
-
-			} else if (policyType.equalsIgnoreCase("Action")) {
-				newPolicy = new ActionPolicy(policyAdapter);
-			} else if (policyType.equalsIgnoreCase("Decision")) {
-				newPolicy = new DecisionPolicy(policyAdapter);	
-			}
-
-			// Validation
-			if (operation != null && operation.equalsIgnoreCase("validate")) {
-
-				// validate the body data if applicable and return a response to the PAP-ADMIN	(Config Base only)
-				if (newPolicy.validateConfigForm()) {					
-					response.setStatus(HttpServletResponse.SC_OK);
-					response.addHeader("isValidData", "true");					
-				} else {	
-					response.setStatus(HttpServletResponse.SC_OK);	
-					response.addHeader("isValidData", "false");
-				}
-
-			}   
-
-			// Create or Update Policy        
-			if (operation != null && (operation.equalsIgnoreCase("create") || operation.equalsIgnoreCase("update"))) {
-
-				// create the policy and return a response to the PAP-ADMIN		        
-				PolicyDBDaoTransaction policyDBDaoTransaction = policyDBDao.getNewTransaction();
-				try {
-					Map<String, String> successMap;
-					newPolicy.prepareToSave();
-					policyDBDaoTransaction.createPolicy(newPolicy, "doACPolicyPut");
-					successMap = newPolicy.savePolicies();
-					if (successMap.containsKey("success")) {
-						policyDBDaoTransaction.commitTransaction();
-						response.setStatus(HttpServletResponse.SC_OK);
-						response.addHeader("successMapKey", "success");		    						    				
-						response.addHeader("finalPolicyPath", policyAdapter.getFinalPolicyPath());	
-					} else {								
-						policyDBDaoTransaction.rollbackTransaction();
-						response.setStatus(HttpServletResponse.SC_OK);								
-					}	
-				} catch (Exception e) {	
-					policyDBDaoTransaction.rollbackTransaction();
-					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Could not save policy ");
-					response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
-				}		        	
-			}
-
-		}
-
-	}
-
-	private void doPolicyAPIPut(HttpServletRequest request,
-			HttpServletResponse response) throws IOException, ServletException {
-		String operation = request.getParameter("operation");
-		String policyType = request.getParameter("policyType");
-		String apiflag = request.getParameter("apiflag");
-
-		
-		if ( policyType != null ) {
-			PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
-			Policy newPolicy = null;
-
-			// get the request content into a String
-			String json = null;
-
-			// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
-			java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
-			scanner.useDelimiter("\\A");
-			json =  scanner.hasNext() ? scanner.next() : "";
-			scanner.close();
-			logger.info("JSON request from API: " + json);
-
-			// convert Object sent as JSON into local object
-			ObjectMapper mapper = new ObjectMapper();
-
-			Object objectFromJSON = mapper.readValue(json, StdPAPPolicy.class);
-
-			StdPAPPolicy policy = (StdPAPPolicy) objectFromJSON;
-
-			//Set policyAdapter values including parentPath (Common to all policy types)
-			try {
-				policyAdapter = setDataToPolicyAdapter(policy, policyType, apiflag);
-			} catch (Exception e1) {
-				logger.error(XACMLErrorConstants.ERROR_UNKNOWN + 
-						"Could not set data to policy adapter ",e1);
-			}
-
-			// Calling Component class per policy type
-			if (policyType.equalsIgnoreCase("Config")) {
-				String configPolicyType = policy.getConfigPolicyType();
-				if (configPolicyType != null && configPolicyType.equalsIgnoreCase("Firewall Config")) {
-
-					newPolicy = new FirewallConfigPolicy(policyAdapter);
-
-				} 
-				else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("BRMS_Raw")) { 
-
-					newPolicy = new CreateBrmsRawPolicy(policyAdapter);
-
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("BRMS_Param")) {
-
-					policyAdapter.setBrmsParamBody(policy.getDrlRuleAndUIParams());
-					//check for valid actionAttributes
-					//Setup EntityManager to communicate with the PolicyVersion table of the DB
-					EntityManager em = null;
-					em = (EntityManager) emf.createEntityManager();
-
-					Map<String,String> ruleAndUIValue=policyAdapter.getBrmsParamBody();
-					String modelName= ruleAndUIValue.get("templateName");
-					logger.info("Template name from API is: "+modelName);
-
-					Query getModel = em.createNamedQuery("BRMSParamTemplate.findAll");	
-					List<?> modelList = getModel.getResultList(); 	
-					Boolean isValidService = false;
-					for (Object id : modelList) {
-						BRMSParamTemplate value = (BRMSParamTemplate)id;
-						logger.info("Template value from dictionary is: "+value);
-						if (modelName.equals(value.getRuleName())) {
-							isValidService = true;
-							break;
-						}
-					}
-
-					em.close();
-
-					if (isValidService) {
-						newPolicy = new CreateBrmsParamPolicy(policyAdapter);
-					} else {
-						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template.  The template name, " 
-								+ modelName 
-								+ " was not found in the dictionary.");
-						response.addHeader("error", "missingTemplate");	
-						response.addHeader("modelName", modelName);
-						response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
-						return;
-					}
-				}
-				else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("Base")) {
-
-					newPolicy =  new ConfigPolicy(policyAdapter);
-
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("ClosedLoop_Fault")) {
-
-					newPolicy = new ClosedLoopPolicy(policyAdapter);
-
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("ClosedLoop_PM")) {
-
-					newPolicy = new CreateClosedLoopPerformanceMetrics(policyAdapter);
-
-				}else if (configPolicyType != null && configPolicyType.equalsIgnoreCase("DCAE Micro Service")) {
-
-					//check for valid actionAttributes
-					//Setup EntityManager to communicate with the PolicyVersion table of the DB
-					EntityManager em = null;
-					em = (EntityManager) emf.createEntityManager();
-
-					String modelName = policy.getServiceType();
-					String modelVersion = policy.getVersion();
-
-					Query getModel = em.createNamedQuery("MicroServiceModels.findAll");	
-					List<?> modelList = getModel.getResultList(); 	
-					Boolean isValidService = false;
-					for (Object id : modelList) {
-						MicroServiceModels value = (MicroServiceModels)id;
-						if (modelName.equals(value.getModelName()) && modelVersion.equals(value.getVersion())) {
-							isValidService = true;
-							break;
-						}
-					}
-
-					em.close();
-
-					if (isValidService) {
-						newPolicy = new MicroServiceConfigPolicy(policyAdapter);
-					} else {
-						logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Service or Version.  The Service Model, " 
-								+ modelName + " of version " + modelVersion 
-								+ " was not found in the dictionary.");
-						response.addHeader("error", "serviceModelDB");	
-						response.addHeader("modelName", modelName);
-						response.addHeader("modelVersion", modelVersion);
-						response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
-						return;
-					}
-
-				}
-
-			} else if (policyType.equalsIgnoreCase("Action")) {
-
-				//check for valid actionAttributes
-				//Setup EntityManager to communicate with the PolicyVersion table of the DB
-				EntityManager em = null;
-				em = (EntityManager) emf.createEntityManager();
-
-				String attributeName = policy.getActionAttribute();
-
-				Query getActionAttributes = em.createNamedQuery("ActionPolicyDict.findAll");	
-				List<?> actionAttributesList = getActionAttributes.getResultList(); 	
-				Boolean isAttribute = false;
-				for (Object id : actionAttributesList) {
-					ActionPolicyDict value = (ActionPolicyDict)id;
-					if (attributeName.equals(value.getAttributeName())) {
-						isAttribute = true;
-						break;
-					}
-				}
-
-				em.close();
-
-				if (isAttribute) {
-					newPolicy = new ActionPolicy(policyAdapter);
-				} else {
-					logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Could not fine " + attributeName + " in the ActionPolicyDict table.");
-					response.addHeader("error", "actionPolicyDB");	
-					response.addHeader("actionAttribute", attributeName);
-					response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
-					return;
-				}
-
-			} else if (policyType.equalsIgnoreCase("Decision")) {
-
-				newPolicy = new DecisionPolicy(policyAdapter);
-
-			}
-
-			// Create or Update Policy        
-			if (operation != null && (operation.equalsIgnoreCase("create") || operation.equalsIgnoreCase("update"))) {
-
-				// create the policy and return a response to the PAP-ADMIN		        
-				if (newPolicy.validateConfigForm()) {		        		
-					PolicyDBDaoTransaction policyDBDaoTransaction = policyDBDao.getNewTransaction();
-					try {	
-
-						// added check for existing policy when new policy is created to 
-						// unique API error for "policy already exists" 
-						Boolean isNewPolicy = newPolicy.prepareToSave();
-						if(isNewPolicy){
-							policyDBDaoTransaction.createPolicy(newPolicy, "doPolicyAPIPut");
-						}
-						Map<String, String> successMap = newPolicy.savePolicies();							
-						if (successMap.containsKey("success")) {
-							
-							EntityManager apiEm = null;
-							apiEm = (EntityManager) emf.createEntityManager();
-							//
-							// Did it get created?
-							//
-							if (apiEm == null) {
-								PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE +  " Error creating entity manager with persistence unit: " + PERSISTENCE_UNIT);	
-								ServletException e = new ServletException("Unable to create Entity Manager Factory");
-								e.printStackTrace();
-								throw e;
-							}
-							
-							String finalPath = policyAdapter.getFinalPolicyPath();
-		    				//
-		    				//Check the database entry if a scope is available in PolicyEditorScope table or not.
-		    				//If not exists create a new entry.
-		    				//
-		    				String dirName = finalPath.toString().substring(finalPath.toString().indexOf("repository")+11, finalPath.toString().lastIndexOf(File.separator));
-		    				apiEm.getTransaction().begin();
-		    				Query query = apiEm.createQuery("Select p from PolicyEditorScopes p where p.scopeName=:sname");
-		    				query.setParameter("sname", dirName);
-		    				
-		    				@SuppressWarnings("rawtypes")
-		    				List result = query.getResultList();
-		    				if(result.isEmpty()){
-		    					PolicyEditorScopes scopeEntity = new PolicyEditorScopes();
-		    					scopeEntity.setScopeName(dirName);
-		    					UserInfo user = new UserInfo();
-		    					user.setUserLoginId("API");
-		    					user.setUserName("API");
-		    					scopeEntity.setUserCreatedBy(user);
-		    					scopeEntity.setUserModifiedBy(user);
-		    					try{
-		    						apiEm.persist(scopeEntity);
-			    					apiEm.getTransaction().commit();
-		    					}catch(Exception e){
-		    						PolicyLogger.error("Exception Occured while inserting a new Entry to PolicyEditorScopes table"+e);
-		    						apiEm.getTransaction().rollback();
-		    					}finally{
-		    						apiEm.close();
-		    					}
-		    				}else{
-	    						PolicyLogger.info("Scope Already Exists in PolicyEditorScopes table, Hence Closing the Transaction");
-	    						apiEm.close();
-	    					}
-		    				
-							policyDBDaoTransaction.commitTransaction();
-							response.setStatus(HttpServletResponse.SC_OK);								
-							response.addHeader("successMapKey", "success");								
-							response.addHeader("policyName", policyAdapter.getPolicyName());
-
-							if (operation.equalsIgnoreCase("update")) {
-								response.addHeader("operation",  "update");
-							} else {
-								response.addHeader("operation", "create");
-							}
-						} else if (successMap.containsKey("EXISTS")) {
-							policyDBDaoTransaction.rollbackTransaction();
-							response.setStatus(HttpServletResponse.SC_CONFLICT);
-							response.addHeader("error", "policyExists");
-							response.addHeader("policyName", policyAdapter.getPolicyName());
-						} else if (successMap.containsKey("fwdberror")) {
-							policyDBDaoTransaction.rollbackTransaction();
-							response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
-							response.addHeader("error", "FWDBError");
-							response.addHeader("policyName", policyAdapter.getPolicyName());
-						}else {						
-							policyDBDaoTransaction.rollbackTransaction();
-							response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);								
-							response.addHeader("error", "error");							
-						}						
-					} catch (Exception e) {							
-						policyDBDaoTransaction.rollbackTransaction();
-						String message = XACMLErrorConstants.ERROR_PROCESS_FLOW + 
-								"Could not save policy " + e;
-						PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Could not save policy");
-						response.setStatus(HttpServletResponse.SC_BAD_REQUEST);	
-						response.addHeader("error", "savePolicy");
-						response.addHeader("message", message);
-					}		        	
-				}
-			}
-		}
-	}
-
-	private PolicyRestAdapter setDataToPolicyAdapter(StdPAPPolicy policy, String policyType, String apiflag) throws Exception {
-		PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
-		int highestVersion = 0;
-
-		if (policy.getHighestVersion()!=null) {	
-			highestVersion = policy.getHighestVersion();
-		}
-
-		EntityManager apiEm = null;
-		apiEm = (EntityManager) emf.createEntityManager();
-
-		//
-		// Did it get created?
-		//
-		if (apiEm == null) {
-			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + 
-					" Error creating entity manager with persistence unit: "
-					+ PERSISTENCE_UNIT);	
-			throw new ServletException("Unable to create Entity Manager Factory");
-		}
-
-		Path workspacePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE), "admin");
-		Path repositoryPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
-		Path gitPath = Paths.get(workspacePath.toString(), repositoryPath.getFileName().toString());
-
-		/*
-		 * Getting and Setting the parent path for Admin Console use when reading the policy files
-		 */
-		//domain chosen by the client to store the policy action files 
-		String domain = policy.getDomainDir();
-
-		//adding the domain to the gitPath
-		Path path;
-		String gitPathString = gitPath.toString();
-
-		if (gitPathString.contains("\\")) {
-			path = Paths.get(gitPath + "\\" + policy.getDomainDir());
-		} else {
-			path = Paths.get(gitPath + "/" + policy.getDomainDir());
-
-		}
-		logger.debug("path is: " + path.toString());
-
-		//getting the fullpath of the gitPath and convert to string
-		String policyDir = path.toAbsolutePath().toString();
-		String parentPath = null;
-
-		//creating the parentPath directory for the Admin Console use
-		File file;
-		if(policyDir.contains("\\"))
-		{
-			parentPath = policyDir.replace("ECOMP-PAP-REST", "ecomp-sdk-app");
-			file = new File(parentPath);
-		}
-		else
-		{
-			parentPath = policyDir.replace("pap",  "console");
-			file = new File(parentPath);
-
-		}
-
-		//Get the policy file from the git repository
-		String filePrefix = null;
-		if (policyType.equalsIgnoreCase("Config")) {
-			if (policy.getConfigPolicyType().equalsIgnoreCase("Firewall Config")) {
-				filePrefix = "Config_FW_";
-			}else if (policy.getConfigPolicyType().equalsIgnoreCase("ClosedLoop_Fault")) {
-				filePrefix = "Config_Fault_";
-			}else if (policy.getConfigPolicyType().equalsIgnoreCase("ClosedLoop_PM")) {
-				filePrefix = "Config_PM_";
-			}else if (policy.getConfigPolicyType().equalsIgnoreCase("DCAE Micro Service")) {
-				filePrefix = "Config_MS_";
-			} else if (policy.getConfigPolicyType().equalsIgnoreCase("BRMS_Raw")) {
-				filePrefix = "Config_BRMS_Raw_";
-			} else if (policy.getConfigPolicyType().equalsIgnoreCase("BRMS_Param")) {
-				filePrefix = "Config_BRMS_Param_";
-			}
-			else {
-				filePrefix = "Config_";
-			}
-		} else if (policyType.equalsIgnoreCase("Action")) {
-			filePrefix = "Action_";
-		} else if (policyType.equalsIgnoreCase("Decision")) {
-			filePrefix = "Decision_";
-		}
-
-
-		String pvName = domain + File.separator + filePrefix + policy.getPolicyName();
-
-		//create the directory if it does not exist
-		Boolean fileDir=true;
-		if (!file.exists()){
-			fileDir = new File(parentPath).mkdirs();
-		}
-
-		//set the parent path in the policy adapter
-		if (!fileDir){
-			logger.debug("Unable to create the policy directory");
-		}
-
-		logger.debug("ParentPath is: " + parentPath.toString());
-		policyAdapter.setParentPath(parentPath.toString());
-		policyAdapter.setApiflag(apiflag);
-
-		if (policy.isEditPolicy()) {
-
-			if(apiflag.equalsIgnoreCase("api")) {
-
-				//Get the Highest Version to Update
-				apiEm.getTransaction().begin();
-				Query query = apiEm.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
-				query.setParameter("pname", pvName);
-
-				@SuppressWarnings("rawtypes")
-				List result = query.getResultList();
-				PolicyVersion versionEntity = null;
-				if (!result.isEmpty()) {
-					versionEntity = (PolicyVersion) result.get(0);
-					apiEm.persist(versionEntity);
-					highestVersion = versionEntity.getHigherVersion();
-					int activeVersion = versionEntity.getActiveVersion();
-
-					Calendar calendar = Calendar.getInstance();
-					Timestamp modifyDate = new Timestamp(calendar.getTime().getTime());
-
-					//update table with highestVersion
-					try{
-						versionEntity.setHigherVersion(highestVersion+1);
-						versionEntity.setActiveVersion(activeVersion+1);
-						versionEntity.setCreatedBy("API");
-						versionEntity.setModifiedBy("API");
-						versionEntity.setModifiedDate(modifyDate);
-
-						apiEm.getTransaction().commit();
-
-					}catch(Exception e){
-						apiEm.getTransaction().rollback();
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR");
-					} finally {
-						apiEm.close();
-					}
-				} else {
-					logger.debug("\nNo PolicyVersion using policyName found");
-				}		
-
-			}
-
-			File policyFile = null;
-			if(policy.getOldPolicyFileName() != null && policy.getOldPolicyFileName().endsWith("Draft.1")) {
-				policyFile = new File(parentPath.toString() + File.separator + policy.getOldPolicyFileName() + ".xml");
-			} else {
-				policyFile = new File(parentPath.toString() + File.separator + filePrefix + policy.getPolicyName() +"."+(highestVersion)+ ".xml");
-			}
-
-			if (policyFile.exists()) {
-				DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-				DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-				Document doc = dBuilder.parse(policyFile);
-
-				doc.getDocumentElement().normalize();
-
-				String version = doc.getDocumentElement().getAttribute("Version");
-
-				NodeList rList = doc.getElementsByTagName("Rule");
-				Node rNode = rList.item(0);
-				Element rElement = (Element) rNode;
-
-				String ruleID = null;
-				if (rNode!=null){
-					ruleID = rElement.getAttribute("RuleId");
-				} else {
-					ruleID = newRuleID();
-				}
-
-				policyAdapter.setPolicyID(newPolicyID());
-				policyAdapter.setRuleID(ruleID);
-				policyAdapter.setVersion(version);
-
-			} else {
-				PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + " The policy file at the path " + policyFile + " does not exist.");
-			}
-
-		} else {
-
-			highestVersion = 1;
-			if (apiflag.equalsIgnoreCase("api")) {
-				Calendar calendar = Calendar.getInstance();
-				Timestamp createdDate = new Timestamp(calendar.getTime().getTime());
-
-				apiEm.getTransaction().begin();
-				Query query = apiEm.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
-				query.setParameter("pname", pvName);
-
-				@SuppressWarnings("rawtypes")
-				List result = query.getResultList();
-
-				if (result.isEmpty()) {
-
-					try{
-						PolicyVersion versionEntity = new PolicyVersion();
-						apiEm.persist(versionEntity);
-						versionEntity.setPolicyName(pvName);
-						versionEntity.setHigherVersion(highestVersion);
-						versionEntity.setActiveVersion(highestVersion);
-						versionEntity.setCreatedBy("API");
-						versionEntity.setModifiedBy("API");
-						versionEntity.setCreatedDate(createdDate);
-						versionEntity.setModifiedDate(createdDate);
-
-						apiEm.getTransaction().commit();
-
-					}catch(Exception e){
-						apiEm.getTransaction().rollback();
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR");
-					} finally {
-						apiEm.close();
-					}		
-				}
-			}
-
-			policyAdapter.setPolicyID(newPolicyID());
-			policyAdapter.setRuleID(newRuleID());	
-
-		}
-
-		/*
-		 * set policy adapter values for Building JSON object containing policy data
-		 */
-		//Common among policy types
-		policyAdapter.setPolicyName(policy.getPolicyName());
-		policyAdapter.setPolicyDescription(policy.getPolicyDescription());
-		policyAdapter.setEcompName(policy.getEcompName()); //Config Base and Decision Policies
-		policyAdapter.setHighestVersion(highestVersion);
-		policyAdapter.setRuleCombiningAlgId("urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
-		policyAdapter.setUserGitPath(gitPath.toString());
-		policyAdapter.setPolicyType(policyType);
-		policyAdapter.setDynamicFieldConfigAttributes(policy.getDynamicFieldConfigAttributes());
-		policyAdapter.setEditPolicy(policy.isEditPolicy());
-		policyAdapter.setEntityManagerFactory(getEmf());
-
-
-		//Config Specific
-		policyAdapter.setConfigName(policy.getConfigName());  //Base and Firewall
-		policyAdapter.setConfigBodyData(policy.getConfigBodyData()); //Base
-		policyAdapter.setConfigType(policy.getConfigType());  //Base
-		policyAdapter.setJsonBody(policy.getJsonBody()); //Firewall, ClosedLoop, and GoC
-		policyAdapter.setConfigPolicyType(policy.getConfigPolicyType());
-		policyAdapter.setDraft(policy.isDraft()); //ClosedLoop_Fault
-		policyAdapter.setServiceType(policy.getServiceType()); //ClosedLoop_PM
-		policyAdapter.setUuid(policy.getUuid()); //Micro Service
-		policyAdapter.setLocation(policy.getMsLocation()); //Micro Service
-		policyAdapter.setPriority(policy.getPriority()); //Micro Service
-		policyAdapter.setPolicyScope(policy.getDomainDir());
-		policyAdapter.setRiskType(policy.getRiskType()); //Safe Policy Attributes
-		policyAdapter.setRiskLevel(policy.getRiskLevel());//Safe Policy Attributes
-		policyAdapter.setGuard(policy.getGuard());//Safe Policy Attributes
-		policyAdapter.setTtlDate(policy.getTTLDate());//Safe Policy Attributes
-
-		//Action Policy Specific
-		policyAdapter.setActionAttribute(policy.getActionAttribute());  //comboDictValue
-		policyAdapter.setActionPerformer(policy.getActionPerformer());
-		policyAdapter.setDynamicRuleAlgorithmLabels(policy.getDynamicRuleAlgorithmLabels());
-		policyAdapter.setDynamicRuleAlgorithmCombo(policy.getDynamicRuleAlgorithmCombo());
-		policyAdapter.setDynamicRuleAlgorithmField1(policy.getDynamicRuleAlgorithmField1());
-		policyAdapter.setDynamicRuleAlgorithmField2(policy.getDynamicRuleAlgorithmField2());
-
-		//Decision Policy Specific
-		policyAdapter.setDynamicSettingsMap(policy.getDynamicSettingsMap());
-		policyAdapter.setProviderComboBox(policy.getProviderComboBox());
-
-		return policyAdapter;
-	}
-
-	public String	newPolicyID() {
-		return Joiner.on(':').skipNulls().join((XACMLPapServlet.getDomain().startsWith("urn") ? null : "urn"),
-				XACMLPapServlet.getDomain().replaceAll("[/\\\\.]", ":"), 
-				"xacml", "policy", "id", UUID.randomUUID());
-	}
-
-	public String	newRuleID() {
-		return Joiner.on(':').skipNulls().join((XACMLPapServlet.getDomain().startsWith("urn") ? null : "urn"),
-				XACMLPapServlet.getDomain().replaceAll("[/\\\\.]", ":"), 
-				"xacml", "rule", "id", UUID.randomUUID());
-	}
-
-	public static String	getDomain() {
-		return XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DOMAIN, "urn");
-	}
-
-
-	/**
-	 * Requests from the Admin Console for operations not on single specific objects
-	 * 
-	 * @param request
-	 * @param response
-	 * @param groupId
-	 * @param loggingContext
-	 * @throws ServletException
-	 * @throws IOException
-	 */
-	private void doACPost(HttpServletRequest request, HttpServletResponse response, String groupId, ECOMPLoggingContext loggingContext) throws ServletException, IOException {
-		PolicyDBDaoTransaction doACPostTransaction = null;
-
-		try {
-			String groupName = request.getParameter("groupName");
-			String groupDescription = request.getParameter("groupDescription");
-			String apiflag = request.getParameter("apiflag");
-
-			if (groupName != null && groupDescription != null) {
-				// Args:	      group=<groupId> groupName=<name> groupDescription=<description>            <= create a new group
-				loggingContext.setServiceName("AC:PAP.createGroup");
-
-				String unescapedName = URLDecoder.decode(groupName, "UTF-8");
-				String unescapedDescription = URLDecoder.decode(groupDescription, "UTF-8");
-				PolicyDBDaoTransaction newGroupTransaction = policyDBDao.getNewTransaction();
-				try {					
-					newGroupTransaction.createGroup(PolicyDBDao.createNewPDPGroupId(unescapedName), unescapedName, unescapedDescription,"XACMLPapServlet.doACPost");
-					papEngine.newGroup(unescapedName, unescapedDescription);
-					newGroupTransaction.commitTransaction();
-				} catch (Exception e) {
-					newGroupTransaction.rollbackTransaction();
-					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Unable to create new group");
-					loggingContext.transactionEnded();
-
-					PolicyLogger.audit("Transaction Failed - See Error.log");
-					response.sendError(500, "Unable to create new group '" + groupId + "'");
-					return;
-				}
-				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-				if (logger.isDebugEnabled()) {
-					logger.debug("New Group '" + groupId + "' created");
-				}
-				// tell the Admin Consoles there is a change
-				notifyAC();
-				// new group by definition has no PDPs, so no need to notify them of changes
-				loggingContext.transactionEnded();
-				PolicyLogger.audit("Transaction Failed - See Error.log");
-				auditLogger.info("Success");
-				PolicyLogger.audit("Transaction Ended Successfully");
-				return;
-			}
-
-			// for all remaining POST operations the group must exist before the operation can be done
-			EcompPDPGroup group = papEngine.getGroup(groupId);
-			if (group == null) {
-				String message = "Unknown groupId '" + groupId + "'";
-				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
-				loggingContext.transactionEnded();
-
-				PolicyLogger.audit("Transaction Failed - See Error.log");
-				if (apiflag!=null){
-					response.addHeader("error", "unknownGroupId");
-					response.addHeader("operation", "push");
-					response.addHeader("message", message);
-					response.setStatus(HttpServletResponse.SC_NOT_FOUND);
-				} else {
-					response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
-				}
-				return;
-			}
-
-			// determine the operation needed based on the parameters in the request
-			if (request.getParameter("policyId") != null) {
-				//	Args:        group=<groupId> policy=<policyId>		<= copy file
-				// copy a policy from the request contents into a file in the group's directory on this machine
-				if(apiflag!=null){
-					loggingContext.setServiceName("PolicyEngineAPI:PAP.postPolicy");
-				} else {
-					loggingContext.setServiceName("AC:PAP.postPolicy");
-				}
-
-				String policyId = request.getParameter("policyId");
-				PolicyDBDaoTransaction addPolicyToGroupTransaction = policyDBDao.getNewTransaction();
-				try {
-					InputStream is = null;
-					if (apiflag != null){
-						// get the request content into a String if the request is from API 
-						String json = null;
-						// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
-						java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
-						scanner.useDelimiter("\\A");
-						json =  scanner.hasNext() ? scanner.next() : "";
-						scanner.close();
-						logger.info("JSON request from API: " + json);
-
-						// convert Object sent as JSON into local object
-						ObjectMapper mapper = new ObjectMapper();
-
-						Object objectFromJSON = mapper.readValue(json, StdPAPPolicy.class);
-
-						StdPAPPolicy policy = (StdPAPPolicy) objectFromJSON;
-
-						is = new FileInputStream(new File(policy.getLocation()));
-					} else {
-						is = request.getInputStream();
-
-					}
-
-					addPolicyToGroupTransaction.addPolicyToGroup(group.getId(), policyId,"XACMLPapServlet.doACPost");
-					((StdPDPGroup) group).copyPolicyToFile(policyId, is);
-					addPolicyToGroupTransaction.commitTransaction();
-
-				} catch (Exception e) {
-					addPolicyToGroupTransaction.rollbackTransaction();
-					String message = "Policy '" + policyId + "' not copied to group '" + groupId +"': " + e;
-					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " " + message);
-					loggingContext.transactionEnded();
-
-					PolicyLogger.audit("Transaction Failed - See Error.log");
-
-					if (apiflag!=null){
-						response.addHeader("error", "policyCopyError");
-						response.addHeader("message", message);
-						response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-					} else {
-						response.sendError(500, message);
-					}
-					return;
-				}
-
-				// policy file copied ok and the Group was updated on the PDP
-				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-				response.addHeader("operation", "push");
-				response.addHeader("policyId", policyId);
-				response.addHeader("groupId", groupId);
-				if (logger.isDebugEnabled()) {
-					logger.debug("policy '" + policyId + "' copied to directory for group '" + groupId + "'");
-				}
-
-				loggingContext.transactionEnded();
-				auditLogger.info("Success");
-				PolicyLogger.audit("Transaction Ended Successfully");
-				return;
-
-			} else if (request.getParameter("default") != null) {
-				// Args:       group=<groupId> default=true               <= make default
-				// change the current default group to be the one identified in the request.
-				loggingContext.setServiceName("AC:PAP.setDefaultGroup");
-				//
-				// This is a POST operation rather than a PUT "update group" because of the side-effect that the current default group is also changed.
-				// It should never be the case that multiple groups are currently marked as the default, but protect against that anyway.
-				PolicyDBDaoTransaction setDefaultGroupTransaction = policyDBDao.getNewTransaction();
-				try {
-					setDefaultGroupTransaction.changeDefaultGroup(group, "XACMLPapServlet.doACPost");
-					papEngine.SetDefaultGroup(group);
-					setDefaultGroupTransaction.commitTransaction();
-				} catch (Exception e) {
-					setDefaultGroupTransaction.rollbackTransaction();
-					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Unable to set group");
-					loggingContext.transactionEnded();
-
-					PolicyLogger.audit("Transaction Failed - See Error.log");
-					response.sendError(500, "Unable to set group '" + groupId + "' to default");
-					return;
-				}
-
-				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-				if (logger.isDebugEnabled()) {
-					logger.debug("Group '" + groupId + "' set to be default");
-				}
-				// Notify the Admin Consoles that something changed
-				// For now the AC cannot handle anything more detailed than the whole set of PDPGroups, so just notify on that
-				//TODO - Future: FIGURE OUT WHAT LEVEL TO NOTIFY: 2 groups or entire set - currently notify AC to update whole configuration of all groups
-				notifyAC();
-				// This does not affect any PDPs in the existing groups, so no need to notify them of this change
-				loggingContext.transactionEnded();
-				auditLogger.info("Success");
-				PolicyLogger.audit("Transaction Ended Successfully");
-				return;
-
-			} else if (request.getParameter("pdpId") != null) {
-				doACPostTransaction = policyDBDao.getNewTransaction();
-				// Args:       group=<groupId> pdpId=<pdpId>               <= move PDP to group
-				loggingContext.setServiceName("AC:PAP.movePDP");
-
-				String pdpId = request.getParameter("pdpId");
-				EcompPDP pdp = papEngine.getPDP(pdpId);
-
-				EcompPDPGroup originalGroup = papEngine.getPDPGroup((EcompPDP) pdp);
-				try{
-					doACPostTransaction.movePdp(pdp, group, "XACMLPapServlet.doACPost");
-				}catch(Exception e){	
-					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", 
-							" Error while moving pdp in the database: "
-									+"pdp="+pdp.getId()+",to group="+group.getId());
-					throw new PAPException(e.getMessage());
-				}
-				papEngine.movePDP((EcompPDP) pdp, group);
-
-				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-				if (logger.isDebugEnabled()) {
-					logger.debug("PDP '" + pdp.getId() +"' moved to group '" + group.getId() + "' set to be default");
-				}
-
-				// update the status of both the original group and the new one
-				((StdPDPGroup)originalGroup).resetStatus();
-				((StdPDPGroup)group).resetStatus();
-
-				// Notify the Admin Consoles that something changed
-				// For now the AC cannot handle anything more detailed than the whole set of PDPGroups, so just notify on that
-				notifyAC();
-				// Need to notify the PDP that it's config may have changed
-				pdpChanged(pdp);
-				doACPostTransaction.commitTransaction();
-				loggingContext.transactionEnded();
-				auditLogger.info("Success");
-				PolicyLogger.audit("Transaction Ended Successfully");
-				return;
-
-
-			}
-		} catch (PAPException e) {
-			if(doACPostTransaction != null){
-				doACPostTransaction.rollbackTransaction();
-			}
-			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " AC POST exception");
-			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
 			response.sendError(500, e.getMessage());
 			return;
 		}
 	}
-
+	
 	/**
 	 * Requests from the Admin Console to create new items or update existing ones
 	 * 
@@ -3193,19 +1736,14 @@
 	private void doACPut(HttpServletRequest request, HttpServletResponse response, String groupId, ECOMPLoggingContext loggingContext) throws ServletException, IOException {
 		PolicyDBDaoTransaction acPutTransaction = policyDBDao.getNewTransaction();
 		try {
-
-
 			// for PUT operations the group may or may not need to exist before the operation can be done
 			EcompPDPGroup group = papEngine.getGroup(groupId);
-
 			// determine the operation needed based on the parameters in the request
-
 			// for remaining operations the group must exist before the operation can be done
 			if (group == null) {
 				String message = "Unknown groupId '" + groupId + "'";
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
 				return;
@@ -3222,14 +1760,12 @@
 				return;
 			} else if (request.getParameter("pdpId") != null) {
 				// ARGS:        group=<groupId> pdpId=<pdpId/URL>          <= create a new PDP or Update an Existing one
-
 				String pdpId = request.getParameter("pdpId");
 				if (papEngine.getPDP(pdpId) == null) {
 					loggingContext.setServiceName("AC:PAP.createPDP");
 				} else {
 					loggingContext.setServiceName("AC:PAP.updatePDP");
 				}
-
 				// get the request content into a String
 				String json = null;
 				// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
@@ -3237,13 +1773,10 @@
 				scanner.useDelimiter("\\A");
 				json =  scanner.hasNext() ? scanner.next() : "";
 				scanner.close();
-				logger.info("JSON request from AC: " + json);
-
+				LOGGER.info("JSON request from AC: " + json);
 				// convert Object sent as JSON into local object
 				ObjectMapper mapper = new ObjectMapper();
-
 				Object objectFromJSON = mapper.readValue(json, StdPDP.class);
-
 				if (pdpId == null ||
 						objectFromJSON == null ||
 						! (objectFromJSON instanceof StdPDP) ||
@@ -3251,12 +1784,10 @@
 						! ((StdPDP)objectFromJSON).getId().equals(pdpId)) {
 					PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " PDP new/update had bad input. pdpId=" + pdpId + " objectFromJSON="+objectFromJSON);
 					loggingContext.transactionEnded();
-
 					PolicyLogger.audit("Transaction Failed - See Error.log");
 					response.sendError(500, "Bad input, pdpid="+pdpId+" object="+objectFromJSON);
 				}
 				StdPDP pdp = (StdPDP) objectFromJSON;
-
 				if (papEngine.getPDP(pdpId) == null) {
 					// this is a request to create a new PDP object
 					try{
@@ -3278,15 +1809,12 @@
 					// this is a request to update the pdp
 					papEngine.updatePDP(pdp);
 				}
-
 				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-				if (logger.isDebugEnabled()) {
-					logger.debug("PDP '" + pdpId + "' created/updated");
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("PDP '" + pdpId + "' created/updated");
 				}
-
 				// adjust the group's state including the new PDP
 				((StdPDPGroup)group).resetStatus();
-
 				// tell the Admin Consoles there is a change
 				notifyAC();
 				// this might affect the PDP, so notify it of the change
@@ -3301,7 +1829,6 @@
 				loggingContext.setServiceName("AC:PAP.putPIP");
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " UNIMPLEMENTED");
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
 				return;
@@ -3309,7 +1836,6 @@
 				// Assume that this is an update of an existing PDP Group
 				// ARGS:        group=<groupId>         <= Update an Existing Group
 				loggingContext.setServiceName("AC:PAP.updateGroup");
-
 				// get the request content into a String
 				String json = null;
 				// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
@@ -3317,28 +1843,21 @@
 				scanner.useDelimiter("\\A");
 				json =  scanner.hasNext() ? scanner.next() : "";
 				scanner.close();
-				logger.info("JSON request from AC: " + json);
-
+				LOGGER.info("JSON request from AC: " + json);
 				// convert Object sent as JSON into local object
 				ObjectMapper mapper = new ObjectMapper();
-
 				Object objectFromJSON  = mapper.readValue(json, StdPDPGroup.class);
-
-				if (objectFromJSON == null ||
-						! (objectFromJSON instanceof StdPDPGroup) ||
+				if (objectFromJSON == null || ! (objectFromJSON instanceof StdPDPGroup) ||
 						! ((StdPDPGroup)objectFromJSON).getId().equals(group.getId())) {
 					PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + group.getId() + " objectFromJSON="+objectFromJSON);
 					loggingContext.transactionEnded();
-
 					PolicyLogger.audit("Transaction Failed - See Error.log");
 					response.sendError(500, "Bad input, id="+group.getId() +" object="+objectFromJSON);
 				}
-
 				// The Path on the PAP side is not carried on the RESTful interface with the AC
 				// (because it is local to the PAP)
 				// so we need to fill that in before submitting the group for update
 				((StdPDPGroup)objectFromJSON).setDirectory(((StdPDPGroup)group).getDirectory());
-
 				try{
 					acPutTransaction.updateGroup((StdPDPGroup)objectFromJSON, "XACMLPapServlet.doACPut");
 				} catch(Exception e){
@@ -3346,19 +1865,24 @@
 							+"group="+group.getId());
 					throw new PAPException(e.getMessage());
 				}
-				papEngine.updateGroup((StdPDPGroup)objectFromJSON);
-
+				
+				PushPolicyHandler pushPolicyHandler = PushPolicyHandler.getInstance();	
+				EcompPDPGroup updatedGroup = (StdPDPGroup)objectFromJSON;	
+				if (pushPolicyHandler.preSafetyCheck(updatedGroup, CONFIG_HOME)) {		
+					LOGGER.debug("Precheck Successful.");
+				}
+				
+                papEngine.updateGroup((StdPDPGroup)objectFromJSON);
 
 				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
-				if (logger.isDebugEnabled()) {
-					logger.debug("Group '" + group.getId() + "' updated");
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("Group '" + group.getId() + "' updated");
 				}
 				acPutTransaction.commitTransaction();
 				// tell the Admin Consoles there is a change
 				notifyAC();
 				// Group changed, which might include changing the policies
 				groupChanged(group);
-
 				loggingContext.transactionEnded();
 				auditLogger.info("Success");
 				PolicyLogger.audit("Transaction Ended Successfully");
@@ -3368,13 +1892,12 @@
 			acPutTransaction.rollbackTransaction();
 			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " AC PUT exception");
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
 			response.sendError(500, e.getMessage());
 			return;
 		}
 	}
-
+	
 	/**
 	 * Requests from the Admin Console to delete/remove items
 	 * 
@@ -3386,8 +1909,7 @@
 	 * @throws IOException
 	 */
 	private void doACDelete(HttpServletRequest request, HttpServletResponse response, String groupId, ECOMPLoggingContext loggingContext) throws ServletException, IOException {
-
-		//This is temporary code to allow deletes to propagate to the database since delete is not implemented
+		//This code is to allow deletes to propagate to the database since delete is not implemented
 		String isDeleteNotify = request.getParameter("isDeleteNotify");
 		if(isDeleteNotify != null){
 			String policyToDelete = request.getParameter("policyToDelete");
@@ -3420,21 +1942,16 @@
 				String message = "Unknown groupId '" + groupId + "'";
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unknown groupId '" + groupId +"'");
 				return;
 			}
-
-
 			// determine the operation needed based on the parameters in the request
 			if (request.getParameter("policy") != null) {
 				//        group=<groupId> policy=<policyId>  [delete=<true|false>]       <= delete policy file from group
 				loggingContext.setServiceName("AC:PAP.deletePolicy");
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " UNIMPLEMENTED");
-				//DATABASE so can policies not be deleted? or doesn't matter maybe as long as this gets called
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
 				return;
@@ -3442,20 +1959,16 @@
 				// ARGS:        group=<groupId> pdpId=<pdpId>                  <= delete PDP 
 				String pdpId = request.getParameter("pdpId");
 				EcompPDP pdp = papEngine.getPDP(pdpId);
-
 				try{
 					removePdpOrGroupTransaction.removePdpFromGroup(pdp.getId(),"XACMLPapServlet.doACDelete");
 				} catch(Exception e){
 					throw new PAPException();
 				}
 				papEngine.removePDP((EcompPDP) pdp);
-
 				// adjust the status of the group, which may have changed when we removed this PDP
 				((StdPDPGroup)group).resetStatus();
-
 				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
 				notifyAC();
-
 				// update the PDP and tell it that it has NO Policies (which prevents it from serving PEP Requests)
 				pdpChanged(pdp);
 				removePdpOrGroupTransaction.commitTransaction();
@@ -3465,11 +1978,9 @@
 				return;
 			} else if (request.getParameter("pipId") != null) {
 				//        group=<groupId> pipId=<pipEngineId> <= delete PIP config for given engine
-
 				loggingContext.setServiceName("AC:PAP.deletePIPConfig");
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " UNIMPLEMENTED");
 				loggingContext.transactionEnded();
-
 				PolicyLogger.audit("Transaction Failed - See Error.log");
 				response.sendError(HttpServletResponse.SC_BAD_REQUEST, "UNIMPLEMENTED");
 				return;
@@ -3480,21 +1991,17 @@
 				if (moveToGroupId != null) {
 					moveToGroup = papEngine.getGroup(moveToGroupId);
 				}
-
 				// get list of PDPs in the group being deleted so we can notify them that they got changed
 				Set<EcompPDP> movedPDPs = new HashSet<EcompPDP>();
 				movedPDPs.addAll(group.getEcompPdps());
-
 				// do the move/remove
 				try{
 					removePdpOrGroupTransaction.deleteGroup(group, moveToGroup,"XACMLPapServlet.doACDelete");
 				} catch(Exception e){
 					PolicyLogger.error(MessageCodes.ERROR_UNKNOWN, e, "XACMLPapServlet", " Failed to delete PDP Group. Exception");
-					e.printStackTrace();
 					throw new PAPException(e.getMessage());
 				}
 				papEngine.removeGroup(group, moveToGroup);
-
 				response.setStatus(HttpServletResponse.SC_NO_CONTENT);
 				notifyAC();
 				// notify any PDPs in the removed set that their config may have changed
@@ -3507,738 +2014,19 @@
 				PolicyLogger.audit("Transaction Ended Successfully");
 				return;
 			}
-
 		} catch (PAPException e) {
 			removePdpOrGroupTransaction.rollbackTransaction();
 			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " AC DELETE exception");
 			loggingContext.transactionEnded();
-
 			PolicyLogger.audit("Transaction Failed - See Error.log");
-			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Exception in request processing");
 			response.sendError(500, e.getMessage());
 			return;
 		}
 	}
-
-
+	
 	/**
-	 * Requests from the API to delete/remove items
+	 * Heartbeat thread - periodically check on PDPs' status
 	 * 
-	 * @param request
-	 * @param response
-	 * @param groupId
-	 * @param loggingContext 
-	 * @throws ServletException
-	 * @throws IOException
-	 */
-	private void doAPIDeleteFromPAP(HttpServletRequest request, HttpServletResponse response, ECOMPLoggingContext loggingContext) throws ServletException, IOException {
-
-		// get the request content into a String
-		String json = null;
-
-		// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
-		java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
-		scanner.useDelimiter("\\A");
-		json =  scanner.hasNext() ? scanner.next() : "";
-		scanner.close();
-		logger.info("JSON request from API: " + json);
-
-		// convert Object sent as JSON into local object
-		ObjectMapper mapper = new ObjectMapper();
-
-		Object objectFromJSON = mapper.readValue(json, StdPAPPolicy.class);
-
-		StdPAPPolicy policy = (StdPAPPolicy) objectFromJSON;
-
-		String policyName = policy.getPolicyName();
-		String fileSeparator = File.separator;
-		policyName = policyName.replaceFirst("\\.", "\\"+fileSeparator);
-
-		File file = getPolicyFile(policyName);
-		String domain = getParentPathSubScopeDir(file);
-		Boolean policyFileDeleted = false;
-		Boolean configFileDeleted = false;
-		Boolean policyVersionScoreDeleted = false;
-
-		if (policy.getDeleteCondition().equalsIgnoreCase("All Versions")){
-
-			//check for extension in policyName
-			String removexmlExtension = null;
-			String removeVersion = null;
-			if (policyName.contains("xml")) {
-				removexmlExtension = file.toString().substring(0, file.toString().lastIndexOf("."));
-				removeVersion = removexmlExtension.substring(0, removexmlExtension.lastIndexOf("."));
-			} else {
-				removeVersion = file.toString();
-			}
-
-			File dirXML = new File(file.getParent());
-			File[] listofXMLFiles = dirXML.listFiles();
-
-			for (File files : listofXMLFiles) {
-				//delete the xml files from the Repository
-				if (files.isFile() && files.toString().contains(removeVersion)) {
-					JPAUtils jpaUtils = null;
-					try {
-						jpaUtils = JPAUtils.getJPAUtilsInstance(emf);
-					} catch (Exception e) {
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " Could not create JPAUtils instance on the PAP");
-						e.printStackTrace();
-						response.addHeader("error", "jpautils");
-						response.addHeader("operation", "delete");
-						response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-						return;
-					}
-
-					if (jpaUtils.dbLockdownIgnoreErrors()) {
-						logger.warn("Policies are locked down");
-						response.addHeader("operation", "delete");
-						response.addHeader("lockdown", "true");
-						response.setStatus(HttpServletResponse.SC_ACCEPTED);
-						return;
-					}
-
-					//Propagates delete to the database 
-					Boolean deletedFromDB = notifyDBofDelete(files.toString());
-
-					if (deletedFromDB) {
-						logger.info("Policy deleted from the database.  Continuing with file delete");
-					} else {
-						PolicyLogger.error("Failed to delete Policy from database. Aborting file delete");
-						response.addHeader("error", "deleteDB");
-						response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-						return;
-					}
-
-					if (files.delete()) {
-						if (logger.isDebugEnabled()) {
-							logger.debug("Deleted file: " + files.toString());
-						}
-						policyFileDeleted = true;
-					} else {
-						logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + 
-								"Cannot delete the policy file in specified location: " + files.getAbsolutePath());	
-						response.addHeader("error", "deleteFile");
-						response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-						return;
-					}
-
-					// Get tomcat home directory for deleting config data
-					logger.info("print the path:" +domain);
-					String path = domain.replace('\\', '.');
-					if(path.contains("/")){
-						path = path.replace('/', '.');
-						logger.info("print the path:" +path);
-					}
-					String fileName = FilenameUtils.removeExtension(file.getName());
-					String removeVersionInFileName = fileName.substring(0, fileName.lastIndexOf("."));
-					String fileLocation = null;
-
-					if(CONFIG_HOME == null){
-						CONFIG_HOME = getConfigHome();
-					}
-					if(ACTION_HOME == null){
-						ACTION_HOME = getActionHome();
-					}
-
-
-					if (fileName != null && fileName.contains("Config_")) {
-						fileLocation = CONFIG_HOME;
-					} else if (fileName != null && fileName.contains("Action_")) {
-						fileLocation = ACTION_HOME;
-					}
-
-					if (logger.isDebugEnabled()) {
-						logger.debug("Attempting to rename file from the location: "+ fileLocation);
-					}
-
-					if(!files.toString().contains("Decision_")){
-						// Get the file from the saved location
-						File dir = new File(fileLocation);
-						File[] listOfFiles = dir.listFiles();
-
-						for (File file1 : listOfFiles) {
-							if (file1.isFile() && file1.getName().contains( path + removeVersionInFileName)) {
-								try {
-									if (file1.delete()) {
-										if (logger.isDebugEnabled()) {
-											logger.debug("Deleted file: " + file1.toString());
-										}
-										configFileDeleted = true;
-									} else {
-										logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + 
-												"Cannot delete the configuration or action body file in specified location: " + file1.getAbsolutePath());	
-										response.addHeader("error", "deleteConfig");
-										response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-										return;
-									}
-								} catch (Exception e) {
-									PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " Failed to Delete file");	
-								}
-							}
-							configFileDeleted = true;
-						}
-					} else {
-						configFileDeleted = true;
-					}
-
-					//Delete the Policy from Database Policy Version table
-					if (policyFileDeleted && configFileDeleted) {
-						String removeExtension = domain + removeVersionInFileName;
-						EntityManager em = (EntityManager) emf.createEntityManager();
-
-						Query getPolicyVersion = em.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
-						Query getPolicyScore = em.createQuery("Select p from PolicyScore p where p.PolicyName=:pname");
-						getPolicyVersion.setParameter("pname", removeExtension);
-						getPolicyScore.setParameter("pname", removeExtension);
-
-						@SuppressWarnings("rawtypes")
-						List pvResult = getPolicyVersion.getResultList();
-						@SuppressWarnings("rawtypes")
-						List psResult = getPolicyScore.getResultList();
-
-
-						try{
-							em.getTransaction().begin();
-							if (!pvResult.isEmpty()) {
-								for (Object id : pvResult) {
-									PolicyVersion versionEntity = (PolicyVersion)id;	
-									em.remove(versionEntity);
-								}
-							} else {
-								logger.debug("No PolicyVersion record found in database.");
-							}
-
-							if (!psResult.isEmpty()) {				
-								for (Object id : psResult) {
-									PolicyScore scoreEntity = (PolicyScore)id;	
-									em.remove(scoreEntity);
-								}
-							} else {
-								PolicyLogger.error("No PolicyScore record found in database.");
-							}
-							em.getTransaction().commit();
-							policyVersionScoreDeleted = true;
-						}catch(Exception e){
-							em.getTransaction().rollback();
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR");
-							response.addHeader("error", "deleteDB");
-							response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-							return;
-						} finally {
-							em.close();
-						}
-					}
-				}
-			}
-			//If Specific version is requested for delete
-		} else if (policy.getDeleteCondition().equalsIgnoreCase("Current Version")) {
-			String policyScoreName = domain + file.getName().toString();
-			String policyVersionName = policyScoreName.substring(0, policyScoreName.indexOf("."));
-			String versionExtension = policyScoreName.substring(policyScoreName.indexOf(".")+1);
-			String removexmlExtension = file.toString().substring(0, file.toString().lastIndexOf("."));
-			String getVersion = removexmlExtension.substring(removexmlExtension.indexOf(".")+1);
-			String removeVersion = removexmlExtension.substring(0, removexmlExtension.lastIndexOf("."));
-
-
-			JPAUtils jpaUtils = null;
-			try {
-				jpaUtils = JPAUtils.getJPAUtilsInstance(emf);
-			} catch (Exception e) {
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " Could not create JPAUtils instance on the PAP");
-				e.printStackTrace();
-				response.addHeader("error", "jpautils");
-				response.addHeader("operation", "delete");
-				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-				return;
-			}
-
-			if (jpaUtils.dbLockdownIgnoreErrors()) {
-				logger.warn("Policies are locked down");
-				response.addHeader("lockdown", "true");
-				response.addHeader("operation", "delete");
-				response.setStatus(HttpServletResponse.SC_ACCEPTED);
-				return;
-			}
-
-			//Propagates delete to the database 
-			Boolean deletedFromDB = notifyDBofDelete(file.toString());
-
-			if (deletedFromDB) {
-				logger.info("Policy deleted from the database.  Continuing with file delete");
-			} else {
-				PolicyLogger.error("Failed to delete Policy from database. Aborting file delete");
-				response.addHeader("error", "deleteDB");
-				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-				return;
-			}
-
-			if (file.delete()) {
-				if (logger.isDebugEnabled()) {
-					logger.debug("Deleted file: " + file.toString());
-				}
-				policyFileDeleted = true;
-			} else {
-				logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + 
-						"Cannot delete the policy file in specified location: " + file.getAbsolutePath());	
-				response.addHeader("error", "deleteFile");
-				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-				return;
-			}
-
-			// Get tomcat home directory for deleting config data
-			logger.info("print the path:" +domain);
-			String path = domain.replace('\\', '.');
-			if(path.contains("/")){
-				path = path.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-			String fileName = FilenameUtils.removeExtension(file.getName());
-			String removeVersionInFileName = fileName.substring(0, fileName.lastIndexOf("."));
-			String fileLocation = null;
-
-			if(CONFIG_HOME == null){
-				CONFIG_HOME = getConfigHome();
-			}
-			if(ACTION_HOME == null){
-				ACTION_HOME = getActionHome();
-			}
-
-
-			if (fileName != null && fileName.contains("Config_")) {
-				fileLocation = CONFIG_HOME;
-			} else if (fileName != null && fileName.contains("Action_")) {
-				fileLocation = ACTION_HOME;
-			}
-
-			if (logger.isDebugEnabled()) {
-				logger.debug("Attempting to rename file from the location: "+ fileLocation);
-			}
-
-			if(!file.toString().contains("Decision_")){
-				// Get the file from the saved location
-				File dir = new File(fileLocation);
-				File[] listOfFiles = dir.listFiles();
-
-				for (File file1 : listOfFiles) {
-					if (file1.isFile() && file1.getName().contains( path + fileName)) {
-						try {
-							if (file1.delete()) {
-								if (logger.isDebugEnabled()) {
-									logger.debug("Deleted file: " + file1.toString());
-								}
-								configFileDeleted = true;
-							} else {
-								logger.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + 
-										"Cannot delete the configuration or action body file in specified location: " + file1.getAbsolutePath());	
-								response.addHeader("error", "deleteConfig");
-								response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-								return;
-							}
-						} catch (Exception e) {
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " Failed to Delete file");		
-						}
-					}
-					configFileDeleted = true;
-				}
-			} else {
-				configFileDeleted = true;
-			}
-
-			//Delete the Policy from Database and set Active Version based on the deleted file.
-			int highestVersion = 0;
-			if (policyFileDeleted && configFileDeleted) {
-				String removeExtension = domain + removeVersionInFileName;
-				EntityManager em = (EntityManager) emf.createEntityManager();
-
-				Query getPolicyVersion = em.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
-				Query getPolicyScore = em.createQuery("Select p from PolicyScore p where p.PolicyName=:pname");
-				getPolicyVersion.setParameter("pname", removeExtension);
-				getPolicyScore.setParameter("pname", removeExtension);
-
-				@SuppressWarnings("rawtypes")
-				List pvResult = getPolicyVersion.getResultList();
-				@SuppressWarnings("rawtypes")
-				List psResult = getPolicyScore.getResultList();
-
-
-				try{
-					em.getTransaction().begin();
-					if (!pvResult.isEmpty()) {
-						PolicyVersion versionEntity = null;
-						for (Object id : pvResult) {
-							versionEntity = (PolicyVersion)id;
-							if(versionEntity.getPolicyName().equals(removeExtension)){
-								highestVersion = versionEntity.getHigherVersion();
-								em.remove(versionEntity);
-							}
-						}
-
-						int i = 0;
-						int version = Integer.parseInt(getVersion);
-
-						if(version == highestVersion) {
-							for(i = highestVersion; i>=1; i--){
-								highestVersion = highestVersion - 1;
-								String dirXML = removeVersion + "." + highestVersion + ".xml";
-								File filenew = new File(dirXML);
-
-								if(filenew.exists()){
-									break;
-								}
-
-							}
-						}
-
-						versionEntity.setPolicyName(removeExtension);
-						versionEntity.setHigherVersion(highestVersion);
-						versionEntity.setActiveVersion(highestVersion);
-						versionEntity.setModifiedBy("API");	
-
-						em.persist(versionEntity);
-
-					} else {
-						logger.debug("No PolicyVersion record found in database.");
-					}
-
-					if (!psResult.isEmpty()) {				
-						for (Object id : psResult) {
-							PolicyScore scoreEntity = (PolicyScore)id;	
-							if(scoreEntity.getPolicyName().equals(policyVersionName) && scoreEntity.getVersionExtension().equals(versionExtension)){
-								em.remove(scoreEntity);
-							}
-						}
-					} else {
-						PolicyLogger.error("No PolicyScore record found in database.");
-					}
-					em.getTransaction().commit();
-					policyVersionScoreDeleted = true;
-				}catch(Exception e){
-					em.getTransaction().rollback();
-					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR");
-					response.addHeader("error", "deleteDB");
-					response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-					return;
-				} finally {
-					em.close();
-				}
-			}
-		}
-
-		if (policyFileDeleted && configFileDeleted && policyVersionScoreDeleted) {
-			response.setStatus(HttpServletResponse.SC_OK);
-			response.addHeader("successMapKey", "success");
-			response.addHeader("operation", "delete");
-			return;				
-		} else {
-			PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + "Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.");
-
-			response.addHeader("error", "unknown");
-			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-			return;
-		}
-
-	}
-
-	private void doImportMicroServicePut(HttpServletRequest request, HttpServletResponse response) {
-		String importServiceCreation = request.getParameter("importService");;
-		String fileName = request.getParameter("fileName");
-		String version = request.getParameter("version");
-		String serviceName = request.getParameter("serviceName");
-		CreateNewMicroSerivceModel newMS = null;
-
-		String randomID = UUID.randomUUID().toString();
-
-		if ( importServiceCreation != null  || fileName != null) {
-			File extracDir = new File("ExtractDir");
-			if (!extracDir.exists()){
-				extracDir.mkdirs();
-			}
-			if (fileName.contains(".xmi")){
-				// get the request content into a String
-				String xmi = null;
-
-				// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
-				java.util.Scanner scanner;
-				try {
-					scanner = new java.util.Scanner(request.getInputStream());
-					scanner.useDelimiter("\\A");
-					xmi =  scanner.hasNext() ? scanner.next() : "";
-					scanner.close();
-				} catch (IOException e1) {
-					logger.error("Error in reading in file from API call");
-					return;
-				}
-
-				logger.info("XML request from API for import new Service");
-
-				//Might need to seperate by , for more than one file. 
-
-				try (Writer writer = new BufferedWriter(new OutputStreamWriter(
-						new FileOutputStream("ExtractDir" + File.separator + randomID+".xmi"), "utf-8"))) {
-					writer.write(xmi);
-				} catch (IOException e) {
-					logger.error("Error in reading in file from API call");
-					return;
-				}
-			}else{ 
-				try {	
-					InputStream inputStream = request.getInputStream() ; 
-
-					FileOutputStream outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip"); 
-					byte[] buffer = new byte[4096];
-					int bytesRead = -1 ; 
-					while ((bytesRead = inputStream.read(buffer)) != -1) { 
-						outputStream.write(buffer, 0, bytesRead) ; 
-					} 
-
-					outputStream.close() ; 
-					inputStream.close() ;
-
-				} catch (IOException e) {
-					logger.error("Error in reading in Zip File from API call");
-					return;
-				}
-			}
-
-			newMS =  new CreateNewMicroSerivceModel(fileName, serviceName, "API IMPORT", version, randomID);
-			Map<String, String> successMap = newMS.addValuesToNewModel();
-			if (successMap.containsKey("success")) {
-				successMap.clear();
-				successMap = newMS.saveImportService();
-			}
-
-
-			// create the policy and return a response to the PAP-ADMIN		    
-			if (successMap.containsKey("success")) {							
-				response.setStatus(HttpServletResponse.SC_OK);								
-				response.addHeader("successMapKey", "success");								
-				response.addHeader("operation", "import");
-				response.addHeader("service", serviceName);
-			} else if (successMap.containsKey("DBError")) {
-				if (successMap.get("DBError").contains("EXISTS")){
-					response.setStatus(HttpServletResponse.SC_CONFLICT);
-					response.addHeader("service", serviceName);
-					response.addHeader("error", "modelExistsDB");
-				}else{
-					response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-					response.addHeader("error", "importDB");
-				}
-				response.addHeader("operation", "import");
-				response.addHeader("service", serviceName);
-			}else if (successMap.get("error").contains("MISSING")){
-				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-				response.addHeader("error", "missing");	
-				response.addHeader("operation", "import");
-				response.addHeader("service", serviceName);
-			}
-		}
-	}
-
-	private void doAPIDeleteFromPDP(HttpServletRequest request, HttpServletResponse response, ECOMPLoggingContext loggingContext) throws ServletException, IOException {
-
-		String policyName = request.getParameter("policyName");
-		String groupId = request.getParameter("groupId");
-		String responseString = null;
-
-		// for PUT operations the group may or may not need to exist before the operation can be done
-		EcompPDPGroup group = null;
-		try {
-			group = papEngine.getGroup(groupId);
-		} catch (PAPException e) {
-			logger.error("Exception occured While PUT operation is performing for PDP Group"+e);
-		}
-
-		if (group == null) {
-			String message = "Unknown groupId '" + groupId + "'";
-			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
-			loggingContext.transactionEnded();
-
-			PolicyLogger.audit("Transaction Failed - See Error.log");
-			response.addHeader("error", "UnknownGroup");
-			response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
-			return;
-		} else {
-
-			loggingContext.setServiceName("API:PAP.deletPolicyFromPDPGroup");
-
-			if (policyName.contains("xml")) {
-				logger.debug("The full file name including the extension was provided for policyName.. continue.");
-			} else {
-				String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid policyName... "
-						+ "policyName must be the full name of the file to be deleted including version and extension";
-				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Invalid policyName... "
-						+ "policyName must be the full name of the file to be deleted including version and extension");
-				response.addHeader("error", "invalidPolicyName");
-				response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
-				return;
-			}
-			RemoveGroupPolicy removePolicy = new RemoveGroupPolicy((StdPDPGroup) group);
-
-			PDPPolicy policy =  group.getPolicy(policyName);
-
-			if (policy != null) {
-				removePolicy.prepareToRemove(policy);
-				EcompPDPGroup updatedGroup = removePolicy.getUpdatedObject();
-				responseString = deletePolicyFromPDPGroup(updatedGroup, loggingContext);
-			} else {
-				String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy does not exist on the PDP.";
-				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Policy does not exist on the PDP.");
-				response.addHeader("error", "noPolicyExist");
-				response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
-				return;
-			}			
-		}
-
-		if (responseString.equals("success")) {
-			logger.info("Policy successfully deleted!");
-			PolicyLogger.audit("Policy successfully deleted!");
-			response.setStatus(HttpServletResponse.SC_OK);
-			response.addHeader("successMapKey", "success");
-			response.addHeader("operation", "delete");
-			return;		
-		} else if (responseString.equals("No Group")) {
-			String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Group update had bad input.";
-			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input.");
-			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-			response.addHeader("error", "groupUpdate");
-			response.addHeader("message", message);
-			return;	
-		} else if (responseString.equals("DB Error")) {
-			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " Error while updating group in the database");
-			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-			response.addHeader("error", "deleteDB");
-			return;
-		} else {
-			PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + " Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.");
-			response.addHeader("error", "unknown");
-			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-			return;
-		}
-
-	}
-
-	protected String getParentPathSubScopeDir(File file) {
-		String domain1 = null;
-
-		Path workspacePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE), "admin");
-		Path repositoryPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
-		Path gitPath = Paths.get(workspacePath.toString(), repositoryPath.getFileName().toString());
-
-		String policyDir = file.getAbsolutePath();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		if(policyDir.contains("Config_")){
-			domain1 = policyDir.substring(0,policyDir.indexOf("Config_"));
-		}else if(policyDir.contains("Action_")){
-			domain1 = policyDir.substring(0,policyDir.indexOf("Action_"));	
-		}else{
-			domain1 = policyDir.substring(0,policyDir.indexOf("Decision_"));	
-		}
-		logger.info("print the main domain value"+policyDir);
-
-		return domain1;
-	}
-
-	/*
-	 * method to delete the policy from the database and return notification when using API
-	 */
-	private Boolean notifyDBofDelete (String policyToDelete) {
-		//String policyToDelete = request.getParameter("policyToDelete");
-		try{
-			policyToDelete = URLDecoder.decode(policyToDelete,"UTF-8");
-		} catch(UnsupportedEncodingException e){
-			PolicyLogger.error("Unsupported URL encoding of policyToDelete (UTF-8)");
-			return false;
-		}
-		PolicyDBDaoTransaction deleteTransaction = policyDBDao.getNewTransaction();
-		try{
-			deleteTransaction.deletePolicy(policyToDelete);
-		} catch(Exception e){
-			deleteTransaction.rollbackTransaction();
-			return false;
-		}
-		deleteTransaction.commitTransaction();
-		return true;
-	}
-
-	private String deletePolicyFromPDPGroup (EcompPDPGroup group, ECOMPLoggingContext loggingContext){
-		PolicyDBDaoTransaction acPutTransaction = policyDBDao.getNewTransaction();
-
-		String response = null;
-		loggingContext.setServiceName("API:PAP.updateGroup");
-
-		EcompPDPGroup existingGroup = null;
-		try {
-			existingGroup = papEngine.getGroup(group.getId());
-		} catch (PAPException e1) {
-			logger.error("Exception occured While Deleting Policy From PDP Group"+e1);
-		}
-
-		if (group == null ||
-				! (group instanceof StdPDPGroup) ||
-				! (group.getId().equals(existingGroup.getId()))) {
-			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + existingGroup.getId() + " objectFromJSON="+group);
-			loggingContext.transactionEnded();
-
-			PolicyLogger.audit("Transaction Failed - See Error.log");
-
-			response = "No Group";
-			return response;
-		}
-
-		// The Path on the PAP side is not carried on the RESTful interface with the AC
-		// (because it is local to the PAP)
-		// so we need to fill that in before submitting the group for update
-		((StdPDPGroup)group).setDirectory(((StdPDPGroup)existingGroup).getDirectory());
-
-		try{
-			acPutTransaction.updateGroup(group, "XACMLPapServlet.doAPIDelete");
-		} catch(Exception e){
-			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Error while updating group in the database: "
-					+"group="+existingGroup.getId());
-			response = "DB Error";
-			return response;
-		}
-
-		try {
-			papEngine.updateGroup(group);
-		} catch (PAPException e) {
-			logger.error("Exception occured While Updating PDP Groups"+e);
-			response = "error in updateGroup method";
-		}
-
-		if (logger.isDebugEnabled()) {
-			logger.debug("Group '" + group.getId() + "' updated");
-		}
-
-		acPutTransaction.commitTransaction();
-
-		// Group changed, which might include changing the policies
-		try {
-			groupChanged(existingGroup);
-		}  catch (Exception e) {
-			logger.error("Exception occured in Group Change Method"+e);
-			response = "error in groupChanged method";
-		}
-
-		if (response==null){
-			response = "success";
-			PolicyLogger.audit("Policy successfully deleted!");
-			PolicyLogger.audit("Transaction Ended Successfully");
-		}
-
-		loggingContext.transactionEnded();
-		PolicyLogger.audit("Transaction Ended");
-		return response;
-	}
-
-
-	//
-	// Heartbeat thread - periodically check on PDPs' status
-	//
-
-	/**
 	 * Heartbeat with all known PDPs.
 	 * 
 	 * Implementation note:
@@ -4258,8 +2046,6 @@
 	 * If there are a lot of non-responsive PDPs and the timeout is large-ish (the default is 20 seconds)
 	 * it could take a long time to cycle through all of the PDPs.
 	 * That means that this may not notice a PDP being down in a predictable time.
-	 * 
-	 *
 	 */
 	private class Heartbeat implements Runnable {
 		private PAPPolicyEngine papEngine;
@@ -4278,16 +2064,14 @@
 		}
 
 		public Heartbeat(PAPPolicyEngine papEngine2) {
-			this.papEngine = papEngine2;
+			papEngine = papEngine2;
 			this.heartbeatInterval = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_HEARTBEAT_INTERVAL, "10000"));
 			this.heartbeatTimeout = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_HEARTBEAT_TIMEOUT, "10000"));
 		}
 
 		@Override
 		public void run() {
-			//
 			// Set ourselves as running
-			//
 			synchronized(this) {
 				this.isRunning = true;
 			}
@@ -4296,7 +2080,6 @@
 				while (this.isRunning()) {
 					// Wait the given time
 					Thread.sleep(heartbeatInterval);
-
 					// get the list of PDPs (may have changed since last time)
 					pdps.clear();
 					synchronized(papEngine) {
@@ -4310,22 +2093,17 @@
 							PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", "Heartbeat unable to read PDPs from PAPEngine");
 						}
 					}
-					//
 					// Check for shutdown
-					//
 					if (this.isRunning() == false) {
-						logger.info("isRunning is false, getting out of loop.");
+						LOGGER.info("isRunning is false, getting out of loop.");
 						break;
 					}
-
 					// try to get the summary status from each PDP
 					boolean changeSeen = false;
 					for (EcompPDP pdp : pdps) {
-						//
 						// Check for shutdown
-						//
 						if (this.isRunning() == false) {
-							logger.info("isRunning is false, getting out of loop.");
+							LOGGER.info("isRunning is false, getting out of loop.");
 							break;
 						}
 						// the id of the PDP is its url (though we add a query parameter)
@@ -4345,35 +2123,26 @@
 								continue;
 							}
 						}
-
 						// Do a GET with type HeartBeat
 						String newStatus = "";
-
 						HttpURLConnection connection = null;
 						try {
-
-							//
 							// Open up the connection
-							//
 							connection = (HttpURLConnection)pdpURL.openConnection();
-							//
 							// Setup our method and headers
-							//
 							connection.setRequestMethod("GET");
 							connection.setConnectTimeout(heartbeatTimeout);
-							// Added for Authentication
+							// Authentication
 							String encoding = CheckPDP.getEncoding(pdp.getId());
 							if(encoding !=null){
 								connection.setRequestProperty("Authorization", "Basic " + encoding);
 							}
-							//
 							// Do the connect
-							//
 							connection.connect();
 							if (connection.getResponseCode() == 204) {
 								newStatus = connection.getHeaderField(XACMLRestProperties.PROP_PDP_HTTP_HEADER_HB);
-								if (logger.isDebugEnabled()) {
-									logger.debug("Heartbeat '" + pdp.getId() + "' status='" + newStatus + "'");
+								if (LOGGER.isDebugEnabled()) {
+									LOGGER.debug("Heartbeat '" + pdp.getId() + "' status='" + newStatus + "'");
 								}
 							} else {
 								// anything else is an unexpected result
@@ -4396,10 +2165,9 @@
 							// cleanup the connection
 							connection.disconnect();
 						}
-
 						if ( ! pdp.getStatus().getStatus().toString().equals(newStatus)) {
-							if (logger.isDebugEnabled()) {
-								logger.debug("previous status='" + pdp.getStatus().getStatus()+"'  new Status='" + newStatus + "'");
+							if (LOGGER.isDebugEnabled()) {
+								LOGGER.debug("previous status='" + pdp.getStatus().getStatus()+"'  new Status='" + newStatus + "'");
 							}
 							try {
 								setPDPSummaryStatus(pdp, newStatus);
@@ -4408,21 +2176,16 @@
 							}
 							changeSeen = true;
 						}
-
 					}
-					//
 					// Check for shutdown
-					//
 					if (this.isRunning() == false) {
-						logger.info("isRunning is false, getting out of loop.");
+						LOGGER.info("isRunning is false, getting out of loop.");
 						break;
 					}
-
 					// if any of the PDPs changed state, tell the ACs to update
 					if (changeSeen) {
 						notifyAC();
 					}
-
 				}
 			} catch (InterruptedException e) {
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " Heartbeat interrupted.  Shutting down");
@@ -4431,13 +2194,10 @@
 		}
 	}
 
-
-	//
-	// HELPER to change Group status when PDP status is changed
-	//
-	// (Must NOT be called from a method that is synchronized on the papEngine or it may deadlock)
-	//
-
+	/*
+	 * HELPER to change Group status when PDP status is changed
+	 * (Must NOT be called from a method that is synchronized on the papEngine or it may deadlock)
+	 */
 	private void setPDPSummaryStatus(EcompPDP pdp, PDPStatus.Status newStatus) throws PAPException {
 		setPDPSummaryStatus(pdp, newStatus.toString());
 	}
@@ -4447,7 +2207,6 @@
 			StdPDPStatus status = new StdPDPStatus();
 			status.setStatus(PDPStatus.Status.valueOf(newStatus));
 			((StdPDP)pdp).setStatus(status);
-
 			// now adjust the group
 			StdPDPGroup group = (StdPDPGroup)papEngine.getPDPGroup((EcompPDP) pdp);
 			// if the PDP was just deleted it may transiently exist but not be in a group
@@ -4457,12 +2216,10 @@
 		}
 	}
 
-
-	//
-	// Callback methods telling this servlet to notify PDPs of changes made by the PAP StdEngine
-	//	in the PDP group directories
-	//
-
+	/*
+	 * Callback methods telling this servlet to notify PDPs of changes made by the PAP StdEngine
+	 * in the PDP group directories
+	 */
 	@Override
 	public void changed() {
 		// all PDPs in all groups need to be updated/sync'd
@@ -4491,10 +2248,7 @@
 		// kick off a thread to do an event notification for each PDP.
 		// This needs to be on a separate thread so that PDPs that do not respond (down, non-existent, etc)
 		// do not block the PSP response to the AC, which would freeze the GUI until all PDPs sequentially respond or time-out.
-		// begin - Fix to maintain requestId - including storedRequestId in UpdatePDPThread to be used later when calling PDP
-		// Thread t = new Thread(new UpdatePDPThread(pdp));
 		Thread t = new Thread(new UpdatePDPThread(pdp, storedRequestId));
-		// end   - Fix to maintain requestId
 		if(CheckPDP.validateID(pdp.getId())){
 			t.start();
 		}
@@ -4502,21 +2256,12 @@
 
 	private class UpdatePDPThread implements Runnable {
 		private EcompPDP pdp;
-		// begin - Fix to maintain requestId - define requestId under class to be used later when calling PDP
 		private String requestId;
-		// end   - Fix to maintain requestId
 
-		// remember which PDP to notify
-		public UpdatePDPThread(EcompPDP pdp) {
-			this.pdp = pdp;
-		}
-
-		// begin - Fix to maintain requestId - clone UpdatePDPThread method with different method signature so to include requestId to be used later when calling PDP
 		public UpdatePDPThread(EcompPDP pdp, String storedRequestId) {
 			this.pdp = pdp;
 			requestId = storedRequestId;
 		}
-		// end   - Fix to maintain requestId
 
 		public void run() {
 			// send the current configuration to one PDP
@@ -4525,11 +2270,7 @@
 			ECOMPLoggingContext loggingContext = new ECOMPLoggingContext(baseLoggingContext);
 			try {
 				loggingContext.setServiceName("PAP:PDP.putConfig");
-				// get a new transaction (request) ID and update the logging context.
-				// begin - Fix to maintain requestId - replace unconditioned generation of new requestID so it won't be used later when calling PDP
 				// If a requestId was provided, use it, otherwise generate one; post to loggingContext to be used later when calling PDP
-				// UUID requestID = UUID.randomUUID();
-				// loggingContext.setRequestID(requestID.toString());
 				if ((requestId == null) || (requestId == "")) {
 					UUID requestID = UUID.randomUUID();
 					loggingContext.setRequestID(requestID.toString());
@@ -4538,62 +2279,29 @@
 					loggingContext.setRequestID(requestId);
 					PolicyLogger.info("requestID was provided in call to XACMLPapSrvlet (UpdatePDPThread):  " + loggingContext.getRequestID());
 				}
-				// end   - Fix to maintain requestId
 				loggingContext.transactionStarted();
-				// dummy metric.log example posted below as proof of concept
-				loggingContext.metricStarted();
-				loggingContext.metricEnded();
-				PolicyLogger.metrics("Metric example posted here - 1 of 2");
-				loggingContext.metricStarted();
-				loggingContext.metricEnded();
-				PolicyLogger.metrics("Metric example posted here - 2 of 2");
-				// dummy metric.log example posted above as proof of concept
-
-				//
 				// the Id of the PDP is its URL
-				//
-				if (logger.isDebugEnabled()) {
-					logger.debug("creating url for id '" + pdp.getId() + "'");
+				if (LOGGER.isDebugEnabled()) {
+					LOGGER.debug("creating url for id '" + pdp.getId() + "'");
 				}
 				//TODO - currently always send both policies and pips.  Do we care enough to add code to allow sending just one or the other?
 				//TODO		(need to change "cache=", implying getting some input saying which to change)
 				URL url = new URL(pdp.getId() + "?cache=all");
-
-				//
 				// Open up the connection
-				//
 				connection = (HttpURLConnection)url.openConnection();
-				//
 				// Setup our method and headers
-				//
 				connection.setRequestMethod("PUT");
-				// Added for Authentication
+				// Authentication
 				String encoding = CheckPDP.getEncoding(pdp.getId());
 				if(encoding !=null){
 					connection.setRequestProperty("Authorization", "Basic " + encoding);
 				}
 				connection.setRequestProperty("Content-Type", "text/x-java-properties");
-				// begin - Fix to maintain requestId - post requestID from loggingContext in PDP request header for call to PDP, then reinit storedRequestId to null
-				// connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
 				connection.setRequestProperty("X-ECOMP-RequestID", loggingContext.getRequestID());
 				storedRequestId = null;
-				// end   - Fix to maintain requestId 
-				//
-				// Adding this in. It seems the HttpUrlConnection class does NOT
-				// properly forward our headers for POST re-direction. It does so
-				// for a GET re-direction.
-				//
-				// So we need to handle this ourselves.
-				//
-				//TODO - is this needed for a PUT?  seems better to leave in for now?
-				//	            connection.setInstanceFollowRedirects(false);
-				//
-				// PLD - MUST be able to handle re-directs.
-				//
 				connection.setInstanceFollowRedirects(true);
 				connection.setDoOutput(true);
 				try (OutputStream os = connection.getOutputStream()) {
-
 					EcompPDPGroup group = papEngine.getPDPGroup((EcompPDP) pdp);
 					// if the PDP was just deleted, there is no group, but we want to send an update anyway
 					if (group == null) {
@@ -4602,11 +2310,9 @@
 						policyProperties.put(XACMLProperties.PROP_ROOTPOLICIES, "");
 						policyProperties.put(XACMLProperties.PROP_REFERENCEDPOLICIES, "");
 						policyProperties.store(os, "");
-
 						Properties pipProps = new Properties();
 						pipProps.setProperty(XACMLProperties.PROP_PIP_ENGINES, "");
 						pipProps.store(os, "");
-
 					} else {
 						// send properties from the current group
 						group.getPolicyProperties().store(os, "");
@@ -4617,35 +2323,31 @@
 						policyLocations.store(os, "");
 						group.getPipConfigProperties().store(os, "");
 					}
-
 				} catch (Exception e) {
 					PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Failed to send property file to " + pdp.getId());
 					// Since this is a server-side error, it probably does not reflect a problem on the client,
 					// so do not change the PDP status.
 					return;
 				}
-				//
 				// Do the connect
-				//
 				connection.connect();
 				if (connection.getResponseCode() == 204) {
-					logger.info("Success. We are configured correctly.");
+					LOGGER.info("Success. We are configured correctly.");
 					loggingContext.transactionEnded();
 					auditLogger.info("Success. PDP is configured correctly.");
 					PolicyLogger.audit("Transaction Success. PDP is configured correctly.");
 					setPDPSummaryStatus(pdp, PDPStatus.Status.UP_TO_DATE);
 				} else if (connection.getResponseCode() == 200) {
-					logger.info("Success. PDP needs to update its configuration.");
+					LOGGER.info("Success. PDP needs to update its configuration.");
 					loggingContext.transactionEnded();
 					auditLogger.info("Success. PDP needs to update its configuration.");
 					PolicyLogger.audit("Transaction Success. PDP is configured correctly.");
 					setPDPSummaryStatus(pdp, PDPStatus.Status.OUT_OF_SYNCH);
 				} else {
-					logger.warn("Failed: " + connection.getResponseCode() + "  message: " + connection.getResponseMessage());
+					LOGGER.warn("Failed: " + connection.getResponseCode() + "  message: " + connection.getResponseMessage());
 					loggingContext.transactionEnded();
 					auditLogger.warn("Failed: " + connection.getResponseCode() + "  message: " + connection.getResponseMessage());
 					PolicyLogger.audit("Transaction Failed: " + connection.getResponseCode() + "  message: " + connection.getResponseMessage());
-
 					setPDPSummaryStatus(pdp, PDPStatus.Status.UNKNOWN);
 				}
 			} catch (Exception e) {
@@ -4656,24 +2358,20 @@
 					setPDPSummaryStatus(pdp, PDPStatus.Status.UNKNOWN);
 				} catch (PAPException e1) {
 					PolicyLogger.audit("Transaction Failed: Unable to set status of PDP " + pdp.getId() + " to UNKNOWN: " + e);
-
 					PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Unable to set status of PDP '" + pdp.getId() + "' to UNKNOWN");
 				}
 			} finally {
 				// cleanup the connection
 				connection.disconnect();
-
 				// tell the AC to update it's status info
 				notifyAC();
 			}
-
 		}
 	}
 
-	//
-	// RESTful Interface from PAP to ACs notifying them of changes
-	//
-
+	/*
+	 * RESTful Interface from PAP to ACs notifying them of changes
+	 */
 	private void notifyAC() {
 		// kick off a thread to do one event notification for all registered ACs
 		// This needs to be on a separate thread so that ACs can make calls back to PAP to get the updated Group data
@@ -4683,68 +2381,47 @@
 	}
 
 	private class NotifyACThread implements Runnable {
-
 		public void run() {
 			List<String> disconnectedACs = new ArrayList<String>();
-
 			// There should be no Concurrent exception here because the list is a CopyOnWriteArrayList.
 			// The "for each" loop uses the collection's iterator under the covers, so it should be correct.
 			for (String acURL : adminConsoleURLStringList) {
 				HttpURLConnection connection = null;
 				try {
-
 					acURL += "?PAPNotification=true";
-
 					//TODO - Currently we just tell AC that "Something changed" without being specific.  Do we want to tell it which group/pdp changed?
 					//TODO - If so, put correct parameters into the Query string here
 					acURL += "&objectType=all" + "&action=update";
-
-					if (logger.isDebugEnabled()) {
-						logger.debug("creating url for id '" + acURL + "'");
+					if (LOGGER.isDebugEnabled()) {
+						LOGGER.debug("creating url for id '" + acURL + "'");
 					}
 					//TODO - currently always send both policies and pips.  Do we care enough to add code to allow sending just one or the other?
 					//TODO		(need to change "cache=", implying getting some input saying which to change)
-
 					URL url = new URL(acURL );
-
-					//
 					// Open up the connection
-					//
 					connection = (HttpURLConnection)url.openConnection();
-					//
 					// Setup our method and headers
-					//
 					connection.setRequestMethod("PUT");
 					connection.setRequestProperty("Content-Type", "text/x-java-properties");
-					//
 					// Adding this in. It seems the HttpUrlConnection class does NOT
 					// properly forward our headers for POST re-direction. It does so
 					// for a GET re-direction.
-					//
 					// So we need to handle this ourselves.
-					//
 					//TODO - is this needed for a PUT?  seems better to leave in for now?
 					connection.setInstanceFollowRedirects(false);
-					//
 					// Do not include any data in the PUT because this is just a
 					// notification to the AC.
 					// The AC will use GETs back to the PAP to get what it needs
 					// to fill in the screens.
-					//
-
-					//
 					// Do the connect
-					//
 					connection.connect();
 					if (connection.getResponseCode() == 204) {
-						logger.info("Success. We updated correctly.");
+						LOGGER.info("Success. We updated correctly.");
 					} else {
-						logger.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Failed: " + connection.getResponseCode() + "  message: " + connection.getResponseMessage());
+						LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Failed: " + connection.getResponseCode() + "  message: " + connection.getResponseMessage());
 					}
 
 				} catch (Exception e) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to sync config AC '" + acURL + "': " + e, e);
 					PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Unable to sync config AC '" + acURL + "'");
 					disconnectedACs.add(acURL);
 				} finally {
@@ -4752,75 +2429,110 @@
 					connection.disconnect();
 				}
 			}
-
 			// remove any ACs that are no longer connected
 			if (disconnectedACs.size() > 0) {
 				adminConsoleURLStringList.removeAll(disconnectedACs);
 			}
+		}
+	}
 
+	private void testService(ECOMPLoggingContext loggingContext, HttpServletResponse response) throws IOException{
+		LOGGER.info("Test request received");
+		try {
+			im.evaluateSanity();
+			//If we make it this far, all is well
+			String message = "GET:/pap/test called and PAP " + papResourceName + " is OK";
+			LOGGER.info(message);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.setStatus(HttpServletResponse.SC_OK);
+			return;
+		}catch (ForwardProgressException fpe){
+			//No forward progress is being made
+			String message = "GET:/pap/test called and PAP " + papResourceName + " is not making forward progress."
+					+ " Exception Message: " + fpe.getMessage();
+			LOGGER.info(message);
+			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
+			return;
+		}catch (AdministrativeStateException ase){
+			//Administrative State is locked
+			String message = "GET:/pap/test called and PAP " + papResourceName + " Administrative State is LOCKED "
+					+ " Exception Message: " + ase.getMessage();
+			LOGGER.info(message);
+			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
+			return;
+		}catch (StandbyStatusException sse){
+			//Administrative State is locked
+			String message = "GET:/pap/test called and PAP " + papResourceName + " Standby Status is NOT PROVIDING SERVICE "
+					+ " Exception Message: " + sse.getMessage();
+			LOGGER.info(message);
+			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
+			return;
+		}catch (Exception e) {
+			//A subsystem is not making progress, is locked, standby or is not responding
+			String eMsg = e.getMessage();
+			if(eMsg == null){
+				eMsg = "No Exception Message";
+			}
+			String message = "GET:/pap/test called and PAP " + papResourceName + " has had a subsystem failure."
+					+ " Exception Message: " + eMsg;
+			LOGGER.info(message);
+			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			//Get the specific list of subsystems that failed
+			String ssFailureList = null;
+			for(String failedSS : papDependencyGroupsFlatArray){
+				if(eMsg.contains(failedSS)){
+					if(ssFailureList == null){
+						ssFailureList = failedSS;
+					}else{
+						ssFailureList = ssFailureList.concat(","+failedSS);
+					}
+				}
+			}
+			if(ssFailureList == null){
+				ssFailureList = "UnknownSubSystem";
+			}
+			response.addHeader("X-ECOMP-SubsystemFailure", ssFailureList);
+			response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
+			return;
 		}
 	}
 
 	/*
-	 * Added by Mike M in 1602 release for Authorizing the PEP Requests for Granularity. 
+	 * Authorizing the PEP Requests. 
 	 */
-	private boolean authorizeRequest(HttpServletRequest request) {
-		if(request instanceof HttpServletRequest) {
-
-			// Get the client Credentials from the Request header. 
-			String clientCredentials = request.getHeader(ENVIRONMENT_HEADER);
-
-			// Check if the Client is Authorized. 
-			if(clientCredentials!=null && clientCredentials.equalsIgnoreCase(environment)){
-				return true;
-			}else{
-				return false;
-			}
-		} else {
+	private boolean authorizeRequest(HttpServletRequest request) { 
+		String clientCredentials = request.getHeader(ENVIRONMENT_HEADER);
+		// Check if the Client is Authorized. 
+		if(clientCredentials!=null && clientCredentials.equalsIgnoreCase(environment)){
+			return true;
+		}else{
 			return false;
 		}
 	}
 
-	public static String getConfigHome(){
-		try {
-			loadWebapps();
-		} catch (Exception e) {
-			return null;
-		}
-		return CONFIG_HOME;
-	}
-
-	public static String getActionHome(){
-		try {
-			loadWebapps();
-		} catch (Exception e) {
-			return null;
-		}
-		return ACTION_HOME;
-	}
-
-	private static void loadWebapps() throws Exception{
+	private static void loadWebapps() throws PAPException{
 		if(ACTION_HOME == null || CONFIG_HOME == null){
 			Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
 			//Sanity Check
 			if (webappsPath == null) {
 				PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
-				throw new Exception("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
+				throw new PAPException("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
 			}
-			Path webappsPathConfig;
-			Path webappsPathAction;
-			if(webappsPath.toString().contains("\\"))
-			{
-				webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
-				webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
-			}
-			else
-			{
-				webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
-				webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
-			}
-			if (Files.notExists(webappsPathConfig)) 
-			{
+			Path webappsPathConfig = Paths.get(webappsPath.toString()+File.separator+"Config");
+			Path webappsPathAction = Paths.get(webappsPath.toString()+File.separator+"Action");
+			if (Files.notExists(webappsPathConfig)) {
 				try {
 					Files.createDirectories(webappsPathConfig);
 				} catch (IOException e) {
@@ -4828,12 +2540,11 @@
 							+ webappsPathConfig.toAbsolutePath().toString());
 				}
 			}
-			if (Files.notExists(webappsPathAction)) 
-			{
+			if (Files.notExists(webappsPathAction)) {
 				try {
 					Files.createDirectories(webappsPathAction);
 				} catch (IOException e) {
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
+					LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
 							+ webappsPathAction.toAbsolutePath().toString(), e);
 				}
 			}
@@ -4842,17 +2553,41 @@
 		}
 	}
 
-	/**
-	 * @return the emf
-	 */
-	public EntityManagerFactory getEmf() {
-		return emf;
-	}
-	public IntegrityMonitor getIm() {
-		return im;
+	public static String getConfigHome(){
+		try {
+			loadWebapps();
+		} catch (PAPException e) {
+			return null;
+		}
+		return CONFIG_HOME;
 	}
 
-	public IntegrityAudit getIa() {
-		return ia;
+	public static String getActionHome(){
+		try {
+			loadWebapps();
+		} catch (PAPException e) {
+			return null;
+		}
+		return ACTION_HOME;
+	}
+
+	public static EntityManagerFactory getEmf() {
+		return emf;
+	}
+	
+	public static String getPDPFile(){
+		return XACMLPapServlet.pdpFile;
+	}
+	
+	public static String getPersistenceUnit(){
+		return PERSISTENCE_UNIT;
+	}
+	
+	public static PAPPolicyEngine getPAPEngine(){
+		return papEngine;
+	}
+	
+	public static PolicyDBDaoTransaction getDbDaoTransaction(){
+		return policyDBDao.getNewTransaction();
 	}
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/PolicyRestAdapter.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/PolicyRestAdapter.java
deleted file mode 100644
index 19af8b0..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/PolicyRestAdapter.java
+++ /dev/null
@@ -1,480 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.adapters;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.EntityManagerFactory;
-
-//import org.openecomp.policy.pap.xacml.rest.model.GitRepositoryContainer;
-
-public class PolicyRestAdapter {
-	
-	private Object data;
-	private String policyName = null;
-	private String configBodyData = null;
-	private String configType = null;
-	private String policyID = null;
-	private String policyType = null;
-	private String configPolicyType = null;
-	private String policyDescription = null;
-	private String ecompName = null;
-	private String configName = null;
-	private String ruleID = null;
-	private String ruleCombiningAlgId = null;
-	private Map<String,String> dynamicFieldConfigAttributes;
-	private Map<String,String> dynamicSettingsMap;
-	private Map<String,String> dropDownMap;
-	private String actionPerformer = null;
-	private String actionAttribute = null;
-	private List<String> dynamicRuleAlgorithmLabels;
-	private List<String> dynamicRuleAlgorithmCombo;
-	private List<String> dynamicRuleAlgorithmField1;
-	private List<String> dynamicRuleAlgorithmField2;
-	private List<Object> dynamicVariableList;
-	private List<String> dataTypeList;
-	private String parentPath;	
-	private boolean isValidData = false;
-	private String adminNotification = null;
-	private boolean isEditPolicy = false;
-	private boolean isViewPolicy = false;
-	private boolean isDraft = false;
-	private Object policyData = null;
-	private String gitPath;
-	private boolean readOnly;
-	private String configHome;
-	private String configUrl;
-	private String finalPolicyPath;
-	private String version;
-	private String jsonBody;
-	private String apiflag;
-	private String prevJsonBody;
-	private Integer highestVersion;
-//	private String actionDictHeader = null;
-//	private String actionDictType = null;
-//	private String actionDictUrl = null;
-//	private String actionDictMethod = null;
-	private String serviceType = null;
-	private String uuid = null;
-	private String location = null;
-    private String priority = null;
-	private Map<String,String> brmsParamBody=null;
-	private EntityManagerFactory entityManagerFactory = null;
-	private Boolean policyExists = false;
-	private String policyScope;
-	private String providerComboBox = null;
-	private String riskType;
-	private String guard;
-	private String riskLevel;
-	private String ttlDate;
-	
-
-	public Integer getHighestVersion() {
-		return highestVersion;
-	}
-	public void setHighestVersion(Integer highestVersion) {
-		this.highestVersion = highestVersion;
-	}
-	public Object getData() {
-		return data;
-	}
-	public void setData(Object data) {
-		this.data = data;
-	}
-	public String getPolicyName() {
-		return policyName;
-	}
-	public void setPolicyName(String policyName) {
-		this.policyName = policyName;
-	}
-	public String getConfigBodyData() {
-		return configBodyData;
-	}
-	public void setConfigBodyData(String configBodyData) {
-		this.configBodyData = configBodyData;
-	}
-	public String getConfigType() {
-		return configType;
-	}
-	public void setConfigType(String configType) {
-		this.configType = configType;
-	}
-	public String getPolicyID() {
-		return policyID;
-	}
-	public void setPolicyID(String policyID) {
-		this.policyID = policyID;
-	}
-	public String getPolicyType() {
-		return policyType;
-	}
-	public void setPolicyType(String policyType) {
-		this.policyType = policyType;
-	}
-	public String getPolicyDescription() {
-		return policyDescription;
-	}
-	public void setPolicyDescription(String policyDescription) {
-		this.policyDescription = policyDescription;
-	}
-	public String getEcompName() {
-		return ecompName;
-	}
-	public void setEcompName(String ecompName) {
-		this.ecompName = ecompName;
-	}
-	public String getConfigName() {
-		return configName;
-	}
-	public void setConfigName(String configName) {
-		this.configName = configName;
-	}
-	public String getRuleID() {
-		return ruleID;
-	}
-	public void setRuleID(String ruleID) {
-		this.ruleID = ruleID;
-	}
-	public String getRuleCombiningAlgId() {
-		return ruleCombiningAlgId;
-	}
-	public void setRuleCombiningAlgId(String ruleCombiningAlgId) {
-		this.ruleCombiningAlgId = ruleCombiningAlgId;
-	}
-	public Map<String,String> getDynamicFieldConfigAttributes() {
-		return dynamicFieldConfigAttributes;
-	}
-	public void setDynamicFieldConfigAttributes(
-			Map<String,String> dynamicFieldConfigAttributes) {
-		this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
-	}
-	public String getParentPath() {
-		return parentPath;
-	}
-	public void setParentPath(String parentPath) {
-		this.parentPath = parentPath;
-	}
-	public boolean isEditPolicy() {
-		return isEditPolicy;
-	}
-	public void setEditPolicy(boolean isEditPolicy) {
-		this.isEditPolicy = isEditPolicy;
-	}
-	public boolean isViewPolicy() {
-		return isViewPolicy;
-	}
-	public void setViewPolicy(boolean isViewPolicy) {
-		this.isViewPolicy = isViewPolicy;
-	}
-	public Object getPolicyData() {
-		return policyData;
-	}
-	public void setPolicyData(Object policyData) {
-		this.policyData = policyData;
-	}
-	public boolean isReadOnly() {
-		return readOnly;
-	}
-	public void setReadOnly(boolean readOnly) {
-		this.readOnly = readOnly;
-	}
-	public String getUserGitPath() {
-		return gitPath;
-	}
-	public void setUserGitPath(String gitPath) {
-		this.gitPath = gitPath;
-	}
-	public boolean isValidData() {
-		return isValidData;
-	}
-	public void setValidData(boolean isValidData) {
-		this.isValidData = isValidData;
-	}
-	public String getAdminNotification() {
-		return adminNotification;
-	}
-	public void setAdminNotification(String adminNotification) {
-		this.adminNotification = adminNotification;
-	}
-	public String getConfigHome() {
-		return configHome;
-	}
-	public void setConfigHome(String configHome) {
-		this.configHome = configHome;
-	}
-	public String getConfigUrl() {
-		return configUrl;
-	}
-	public void setConfigUrl(String configUrl) {
-		this.configUrl = configUrl;
-	}
-	public String getFinalPolicyPath() {
-		return finalPolicyPath;
-	}
-	public void setFinalPolicyPath(String finalPolicyPath) {
-		this.finalPolicyPath = finalPolicyPath;
-	}
-	public String getVersion() {
-		return version;
-	}
-	public void setVersion(String version) {
-		this.version = version;
-	}
-	public String getJsonBody() {
-		return jsonBody;
-	}
-	public void setJsonBody(String jsonBody) {
-		this.jsonBody = jsonBody;
-	}
-	public String getPrevJsonBody() {
-		return prevJsonBody;
-	}
-	public void setPrevJsonBody(String prevJsonBody) {
-		this.prevJsonBody = prevJsonBody;
-	}
-	public String getApiflag() {
-		return apiflag;
-	}
-	public void setApiflag(String apiflag) {
-		this.apiflag = apiflag;
-	}
-	/**
-	 * @return the actionPerformer
-	 */
-	public String getActionPerformer() {
-		return actionPerformer;
-	}
-	/**
-	 * @param actionPerformer the actionPerformer to set
-	 */
-	public void setActionPerformer(String actionPerformer) {
-		this.actionPerformer = actionPerformer;
-	}
-	/**
-	 * @return the actionAttribute
-	 */
-	public String getActionAttribute() {
-		return actionAttribute;
-	}
-	/**
-	 * @param actionAttribute the actionAttribute to set
-	 */
-	public void setActionAttribute(String actionAttribute) {
-		this.actionAttribute = actionAttribute;
-	}
-	/**
-	 * @return the dynamicRuleAlgorithmLabels
-	 */
-	public List<String> getDynamicRuleAlgorithmLabels() {
-		return dynamicRuleAlgorithmLabels;
-	}
-	/**
-	 * @param dynamicRuleAlgorithmLabels the dynamicRuleAlgorithmLabels to set
-	 */
-	public void setDynamicRuleAlgorithmLabels(
-			List<String> dynamicRuleAlgorithmLabels) {
-		this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
-	}
-	/**
-	 * @return the dynamicRuleAlgorithmCombo
-	 */
-	public List<String> getDynamicRuleAlgorithmCombo() {
-		return dynamicRuleAlgorithmCombo;
-	}
-	/**
-	 * @param dynamicRuleAlgorithmCombo the dynamicRuleAlgorithmCombo to set
-	 */
-	public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
-		this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
-	}
-	/**
-	 * @return the dynamicRuleAlgorithmField1
-	 */
-	public List<String> getDynamicRuleAlgorithmField1() {
-		return dynamicRuleAlgorithmField1;
-	}
-	/**
-	 * @param dynamicRuleAlgorithmField1 the dynamicRuleAlgorithmField1 to set
-	 */
-	public void setDynamicRuleAlgorithmField1(
-			List<String> dynamicRuleAlgorithmField1) {
-		this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
-	}
-	/**
-	 * @return the dynamicRuleAlgorithmField2
-	 */
-	public List<String> getDynamicRuleAlgorithmField2() {
-		return dynamicRuleAlgorithmField2;
-	}
-	/**
-	 * @param dynamicRuleAlgorithmField2 the dynamicRuleAlgorithmField2 to set
-	 */
-	public void setDynamicRuleAlgorithmField2(
-			List<String> dynamicRuleAlgorithmField2) {
-		this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
-	}
-	public Map<String,String> getDropDownMap() {
-		return dropDownMap;
-	}
-	public void setDropDownMap(Map<String,String> dropDownMap) {
-		this.dropDownMap = dropDownMap;
-	}
-/*	public String getActionDictHeader() {
-		return actionDictHeader;
-	}
-	public void setActionDictHeader(String actionDictHeader) {
-		this.actionDictHeader = actionDictHeader;
-	}
-	public String getActionDictType() {
-		return actionDictType;
-	}
-	public void setActionDictType(String actionDictType) {
-		this.actionDictType = actionDictType;
-	}
-	public String getActionDictUrl() {
-		return actionDictUrl;
-	}
-	public void setActionDictUrl(String actionDictUrl) {
-		this.actionDictUrl = actionDictUrl;
-	}
-	public String getActionDictMethod() {
-		return actionDictMethod;
-	}
-	public void setActionDictMethod(String actionDictMethod) {
-		this.actionDictMethod = actionDictMethod;
-	}*/
-	public Map<String,String> getDynamicSettingsMap() {
-		return dynamicSettingsMap;
-	}
-	public void setDynamicSettingsMap(Map<String,String> dynamicSettingsMap) {
-		this.dynamicSettingsMap = dynamicSettingsMap;
-	}
-	public List<Object> getDynamicVariableList() {
-		return dynamicVariableList;
-	}
-	public void setDynamicVariableList(List<Object> dynamicVariableList) {
-		this.dynamicVariableList = dynamicVariableList;
-	}
-	public List<String> getDataTypeList() {
-		return dataTypeList;
-	}
-	public void setDataTypeList(List<String> dataTypeList) {
-		this.dataTypeList = dataTypeList;
-	}
-	public boolean isDraft() {
-		return isDraft;
-	}
-	public void setDraft(boolean isDraft) {
-		this.isDraft = isDraft;
-	}
-	public String getConfigPolicyType() {
-		return configPolicyType;
-	}
-	public void setConfigPolicyType(String configPolicyType) {
-		this.configPolicyType = configPolicyType;
-	}
-	public String getServiceType() {
-		return serviceType;
-	}
-	public void setServiceType(String serviceType) {
-		this.serviceType = serviceType;
-	}
-	public String getUuid() {
-		return uuid;
-	}
-	public void setUuid(String uuid) {
-		this.uuid = uuid;
-	}
-	public String getLocation() {
-		return location;
-	}
-	public void setLocation(String location) {
-		this.location = location;
-	}
-    public String getPriority() {
-        return priority;
-    }
-    public void setPriority(String priority) {
-        this.priority = priority;
-    }
-	public Map<String, String> getBrmsParamBody() {
-		return brmsParamBody;
-	}
-	public void setBrmsParamBody(Map<String, String> brmsParamBody) {
-		this.brmsParamBody = brmsParamBody;
-	}
-	public EntityManagerFactory getEntityManagerFactory() {
-		return entityManagerFactory;
-	}
-	public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
-		this.entityManagerFactory = entityManagerFactory;
-	}
-	/**
-	 * @return the policyExists
-	 */
-	public Boolean getPolicyExists() {
-		return policyExists;
-	}
-	/**
-	 * @param policyExists the policyExists to set
-	 */
-	public void setPolicyExists(Boolean policyExists) {
-		this.policyExists = policyExists;
-	}
-	public String getPolicyScope() {
-		return policyScope;
-	}
-	
-	public void setPolicyScope(String domainDir) {
-		this. policyScope=domainDir;
-	}
-	public String getProviderComboBox() {
-		return providerComboBox;
-	}
-	public void setProviderComboBox(String providerComboBox) {
-		this.providerComboBox = providerComboBox;
-	}
-	public String getRiskType() {
-		return riskType;
-	}
-	public void setRiskType(String riskType) {
-		this.riskType = riskType;
-	}
-	public String getGuard() {
-		return guard;
-	}
-	public void setGuard(String guard) {
-		this.guard = guard;
-	}
-	public String getRiskLevel() {
-		return riskLevel;
-	}
-	public void setRiskLevel(String riskLevel) {
-		this.riskLevel = riskLevel;
-	}
-	public String getTtlDate() {
-		return ttlDate;
-	}
-	public void setTtlDate(String ttlDate) {
-		this.ttlDate = ttlDate;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/package-info.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/package-info.java
index fd5f064..20b95c7 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/package-info.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/adapters/package-info.java
@@ -18,10 +18,4 @@
  * ============LICENSE_END=========================================================
  */
 
-/**
- * 
- */
-/**
- *
- */
 package org.openecomp.policy.pap.xacml.rest.adapters;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
index b6e003c..b6a959b 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
@@ -26,14 +26,12 @@
 import java.io.IOException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
 import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
 import javax.persistence.Query;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
@@ -52,17 +50,13 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
 
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
 import org.openecomp.policy.pap.xacml.rest.util.JPAUtils;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
 import org.openecomp.policy.rest.jpa.ActionPolicyDict;
 import org.openecomp.policy.rest.jpa.Datatype;
 import org.openecomp.policy.rest.jpa.FunctionDefinition;
-
 import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
 import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
@@ -71,14 +65,11 @@
 public class ActionPolicy extends Policy {
 	
 	/**
-	 * Config Fields
+	 * ActionPolicy Fields
 	 */
-	private static final Logger logger = FlexLogger.getLogger(ConfigPolicy.class);
-
+	private static final Logger LOGGER = FlexLogger.getLogger(ActionPolicy.class);
+	
 	public static final String JSON_CONFIG = "JSON";
-	public static final String XML_CONFIG = "XML";
-	public static final String PROPERTIES_CONFIG = "PROPERTIES";
-	public static final String OTHER_CONFIG = "OTHER";
 	
 	public static final String PDP_ACTION = "PDP";
 	public static final String PEP_ACTION = "PEP";
@@ -95,6 +86,9 @@
 	public static final String URL_ATTRIBUTEID = "url";
 	public static final String BODY_ATTRIBUTEID = "body";
 	
+	public static boolean isAttribute = false;
+
+	
 	List<String> dynamicLabelRuleAlgorithms = new LinkedList<String>();
 	List<String> dynamicFieldFunctionRuleAlgorithms = new LinkedList<String>();
 	List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<String>();
@@ -102,6 +96,7 @@
 	
 	protected Map<String, String> dropDownMap = new HashMap<String, String>();
 	
+	
 	public ActionPolicy() {
 		super();
 	}
@@ -119,6 +114,11 @@
 			return successMap;
 		}
 		
+		if(!ActionPolicy.isAttribute) {
+			successMap.put("invalidAttribute", "Action Attrbute was not in the database.");
+			return successMap;
+		}
+		
 		if(!isPreparedToSave()){
 			//Prep and configure the policy for saving
 			prepareToSave();
@@ -126,12 +126,8 @@
 
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
 		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject() );		
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
 		return successMap;		
 	}
 	
@@ -147,12 +143,7 @@
 		
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-		
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Action")) {
@@ -164,38 +155,23 @@
 			policyAdapter.setData(policyConfig);
 		}
 		
+		policyName = policyAdapter.getNewFileName();
+		
 		if (policyAdapter.getData() != null) {
-			
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			Path newFile = getNextFilename(Paths.get(policyAdapter.getParentPath().toString()), policyAdapter.getPolicyType(), policyAdapter.getPolicyName(), version);
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Policy already Exists, cannot create the policy.");
-				PolicyLogger.error("Policy already Exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;
-			}
-			policyName = newFile.getFileName().toString();
-			
 			// Action body is optional so checking value provided or not
-			//String actionBodyString = policyAdapter.getActionBody();
 			String comboDictValue = policyAdapter.getActionAttribute();
 	        String actionBody = getActionPolicyDict(comboDictValue).getBody();
-			if(!(actionBody==null || "".equals(actionBody))){
+			if(!(actionBody==null || "".equals(actionBody))){	
 				saveActionBody(policyName, actionBody);
-			}
-			
-			// Make sure the filename ends with an extension
-			if (policyName.endsWith(".xml") == false) {
-				policyName = policyName + ".xml";
+			} else {
+				if(!isAttribute){
+					LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Could not find " + comboDictValue + " in the ActionPolicyDict table.");
+					return false;
+				}
 			}
 			
 			PolicyType actionPolicy = (PolicyType) policyAdapter.getData();
-			
 			actionPolicy.setDescription(policyAdapter.getPolicyDescription());
-			
 			actionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 
 			AllOfType allOf = new AllOfType();
@@ -252,7 +228,6 @@
 						condition.setExpression(new ObjectFactory().createApply(actionApply));
 						isCompound = true;
 					}
-					
 				}
 				// if rule algorithm not a compound
 				if (!isCompound) {
@@ -265,8 +240,6 @@
 			actionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(rule);
 			policyAdapter.setPolicyData(actionPolicy);
 		}  else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 		}	
 
@@ -276,69 +249,25 @@
 	
 	// Saving the json Configurations file if exists at server location for action policy.
 	private void saveActionBody(String policyName, String actionBodyData) {
-		int version = 0;
-		int highestVersion = 0;
-		String domain = getParentPathSubScopeDir();
-		String path = domain.replace('\\', '.');
-		String removeExtension = policyName.substring(0, policyName.indexOf(".xml"));
-		String removeVersion = removeExtension.substring(0, removeExtension.indexOf("."));
-		if (policyAdapter.isEditPolicy()) {
-			highestVersion = policyAdapter.getHighestVersion();
-			if(highestVersion != 0){
-				version = highestVersion + 1;	
-			}
-		} else {
-			version = 1;
-		}
-		if(path.contains("/")){
-			path = domain.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
 		try {
-
-			File file = new File(ACTION_HOME + File.separator + path + "." + removeVersion + "." + version + ".json");
-			
-			if (logger.isDebugEnabled())
-				logger.debug("The action body is at " + file.getAbsolutePath());
-
-			// if file doesn't exists, then create it
-			if (!file.exists()) {
-				file.createNewFile();
+			if(policyName.endsWith(".xml")){
+				policyName = policyName.replace(".xml", "");
 			}
-			File configHomeDir = new File(ACTION_HOME);
-			File[] listOfFiles = configHomeDir.listFiles();
-			if (listOfFiles != null){
-				for(File eachFile : listOfFiles){
-					if(eachFile.isFile()){
-						String fileNameWithoutExtension = FilenameUtils.removeExtension(eachFile.getName());
-						String actionFileNameWithoutExtension = FilenameUtils.removeExtension(path + "." + policyName);
-						if (fileNameWithoutExtension.equals(actionFileNameWithoutExtension)){
-							//delete the file
-							if (logger.isInfoEnabled())
-								logger.info("Deleting action body is at " + eachFile.getAbsolutePath());
-							eachFile.delete();
-						}
-					}
-				}
-			}
+			File file = new File(ACTION_HOME+ File.separator + policyName + ".json");
 			FileWriter fw = new FileWriter(file.getAbsoluteFile());
 			BufferedWriter bw = new BufferedWriter(fw);
 			bw.write(actionBodyData);
 			bw.close();
-
-			if (logger.isInfoEnabled()) {
-				logger.info("Action Body is succesfully saved at " + file.getAbsolutePath());
+			if (LOGGER.isInfoEnabled()) {
+				LOGGER.info("Action Body is succesfully saved at " + file.getAbsolutePath());
 			}
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
-
 	}
 	
 	// Data required for obligation part is setting here.
 	private ObligationExpressionsType getObligationExpressions() {
-		
-		// TODO: add code to get all these values from dictionary
 		ObligationExpressionsType obligations = new ObligationExpressionsType();
 
 		ObligationExpressionType obligation = new ObligationExpressionType();
@@ -407,17 +336,7 @@
 
 			AttributeValueType jsonURLAttributeValue = new AttributeValueType();
 			jsonURLAttributeValue.setDataType(URI_DATATYPE);
-			final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());;
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex1 = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex1, policyDir.length());
-			logger.info("print the main domain value"+policyDir);
-			String path = policyDir.replace('\\', '.');
-			if(path.contains("/")){
-				path = policyDir.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-			jsonURLAttributeValue.getContent().add(CONFIG_URL + "/Action/" +  path + "." +FilenameUtils.removeExtension(policyName) + ".json");
+			jsonURLAttributeValue.getContent().add(CONFIG_URL + "/Action/"  + policyName + ".json");
 
 			assignmentJsonURL.setExpression(new ObjectFactory().createAttributeValue(jsonURLAttributeValue));
 			obligation.getAttributeAssignmentExpression().add(assignmentJsonURL);
@@ -428,7 +347,6 @@
 			if(headerVal != null && !headerVal.equals("")){
 				// parse it on : to get number of headers
 				String[] result = headerVal.split(":");
-				System.out.println(Arrays.toString(result));
 				for (String eachString : result){
 					// parse each value on =
 					String[] textFieldVals = eachString.split("=");
@@ -567,9 +485,8 @@
 	private Map<String,String> createDropDownMap(){
 		JPAUtils jpaUtils = null;
 		try {
-			jpaUtils = JPAUtils.getJPAUtilsInstance(policyAdapter.getEntityManagerFactory());
+			jpaUtils = JPAUtils.getJPAUtilsInstance(XACMLPapServlet.getEmf());
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 		Map<Datatype, List<FunctionDefinition>> functionMap = jpaUtils.getFunctionDatatypeMap();
@@ -587,32 +504,19 @@
 	
 	private ActionPolicyDict getActionPolicyDict(String attributeName){
 		ActionPolicyDict retObj = new ActionPolicyDict();
-		//EntityManagerFactory emf = policyAdapter.getEntityManagerFactory();
-		//EntityManager em = emf.createEntityManager();
-		EntityManager em = policyAdapter.getEntityManagerFactory().createEntityManager();
+		EntityManager em = XACMLPapServlet.getEmf().createEntityManager();
 		Query getActionPolicyDicts = em.createNamedQuery("ActionPolicyDict.findAll");	
 		List<?> actionPolicyDicts = getActionPolicyDicts.getResultList(); 	
 		
 		for (Object id : actionPolicyDicts) {
-			//ActionPolicyDict actionPolicyList = actionPolicyDicts.getItem(id).getEntity();
 			ActionPolicyDict actionPolicy = (ActionPolicyDict) id;
 			if(attributeName.equals(actionPolicy.getAttributeName())){
+				isAttribute = true;
 				retObj = actionPolicy;
 				break;
 			}
 		}
-		
-		try{
-		em.getTransaction().commit();
-		} catch(Exception e){
-			try{
-				em.getTransaction().rollback();
-			} catch(Exception e2){
-				e2.printStackTrace();
-			}
-		}
 		em.close();
-		
 		return retObj;
 	}
 
@@ -621,6 +525,4 @@
 		return policyAdapter.getPolicyData();
 	}
 
-
-
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
index 61498e2..4d48593 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/AutoPushPolicy.java
@@ -28,21 +28,16 @@
 import java.util.Properties;
 import java.util.Set;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
 import org.openecomp.policy.common.logging.flexlogger.Logger;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
 import org.openecomp.policy.xacml.api.pap.PAPPolicyEngine;
-
-import com.att.research.xacml.api.pap.PAPEngine;
-import com.att.research.xacml.api.pap.PDPPolicy;
 import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
 import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
+
+import com.att.research.xacml.api.pap.PDPPolicy;
 /**
  * Auto Push Policy based on the property file properties. 
  * 
@@ -50,7 +45,7 @@
  */
 public class AutoPushPolicy {
 	
-	private static final Logger logger = FlexLogger.getLogger(AutoPushPolicy.class);
+	private static final Logger LOGGER = FlexLogger.getLogger(AutoPushPolicy.class);
 	
 	private String filePath = null;
 	private Properties properties;
@@ -94,8 +89,8 @@
 			if(policyId.contains("\\")){
 				policyId = policyId.replace("\\", ".");
 			}
-			logger.info("Policy ID : " + policyId);
-			logger.info("Policy Name : " + policyName);
+			LOGGER.info("Policy ID : " + policyId);
+			LOGGER.info("Policy Name : " + policyName);
 			// Read in Groups 
 			for(EcompPDPGroup pdpGroup: papEngine.getEcompPDPGroups()){
 				String groupName = pdpGroup.getName();
@@ -121,8 +116,6 @@
 				}
 			}
 		} catch (Exception e) {
-			//TODO:EELF Cleanup - Remove logger
- 			//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while processing the auto push for " + policyToCreateUpdate +"\n " + e.getMessage());
  			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "AutoPushPolicy", "Error while processing the auto push for " + policyToCreateUpdate);
 		}
 		return changedGroups;
@@ -133,15 +126,13 @@
 			properties.load(new FileInputStream(propFile));
 			oldModified = propFile.lastModified();
 		} catch (Exception e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while loading in the auto push properties file. " + propFile.toString());
 			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "AutoPushPolicy", "Error while loading in the auto push properties file.");
 		}
 	}
 	
 	private StdPDPGroup addToGroup(String policyId, String policyName, String policyToCreateUpdate, StdPDPGroup pdpGroup) throws Exception{
 		// Add to group. Send Notification. 
-		StdPDPPolicy policy = new StdPDPPolicy(policyId, true, policyName, Paths.get(policyToCreateUpdate).toUri());
+		StdPDPPolicy policy = new StdPDPPolicy(policyId, true, policyName, null);
 		//Get the current policies from the Group and Add the new one
         Set<PDPPolicy> currentPoliciesInGroup = pdpGroup.getPolicies();
         Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
@@ -156,7 +147,7 @@
 			for (PDPPolicy existingPolicy : currentPoliciesInGroup) {
 				if (existingPolicy.getId().equals(selPolicy.getId())) {
 					pdpGroup.removePolicyFromGroup(existingPolicy);
-					logger.debug("Removing policy: " + existingPolicy);
+					LOGGER.debug("Removing policy: " + existingPolicy);
 					break;
 				}
 			}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
index 8c3e34d..c2ab845 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
@@ -31,9 +31,15 @@
 import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.StringTokenizer;
 
-import javax.json.stream.JsonGenerationException;
+import org.apache.commons.io.FilenameUtils;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import com.att.research.xacml.std.IdentifierImpl;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
@@ -47,26 +53,11 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-
-import com.att.research.xacml.std.IdentifierImpl;
-
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; 
 
 public class ClosedLoopPolicy extends Policy {
-	
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger.getLogger(ConfigPolicy.class);
+
+	private static final Logger LOGGER = FlexLogger.getLogger(ClosedLoopPolicy.class);
 
 	public ClosedLoopPolicy() {
 		super();
@@ -77,13 +68,7 @@
 	}
 	
 	//save configuration of the policy based on the policyname
-	private void saveConfigurations(String policyName, String prevPolicyName, String jsonBody) {
-		String domain = getParentPathSubScopeDir();
-		String path = domain.replace('\\', '.');
-		if(path.contains("/")){
-			path = domain.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
+	private void saveConfigurations(String policyName, String jsonBody) {
 		try {
 			String body = jsonBody;
 			try {
@@ -91,27 +76,24 @@
 					//Remove the trapMaxAge in Verification Signature
 					body = body.replace(",\"trapMaxAge\":null", "");
 				}catch(Exception e){
-					logger.debug("No Trap Max Age in JSON body");
+					LOGGER.debug("No Trap Max Age in JSON body");
 				}
 				this.policyAdapter.setJsonBody(body);
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
 
-			System.out.println(body);
 			if(policyName.endsWith(".xml")){
-				policyName	 = policyName.substring(0, policyName.lastIndexOf(".xml"));	
+				policyName = policyName.replace(".xml", "");
 			}
-			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+path + "."+ policyName +".json");
+			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+ policyName +".json");
 			out.println(body);
 			out.close();
 
-		} catch (JsonGenerationException e) {
+		} catch (Exception e) {
+			LOGGER.error("Exception Occured while writing Configuration Data"+e);
 			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-
+		} 
 	}
 	
 	//Utility to read json data from the existing file to a string
@@ -147,13 +129,9 @@
 		
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
 
 		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());	
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
 		return successMap;		
 	}
 
@@ -169,12 +147,7 @@
 		
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Config")) {
@@ -185,86 +158,11 @@
 			policyConfig.setTarget(new TargetType());
 			policyAdapter.setData(policyConfig);
 		}
-
+		policyName = policyAdapter.getNewFileName();
 		if (policyAdapter.getData() != null) {
-			
-			//delete the closed loop draft file and configuration file, if validation is success after editing the draft policy
-			String prevPolicyName = null;
-			if(policyAdapter.isEditPolicy()){
-				prevPolicyName = "Config_Fault_" + policyAdapter.getPolicyName() + "." + policyAdapter.getHighestVersion() + ".xml";
-
-				if (policyAdapter.isDraft()) {
-					policyName = "Config_Fault_" + policyAdapter.getPolicyName() + "_Draft";
-				} else {
-					policyName = "Config_Fault_" + policyAdapter.getPolicyName();
-				}
-				
-				//delete the closed loop draft configuration file, if validation is success after editing the draft policy
-				final Path gitPath = Paths.get(policyAdapter.getUserGitPath());
-				String policyDir = policyAdapter.getParentPath();
-				int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-				policyDir = policyDir.substring(startIndex, policyDir.length());
-				logger.info("print the main domain value"+policyDir);
-				String path = policyDir.replace('\\', '.');
-				if(path.contains("/")){
-					path = policyDir.replace('/', '.');
-					logger.info("print the path:" +path); 
-				}
-				String fileName = FilenameUtils.removeExtension(policyName);
-
-				final String tempPath = path;
-				String fileLocation = null;
-				if (fileName != null && fileName.contains("Config_Fault_")) {
-					fileLocation = CONFIG_HOME;
-				} 
-				// Get the file from the saved location
-				File dir = new File(fileLocation);
-				File[] listOfFiles = dir.listFiles();
-				for (File file : listOfFiles) {
-					String configFile = null;
-					if(!policyAdapter.isDraft()){
-						configFile = fileName + "_Draft";
-					}else{
-						configFile = fileName;
-					}
-					if (file.isFile() && file.getName().contains( tempPath + "." + configFile)) {
-						try {
-							if (file.delete() == false) {
-								throw new Exception(
-										"No known error, Delete failed");
-							}
-						} catch (Exception e) {
-							logger.error("Failed to Delete file: "
-									+ e.getLocalizedMessage());
-						}
-					}
-				}
-			}
-			
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			String policyName1 = null;
-			if(policyAdapter.isDraft()){
-				policyName1 = policyAdapter.getPolicyName() + "_Draft";
-			}else{
-				policyName1 = policyAdapter.getPolicyName();
-			}
-			
-			Path newFile = this.getNextLoopFilename(Paths.get(policyAdapter.getParentPath()), policyAdapter.getPolicyType(), policyAdapter.getConfigPolicyType(), policyName1, version);
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("File already exists, cannot create the policy.");
-				PolicyLogger.error("File already exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;
-			}
-			
-			policyName = newFile.getFileName().toString();
-			
 			// Save the Configurations file with the policy name with extention based on selection.
 			String jsonBody = policyAdapter.getJsonBody();
-			saveConfigurations(policyName, prevPolicyName, jsonBody);
+			saveConfigurations(policyName, jsonBody);
 			
 			// Make sure the filename ends with an extension
 			if (policyName.endsWith(".xml") == false) {
@@ -278,10 +176,7 @@
 			faultPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 			
 			AllOfType allOfOne = new AllOfType();
-			File policyFilePath = new File(policyAdapter.getParentPath().toString(), policyName);
-			String policyDir = policyFilePath.getParentFile().getName();
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = policyDir + "." + fileName + ".xml";
+			String fileName = policyAdapter.getNewFileName();
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -331,8 +226,6 @@
 			try {
 				accessURI = new URI(ACTION_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(e.getStackTrace());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "CreateClosedLoopPolicy", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -352,8 +245,6 @@
 			try {
 				closedURI = new URI(RESOURCE_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(e.getStackTrace());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "CreateClosedLoopPolicy", "Exception creating closed URI");
 			}
 			closedAttributeDesignator.setCategory(CATEGORY_RESOURCE);
@@ -378,8 +269,6 @@
 			policyAdapter.setPolicyData(faultPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 		}
 
@@ -405,7 +294,6 @@
 		assignment1.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue));
 
 		advice.getAttributeAssignmentExpression().add(assignment1);
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
 		// For Config file Url if configurations are provided.
 		AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
 		assignment2.setAttributeId("URLID");
@@ -414,17 +302,7 @@
 
 		AttributeValueType AttributeValue = new AttributeValueType();
 		AttributeValue.setDataType(URI_DATATYPE);
-		String policyDir1 = policyAdapter.getParentPath().toString();
-		int startIndex1 = policyDir1.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-		logger.info("print the main domain value"+policyDir1);
-		String path = policyDir1.replace('\\', '.');
-		if(path.contains("/")){
-			path = policyDir1.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
-
-		String content = CONFIG_URL +"/Config/" + path + "." + getConfigFile(policyName);
+		String content = CONFIG_URL +"/Config/" + getConfigFile(policyName);
 		System.out.println("URL value :" + content);
 		AttributeValue.getContent().add(content);
 		assignment2.setExpression(new ObjectFactory().createAttributeValue(AttributeValue));
@@ -437,25 +315,8 @@
 
 		AttributeValueType attributeValue3 = new AttributeValueType();
 		attributeValue3.setDataType(STRING_DATATYPE);
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		StringTokenizer tokenizer = null;
-		StringBuffer buffer = new StringBuffer();
-		if (policyDir.contains("\\")) {
-			tokenizer = new StringTokenizer(policyDir, "\\");
-		} else {
-			tokenizer = new StringTokenizer(policyDir, "/");
-		}
-		if (tokenizer != null) {
-			while (tokenizer.hasMoreElements()) {
-				String value = tokenizer.nextToken();
-				buffer.append(value);
-				buffer.append(".");
-			}
-		}
 		fileName = FilenameUtils.removeExtension(fileName);
-		fileName = buffer.toString() + fileName + ".xml";
+		fileName = fileName + ".xml";
 		String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 		if ((name == null) || (name.equals(""))) {
 			name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -477,7 +338,7 @@
 		advice.getAttributeAssignmentExpression().add(assignment4);
 
 		AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
-		assignment5.setAttributeId("matching:" + this.ECOMPID);
+		assignment5.setAttributeId("matching:" + ECOMPID);
 		assignment5.setCategory(CATEGORY_RESOURCE);
 		assignment5.setIssuer("");
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
index a339b15..ff80458 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
@@ -32,7 +32,6 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Scanner;
-import java.util.StringTokenizer;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
@@ -53,30 +52,25 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
 
 import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import com.att.research.xacml.std.IdentifierImpl;
 
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
-
 public class ConfigPolicy extends Policy {
 
 	/**
 	 * Config Fields
 	 */
-	private static final Logger logger = FlexLogger.getLogger(ConfigPolicy.class);
+	private static final Logger LOGGER = FlexLogger.getLogger(ConfigPolicy.class);
 
 	public static final String JSON_CONFIG = "JSON";
 	public static final String XML_CONFIG = "XML";
@@ -92,65 +86,25 @@
 	public ConfigPolicy(PolicyRestAdapter policyAdapter){
 		this.policyAdapter = policyAdapter;
 	}
-
+	
 	// Saving the Configurations file at server location for config policy.
 	protected void saveConfigurations(String policyName) {
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		logger.info("print the main domain value"+policyDir);
-		String path = policyDir.replace('\\', '.');
-		if(path.contains("/")){
-			path = policyDir.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
-		
 		try {
-			File file;
-			String configFileName = getConfigFile(policyName);
-			if(CONFIG_HOME.contains("\\"))
-			{
-			 file = new File(CONFIG_HOME + "\\" + path + "."+ configFileName);
-			}
-			else
-			{
-			 file = new File(CONFIG_HOME + "/" + path + "."+ configFileName);
-			}
-			
-			// if file doesnt exists, then create it
-			if (!file.exists()) {
-				file.createNewFile();
-			}
-
-
-			File configHomeDir = new File(CONFIG_HOME);
-			File[] listOfFiles = configHomeDir.listFiles();
-			if (listOfFiles != null){
-				for(File eachFile : listOfFiles){
-					if(eachFile.isFile()){
-						String fileNameWithoutExtension = FilenameUtils.removeExtension(eachFile.getName());
-						String configFileNameWithoutExtension = FilenameUtils.removeExtension(path + "." + configFileName);
-						if (fileNameWithoutExtension.equals(configFileNameWithoutExtension)){
-							//delete the file
-							eachFile.delete();
-						}
-					}
-				}
-			}
-
-			FileWriter fw = new FileWriter(file.getAbsoluteFile());
+			String fileName = getConfigFile(policyName);
+			FileWriter fw = new FileWriter(CONFIG_HOME + File.separator + fileName);
 			BufferedWriter bw = new BufferedWriter(fw);
 			bw.write(configBodyData);
 			bw.close();
-			if (logger.isDebugEnabled()) {
-				logger.debug("Configuration is succesfully saved");
+			if (LOGGER.isDebugEnabled()) {
+				LOGGER.debug("Configuration is succesfully saved");
 			}
 		} catch (IOException e) {
+			LOGGER.error("Exception Occured while writing Configuration Data"+e);
 			e.printStackTrace();
 		}
 	}
 
+
 	// Here we are adding the extension for the configurations file based on the
 	// config type selection for saving.
 	private String getConfigFile(String filename) {
@@ -177,6 +131,7 @@
 		return filename;
 	}
 
+	
 	// Validations for Config form
 	/*
 	 * FORM VALIDATION WILL BE DONE BY THE PAP-ADMIN before creating JSON object... 
@@ -295,12 +250,8 @@
 
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
-		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject() );		
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
+		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());
 		return successMap;		
 	}
 	
@@ -310,18 +261,12 @@
 	public boolean prepareToSave() throws Exception{
 
 		if(isPreparedToSave()){
-			//we have already done this
 			return true;
 		}
-		
+	
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Config")) {
@@ -333,52 +278,19 @@
 			policyAdapter.setData(policyConfig);
 		}
 		
+		policyName = policyAdapter.getNewFileName();
+		configBodyData = policyAdapter.getConfigBodyData();
+		saveConfigurations(policyName);
+		
 		if (policyAdapter.getData() != null) {
-			
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			Path newFile = getNextFilename(Paths.get(policyAdapter.getParentPath().toString()), policyAdapter.getPolicyType(), policyAdapter.getPolicyName(), version);
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("File already exists");
-				PolicyLogger.error("File alrady exists");
-				setPolicyExists(true);
-				return false;
-			}
-			policyName = newFile.getFileName().toString();
-			
-			// Body is optional so checking.
-			configBodyData = policyAdapter.getConfigBodyData();
-			if (!configBodyData.equals("")) {
-				// Save the Configurations file with the policy name with extention based on selection.
-				saveConfigurations(policyName);
-			}
-			
-			// Make sure the filename ends with an extension
-			if (policyName.endsWith(".xml") == false) {
-				policyName = policyName + ".xml";
-			}
-			
-	
 			PolicyType configPolicy = (PolicyType) policyAdapter.getData();
 			
 			configPolicy.setDescription(policyAdapter.getPolicyDescription());
 
 			configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 			AllOfType allOfOne = new AllOfType();
-			final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex, policyDir.length());
-			logger.info("print the main domain value "+policyDir);
-			String path = policyDir.replace('\\', '.');
-			if(path.contains("/")){
-				path = policyDir.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = path + "." + fileName + ".xml";
+
+			String fileName = policyAdapter.getNewFileName();
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -389,17 +301,13 @@
 			// Adding the matches to AllOfType element Match for Ecomp
 			allOf.getMatch().add(createMatch("ECOMPName", policyAdapter.getEcompName()));
 			// Match for riskType
-			allOf.getMatch().add(
-					createDynamicMatch("RiskType", policyAdapter.getRiskType()));
+			allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
 			// Match for riskLevel
-			allOf.getMatch().add(
-					createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
+			allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
 			// Match for riskguard
-			allOf.getMatch().add(
-					createDynamicMatch("guard", policyAdapter.getGuard()));
+			allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
 			// Match for ttlDate
-			allOf.getMatch().add(
-					createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
+			allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
 			// Match for ConfigName
 			allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
 			
@@ -425,7 +333,6 @@
 
 			RuleType rule = new RuleType();
 			rule.setRuleId(policyAdapter.getRuleID());
-			
 			rule.setEffect(EffectType.PERMIT);
 			
 			// Create Target in Rule
@@ -439,11 +346,9 @@
 			accessMatch.setAttributeValue(accessAttributeValue);
 			AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
 			URI accessURI = null;
-			try {
+			try{
 				accessURI = new URI(ACTION_ID);
-			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
+			}catch(URISyntaxException e){
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "ConfigPolicy", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -460,11 +365,9 @@
 			configMatch.setAttributeValue(configAttributeValue);
 			AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
 			URI configURI = null;
-			try {
+			try{
 				configURI = new URI(RESOURCE_ID);
-			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
+			}catch(URISyntaxException e){
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "ConfigPolicy", "Exception creating Config URI");
 			}
 			configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
@@ -489,8 +392,6 @@
 			policyAdapter.setPolicyData(configPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 		}
 		setPreparedToSave(true);
@@ -516,7 +417,6 @@
 		assignment1.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue));
 
 		advice.getAttributeAssignmentExpression().add(assignment1);
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
 		
 		// For Config file Url if configurations are provided.
 		if (policyAdapter.getConfigType() != null) {
@@ -527,18 +427,7 @@
 
 			AttributeValueType AttributeValue = new AttributeValueType();
 			AttributeValue.setDataType(URI_DATATYPE);
-			String policyDir1 = policyAdapter.getParentPath().toString();
-			int startIndex1 = policyDir1.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-			logger.info("print the main domain value"+policyDir1);
-			String path = policyDir1.replace('\\', '.');
-			if(path.contains("/")){
-				path = policyDir1.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-
-			String content = "$URL" + "/Config/" + path + "." + getConfigFile(policyName);
-			System.out.println("URL value :" + content);
+			String content = "$URL" + "/Config/" + getConfigFile(policyName);
 			AttributeValue.getContent().add(content);
 			assignment2.setExpression(new ObjectFactory().createAttributeValue(AttributeValue));
 
@@ -550,25 +439,9 @@
 
 			AttributeValueType attributeValue3 = new AttributeValueType();
 			attributeValue3.setDataType(STRING_DATATYPE);
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex, policyDir.length());
-			StringTokenizer tokenizer = null;
-			StringBuffer buffer = new StringBuffer();
-			if (policyDir.contains("\\")) {
-				tokenizer = new StringTokenizer(policyDir, "\\");
-			} else {
-				tokenizer = new StringTokenizer(policyDir, "/");
-			}
-			if (tokenizer != null) {
-				while (tokenizer.hasMoreElements()) {
-					String value = tokenizer.nextToken();
-					buffer.append(value);
-					buffer.append(".");
-				}
-			}
+			
 			fileName = FilenameUtils.removeExtension(fileName);
-			fileName = buffer.toString() + fileName + ".xml";
+			fileName = fileName + ".xml";
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -590,7 +463,7 @@
 			advice.getAttributeAssignmentExpression().add(assignment4);
 
 			AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
-			assignment5.setAttributeId("matching:" + this.ECOMPID);
+			assignment5.setAttributeId("matching:" + ECOMPID);
 			assignment5.setCategory(CATEGORY_RESOURCE);
 			assignment5.setIssuer("");
 
@@ -602,7 +475,7 @@
 			advice.getAttributeAssignmentExpression().add(assignment5);
 
 			AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
-			assignment6.setAttributeId("matching:" + this.CONFIGID);
+			assignment6.setAttributeId("matching:" + CONFIGID);
 			assignment6.setCategory(CATEGORY_RESOURCE);
 			assignment6.setIssuer("");
 
@@ -680,7 +553,6 @@
 
 		advice.getAttributeAssignmentExpression().add(assignment11);
 		
-
 		advices.getAdviceExpression().add(advice);
 		return advices;
 	}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
new file mode 100644
index 0000000..2f12264
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBRMSRuleTemplate.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.components;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
+import org.openecomp.policy.rest.jpa.UserInfo;
+import org.openecomp.policy.utils.PolicyUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CreateBRMSRuleTemplate {
+	private static final Logger LOGGER  = FlexLogger.getLogger(CreateBRMSRuleTemplate.class);
+	private static CommonClassDao commonClassDao;
+	
+	@Autowired
+	public CreateBRMSRuleTemplate(CommonClassDao commonClassDao){
+		CreateBRMSRuleTemplate.commonClassDao = commonClassDao;
+	}
+	
+	public CreateBRMSRuleTemplate() {}
+
+	public Map<String, String> addRule(String rule, String ruleName, String description, String userID) {
+		Map<String,String> responseMap = new HashMap<String,String>();
+		if(rule!=null && !PolicyUtils.brmsRawValidate(rule).contains("[ERR")){
+			List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ruleName, "ruleName", BRMSParamTemplate.class);
+			if(duplicateData!=null && !duplicateData.isEmpty()){
+				LOGGER.error("Import new service failed.  Service already exists");
+				responseMap.put("DBError", "EXISTS");
+				return responseMap;
+			}else{
+				BRMSParamTemplate brmsParamTemplate = new BRMSParamTemplate();
+				brmsParamTemplate.setDescription(description);
+				brmsParamTemplate.setRuleName(ruleName);
+				brmsParamTemplate.setRule(rule);
+				UserInfo userCreatedBy = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", userID);
+				brmsParamTemplate.setUserCreatedBy(userCreatedBy);
+				commonClassDao.save(brmsParamTemplate);
+				LOGGER.info("Template created with " + ruleName + " by " + userID);
+			}
+			responseMap.put("success", "success");
+		}else{
+			LOGGER.debug("Error during validating the rule for creating record for BRMS Param Template");
+			responseMap.put("error", "VALIDATION");
+		}
+		return responseMap;
+	}
+	
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
index 6e18da5..0aaf1b1 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
@@ -26,7 +26,6 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -35,14 +34,26 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-import java.util.StringTokenizer;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.regex.Matcher; 
+
+import org.apache.commons.io.FilenameUtils;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.controller.BRMSDictionaryController;
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import com.att.research.xacml.std.IdentifierImpl;
+import com.att.research.xacml.util.XACMLProperties;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
@@ -56,26 +67,11 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-
-import org.apache.commons.io.FilenameUtils;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-import org.openecomp.policy.rest.XACMLRestProperties;
-
-import com.att.research.xacml.std.IdentifierImpl;
-import com.att.research.xacml.util.XACMLProperties;
-
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; 
 
 public class CreateBrmsParamPolicy extends Policy {
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger
-			.getLogger(CreateBrmsParamPolicy.class);
+	
+	private static final Logger LOGGER = FlexLogger.getLogger(CreateBrmsParamPolicy.class);
 
 	/*
 	 * These are the parameters needed for DB access from the PAP
@@ -95,16 +91,14 @@
 
 	}
 	
-	public String expandConfigBody(String ruleContents,  
-										Map<String, String> brmsParamBody
-										  ) { 
+	public String expandConfigBody(String ruleContents, Map<String, String> brmsParamBody) { 
 			 
 			Set<String> keySet= new HashSet<String>();
 			
 			Map<String,String> copyMap=new HashMap<>();
 			copyMap.putAll(brmsParamBody);
-			copyMap.put("policyName", policyAdapter.getPolicyName());
-			copyMap.put("policyScope", policyAdapter.getPolicyScope());
+			copyMap.put("policyName", policyName.substring(0, policyName.replace(".xml", "").lastIndexOf(".")));
+			copyMap.put("policyScope", policyAdapter.getDomainDir());
 			copyMap.put("policyVersion",policyAdapter.getHighestVersion().toString());
 			
 			//Finding all the keys in the Map data-structure.
@@ -127,90 +121,11 @@
 				}
 				ruleContents=m.replaceAll(finalInput);
 			}
-			System.out.println(ruleContents);
 			return ruleContents; 
 	} 
 			 
-	// Saving the Configurations file at server location for config policy.
-	protected void saveConfigurations(String policyName, String prevPolicyName,
-			String ruleBody) {
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath()
-				.toString());
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString())
-				+ gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		logger.info("print the main domain value" + policyDir);
-		String path = policyDir.replace('\\', '.');
-		if (path.contains("/")) {
-			path = policyDir.replace('/', '.');
-			logger.info("print the path:" + path);
-		}
 
-		
-			String configFileName = getConfigFile(policyName);
-        try{
-			// Getting the previous policy Config Json file to be used for
-			// updating the dictionary tables
-			if (policyAdapter.isEditPolicy()) {
-
-				String prevConfigFileName = getConfigFile(prevPolicyName);
-
-				File oldFile;
-				if (CONFIG_HOME.contains("\\")) {
-					oldFile = new File(CONFIG_HOME + "\\" + path + "."
-							+ prevConfigFileName);
-				} else {
-					oldFile = new File(CONFIG_HOME + "/" + path + "."
-							+ prevConfigFileName);
-				}
-
-				String filepath = oldFile.toString();
-
-				String prevJsonBody = readFile(filepath, StandardCharsets.UTF_8);
-				policyAdapter.setPrevJsonBody(prevJsonBody);
-			}
-
-			File configHomeDir = new File(CONFIG_HOME);
-			File[] listOfFiles = configHomeDir.listFiles();
-			if (listOfFiles != null) {
-				for (File eachFile : listOfFiles) {
-					if (eachFile.isFile()) {
-						String fileNameWithoutExtension = FilenameUtils
-								.removeExtension(eachFile.getName());
-						String configFileNameWithoutExtension = FilenameUtils
-								.removeExtension(configFileName);
-						if (fileNameWithoutExtension
-								.equals(configFileNameWithoutExtension)) {
-							// delete the file
-							eachFile.delete();
-						}
-					}
-				}
-			}
-        }
-        catch(IOException e){
-        	
-        }
-			try {
-				
-				if (policyName.endsWith(".xml")) {
-					policyName = policyName.substring(0,
-							policyName.lastIndexOf(".xml"));
-				}
-				PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator
-						+ path + "." + policyName + ".txt");
-				String expandedBody=expandConfigBody(ruleBody,policyAdapter.getBrmsParamBody());
-				out.println(expandedBody);
-				out.close();
-
-			} catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving configuration file");
-			}
-	}
-
+    
 	// Utility to read json data from the existing file to a string
 	static String readFile(String path, Charset encoding) throws IOException {
 
@@ -218,6 +133,27 @@
 		return new String(encoded, encoding);
 
 	}
+	
+	// Saving the Configurations file at server location for config policy.
+	protected void saveConfigurations(String policyName, String ruleBody) {
+		try {
+			if (policyName.endsWith(".xml")) {
+				policyName = policyName.substring(0,
+						policyName.lastIndexOf(".xml"));
+			}
+			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt");
+			String expandedBody=expandConfigBody(ruleBody,policyAdapter.getBrmsParamBody());
+			out.println(expandedBody);
+			policyAdapter.setJsonBody(expandedBody);
+			policyAdapter.setConfigBodyData(expandedBody);
+			out.close();
+			
+
+		} catch (Exception e) {
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving configuration file");
+		}
+	}
+
 
 	// Here we are adding the extension for the configurations file based on the
 	// config type selection for saving.
@@ -255,30 +191,17 @@
 		// Until here we prepared the data and here calling the method to create
 		// xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(),
-				policyName);
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
 		
 		Boolean dbIsUpdated = true;
 
 		successMap = new HashMap<String, String>();
 		if (dbIsUpdated) {
-			successMap = createPolicy(newPolicyPath,
-					getCorrectPolicyDataObject());
+			successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Failed to Update the Database Dictionary Tables.");
 			PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
-
-			// remove the new json file
-			String jsonBody = policyAdapter.getPrevJsonBody();
-			saveConfigurations(policyName, "", jsonBody);
 			successMap.put("error", "DB UPDATE");
 		}
-
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
 		return successMap;
 	}
 	
@@ -313,22 +236,17 @@
 			}
 			rs.close();
 		}catch (ClassNotFoundException e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(e.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "CreateBrmsParamPolicy", "Exception querying BRMSParamTemplate");
-			System.out.println(e.getMessage());
-
 		} catch (SQLException e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(e.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "CreateBrmsParamPolicy", "Exception querying BRMSParamTemplate");
-			System.out.println(e.getMessage());
 		} finally {
 			try{
 				if (con!=null) con.close();
 				if (rs!=null) rs.close();
 				if (st!=null) st.close();
-			} catch (Exception ex){}
+			} catch (Exception ex){
+				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, ex, "CreateBrmsParamPolicy", "Exception querying BRMSParamTemplate");
+			}
 		}
 		return ruleTemplate;
 		
@@ -421,8 +339,6 @@
 					}
 				}
 			} catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CreateBrmsParamPolicy", "Exception parsing file in findType");
 			}
 		}
@@ -443,13 +359,7 @@
 
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			// version = Integer.parseInt(policyAdapter.getVersion()) + 1;
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 
 		// Create the Instance for pojo, PolicyType object is used in
 		// marshalling.
@@ -462,33 +372,9 @@
 			policyAdapter.setData(policyConfig);
 		}
 
-		if (policyAdapter.getData() != null) {
-
-			// Save off everything
-			// making ready all the required elements to generate the action
-			// policy xml.
-			// Get the uniqueness for policy name.
-			String prevPolicyName = null;
-			if (policyAdapter.isEditPolicy()) {
-				prevPolicyName = "Config_BRMS_Param_" + policyAdapter.getPolicyName()
-						+ "." + policyAdapter.getHighestVersion() + ".xml";
-			}
-
-			Path newFile = getNextFilename(
-					Paths.get(policyAdapter.getParentPath().toString()),
-					(policyAdapter.getPolicyType() + "_BRMS_Param"),
-					policyAdapter.getPolicyName(), version);
-
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Policy already Exists, cannot create the policy.");
-				PolicyLogger.error("Policy already Exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;			
-			}
-			policyName = newFile.getFileName().toString();
-			
-				
+		policyName = policyAdapter.getNewFileName();
+		
+		if (policyAdapter.getData() != null) {	
 			Map<String,String> ruleAndUIValue= policyAdapter.getBrmsParamBody();
 			String tempateValue= ruleAndUIValue.get("templateName");
 			String valueFromDictionary= getValueFromDictionary(tempateValue);
@@ -504,7 +390,7 @@
 					body = "/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
 								"<$%BRMSParamTemplate=" + tempateValue + "%$> \n */ \n";
 					body = body +  valueFromDictionary + "\n";
-					generatedRule = "rule \"Params\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tParams params = new Params();";
+					generatedRule = "rule \"" +policyName.substring(0, policyName.replace(".xml", "").lastIndexOf(".")) +".Params\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tParams params = new Params();";
 					
 					//We first read the map data structure(ruleAndUIValue) received from the PAP-ADMIN
 					//We ignore if the key is "templateName as we are interested only in the UI fields and its value. 
@@ -537,22 +423,18 @@
 					
 					generatedRule = generatedRule
 							+ "\n\t\tinsert(params);\nend";
-					logger.info("New rule generated with :" + generatedRule);
+					LOGGER.info("New rule generated with :" + generatedRule);
 					body = body + generatedRule;
 				} catch (Exception e) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
 				}
 			}
 			catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
 			}
 			
-			saveConfigurations(policyName,prevPolicyName,body);
-
+			saveConfigurations(policyName,body);
+			
 			// Make sure the filename ends with an extension
 			if (policyName.endsWith(".xml") == false) {
 				policyName = policyName + ".xml";
@@ -562,17 +444,12 @@
 
 			configPolicy.setDescription(policyAdapter.getPolicyDescription());
 
-			configPolicy.setRuleCombiningAlgId(policyAdapter
-					.getRuleCombiningAlgId());
+			configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 
 			AllOfType allOfOne = new AllOfType();
-			File policyFilePath = new File(policyAdapter.getParentPath()
-					.toString(), policyName);
-			String policyDir = policyFilePath.getParentFile().getName();
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = policyDir + "." + fileName + ".xml";
-			String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
-					fileName.length());
+
+			String fileName = policyAdapter.getNewFileName();
+			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1,
 						fileName.length());
@@ -583,22 +460,16 @@
 			AllOfType allOf = new AllOfType();
 
 			// Match for ECOMPName
-			allOf.getMatch().add(
-					createMatch("ECOMPName", policyAdapter.getEcompName()));
-			allOf.getMatch().add(
-					createMatch("ConfigName", policyAdapter.getConfigName()));
+			allOf.getMatch().add(createMatch("ECOMPName", policyAdapter.getEcompName()));
+			allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
 			// Match for riskType
-			allOf.getMatch().add(
-					createDynamicMatch("RiskType", policyAdapter.getRiskType()));
+			allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
 			// Match for riskLevel
-			allOf.getMatch().add(
-					createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
+			allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
 			// Match for riskguard
-			allOf.getMatch().add(
-					createDynamicMatch("guard", policyAdapter.getGuard()));
+			allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
 			// Match for ttlDate
-			allOf.getMatch().add(
-					createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
+			allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
 			AnyOfType anyOf = new AnyOfType();
 			anyOf.getAllOf().add(allOfOne);
 			anyOf.getAllOf().add(allOf);
@@ -628,9 +499,6 @@
 			try {
 				accessURI = new URI(ACTION_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
-						//+ e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -653,16 +521,12 @@
 			try {
 				configURI = new URI(RESOURCE_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
-						//+ e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy", "Exception creating Config URI");
 			}
 
 			configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
 			configAttributeDesignator.setDataType(STRING_DATATYPE);
-			configAttributeDesignator.setAttributeId(new IdentifierImpl(
-					configURI).stringValue());
+			configAttributeDesignator.setAttributeId(new IdentifierImpl(configURI).stringValue());
 			configMatch.setAttributeDesignator(configAttributeDesignator);
 			configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
 
@@ -684,9 +548,6 @@
 			policyAdapter.setPolicyData(configPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object."
-					//+ policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object."
 					+ policyAdapter.getData().getClass().getCanonicalName());
 		}
@@ -717,26 +578,14 @@
 
 		// For Config file Url if configurations are provided.
 		// URL ID Assignment
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath()
-				.toString());
 		AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
 		assignment2.setAttributeId("URLID");
 		assignment2.setCategory(CATEGORY_RESOURCE);
 		assignment2.setIssuer("");
 		AttributeValueType AttributeValue = new AttributeValueType();
 		AttributeValue.setDataType(URI_DATATYPE);
-		String policyDir1 = policyAdapter.getParentPath().toString();
-		int startIndex1 = policyDir1.indexOf(gitPath.toString())
-				+ gitPath.toString().length() + 1;
-		policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-		logger.info("print the main domain value" + policyDir1);
-		String path = policyDir1.replace('\\', '.');
-		if (path.contains("/")) {
-			path = policyDir1.replace('/', '.');
-			logger.info("print the path:" + path);
-		}
-		String content = CONFIG_URL + "/Config/" + path + "."
-				+ getConfigFile(policyName);
+
+		String content = CONFIG_URL + "/Config/"+ getConfigFile(policyName);
 
 		AttributeValue.getContent().add(content);
 		assignment2.setExpression(new ObjectFactory()
@@ -750,34 +599,14 @@
 		assignment3.setIssuer("");
 		AttributeValueType attributeValue3 = new AttributeValueType();
 		attributeValue3.setDataType(STRING_DATATYPE);
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString())
-				+ gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		StringTokenizer tokenizer = null;
-		StringBuffer buffer = new StringBuffer();
-		if (policyDir.contains("\\")) {
-			tokenizer = new StringTokenizer(policyDir, "\\");
-		} else {
-			tokenizer = new StringTokenizer(policyDir, "/");
-		}
-		if (tokenizer != null) {
-			while (tokenizer.hasMoreElements()) {
-				String value = tokenizer.nextToken();
-				buffer.append(value);
-				buffer.append(".");
-			}
-		}
 		fileName = FilenameUtils.removeExtension(fileName);
-		fileName = buffer.toString() + fileName + ".xml";
-		System.out.println(fileName);
+		fileName = fileName + ".xml";
 		String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
 				fileName.length());
 		if ((name == null) || (name.equals(""))) {
 			name = fileName.substring(fileName.lastIndexOf("/") + 1,
 					fileName.length());
 		}
-		System.out.println(name);
 		attributeValue3.getContent().add(name);
 		assignment3.setExpression(new ObjectFactory()
 				.createAttributeValue(attributeValue3));
@@ -797,7 +626,7 @@
 
 		// Ecomp Name Assignment
 		AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
-		assignment5.setAttributeId("matching:" + this.ECOMPID);
+		assignment5.setAttributeId("matching:" + ECOMPID);
 		assignment5.setCategory(CATEGORY_RESOURCE);
 		assignment5.setIssuer("");
 		AttributeValueType configNameAttributeValue5 = new AttributeValueType();
@@ -810,7 +639,7 @@
 		
 		//Config Name Assignment
 		AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
-		assignment6.setAttributeId("matching:" + this.CONFIGID);
+		assignment6.setAttributeId("matching:" +CONFIGID);
 		assignment6.setCategory(CATEGORY_RESOURCE);
 		assignment6.setIssuer("");
 		AttributeValueType configNameAttributeValue6 = new AttributeValueType();
@@ -818,22 +647,31 @@
 		configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
 		assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
 		advice.getAttributeAssignmentExpression().add(assignment6);
-		
+        // Adding Controller Information. 
+        if(policyAdapter.getBrmsController()!=null){
+            BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
+            advice.getAttributeAssignmentExpression().add(
+                        createResponseAttributes("controller:"+ policyAdapter.getBrmsController(), 
+                                brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
+        }
+        
+        // Adding Dependencies. 
+        if(policyAdapter.getBrmsDependency()!=null){
+            BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
+            ArrayList<String> dependencies = new ArrayList<String>();
+            StringBuilder key = new StringBuilder();
+            for(String dependencyName: policyAdapter.getBrmsDependency()){
+                dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
+                key.append(dependencyName + ",");
+            }
+            advice.getAttributeAssignmentExpression().add(
+                        createResponseAttributes("dependencies:"+key.toString(), dependencies.toString()));
+        }
+        
+        // Dynamic Field Config Attributes. 
 		Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
 		for (String keyField : dynamicFieldConfigAttributes.keySet()) {
-			String key = keyField;
-			String value = dynamicFieldConfigAttributes.get(key);
-			AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
-			assignment7.setAttributeId("key:" + key);
-			assignment7.setCategory(CATEGORY_RESOURCE);
-			assignment7.setIssuer("");
-
-			AttributeValueType configNameAttributeValue7 = new AttributeValueType();
-			configNameAttributeValue7.setDataType(STRING_DATATYPE);
-			configNameAttributeValue7.getContent().add(value);
-			assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
-
-			advice.getAttributeAssignmentExpression().add(assignment7);
+			advice.getAttributeAssignmentExpression().add(createResponseAttributes("key:"+keyField, dynamicFieldConfigAttributes.get(keyField)));
 		}
 		
 		//Risk Attributes
@@ -893,4 +731,16 @@
 	public Object getCorrectPolicyDataObject() {		
 		return policyAdapter.getData();
 	}
+	
+    private AttributeAssignmentExpressionType  createResponseAttributes(String key, String value){
+        AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
+        assignment7.setAttributeId(key);
+        assignment7.setCategory(CATEGORY_RESOURCE);
+        assignment7.setIssuer("");
+        AttributeValueType configNameAttributeValue7 = new AttributeValueType();
+        configNameAttributeValue7.setDataType(STRING_DATATYPE);
+        configNameAttributeValue7.getContent().add(value);
+        assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
+        return assignment7;
+    }
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
index d77abf0..dfd647c 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateBrmsRawPolicy.java
@@ -27,13 +27,20 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.StringTokenizer;
+
+import org.apache.commons.io.FilenameUtils;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.controller.BRMSDictionaryController;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import com.att.research.xacml.std.IdentifierImpl;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
@@ -49,29 +56,9 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
 
-import org.apache.commons.io.FilenameUtils;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-
-import com.att.research.xacml.std.IdentifierImpl;
-
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
-
 
 public class CreateBrmsRawPolicy extends Policy {
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger
-			.getLogger(CreateBrmsRawPolicy.class);
-
-	public static final String JSON_CONFIG = "JSON";
-	public static final String XML_CONFIG = "XML";
-	public static final String PROPERTIES_CONFIG = "PROPERTIES";
-	public static final String OTHER_CONFIG = "OTHER";
-
+	
 	public CreateBrmsRawPolicy() {
 		super();
 	}
@@ -82,104 +69,19 @@
 
 	}
 
-	// Saving the Configurations file at server location for config policy.
-	protected void saveConfigurations(String policyName, String prevPolicyName,
-			String jsonBody) {
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath()
-				.toString());
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString())
-				+ gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		logger.info("print the main domain value" + policyDir);
-		String path = policyDir.replace('\\', '.');
-		if (path.contains("/")) {
-			path = policyDir.replace('/', '.');
-			logger.info("print the path:" + path);
-		}
-
+	// Saving the Configurations file at server location for CreateBrmsRawPolicy policy.
+	protected void saveConfigurations(String policyName, String jsonBody) {		
 		try {
-			String configFileName = getConfigFile(policyName);
-
-			File file;
-			if (CONFIG_HOME.contains("\\")) {
-				file = new File(CONFIG_HOME + "\\" + path + "."
-						+ configFileName);
-			} else {
-				file = new File(CONFIG_HOME + "/" + path + "." + configFileName);
+			if (policyName.endsWith(".xml")) {
+				policyName = policyName.substring(0,
+						policyName.lastIndexOf(".xml"));
 			}
+			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt");
+			out.println(jsonBody);
+			out.close();
 
-			// if file doesnt exists, then create it
-			if (!file.exists()) {
-				file.createNewFile();
-			}
-
-			// Getting the previous policy Config Json file to be used for
-			// updating the dictionary tables
-			if (policyAdapter.isEditPolicy()) {
-
-				String prevConfigFileName = getConfigFile(prevPolicyName);
-
-				File oldFile;
-				if (CONFIG_HOME.contains("\\")) {
-					oldFile = new File(CONFIG_HOME + "\\" + path + "."
-							+ prevConfigFileName);
-				} else {
-					oldFile = new File(CONFIG_HOME + "/" + path + "."
-							+ prevConfigFileName);
-				}
-
-				String filepath = oldFile.toString();
-
-				String prevJsonBody = readFile(filepath, StandardCharsets.UTF_8);
-				policyAdapter.setPrevJsonBody(prevJsonBody);
-			}
-
-			File configHomeDir = new File(CONFIG_HOME);
-			File[] listOfFiles = configHomeDir.listFiles();
-			if (listOfFiles != null) {
-				for (File eachFile : listOfFiles) {
-					if (eachFile.isFile()) {
-						String fileNameWithoutExtension = FilenameUtils
-								.removeExtension(eachFile.getName());
-						String configFileNameWithoutExtension = FilenameUtils
-								.removeExtension(configFileName);
-						if (fileNameWithoutExtension
-								.equals(configFileNameWithoutExtension)) {
-							// delete the file
-							eachFile.delete();
-						}
-					}
-				}
-			}
-
-			/*FileWriter fw = new FileWriter(file.getAbsoluteFile());
-			BufferedWriter bw = new BufferedWriter(fw);
-			bw.write(jsonBody);
-			bw.close();
-			if (logger.isDebugEnabled()) {
-				logger.debug("Configuration is succesfully saved");
-			}*/
-			
-			try {
-				
-				if (policyName.endsWith(".xml")) {
-					policyName = policyName.substring(0,
-							policyName.lastIndexOf(".xml"));
-				}
-				PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator
-						+ path + "." + policyName + ".txt");
-				out.println(jsonBody);
-				out.close();
-
-			} catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
-				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file");
-			}
-			
-		} catch (IOException e) {
-			e.printStackTrace();
+		} catch (Exception e) {
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file");
 		}
 	}
 
@@ -227,8 +129,7 @@
 		// Until here we prepared the data and here calling the method to create
 		// xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(),
-				policyName);
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
 		
 		Boolean dbIsUpdated = true;
 
@@ -237,20 +138,10 @@
 			successMap = createPolicy(newPolicyPath,
 					getCorrectPolicyDataObject());
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Failed to Update the Database Dictionary Tables.");
 			PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
-
-			// remove the new json file
-			String jsonBody = policyAdapter.getPrevJsonBody();
-			saveConfigurations(policyName, "", jsonBody);
 			successMap.put("error", "DB UPDATE");
 		}
 
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
 		return successMap;
 	}
 
@@ -268,13 +159,7 @@
 
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			// version = Integer.parseInt(policyAdapter.getVersion()) + 1;
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 
 		// Create the Instance for pojo, PolicyType object is used in
 		// marshalling.
@@ -287,36 +172,12 @@
 			policyAdapter.setData(policyConfig);
 		}
 
+		policyName = policyAdapter.getNewFileName();
+		
 		if (policyAdapter.getData() != null) {
-
-			// Save off everything
-			// making ready all the required elements to generate the action
-			// policy xml.
-			// Get the uniqueness for policy name.
-			String prevPolicyName = null;
-			if (policyAdapter.isEditPolicy()) {
-				prevPolicyName = "Config_BRMS_Raw_" + policyAdapter.getPolicyName()
-						+ "." + policyAdapter.getHighestVersion() + ".xml";
-			}
-			//if (!policyAdapter.isEditPolicy()) {
-				Path newFile = getNextFilename(
-						Paths.get(policyAdapter.getParentPath().toString()),
-						(policyAdapter.getPolicyType() + "_BRMS_Raw"),
-						policyAdapter.getPolicyName(), version);
-	
-				if (newFile == null) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("File already exists, cannot create the policy.");
-					PolicyLogger.error("File already exists, cannot create the policy.");
-					setPolicyExists(true);
-					return false;
-				}
-				policyName = newFile.getFileName().toString();
-			//}
-
 			//String jsonBody = policyAdapter.getJsonBody();
 			String configBody=policyAdapter.getConfigBodyData();
-			saveConfigurations(policyName, prevPolicyName, configBody);
+			saveConfigurations(policyName, configBody);
 
 			// Make sure the filename ends with an extension
 			if (policyName.endsWith(".xml") == false) {
@@ -327,17 +188,11 @@
 
 			configPolicy.setDescription(policyAdapter.getPolicyDescription());
 
-			configPolicy.setRuleCombiningAlgId(policyAdapter
-					.getRuleCombiningAlgId());
+			configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 
 			AllOfType allOfOne = new AllOfType();
-			File policyFilePath = new File(policyAdapter.getParentPath()
-					.toString(), policyName);
-			String policyDir = policyFilePath.getParentFile().getName();
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = policyDir + "." + fileName + ".xml";
-			String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
-					fileName.length());
+			String fileName = policyAdapter.getNewFileName();
+			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1,
 						fileName.length());
@@ -348,22 +203,16 @@
 			AllOfType allOf = new AllOfType();
 
 			// Match for ECOMPName
-			allOf.getMatch().add(
-					createMatch("ECOMPName", policyAdapter.getEcompName()));
-			allOf.getMatch().add(
-					createMatch("ConfigName", policyAdapter.getConfigName()));
+			allOf.getMatch().add(createMatch("ECOMPName", policyAdapter.getEcompName()));
+			allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
 			// Match for riskType
-			allOf.getMatch().add(
-					createDynamicMatch("RiskType", policyAdapter.getRiskType()));
+			allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
 			// Match for riskLevel
-			allOf.getMatch().add(
-					createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
+			allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
 			// Match for riskguard
-			allOf.getMatch().add(
-					createDynamicMatch("guard", policyAdapter.getGuard()));
+			allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
 			// Match for ttlDate
-			allOf.getMatch().add(
-					createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
+			allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
 			AnyOfType anyOf = new AnyOfType();
 			anyOf.getAllOf().add(allOfOne);
 			anyOf.getAllOf().add(allOf);
@@ -393,9 +242,6 @@
 			try {
 				accessURI = new URI(ACTION_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
-						//+ e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsRawPolicy", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -418,9 +264,6 @@
 			try {
 				configURI = new URI(RESOURCE_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
-						//+ e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsRawPolicy", "Exception creating Config URI");
 			}
 
@@ -449,9 +292,6 @@
 			policyAdapter.setPolicyData(configPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object."
-					//+ policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object."
 					+ policyAdapter.getData().getClass().getCanonicalName());
 		}
@@ -482,26 +322,14 @@
 
 		// For Config file Url if configurations are provided.
 		// URL ID Assignment
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath()
-				.toString());
 		AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
 		assignment2.setAttributeId("URLID");
 		assignment2.setCategory(CATEGORY_RESOURCE);
 		assignment2.setIssuer("");
 		AttributeValueType AttributeValue = new AttributeValueType();
 		AttributeValue.setDataType(URI_DATATYPE);
-		String policyDir1 = policyAdapter.getParentPath().toString();
-		int startIndex1 = policyDir1.indexOf(gitPath.toString())
-				+ gitPath.toString().length() + 1;
-		policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-		logger.info("print the main domain value" + policyDir1);
-		String path = policyDir1.replace('\\', '.');
-		if (path.contains("/")) {
-			path = policyDir1.replace('/', '.');
-			logger.info("print the path:" + path);
-		}
-		String content = CONFIG_URL + "/Config/" + path + "."
-				+ getConfigFile(policyName);
+
+		String content = CONFIG_URL + "/Config/" + getConfigFile(policyName);
 
 		AttributeValue.getContent().add(content);
 		assignment2.setExpression(new ObjectFactory()
@@ -515,26 +343,8 @@
 		assignment3.setIssuer("");
 		AttributeValueType attributeValue3 = new AttributeValueType();
 		attributeValue3.setDataType(STRING_DATATYPE);
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString())
-				+ gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		StringTokenizer tokenizer = null;
-		StringBuffer buffer = new StringBuffer();
-		if (policyDir.contains("\\")) {
-			tokenizer = new StringTokenizer(policyDir, "\\");
-		} else {
-			tokenizer = new StringTokenizer(policyDir, "/");
-		}
-		if (tokenizer != null) {
-			while (tokenizer.hasMoreElements()) {
-				String value = tokenizer.nextToken();
-				buffer.append(value);
-				buffer.append(".");
-			}
-		}
 		fileName = FilenameUtils.removeExtension(fileName);
-		fileName = buffer.toString() + fileName + ".xml";
+		fileName = fileName + ".xml";
 		System.out.println(fileName);
 		String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
 				fileName.length());
@@ -562,7 +372,7 @@
 
 		// Ecomp Name Assignment
 		AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
-		assignment5.setAttributeId("matching:" + this.ECOMPID);
+		assignment5.setAttributeId("matching:" + ECOMPID);
 		assignment5.setCategory(CATEGORY_RESOURCE);
 		assignment5.setIssuer("");
 		AttributeValueType configNameAttributeValue5 = new AttributeValueType();
@@ -575,7 +385,7 @@
 		
 		//Config Name Assignment
 		AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
-		assignment6.setAttributeId("matching:" + this.CONFIGID);
+		assignment6.setAttributeId("matching:" + CONFIGID);
 		assignment6.setCategory(CATEGORY_RESOURCE);
 		assignment6.setIssuer("");
 		AttributeValueType configNameAttributeValue6 = new AttributeValueType();
@@ -584,21 +394,31 @@
 		assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
 		advice.getAttributeAssignmentExpression().add(assignment6);
 		
+        // Adding Controller Information. 
+        if(policyAdapter.getBrmsController()!=null){
+            BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
+            advice.getAttributeAssignmentExpression().add(
+                    createResponseAttributes("controller:"+ policyAdapter.getBrmsController(), 
+                                brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
+        }
+        
+        // Adding Dependencies. 
+        if(policyAdapter.getBrmsDependency()!=null){
+            BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
+            ArrayList<String> dependencies = new ArrayList<String>();
+            StringBuilder key = new StringBuilder();
+            for(String dependencyName: policyAdapter.getBrmsDependency()){
+                dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
+                key.append(dependencyName + ",");
+            }
+            advice.getAttributeAssignmentExpression().add(
+                        createResponseAttributes("dependencies:"+key.toString(), dependencies.toString()));
+        }
+        
+        // Dynamic Field Config Attributes. 
 		Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
 		for (String keyField : dynamicFieldConfigAttributes.keySet()) {
-			String key = keyField;
-			String value = dynamicFieldConfigAttributes.get(key);
-			AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
-			assignment7.setAttributeId("key:" + key);
-			assignment7.setCategory(CATEGORY_RESOURCE);
-			assignment7.setIssuer("");
-
-			AttributeValueType configNameAttributeValue7 = new AttributeValueType();
-			configNameAttributeValue7.setDataType(STRING_DATATYPE);
-			configNameAttributeValue7.getContent().add(value);
-			assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
-
-			advice.getAttributeAssignmentExpression().add(assignment7);
+			advice.getAttributeAssignmentExpression().add(createResponseAttributes("key:"+keyField, dynamicFieldConfigAttributes.get(keyField)));
 		}
 		
 		//Risk Attributes
@@ -658,4 +478,16 @@
 	public Object getCorrectPolicyDataObject() {
 		return policyAdapter.getData();
 	}
+	
+    private AttributeAssignmentExpressionType  createResponseAttributes(String key, String value){
+        AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
+        assignment7.setAttributeId(key);
+        assignment7.setCategory(CATEGORY_RESOURCE);
+        assignment7.setIssuer("");
+        AttributeValueType configNameAttributeValue7 = new AttributeValueType();
+        configNameAttributeValue7.setDataType(STRING_DATATYPE);
+        configNameAttributeValue7.getContent().add(value);
+        assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
+        return assignment7;
+    }
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
index 578efc2..5eb3493 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
@@ -22,7 +22,6 @@
 
 
 import java.io.File;
-import java.io.IOException;
 import java.io.PrintWriter;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -30,9 +29,6 @@
 import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.json.stream.JsonGenerationException;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
@@ -49,25 +45,14 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
 
 import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-import com.att.research.xacml.std.IdentifierImpl;
-
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import com.att.research.xacml.std.IdentifierImpl;
 
 public class CreateClosedLoopPerformanceMetrics extends Policy {
 	
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger.getLogger(ConfigPolicy.class);
-
 	public CreateClosedLoopPerformanceMetrics() {
 		super();
 	}
@@ -77,13 +62,7 @@
 	}
 
 	//save configuration of the policy based on the policyname
-	private void saveConfigurations(String policyName, String prevPolicyName, String jsonBody) {
-		String domain = getParentPathSubScopeDir();
-		String path = domain.replace('\\', '.');
-		if(path.contains("/")){
-			path = domain.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
+	private void saveConfigurations(String policyName, String jsonBody) {
 		try {
 			String body = null;
 			try {
@@ -91,21 +70,18 @@
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
-
-			System.out.println(body);
 			if(policyName.endsWith(".xml")){
 				policyName	 = policyName.substring(0, policyName.lastIndexOf(".xml"));	
 			}
-			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+path + "."+ policyName +".json");
+			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + "."+ policyName +".json");
 			out.println(body);
+			policyAdapter.setJsonBody(body);
+			policyAdapter.setConfigBodyData(body);
 			out.close();
 
-		} catch (JsonGenerationException e) {
-			e.printStackTrace();
-		} catch (IOException e) {
+		} catch (Exception e) {
 			e.printStackTrace();
 		}
-
 	}
 	
 	//getting the policy name and setting to configuration on adding .json
@@ -120,13 +96,13 @@
 	
 	@Override
 	public Map<String, String> savePolicies() throws Exception {
-		
+
 		Map<String, String> successMap = new HashMap<String,String>();
 		if(isPolicyExists()){
 			successMap.put("EXISTS", "This Policy already exist on the PAP");
 			return successMap;
 		}
-		
+
 		if(!isPreparedToSave()){
 			//Prep and configure the policy for saving
 			prepareToSave();
@@ -134,12 +110,10 @@
 
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
-		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject() );		
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
+
+		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());	
+		
 		return successMap;		
 	}
 	
@@ -155,12 +129,7 @@
 		
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Config")) {
@@ -171,32 +140,11 @@
 			policyConfig.setTarget(new TargetType());
 			policyAdapter.setData(policyConfig);
 		}
-		
+		policyName = policyAdapter.getNewFileName();
 		if (policyAdapter.getData() != null) {
-			
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			String prevPolicyName = null;
-			if(policyAdapter.isEditPolicy()){
-				prevPolicyName = "Config_PM_" + policyAdapter.getPolicyName() + "." + policyAdapter.getHighestVersion() + ".xml";
-			}
-			
-			Path newFile = this.getNextLoopFilename(Paths.get(policyAdapter.getParentPath()), policyAdapter.getPolicyType(), policyAdapter.getConfigPolicyType(), policyAdapter.getPolicyName(), version);
-
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("File already exists, cannot create the policy.");
-				PolicyLogger.error("File already exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;
-			}
-			
-			policyName = newFile.getFileName().toString();
-			
 			// Save the Configurations file with the policy name with extention based on selection.
 			String jsonBody = policyAdapter.getJsonBody();
-			saveConfigurations(policyName, prevPolicyName, jsonBody);
+			saveConfigurations(policyName, jsonBody);
 			
 			// Make sure the filename ends with an extension
 			if (policyName.endsWith(".xml") == false) {
@@ -211,18 +159,7 @@
 			configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 			
 			AllOfType allOfOne = new AllOfType();
-			final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex, policyDir.length());
-			logger.info("print the main domain value "+policyDir);
-			String path = policyDir.replace('\\', '.');
-			if(path.contains("/")){
-				path = policyDir.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = path + "." + fileName + ".xml";
+			String fileName = policyAdapter.getNewFileName();
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -276,8 +213,6 @@
 			try {
 				accessURI = new URI(ACTION_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateClosedLoopPerformanceMetrics", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -297,8 +232,6 @@
 			try {
 				configURI = new URI(RESOURCE_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateClosedLoopPerformanceMetrics", "Exception creating Config URI");
 			}
 			configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
@@ -323,8 +256,6 @@
 			policyAdapter.setPolicyData(configPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 		}
 		setPreparedToSave(true);
@@ -350,7 +281,6 @@
 		assignment1.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue));
 
 		advice.getAttributeAssignmentExpression().add(assignment1);
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
 		// For Config file Url if configurations are provided.
 		AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
 		assignment2.setAttributeId("URLID");
@@ -359,17 +289,7 @@
 
 		AttributeValueType AttributeValue = new AttributeValueType();
 		AttributeValue.setDataType(URI_DATATYPE);
-		String policyDir1 = policyAdapter.getParentPath().toString();
-		int startIndex1 = policyDir1.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-		logger.info("print the main domain value"+policyDir1);
-		String path = policyDir1.replace('\\', '.');
-		if(path.contains("/")){
-			path = policyDir1.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
-		String content = CONFIG_URL +"/Config/" + path + "." + getConfigFile(policyName);
-		System.out.println("URL value :" + content);
+		String content = CONFIG_URL +"/Config/"+ getConfigFile(policyName);
 		AttributeValue.getContent().add(content);
 		assignment2.setExpression(new ObjectFactory().createAttributeValue(AttributeValue));
 
@@ -381,25 +301,8 @@
 
 		AttributeValueType attributeValue3 = new AttributeValueType();
 		attributeValue3.setDataType(STRING_DATATYPE);
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		StringTokenizer tokenizer = null;
-		StringBuffer buffer = new StringBuffer();
-		if (policyDir.contains("\\")) {
-			tokenizer = new StringTokenizer(policyDir, "\\");
-		} else {
-			tokenizer = new StringTokenizer(policyDir, "/");
-		}
-		if (tokenizer != null) {
-			while (tokenizer.hasMoreElements()) {
-				String value = tokenizer.nextToken();
-				buffer.append(value);
-				buffer.append(".");
-			}
-		}
 		fileName = FilenameUtils.removeExtension(fileName);
-		fileName = buffer.toString() + fileName + ".xml";
+		fileName = fileName + ".xml";
 		String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 		if ((name == null) || (name.equals(""))) {
 			name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -499,7 +402,6 @@
 
 	@Override
 	public Object getCorrectPolicyDataObject() {
-		// TODO Auto-generated method stub
 		return policyAdapter.getPolicyData();
 	}	
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
index 73479fd..c1740ae 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateNewMicroSerivceModel.java
@@ -41,33 +41,25 @@
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-//import org.eclipse.emf.common.util.URI;
-//import org.eclipse.emf.ecore.EPackage;
-//import org.eclipse.emf.ecore.resource.Resource;
-//import org.eclipse.emf.ecore.resource.ResourceSet;
-//import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-//import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
 import org.openecomp.policy.rest.XACMLRestProperties;
 import org.openecomp.policy.rest.jpa.MicroServiceModels;
 import org.openecomp.policy.rest.jpa.UserInfo;
 import org.openecomp.policy.rest.util.MSAttributeObject;
-import org.openecomp.policy.rest.util.MSModelUtitils;
+import org.openecomp.policy.rest.util.MSModelUtils;
+import org.openecomp.policy.rest.util.MSModelUtils.MODEL_TYPE;
 
 import com.att.research.xacml.util.XACMLProperties;
 
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
-
 public class CreateNewMicroSerivceModel {
 	private static final Logger logger = FlexLogger.getLogger(CreateNewMicroSerivceModel.class);
 	private MicroServiceModels newModel = null;
 	private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>();
-	private String directory;
-	
+
 	/*
 	 * These are the parameters needed for DB access from the PAP
 	 */
@@ -76,15 +68,14 @@
 	private static String papDbUser = null;
 	private static String papDbPassword = null;
 	
-	MSModelUtitils utils = new MSModelUtitils();
+	MSModelUtils utils = new MSModelUtils(XACMLPapServlet.msEcompName, XACMLPapServlet.msPolicyName);
 
 	public CreateNewMicroSerivceModel(String fileName, String serviceName, String string, String version) {
 		super();
 	}
 
 	public CreateNewMicroSerivceModel(String importFile, String  modelName, String description, String version, String randomID) {
-		
-		Map<String, String> successMap = new HashMap<String,String>();
+	
 		this.newModel = new MicroServiceModels();
 		this.newModel.setDescription(description);
 		this.newModel.setVersion(version);
@@ -100,11 +91,10 @@
 	    	extractFolder(randomID + ".zip");
 	        File directory = new File("ExtractDir" + File.separator + randomID);
 	        List<File> fileList = listModelFiles(directory.toString());
-	        //get all the files from a directory
-	        File[] fList = directory.listFiles();
+	        //get all the files from a director
 	        for (File file : fileList){
 	            if (file.isFile()){
-				    tempMap = utils.processEpackage(file.getAbsolutePath());
+				    tempMap = utils.processEpackage(file.getAbsolutePath(), MODEL_TYPE.XMI);
 				    classMap.putAll(tempMap);
 	            }
 	        }
@@ -118,16 +108,12 @@
 				logger.error("Failed to unzip model file " + randomID);
 			}
 	    }else {
-		    tempMap = utils.processEpackage("ExtractDir" + File.separator + randomID+".xmi");
+		    tempMap = utils.processEpackage("ExtractDir" + File.separator + randomID+".xmi", MODEL_TYPE.XMI);
 		    classMap.putAll(tempMap);
 		    cleanUpFile = "ExtractDir" + File.separator + randomID+".xmi";
 		    File deleteFile = new File(cleanUpFile); 
 			deleteFile.delete();
 	    }
-
-	    //	addValuesToNewModel();
-
-
 	}
 	
 	private List<File> listModelFiles(String directoryName) {
@@ -144,6 +130,7 @@
 		return resultList;
 	}
 
+	@SuppressWarnings("rawtypes")
 	private void extractFolder(String zipFile) {
 	    int BUFFER = 2048;
 	    File file = new File(zipFile);
@@ -152,7 +139,6 @@
 		try {
 			zip = new ZipFile("ExtractDir" + File.separator +file);
 		    String newPath =  zipFile.substring(0, zipFile.length() - 4);
-		    this.directory = "ExtractDir" + File.separator + zipFile.substring(0, zipFile.length() - 4);
 		    new File(newPath).mkdir();
 		    Enumeration zipFileEntries = zip.entries();
 	
@@ -232,11 +218,14 @@
 		this.newModel.setSub_attributes(subAttribute);
 		this.newModel.setAttributes(mainClass.getAttribute().toString().replace("{", "").replace("}", ""));
 		this.newModel.setRef_attributes(mainClass.getRefAttribute().toString().replace("{", "").replace("}", ""));
+		this.newModel.setEnumValues(mainClass.getEnumType().toString().replace("{", "").replace("}", ""));
+        this.newModel.setAnnotation(mainClass.getMatchingSet().toString().replace("{", "").replace("}", ""));
 		successMap.put("success", "success");
 		return successMap;
 		
 	}
 	
+	@SuppressWarnings("resource")
 	public Map<String, String> saveImportService(){
 		Map<String, String> successMap = new HashMap<String,String>();
 		
@@ -275,21 +264,19 @@
 					ID++;
 				}
 	
-				insertQuery = "INSERT INTO MicroServiceModels (ID, modelName, Dependency, DESCRIPTION, attributes, ref_attributes, sub_attributes, version, imported_by) "
-							+ "VALUES("+ID+",'"+modelName+"','"+ this.newModel.getDependency()+"','"+this.newModel.getDescription()+"','"+this.newModel.getAttributes()+
-							"','"+this.newModel.getRef_attributes()+"','"+this.newModel.getSub_attributes()+"','"+version+"','"+imported_by+"')";
+				String newDependency = "[" + this.newModel.getDependency() + "]";
+	            this.newModel.setDependency(newDependency);
+	            insertQuery = "INSERT INTO MicroServiceModels (ID, modelName, Dependency, DESCRIPTION, attributes, ref_attributes, sub_attributes, version, imported_by, enumValues, annotation) "
+						+ "VALUES("+ID+",'"+modelName+"','"+ this.newModel.getDependency()+"','"+this.newModel.getDescription()+"','"+this.newModel.getAttributes()+
+						"','"+this.newModel.getRef_attributes()+"','"+this.newModel.getSub_attributes()+"','"+version+"','"+imported_by+"','"+this.newModel.getEnumValues()+"','"+this.newModel.getAnnotation()+"')";
 				st.executeUpdate(insertQuery);
 				successMap.put("success", "success");
 			}
 			rs.close();
 		}catch (ClassNotFoundException e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(e.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "saveImportService", "Exception querying MicroServiceModels");
 			successMap.put("DBError", "Error Query");
 		} catch (SQLException e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(e.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "saveImportService", "Exception querying MicroServiceModels");
 			successMap.put("DBError", "Error Query");
 		} finally {
@@ -297,7 +284,9 @@
 				if (con!=null) con.close();
 				if (rs!=null) rs.close();
 				if (st!=null) st.close();
-			} catch (Exception ex){}
+			} catch (Exception ex){
+				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, ex, "saveImportService", "Exception querying MicroServiceModels");
+			}
 		}
 
 		return successMap;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
index 822768f..b7b47cf 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
@@ -50,9 +50,11 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableDefinitionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableReferenceType;
 
-import org.apache.commons.io.FilenameUtils;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
 import org.openecomp.policy.pap.xacml.rest.util.JPAUtils;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
 import org.openecomp.policy.rest.jpa.Datatype;
 import org.openecomp.policy.rest.jpa.DecisionSettings;
 import org.openecomp.policy.rest.jpa.FunctionDefinition;
@@ -60,48 +62,15 @@
 
 import com.att.research.xacml.std.IdentifierImpl;
 
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-
 public class DecisionPolicy extends Policy {
 
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger.getLogger(ConfigPolicy.class);
-
-	public static final String JSON_CONFIG = "JSON";
-	public static final String XML_CONFIG = "XML";
-	public static final String PROPERTIES_CONFIG = "PROPERTIES";
-	public static final String OTHER_CONFIG = "OTHER";
-	
-	public static final String PDP_ACTION = "PDP";
-	public static final String PEP_ACTION = "PEP";
-	public static final String TYPE_ACTION = "REST";
-
-	public static final String GET_METHOD = "GET";
-	public static final String PUT_METHOD = "PUT";
-	public static final String POST_METHOD = "POST";
-
-	public static final String PERFORMER_ATTRIBUTEID = "performer";
-	public static final String TYPE_ATTRIBUTEID = "type";
-	public static final String METHOD_ATTRIBUTEID = "method";
-	public static final String HEADERS_ATTRIBUTEID = "headers";
-	public static final String URL_ATTRIBUTEID = "url";
-	public static final String BODY_ATTRIBUTEID = "body";
-	
 	public static final String FUNCTION_NOT = "urn:oasis:names:tc:xacml:1.0:function:not";
-	
 	private static final String AAFProvider = "AAF";
-	//private static final String CustomProvider = "Custom";
 	
 	List<String> dynamicLabelRuleAlgorithms = new LinkedList<String>();
 	List<String> dynamicFieldComboRuleAlgorithms = new LinkedList<String>();
 	List<String> dynamicFieldOneRuleAlgorithms = new LinkedList<String>();
 	List<String> dynamicFieldTwoRuleAlgorithms = new LinkedList<String>();
-	//List<Object> dynamicVariableList = new LinkedList<Object>();
 	List<String> dataTypeList = new LinkedList<String>();
 	
 	protected Map<String, String> dropDownMap = new HashMap<String, String>();
@@ -117,13 +86,13 @@
 	
 	@Override
 	public Map<String, String> savePolicies() throws Exception {
-		
+
 		Map<String, String> successMap = new HashMap<String,String>();
 		if(isPolicyExists()){
 			successMap.put("EXISTS", "This Policy already exist on the PAP");
 			return successMap;
 		}
-		
+
 		if(!isPreparedToSave()){
 			//Prep and configure the policy for saving
 			prepareToSave();
@@ -131,12 +100,9 @@
 
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
-		successMap = createPolicy(newPolicyPath, getCorrectPolicyDataObject());		
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
+
+		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());	
 		return successMap;		
 	}
 	
@@ -152,12 +118,7 @@
 		
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-		
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Decision")) {
@@ -168,45 +129,16 @@
 			policyConfig.setTarget(new TargetType());
 			policyAdapter.setData(policyConfig);
 		}
+		policyName = policyAdapter.getNewFileName();
 		
 		if (policyAdapter.getData() != null) {
-			
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			Path newFile = getNextFilename(Paths.get(policyAdapter.getParentPath().toString()), policyAdapter.getPolicyType(), policyAdapter.getPolicyName(), version);
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("File already exists, cannot create the policy.");
-				PolicyLogger.error("File already exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;
-			}
-			policyName = newFile.getFileName().toString();
-			
-			// Make sure the filename ends with an extension
-			if (policyName.endsWith(".xml") == false) {
-				policyName = policyName + ".xml";
-			}
-			
 			PolicyType decisionPolicy = (PolicyType)  policyAdapter.getData();
 			
 			decisionPolicy.setDescription(policyAdapter.getPolicyDescription());
 			
 			decisionPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 			AllOfType allOfOne = new AllOfType();
-			final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex, policyDir.length());
-			logger.info("print the main domain value "+policyDir);
-			String path = policyDir.replace('\\', '.');
-			if(path.contains("/")){
-				path = policyDir.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = path + "." + fileName + ".xml";
+			String fileName = policyAdapter.getNewFileName();
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -219,7 +151,7 @@
 			allOf.getMatch().add(createMatch("ECOMPName", (policyAdapter.getEcompName())));
 			
 			Map<String, String> dynamicFieldComponentAttributes = policyAdapter.getDynamicFieldConfigAttributes();
-			if(policyAdapter.getProviderComboBox()!=null && policyAdapter.getProviderComboBox().equals(AAFProvider)){
+			if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFProvider)){
 				dynamicFieldComponentAttributes = new HashMap<String,String>();
 			}
 			
@@ -267,7 +199,7 @@
 	private DecisionSettings findDecisionSettingsBySettingId(String settingId) {
 		DecisionSettings decisionSetting = null;
 		
-		EntityManager em = policyAdapter.getEntityManagerFactory().createEntityManager();
+		EntityManager em = XACMLPapServlet.getEmf().createEntityManager();
 		Query getDecisionSettings = em.createNamedQuery("DecisionSettings.findAll");
 		List<?> decisionSettingsList = getDecisionSettings.getResultList();
 		
@@ -306,8 +238,6 @@
 		try {
 			accessURI = new URI(ACTION_ID);
 		} catch (URISyntaxException e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "DecisionPolicy", "Exception creating ACCESS URI");
 		}
 		accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -322,7 +252,7 @@
 		dynamicFieldTwoRuleAlgorithms = policyAdapter.getDynamicRuleAlgorithmField2();
 		dropDownMap = createDropDownMap();
 		
-		if(policyAdapter.getProviderComboBox()!=null && policyAdapter.getProviderComboBox().equals(AAFProvider)){
+		if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFProvider)){
 			// Values for AAF Provider are here for XML Creation. 
 			ConditionType condition = new ConditionType();
 			ApplyType decisionApply = new ApplyType();
@@ -429,8 +359,6 @@
 			policyAdapter.setPolicyData(decisionPolicy);
 			
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Unsupported data object."+ policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Unsupported data object."+ policyAdapter.getData().getClass().getCanonicalName());
 		}
 
@@ -589,9 +517,8 @@
 	private Map<String,String> createDropDownMap(){
 		JPAUtils jpaUtils = null;
 		try {
-			jpaUtils = JPAUtils.getJPAUtilsInstance(policyAdapter.getEntityManagerFactory());
+			jpaUtils = JPAUtils.getJPAUtilsInstance(XACMLPapServlet.getEmf());
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 		Map<Datatype, List<FunctionDefinition>> functionMap = jpaUtils.getFunctionDatatypeMap();
@@ -627,7 +554,5 @@
 	public Object getCorrectPolicyDataObject() {
 		return policyAdapter.getData();
 	}
-
-
-
+	
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
index ad7525b..509da0b 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
@@ -28,7 +28,6 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -38,16 +37,15 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
-import java.util.StringTokenizer;
 
 import javax.json.Json;
 import javax.json.JsonArray;
-import javax.json.JsonException;
 import javax.json.JsonObject;
 import javax.json.JsonReader;
-import javax.json.JsonString;
-import javax.json.JsonValue;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
@@ -64,33 +62,25 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
 
 import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-import org.openecomp.policy.rest.XACMLRestProperties;
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.rest.jpa.PolicyEntity;
 
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import com.att.research.xacml.std.IdentifierImpl;
 import com.att.research.xacml.util.XACMLProperties;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.github.fge.jackson.JsonLoader;
 import com.github.fge.jsonpatch.JsonPatch;
 import com.github.fge.jsonpatch.diff.JsonDiff;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
 
 public class FirewallConfigPolicy extends Policy {
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger.getLogger(FirewallConfigPolicy.class);
 
-	public static final String JSON_CONFIG = "JSON";
-	public static final String XML_CONFIG = "XML";
-	public static final String PROPERTIES_CONFIG = "PROPERTIES";
-	public static final String OTHER_CONFIG = "OTHER";
+	private static final Logger LOGGER = FlexLogger.getLogger(FirewallConfigPolicy.class);
 	
 	/*
 	 * These are the parameters needed for DB access from the PAP
@@ -111,79 +101,17 @@
 	}
 	
 	// Saving the Configurations file at server location for config policy.
-	protected void saveConfigurations(String policyName, String prevPolicyName, String jsonBody) {
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		logger.info("print the main domain value"+policyDir);
-		String path = policyDir.replace('\\', '.');
-		if(path.contains("/")){
-			path = policyDir.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
-		
-		try {
-			String configFileName = getConfigFile(policyName);
-			
-			File file;
-			if(CONFIG_HOME.contains("\\"))
-			{
-			 file = new File(CONFIG_HOME + "\\" + path + "."+ configFileName);
+	protected void saveConfigurations(String policyName, String jsonBody) {
+		try{
+			if(policyName.endsWith(".xml")){
+				policyName = policyName.replace(".xml", "");
 			}
-			else
-			{
-			 file = new File(CONFIG_HOME + "/" + path + "."+ configFileName);
-			}
-			
-			// if file doesnt exists, then create it
-			if (!file.exists()) {
-				file.createNewFile();
-			}
-			
-			//Getting the previous policy Config Json file to be used for updating the dictionary tables
-			if (policyAdapter.isEditPolicy()) {
-				
-				String prevConfigFileName = getConfigFile(prevPolicyName);
-				
-				File oldFile;
-				if(CONFIG_HOME.contains("\\"))
-				{
-					oldFile = new File(CONFIG_HOME + "\\" + path + "."+ prevConfigFileName);
-				}
-				else
-				{
-					oldFile = new File(CONFIG_HOME + "/" + path + "."+ prevConfigFileName);
-				}
-				
-				String filepath = oldFile.toString();
-				
-				String prevJsonBody = readFile(filepath, StandardCharsets.UTF_8);
-				policyAdapter.setPrevJsonBody(prevJsonBody);
-			}
-
-
-			File configHomeDir = new File(CONFIG_HOME);
-			File[] listOfFiles = configHomeDir.listFiles();
-			if (listOfFiles != null){
-				for(File eachFile : listOfFiles){
-					if(eachFile.isFile()){
-						String fileNameWithoutExtension = FilenameUtils.removeExtension(eachFile.getName());
-						String configFileNameWithoutExtension = FilenameUtils.removeExtension(configFileName);
-						if (fileNameWithoutExtension.equals(configFileNameWithoutExtension)){
-							//delete the file
-							eachFile.delete();
-						}
-					}
-				}
-			}
-
-			FileWriter fw = new FileWriter(file.getAbsoluteFile());
+			FileWriter fw = new FileWriter(CONFIG_HOME + File.separator + policyName + ".json");
 			BufferedWriter bw = new BufferedWriter(fw);
 			bw.write(jsonBody);
 			bw.close();
-			if (logger.isDebugEnabled()) {
-				logger.debug("Configuration is succesfully saved");
+			if (LOGGER.isDebugEnabled()) {
+				LOGGER.debug("Configuration is succesfully saved");
 			}
 		} catch (IOException e) {
 			e.printStackTrace();
@@ -197,19 +125,6 @@
 		return new String(encoded, encoding);
 		
 	}
-
-	// Here we are adding the extension for the configurations file based on the
-	// config type selection for saving.
-	private String getConfigFile(String filename) {
-		filename = FilenameUtils.removeExtension(filename);
-		if (filename.endsWith(".json")) {
-			filename = filename.substring(0, filename.length() - 4);
-		}
-
-		filename=filename+".json";
-		return filename;
-	}
-	
 	
 	// Validations for Config form
 	public boolean validateConfigForm() {
@@ -222,52 +137,46 @@
 
 	@Override
 	public Map<String, String> savePolicies() throws Exception {
-		
+
 		Map<String, String> successMap = new HashMap<String,String>();
 		if(isPolicyExists()){
 			successMap.put("EXISTS", "This Policy already exist on the PAP");
 			return successMap;
 		}
-		
+
 		if(!isPreparedToSave()){
 			prepareToSave();
 		}
-		
+
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
 		Boolean dbIsUpdated = false;
-		if (policyAdapter.getApiflag().equalsIgnoreCase("admin")){
-			dbIsUpdated = true;
-		} else {
+		if (policyAdapter.getApiflag() != null && policyAdapter.getApiflag().equalsIgnoreCase("admin")){
 			if (policyAdapter.isEditPolicy()) {
 				dbIsUpdated = updateFirewallDictionaryData(policyAdapter.getJsonBody(), policyAdapter.getPrevJsonBody());
 			} else {
 				dbIsUpdated = insertFirewallDicionaryData(policyAdapter.getJsonBody());
 			}
-		}
-		
-		if(dbIsUpdated) {
-			successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject() );	
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Failed to Update the Database Dictionary Tables.");
+			dbIsUpdated = true;
+		}
+
+		if(dbIsUpdated) {
+			successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());	
+		} else {
 			PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
-			
+
 			//remove the new json file 
 			String jsonBody = policyAdapter.getPrevJsonBody();
 			if (jsonBody!=null){
-				saveConfigurations(policyName, "", jsonBody);
+				saveConfigurations(policyName, jsonBody);
 			} else {
-				saveConfigurations(policyName, "", "");
+				saveConfigurations(policyName, "");
 			}
 			successMap.put("fwdberror", "DB UPDATE");
 		}
-
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
+	
 		return successMap;		
 	}
 
@@ -283,12 +192,7 @@
 		
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Config")) {
@@ -299,31 +203,33 @@
 			policyConfig.setTarget(new TargetType());
 			policyAdapter.setData(policyConfig);
 		}
-
+		policyName = policyAdapter.getNewFileName();
+		
+		//String oldPolicyName = policyName.replace(".xml", "");
+		String scope = policyName.substring(0, policyName.indexOf("."));
+		String dbPolicyName = policyName.substring(policyName.indexOf(".")+1).replace(".xml", "");
+		
+		int oldversion = Integer.parseInt(dbPolicyName.substring(dbPolicyName.lastIndexOf(".")+1));
+		dbPolicyName = dbPolicyName.substring(0, dbPolicyName.lastIndexOf(".")+1);
+		//String scope = oldPolicyName.substring(0, oldPolicyName.lastIndexOf("."));
+		//scope = scope.substring(0, scope.lastIndexOf("."));
+		if(oldversion > 1){
+			oldversion = oldversion - 1; 
+			dbPolicyName = dbPolicyName + oldversion + ".xml";
+		}
+		EntityManager em = XACMLPapServlet.getEmf().createEntityManager();
+		Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.scope=:scope AND p.policyName=:policyName");			
+		createPolicyQuery.setParameter("scope", scope);
+		createPolicyQuery.setParameter("policyName", dbPolicyName);
+		List<?> createPolicyQueryList = createPolicyQuery.getResultList();
+		if(!createPolicyQueryList.isEmpty()){
+			PolicyEntity entitydata = (PolicyEntity) createPolicyQueryList.get(0);
+			policyAdapter.setPrevJsonBody(entitydata.getConfigurationData().getConfigBody());
+		}
+		em.close();
 		if (policyAdapter.getData() != null) {
-	
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			String prevPolicyName = null;
-			if(policyAdapter.isEditPolicy()){
-				prevPolicyName = "Config_FW_" + policyAdapter.getPolicyName() + "." + policyAdapter.getHighestVersion() + ".xml";
-			}
-
-			Path newFile = getNextFilename(Paths.get(policyAdapter.getParentPath().toString()),
-					(policyAdapter.getPolicyType() + "_FW"), policyAdapter.getPolicyName(), version);
-
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Policy already Exists, cannot create the policy.");
-				PolicyLogger.error("Policy already Exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;
-			}
-			policyName = newFile.getFileName().toString();
-
 			String jsonBody = policyAdapter.getJsonBody();
-			saveConfigurations(policyName, prevPolicyName, jsonBody);
+			saveConfigurations(policyName, jsonBody);
 			
 			// Make sure the filename ends with an extension
 			if (policyName.endsWith(".xml") == false) {
@@ -337,10 +243,7 @@
 			configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 
 			AllOfType allOfOne = new AllOfType();
-			File policyFilePath = new File(policyAdapter.getParentPath().toString(), policyName);
-			String policyDir = policyFilePath.getParentFile().getName();
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = policyDir + "." + fileName + ".xml";
+			String fileName = policyAdapter.getNewFileName();
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -391,8 +294,6 @@
 			try {
 				accessURI = new URI(ACTION_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "FirewallConfigPolicy", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -414,8 +315,6 @@
 			try {
 				configURI = new URI(RESOURCE_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "FirewallConfigPolicy", "Exception creating Config URI");
 			}
 			
@@ -441,8 +340,6 @@
 			policyAdapter.setPolicyData(configPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 		}
 		setPreparedToSave(true);
@@ -470,23 +367,13 @@
 		
 		// For Config file Url if configurations are provided.
 		//URL ID Assignment
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
 		AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
 		assignment2.setAttributeId("URLID");
 		assignment2.setCategory(CATEGORY_RESOURCE);
 		assignment2.setIssuer("");
 		AttributeValueType AttributeValue = new AttributeValueType();
-		AttributeValue.setDataType(URI_DATATYPE);
-		String policyDir1 = policyAdapter.getParentPath().toString();
-		int startIndex1 = policyDir1.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-		logger.info("print the main domain value"+policyDir1);
-		String path = policyDir1.replace('\\', '.');
-		if(path.contains("/")){
-			path = policyDir1.replace('/', '.');
-			logger.info("print the path:" +path);
-		}		
-		String content = CONFIG_URL + "/Config/" + path + "." + getConfigFile(policyName);
+		AttributeValue.setDataType(URI_DATATYPE);	
+		String content = CONFIG_URL + "/Config/" + policyName + ".json";
 
 		AttributeValue.getContent().add(content);
 		assignment2.setExpression(new ObjectFactory().createAttributeValue(AttributeValue));
@@ -499,31 +386,12 @@
 		assignment3.setIssuer("");
 		AttributeValueType attributeValue3 = new AttributeValueType();
 		attributeValue3.setDataType(STRING_DATATYPE);
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		StringTokenizer tokenizer = null;
-		StringBuffer buffer = new StringBuffer();
-		if (policyDir.contains("\\")) {
-			tokenizer = new StringTokenizer(policyDir, "\\");
-		} else {
-			tokenizer = new StringTokenizer(policyDir, "/");
-			}
-		if (tokenizer != null) {
-			while (tokenizer.hasMoreElements()) {
-				String value = tokenizer.nextToken();
-				buffer.append(value);
-				buffer.append(".");
-			}
-		}
 		fileName = FilenameUtils.removeExtension(fileName);
-		fileName = buffer.toString() + fileName + ".xml";
-		System.out.println(fileName);
+		fileName = fileName + ".xml";
 		String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 		if ((name == null) || (name.equals(""))) {
 			name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
 		}
-		System.out.println(name);
 		attributeValue3.getContent().add(name);
 		assignment3.setExpression(new ObjectFactory().createAttributeValue(attributeValue3));
 		advice.getAttributeAssignmentExpression().add(assignment3);
@@ -541,7 +409,7 @@
 		
 		//Ecomp Name Assignment
 		AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
-		assignment5.setAttributeId("matching:" + this.ECOMPID);
+		assignment5.setAttributeId("matching:" + ECOMPID);
 		assignment5.setCategory(CATEGORY_RESOURCE);
 		assignment5.setIssuer("");
 		AttributeValueType configNameAttributeValue5 = new AttributeValueType();
@@ -551,7 +419,7 @@
 		
 		//Config Name Assignment
 		AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
-		assignment6.setAttributeId("matching:" + this.CONFIGID);
+		assignment6.setAttributeId("matching:" + CONFIGID);
 		assignment6.setCategory(CATEGORY_RESOURCE);
 		assignment6.setIssuer("");
 		AttributeValueType configNameAttributeValue6 = new AttributeValueType();
@@ -608,9 +476,6 @@
 		assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
 
 		advice.getAttributeAssignmentExpression().add(assignment10);
-		
-		int index = 0;
-
 		advices.getAdviceExpression().add(advice);
 		return advices;
 	}
@@ -628,7 +493,6 @@
 			JsonArray firewallRules = null;
 			JsonArray serviceGroup = null;
 			JsonArray addressGroup = null;
-			String securityZone=null;
 			
 			Connection con = null;
 			Statement st = null;
@@ -652,35 +516,9 @@
 				firewallRules = json.getJsonArray("firewallRuleList");
 				serviceGroup = json.getJsonArray("serviceGroups");
 				addressGroup = json.getJsonArray("addressGroups");	
-				securityZone=json.getString("primaryParentZoneId").toString();
 				
-				logger.info("Parent child: securityZone from JSON: "+securityZone);
 				String insertQuery = null;
 				
-				//Inserting childPolicy and its parent to the FWChildToParent DB table
-				if(securityZone!=null){
-					//Its a child Policy. 
-					//Retrieve the parent name from the securityZone Id
-					String retrieveParentQuery= "select parent from fwparent where securityZone='";
-					
-					retrieveParentQuery=retrieveParentQuery+securityZone+"';";
-					logger.info("Parent child: Query to retrieve parent "+retrieveParentQuery);
-					rs = st.executeQuery(retrieveParentQuery);
-					
-					String parent=null;
-					if(rs.next()){
-						parent = rs.getString("parent");
-					}
-					rs.close();
-					
-					
-					String insertQueryChildTable="INSERT INTO FWChildToParent(child, parent) VALUES ('";
-					insertQueryChildTable=insertQueryChildTable+policyAdapter.getPolicyName()+"','"+parent+"');";
-					logger.info("Parent child: Insert child and parent to DB: "+insertQueryChildTable);
-					st.executeUpdate(insertQueryChildTable);
-					
-				}
-				
 				/*
 				 * Inserting firewallRuleList data into the Terms, SecurityZone, and Action tables
 				 */
@@ -707,9 +545,7 @@
 						actionID = rs.getInt("ID");
 					}
 					rs.close();
-					
-					int i = 0;
-					for(JsonValue jsonValue : firewallRules) {
+					for(int i = 0;i<firewallRules.size();i++) {
 						
 						//increment ID Primary Keys
 						termID = termID + 1;
@@ -738,8 +574,8 @@
 						JsonArray fromZoneArray = ruleListobj.getJsonArray("fromZones");
 						String fromZoneString = null;
 						
-						int fromZoneIndex = 0;
-						for (JsonValue fromZoneJsonValue : fromZoneArray) {
+						
+						for (int fromZoneIndex = 0;fromZoneIndex<fromZoneArray.size(); fromZoneIndex++) {
 							String value = fromZoneArray.get(fromZoneIndex).toString();
 							value = value.replace("\"", "");
 							
@@ -750,17 +586,13 @@
 								fromZoneString = value;
 							}
 							
-							fromZoneIndex++;
-							
 						}
 						String fromZoneInsert = "'"+fromZoneString+"'";
 						
 						//getting toZone Array field from the firewallRulesList
 						JsonArray toZoneArray = ruleListobj.getJsonArray("toZones");
 						String toZoneString = null;
-						
-						int toZoneIndex = 0;
-						for (JsonValue toZoneJsonValue : toZoneArray) {
+						for (int toZoneIndex = 0; toZoneIndex<toZoneArray.size(); toZoneIndex++) {
 							String value = toZoneArray.get(toZoneIndex).toString();
 							value = value.replace("\"", "");
 							
@@ -771,17 +603,13 @@
 								toZoneString = value;
 							}
 							
-							toZoneIndex++;
-							
 						}
 						String toZoneInsert = "'"+toZoneString+"'";
 						
 						//getting sourceList Array fields from the firewallRulesList
 						JsonArray srcListArray = ruleListobj.getJsonArray("sourceList");
 						String srcListString = null;
-						
-						int srcListIndex = 0;
-						for (JsonValue srcListJsonValue : srcListArray) {
+						for (int srcListIndex = 0; srcListIndex< srcListArray.size(); srcListIndex++) {
 							JsonObject srcListObj = srcListArray.getJsonObject(srcListIndex);
 							String type = srcListObj.get("type").toString().replace("\"", "");
 							
@@ -805,17 +633,13 @@
 								srcListString = value;
 							}
 							
-							srcListIndex++;
-							
 						}
 						String srcListInsert = "'"+srcListString+"'";
 						
 						//getting destinationList Array fields from the firewallRulesList
 						JsonArray destListArray = ruleListobj.getJsonArray("destinationList");
 						String destListString = null;
-						
-						int destListIndex = 0;
-						for (JsonValue destListJsonValue : destListArray) {
+						for (int destListIndex = 0; destListIndex <destListArray.size(); destListIndex++) {
 							JsonObject destListObj = destListArray.getJsonObject(destListIndex);
 							String type = destListObj.get("type").toString().replace("\"", "");
 							
@@ -837,17 +661,13 @@
 							} else {
 								destListString = value;
 							}
-							
-							destListIndex++;
 						}
 						String destListInsert = "'"+destListString+"'";
 						
 						//getting destServices Array fields from the firewallRulesList
 						JsonArray destServicesArray = ruleListobj.getJsonArray("destServices");
 						String destPortListString = null;
-						
-						int destPortListIndex = 0;
-						for (JsonValue destListJsonValue : destServicesArray) {
+						for (int destPortListIndex = 0; destPortListIndex < destServicesArray.size(); destPortListIndex++) {
 							JsonObject destServicesObj = destServicesArray.getJsonObject(destPortListIndex);
 							String type = destServicesObj.get("type").toString().replace("\"", "");
 							
@@ -869,8 +689,6 @@
 							} else {
 								destPortListString = value;
 							}
-							
-							destPortListIndex++;
 						}
 						String destPortListInsert = "'"+destPortListString+"'";					
 						
@@ -889,8 +707,6 @@
 						st.addBatch(actionSql);
 						
 						st.executeBatch();
-						
-						i++;
 					}
 					
 				}
@@ -929,9 +745,7 @@
 						portID = rs.getInt("ID");
 					}
 					rs.close();
-					
-					int i = 0;
-					for(JsonValue jsonValue : serviceGroup) {
+					for(int i = 0; i < serviceGroup.size() ; i++) {
 						
 						/*
 						 * Populate ArrayLists with values from the JSON
@@ -965,9 +779,7 @@
 							serviceListID = serviceListID + 1;
 
 							String name = null;
-							
-							int membersIndex = 0;
-							for (JsonValue membersValue : membersArray) {
+							for (int membersIndex = 0; membersIndex< membersArray.size(); membersIndex++) {
 								JsonObject membersObj = membersArray.getJsonObject(membersIndex);
 								//String value = membersObj.get("name").toString();
 								String type = membersObj.get("type").toString().replace("\"", "");
@@ -990,8 +802,6 @@
 								} else {
 									name = value;
 								}
-								
-								membersIndex++;
 							}
 							String nameInsert = "'"+name+"'";		
 							
@@ -1034,11 +844,7 @@
 							
 							st.executeBatch();
 
-						}		
-						
-						
-						
-						i++;
+						}
 					}
 				}
 				
@@ -1060,11 +866,7 @@
 						addressID = rs.getInt("ID");
 					}
 					rs.close();
-					
-					
-					int i = 0;
-					for(JsonValue jsonValue : addressGroup) {
-						
+					for(int i = 0; i < addressGroup.size(); i++) {
 						/*
 						 * Populate ArrayLists with values from the JSON
 						 */
@@ -1082,9 +884,7 @@
 						
 						String prefixIP = null;
 						String type = null;
-						
-						int membersIndex = 0;
-						for (JsonValue membersValue : membersArray) {
+						for (int membersIndex = 0; membersIndex < membersArray.size(); membersIndex++) {
 							JsonObject membersObj = membersArray.getJsonObject(membersIndex);
 							//String value = membersObj.get("value").toString();
 							type = membersObj.get("type").toString().replace("\"", "");
@@ -1107,8 +907,6 @@
 							} else {
 								prefixIP = value;
 							}
-							
-							membersIndex++;
 						}
 						String prefixList = "'"+prefixIP+"'";
 						
@@ -1135,8 +933,6 @@
 						
 						//Execute the queries to Insert data
 			            st.executeUpdate(insertQuery);
-						
-						i++;
 					}
 					
 				}
@@ -1169,15 +965,11 @@
 				st.executeBatch();
 				
 			} catch (ClassNotFoundException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(e.getMessage());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FirewallConfigPolicy", "Exception building Firewall queries ");
 				System.out.println(e.getMessage());
 				return false;
 	
 			} catch (SQLException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(e.getMessage());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FirewallConfigPolicy", "Exception executing Firewall queries");
 				System.out.println(e.getMessage());
 				return false;
@@ -1246,8 +1038,8 @@
 				
 				JsonNode jsonDiff = createPatch(jsonBody, prevJsonBody);
 				
-				int i = 0;
-				for (JsonNode node : jsonDiff) {
+				
+				for (int i = 0; i<jsonDiff.size(); i++) {
 					//String path = jsonDiff.get(i).asText();
 					String jsonpatch = jsonDiff.get(i).toString();
 					
@@ -1278,13 +1070,10 @@
 						}
 						rs.close();
 						
-						String insertQuery = null;
-						
 						/*
 						 * Inserting firewallRuleList data into the Terms, SecurityZone, and Action tables
 						 */
-						int ri = 0;
-						for(JsonValue jsonValue : firewallRules) {
+						for(int ri = 0; ri < firewallRules.size(); ri++) {
 							
 							//increment ID Primary Keys
 							termID = termID + 1;
@@ -1313,8 +1102,7 @@
 							JsonArray fromZoneArray = ruleListobj.getJsonArray("fromZones");
 							String fromZoneString = null;
 							
-							int fromZoneIndex = 0;
-							for (JsonValue fromZoneJsonValue : fromZoneArray) {
+							for (int fromZoneIndex = 0; fromZoneIndex<fromZoneArray.size() ; fromZoneIndex++) {
 								String value = fromZoneArray.get(fromZoneIndex).toString();
 								value = value.replace("\"", "");
 								
@@ -1325,8 +1113,6 @@
 									fromZoneString = value;
 								}
 								
-								fromZoneIndex++;
-								
 							}
 							String fromZoneInsert = "'"+fromZoneString+"'";
 							
@@ -1334,8 +1120,8 @@
 							JsonArray toZoneArray = ruleListobj.getJsonArray("toZones");
 							String toZoneString = null;
 							
-							int toZoneIndex = 0;
-							for (JsonValue toZoneJsonValue : toZoneArray) {
+							
+							for (int toZoneIndex = 0; toZoneIndex < toZoneArray.size(); toZoneIndex++) {
 								String value = toZoneArray.get(toZoneIndex).toString();
 								value = value.replace("\"", "");
 								
@@ -1346,16 +1132,12 @@
 									toZoneString = value;
 								}
 								
-								toZoneIndex++;
-								
 							}
 							String toZoneInsert = "'"+toZoneString+"'";
 							//getting sourceList Array fields from the firewallRulesList
 							JsonArray srcListArray = ruleListobj.getJsonArray("sourceList");
 							String srcListString = null;
-							
-							int srcListIndex = 0;
-							for (JsonValue srcListJsonValue : srcListArray) {
+							for (int srcListIndex = 0; srcListIndex<srcListArray.size(); srcListIndex++) {
 								JsonObject srcListObj = srcListArray.getJsonObject(srcListIndex);
 								String type = srcListObj.get("type").toString().replace("\"", "");
 								
@@ -1379,17 +1161,13 @@
 									srcListString = value;
 								}
 								
-								srcListIndex++;
-								
 							}
 							String srcListInsert = "'"+srcListString+"'";
 							
 							//getting destinationList Array fields from the firewallRulesList
 							JsonArray destListArray = ruleListobj.getJsonArray("destinationList");
 							String destListString = null;
-							
-							int destListIndex = 0;
-							for (JsonValue destListJsonValue : destListArray) {
+							for (int destListIndex = 0; destListIndex<destListArray.size(); destListIndex ++) {
 								JsonObject destListObj = destListArray.getJsonObject(destListIndex);
 								String type = destListObj.get("type").toString().replace("\"", "");
 								
@@ -1411,17 +1189,13 @@
 								} else {
 									destListString = value;
 								}
-								
-								destListIndex++;
 							}
 							String destListInsert = "'"+destListString+"'";
 							
 							//getting destServices Array fields from the firewallRulesList
 							JsonArray destServicesArray = ruleListobj.getJsonArray("destServices");
 							String destPortListString = null;
-							
-							int destPortListIndex = 0;
-							for (JsonValue destListJsonValue : destServicesArray) {
+							for (int destPortListIndex = 0; destPortListIndex < destServicesArray.size(); destPortListIndex++) {
 								JsonObject destServicesObj = destServicesArray.getJsonObject(destPortListIndex);
 								String type = destServicesObj.get("type").toString().replace("\"", "");
 								
@@ -1443,8 +1217,6 @@
 								} else {
 									destPortListString = value;
 								}
-								
-								destPortListIndex++;
 							}
 							String destPortListInsert = "'"+destPortListString+"'";					
 							
@@ -1471,10 +1243,7 @@
 								actionSql = actionSql.replace('"', '\'');
 								st.addBatch(actionSql);
 							}
-
 							st.executeBatch();
-							
-							ri++;
 						}
 						
 					}
@@ -1515,9 +1284,7 @@
 						/*
 						 * Inserting serviceGroups data into the ServiceGroup, ServiceList, ProtocolList, and PortList tables
 						 */
-						int si = 0;
-						for(JsonValue jsonValue : serviceGroup) {
-							
+						for(int si = 0; si < serviceGroup.size(); si++) {
 							/*
 							 * Populate ArrayLists with values from the JSON
 							 */
@@ -1552,10 +1319,8 @@
 								rs.close();
 								//increment ID Primary Keys
 								serviceListID = serviceListID + 1;
-								
 								String name = null;
-								int membersIndex = 0;
-								for (JsonValue membersValue : membersArray) {
+								for (int membersIndex = 0; membersIndex < membersArray.size(); membersIndex++) {
 									JsonObject membersObj = membersArray.getJsonObject(membersIndex);
 									String type = membersObj.get("type").toString().replace("\"", "");
 									
@@ -1577,8 +1342,6 @@
 									} else {
 										name = value;
 									}
-									
-									membersIndex++;
 								}
 								String nameInsert = "'"+name+"'";		
 								
@@ -1640,15 +1403,9 @@
 									st.addBatch(portSql);
 								}
 								rs.close();
-								
 								st.executeBatch();
-
-							}		
-							
-							
-				            si++;
+							}
 						}
-						
 					}
 					
 					if (path.contains("addressGroups")) {
@@ -1671,9 +1428,7 @@
 						rs.close();
 						
 						String insertQuery = null;
-						
-						int ai = 0;
-						for(JsonValue jsonValue : addressGroup) {
+						for(int ai=0; ai < addressGroup.size() ; ai++) {
 							
 							/*
 							 * Populate ArrayLists with values from the JSON
@@ -1692,8 +1447,7 @@
 							
 							String prefixIP = null;
 							String type = null;
-							int membersIndex = 0;
-							for (JsonValue membersValue : membersArray) {
+							for (int membersIndex=0; membersIndex < membersArray.size(); membersIndex++) {
 								JsonObject membersObj = membersArray.getJsonObject(membersIndex);
 								type = membersObj.get("type").toString().replace("\"", "");
 								
@@ -1715,8 +1469,6 @@
 								} else {
 									prefixIP = value;
 								}
-								
-								membersIndex++;
 							}
 							String prefixList = "'"+prefixIP+"'";
 							
@@ -1753,20 +1505,13 @@
 											+ "VALUES("+prefixID+","+addressGroupName+","+prefixList+","+description+")";
 								
 							}
-			
-							
 							//Replace double quote with single quote
 							insertQuery = insertQuery.replace('"', '\'');
 							
 							//Execute the queries to Insert data
 				            st.executeUpdate(insertQuery);
-							
-							ai++;
-						}
-						
+						}						
 					}
-						
-					i++;	
 				}
 				
 				/*
@@ -1797,15 +1542,11 @@
 				st.executeBatch();
 				
 			} catch (ClassNotFoundException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(e.getMessage());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FirewallConfigPolicy", "Exception building Firewall queries");
 				System.out.println(e.getMessage());
 				return false;
 	
 			} catch (SQLException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(e.getMessage());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FirewallConfigPolicy", "Exception executing Firewall queries");
 				System.out.println(e.getMessage());
 				return false;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
index c65b0be..c5fdc18 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
@@ -21,17 +21,35 @@
 package org.openecomp.policy.pap.xacml.rest.components;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.PrintWriter;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
-import java.util.StringTokenizer;
+import java.util.Map.Entry;
 
-import javax.json.stream.JsonGenerationException;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import com.att.research.xacml.std.IdentifierImpl;
+import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Splitter;
 
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
@@ -45,27 +63,21 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-import com.att.research.xacml.std.IdentifierImpl;
-
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; 
 
 public class MicroServiceConfigPolicy extends Policy {
 	
-	/**
-	 * Config Fields
-	 */
-	private static final Logger logger = FlexLogger.getLogger(ConfigPolicy.class);
+	private static final Logger LOGGER = FlexLogger.getLogger(MicroServiceConfigPolicy.class);
+	
+    /*
+     * These are the parameters needed for DB access from the PAP
+     */
+    private static String papDbDriver = null;
+    private static String papDbUrl = null;
+    private static String papDbUser = null;
+    private static String papDbPassword = null;
+    private static Map<String, String> mapAttribute = new HashMap<String,String>();
+    private static Map<String, String> matchMap = new HashMap<String,String>();
 
 	public MicroServiceConfigPolicy() {
 		super();
@@ -76,56 +88,30 @@
 	}
 
 	//save configuration of the policy based on the policyname
-	private void saveConfigurations(String policyName, String prevPolicyName, String jsonBody) {
-		String domain = getParentPathSubScopeDir();
-		String path = domain.replace('\\', '.');
-		if(path.contains("/")){
-			path = domain.replace('/', '.');
-			logger.info("print the path:" +path);
-		}
+	private void saveConfigurations(String policyName, String jsonBody) {
 		try {
-			String body = null;
-			try {
-				body = jsonBody;
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-
-			System.out.println(body);
 			if(policyName.endsWith(".xml")){
-				policyName	 = policyName.substring(0, policyName.lastIndexOf(".xml"));	
+				policyName = policyName.replace(".xml", "");
 			}
-			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator+path + "."+ policyName +".json");
-			out.println(body);
+			PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json");
+			out.println(jsonBody);
 			out.close();
-
-		} catch (JsonGenerationException e) {
+		} catch (Exception e) {
+			LOGGER.error("Exception Occured While writing Configuration data"+e);
 			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-
+		} 
 	}
 	
-	//getting the policy name and setting to configuration on adding .json
-	private String getConfigFile(String filename) {
-		filename = FilenameUtils.removeExtension(filename);
-		if (filename.endsWith(".xml")) {
-			filename = filename.substring(0, filename.length() - 4);
-		}
-		filename = filename +".json";
-		return filename;
-	}
 	
 	@Override
 	public Map<String, String> savePolicies() throws Exception {
-		
+
 		Map<String, String> successMap = new HashMap<String,String>();
 		if(isPolicyExists()){
 			successMap.put("EXISTS", "This Policy already exist on the PAP");
 			return successMap;
 		}
-		
+
 		if(!isPreparedToSave()){
 			//Prep and configure the policy for saving
 			prepareToSave();
@@ -133,12 +119,10 @@
 
 		// Until here we prepared the data and here calling the method to create xml.
 		Path newPolicyPath = null;
-		newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(), policyName);
-		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject() );		
-		if (successMap.containsKey("success")) {
-			Path finalPolicyPath = getFinalPolicyPath();
-			policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
-		}
+		newPolicyPath = Paths.get(policyAdapter.getNewFileName());
+
+		successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());	
+	
 		return successMap;		
 	}
 	
@@ -154,12 +138,7 @@
 		
 		int version = 0;
 		String policyID = policyAdapter.getPolicyID();
-
-		if (policyAdapter.isEditPolicy()) {
-			version = policyAdapter.getHighestVersion() + 1;
-		} else {
-			version = 1;
-		}
+		version = policyAdapter.getHighestVersion();
 		
 		// Create the Instance for pojo, PolicyType object is used in marshalling.
 		if (policyAdapter.getPolicyType().equals("Config")) {
@@ -170,33 +149,11 @@
 			policyConfig.setTarget(new TargetType());
 			policyAdapter.setData(policyConfig);
 		}
-		
+		policyName = policyAdapter.getNewFileName();
 		if (policyAdapter.getData() != null) {
-			
-			// Save off everything
-			// making ready all the required elements to generate the action policy xml.
-			// Get the uniqueness for policy name.
-			String prevPolicyName = null;
-			if(policyAdapter.isEditPolicy()){
-				prevPolicyName = "Config_MS_" + policyAdapter.getPolicyName() + "." + policyAdapter.getHighestVersion() + ".xml";
-			}
-			
-			Path newFile = this.getNextLoopFilename(Paths.get(policyAdapter.getParentPath()), policyAdapter.getPolicyType(), 
-					policyAdapter.getConfigPolicyType(), policyAdapter.getPolicyName(), version);
-			
-			if (newFile == null) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Policy already Exists, cannot create the policy.");
-				PolicyLogger.error("Policy already Exists, cannot create the policy.");
-				setPolicyExists(true);
-				return false;
-			}
-			
-			policyName = newFile.getFileName().toString();
-			
 			// Save the Configurations file with the policy name with extention based on selection.
 			String jsonBody = policyAdapter.getJsonBody();
-			saveConfigurations(policyName, prevPolicyName, jsonBody);
+			saveConfigurations(policyName, jsonBody);
 			
 			// Make sure the filename ends with an extension
 			if (policyName.endsWith(".xml") == false) {
@@ -211,23 +168,35 @@
 			configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
 			
 			AllOfType allOfOne = new AllOfType();
-			final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex, policyDir.length());
-			logger.info("print the main domain value "+policyDir);
-			String path = policyDir.replace('\\', '.');
-			if(path.contains("/")){
-				path = policyDir.replace('/', '.');
-				logger.info("print the path:" +path);
-			}
-			String fileName = FilenameUtils.removeExtension(policyName);
-			fileName = path + "." + fileName + ".xml";
+			String fileName = policyAdapter.getNewFileName();
 			String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 			if ((name == null) || (name.equals(""))) {
 				name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
 			}
 			
+            //setup values for pulling out matching attributes
+            ObjectMapper mapper = new ObjectMapper();
+            JsonNode rootNode = mapper.readTree(policyAdapter.getJsonBody());
+            String matching = null;
+            
+            if (policyAdapter.getTtlDate()==null){
+                policyAdapter.setTtlDate("NA");
+            }
+            if (policyAdapter.getServiceType().contains("-v")){
+                matching = getValueFromDictionary(policyAdapter.getServiceType());
+            } else {
+                String jsonVersion  = StringUtils.replaceEach(rootNode.get("version").toString(), new String[]{"\""}, new String[]{""});
+                matching = getValueFromDictionary(policyAdapter.getServiceType() + "-v" + jsonVersion);
+            }
+            
+            matchMap = new HashMap<String,String>();
+            if (matching != null && !matching.isEmpty()){
+                matchMap = Splitter.on(",").withKeyValueSeparator("=").split(matching);
+                if(policyAdapter.getJsonBody() != null){
+                    pullMatchValue(rootNode);           
+                }
+            }
+            
 			// Match for policyName
 			allOfOne.getMatch().add(createMatch("PolicyName", name));
 			
@@ -235,14 +204,26 @@
 		
 			// Adding the matches to AllOfType element Match for Ecomp
 			allOf.getMatch().add(createMatch("ECOMPName", policyAdapter.getEcompName()));
-			// Match for ConfigName
-			allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
-			// Match for Service
-			allOf.getMatch().add(createDynamicMatch("service", policyAdapter.getServiceType()));
-			// Match for uuid
-			allOf.getMatch().add(createDynamicMatch("uuid", policyAdapter.getUuid()));
-			// Match for location
-			allOf.getMatch().add(createDynamicMatch("location", policyAdapter.getLocation()));
+			if (matchMap==null || matchMap.isEmpty()){
+				// Match for ConfigName
+				allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
+				// Match for Service
+				allOf.getMatch().add(createDynamicMatch("service", policyAdapter.getServiceType()));
+				// Match for uuid
+				allOf.getMatch().add(createDynamicMatch("uuid", policyAdapter.getUuid()));
+				// Match for location
+				allOf.getMatch().add(createDynamicMatch("location", policyAdapter.getLocation()));
+			}else {
+				for (Entry<String, String> matchValue : matchMap.entrySet()){
+					String value = matchValue.getValue();
+					String key = matchValue.getKey().trim();
+					if (value.contains("matching-true")){
+						if (mapAttribute.containsKey(key)){
+							allOf.getMatch().add(createDynamicMatch(key, mapAttribute.get(key)));
+						}
+					}
+				}
+			}
 			// Match for riskType
 			allOf.getMatch().add(
 					createDynamicMatch("RiskType", policyAdapter.getRiskType()));
@@ -285,8 +266,6 @@
 			try {
 				accessURI = new URI(ACTION_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "MicroServiceConfigPolicy", "Exception creating ACCESS URI");
 			}
 			accessAttributeDesignator.setCategory(CATEGORY_ACTION);
@@ -306,8 +285,6 @@
 			try {
 				configURI = new URI(RESOURCE_ID);
 			} catch (URISyntaxException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getStackTrace());
 				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "MicroServiceConfigPolicy", "Exception creating Config URI");
 			}
 			configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
@@ -332,14 +309,80 @@
 			policyAdapter.setPolicyData(configPolicy);
 
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 			PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
 		}
 		setPreparedToSave(true);
 		return true;
 	}
 	
+    private void pullMatchValue(JsonNode rootNode) {
+        Iterator<Map.Entry<String, JsonNode>> fieldsIterator = rootNode.fields();
+        String newValue = null;
+           while (fieldsIterator.hasNext()) {
+               Map.Entry<String, JsonNode> field = fieldsIterator.next();
+               final String key = field.getKey();
+               final JsonNode value = field.getValue();
+               if (value.isContainerNode() && !value.isArray()) {
+                   pullMatchValue(value); // RECURSIVE CALL
+               } else {
+                   newValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]", "\""}, new String[]{"", "", ""});
+                   mapAttribute.put(key, newValue);
+               }
+           }
+       
+   }
+
+   private String getValueFromDictionary(String service){
+       
+       Connection con = null;
+       Statement st = null;
+       ResultSet rs = null;
+       
+       String modelName = service.split("-v")[0];
+       String modelVersion = service.split("-v")[1];
+       
+       
+       /*
+        * Retrieve the property values for db access from the xacml.pap.properties
+        */
+       papDbDriver = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_DRIVER);
+       papDbUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_URL);
+       papDbUser = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_USER);
+       papDbPassword = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_PASSWORD);
+       
+       String ruleTemplate=null;
+       
+       try {
+           //Get DB Connection
+           Class.forName(papDbDriver);
+           con = DriverManager.getConnection(papDbUrl,papDbUser,papDbPassword);
+           st = con.createStatement();
+   
+           String queryString = "Select * from MicroServiceModels where modelName=\""  + modelName
+                   + "\" AND version=\"" + modelVersion+"\"";
+
+           
+           rs = st.executeQuery(queryString);
+           if(rs.next()){
+               ruleTemplate=rs.getString("annotation");
+           }
+           rs.close();
+       }catch (ClassNotFoundException e) {
+           PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "MicroServiceModels", "Exception querying MicroServiceModels");
+       } catch (SQLException e) {
+           PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "MicroServiceModels", "Exception querying MicroServiceModels");
+       } finally {
+           try{
+               if (con!=null) con.close();
+               if (rs!=null) rs.close();
+               if (st!=null) st.close();
+           } catch (Exception ex){
+        	   LOGGER.error("Exception Occured While Closing the Database Connection"+ex);
+           }
+       }
+       return ruleTemplate;
+       
+   }
 	// Data required for Advice part is setting here.
 	private AdviceExpressionsType getAdviceExpressions(int version, String fileName) {
 		AdviceExpressionsType advices = new AdviceExpressionsType();
@@ -358,7 +401,6 @@
 		assignment1.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue));
 
 		advice.getAttributeAssignmentExpression().add(assignment1);
-		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
 		// For Config file Url if configurations are provided.
 		AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
 		assignment2.setAttributeId("URLID");
@@ -367,17 +409,13 @@
 
 		AttributeValueType AttributeValue = new AttributeValueType();
 		AttributeValue.setDataType(URI_DATATYPE);
-		String policyDir1 = policyAdapter.getParentPath().toString();
-		int startIndex1 = policyDir1.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
-		logger.info("print the main domain value"+policyDir1);
-		String path = policyDir1.replace('\\', '.');
-		if(path.contains("/")){
-			path = policyDir1.replace('/', '.');
-			logger.info("print the path:" +path);
+		String configName;
+		if(policyName.endsWith(".xml")){
+			configName = policyName.replace(".xml", "");
+		}else{
+			configName = policyName;
 		}
-		String content = CONFIG_URL +"/Config/" + path + "." + getConfigFile(policyName);
-		System.out.println("URL value :" + content);
+		String content = CONFIG_URL +"/Config/" + configName + ".json";
 		AttributeValue.getContent().add(content);
 		assignment2.setExpression(new ObjectFactory().createAttributeValue(AttributeValue));
 
@@ -389,25 +427,8 @@
 
 		AttributeValueType attributeValue3 = new AttributeValueType();
 		attributeValue3.setDataType(STRING_DATATYPE);
-		String policyDir = policyAdapter.getParentPath().toString();
-		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-		policyDir = policyDir.substring(startIndex, policyDir.length());
-		StringTokenizer tokenizer = null;
-		StringBuffer buffer = new StringBuffer();
-		if (policyDir.contains("\\")) {
-			tokenizer = new StringTokenizer(policyDir, "\\");
-		} else {
-			tokenizer = new StringTokenizer(policyDir, "/");
-		}
-		if (tokenizer != null) {
-			while (tokenizer.hasMoreElements()) {
-				String value = tokenizer.nextToken();
-				buffer.append(value);
-				buffer.append(".");
-			}
-		}
 		fileName = FilenameUtils.removeExtension(fileName);
-		fileName = buffer.toString() + fileName + ".xml";
+		fileName = fileName + ".xml";
 		String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
 		if ((name == null) || (name.equals(""))) {
 			name = fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length());
@@ -429,7 +450,7 @@
 		advice.getAttributeAssignmentExpression().add(assignment4);
 
 		AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
-		assignment5.setAttributeId("matching:" + this.ECOMPID);
+		assignment5.setAttributeId("matching:" + ECOMPID);
 		assignment5.setCategory(CATEGORY_RESOURCE);
 		assignment5.setIssuer("");
 
@@ -440,53 +461,78 @@
 
 		advice.getAttributeAssignmentExpression().add(assignment5);
 
-		AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
-		assignment6.setAttributeId("matching:" + this.CONFIGID);
-		assignment6.setCategory(CATEGORY_RESOURCE);
-		assignment6.setIssuer("");
-
-		AttributeValueType configNameAttributeValue6 = new AttributeValueType();
-		configNameAttributeValue6.setDataType(STRING_DATATYPE);
-		configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
-		assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
-
-		advice.getAttributeAssignmentExpression().add(assignment6);
-		AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
-		assignment7.setAttributeId("matching:service");
-		assignment7.setCategory(CATEGORY_RESOURCE);
-		assignment7.setIssuer("");
-
-		AttributeValueType configNameAttributeValue7 = new AttributeValueType();
-		configNameAttributeValue7.setDataType(STRING_DATATYPE);
-		configNameAttributeValue7.getContent().add(policyAdapter.getServiceType());
-		assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
-
-		advice.getAttributeAssignmentExpression().add(assignment7);
-		
-		AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
-		assignment8.setAttributeId("matching:uuid");
-		assignment8.setCategory(CATEGORY_RESOURCE);
-		assignment8.setIssuer("");
-
-		AttributeValueType configNameAttributeValue8 = new AttributeValueType();
-		configNameAttributeValue8.setDataType(STRING_DATATYPE);
-		configNameAttributeValue8.getContent().add(policyAdapter.getUuid());
-		assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
-
-		advice.getAttributeAssignmentExpression().add(assignment8);
+        AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
+        assignment7.setAttributeId("matching:service");
+        assignment7.setCategory(CATEGORY_RESOURCE);
+        assignment7.setIssuer("");
+ 
+        AttributeValueType configNameAttributeValue7 = new AttributeValueType();
+        configNameAttributeValue7.setDataType(STRING_DATATYPE);
+        configNameAttributeValue7.getContent().add(policyAdapter.getServiceType());
+        assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
+ 
+        advice.getAttributeAssignmentExpression().add(assignment7);
         
-		AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
-		assignment9.setAttributeId("matching:Location");
-		assignment9.setCategory(CATEGORY_RESOURCE);
-		assignment9.setIssuer("");
+        if (matchMap==null || matchMap.isEmpty()){
+        	AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
+        	assignment6.setAttributeId("matching:" + CONFIGID);
+        	assignment6.setCategory(CATEGORY_RESOURCE);
+        	assignment6.setIssuer("");
 
-		AttributeValueType configNameAttributeValue9 = new AttributeValueType();
-		configNameAttributeValue9.setDataType(STRING_DATATYPE);
-		configNameAttributeValue9.getContent().add(policyAdapter.getLocation());
-		assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
+        	AttributeValueType configNameAttributeValue6 = new AttributeValueType();
+        	configNameAttributeValue6.setDataType(STRING_DATATYPE);
+        	configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
+        	assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
 
-		advice.getAttributeAssignmentExpression().add(assignment9);
-		
+        	advice.getAttributeAssignmentExpression().add(assignment6);
+
+
+        	AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
+        	assignment8.setAttributeId("matching:uuid");
+        	assignment8.setCategory(CATEGORY_RESOURCE);
+        	assignment8.setIssuer("");
+
+        	AttributeValueType configNameAttributeValue8 = new AttributeValueType();
+        	configNameAttributeValue8.setDataType(STRING_DATATYPE);
+        	configNameAttributeValue8.getContent().add(policyAdapter.getUuid());
+        	assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
+
+        	advice.getAttributeAssignmentExpression().add(assignment8);
+
+        	AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
+        	assignment9.setAttributeId("matching:Location");
+        	assignment9.setCategory(CATEGORY_RESOURCE);
+        	assignment9.setIssuer("");
+
+        	AttributeValueType configNameAttributeValue9 = new AttributeValueType();
+        	configNameAttributeValue9.setDataType(STRING_DATATYPE);
+        	configNameAttributeValue9.getContent().add(policyAdapter.getLocation());
+        	assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
+
+        	advice.getAttributeAssignmentExpression().add(assignment9);
+        } else {
+            for (Entry<String, String> matchValue : matchMap.entrySet()){
+                String value = matchValue.getValue();
+                String key = matchValue.getKey().trim();
+                if (value.contains("matching-true")){
+                    if (mapAttribute.containsKey(key)){
+                        AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
+                        assignment9.setAttributeId("matching:" + key);
+                        assignment9.setCategory(CATEGORY_RESOURCE);
+                        assignment9.setIssuer("");
+                
+                        AttributeValueType configNameAttributeValue9 = new AttributeValueType();
+                        configNameAttributeValue9.setDataType(STRING_DATATYPE);
+                        configNameAttributeValue9.getContent().add(mapAttribute.get(key));
+                        assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
+                
+                        advice.getAttributeAssignmentExpression().add(assignment9);
+ 
+                    }
+                }
+            }
+        }
+        
 		AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
 		assignment10.setAttributeId("Priority");
 		assignment10.setCategory(CATEGORY_RESOURCE);
@@ -531,7 +577,7 @@
 
 		AttributeValueType configNameAttributeValue13 = new AttributeValueType();
 		configNameAttributeValue13.setDataType(STRING_DATATYPE);
-		configNameAttributeValue13.getContent().add(policyAdapter.getRiskLevel());
+		configNameAttributeValue13.getContent().add(policyAdapter.getGuard());
 		assignment13.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue13));
 
 		advice.getAttributeAssignmentExpression().add(assignment13);
@@ -556,6 +602,4 @@
 	public Object getCorrectPolicyDataObject() {
 		return policyAdapter.getPolicyData();
 	}	
-
-
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
index 09c90de..0f8ccfb 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
@@ -41,24 +41,18 @@
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 
 import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.json.JSONObject;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
 import org.openecomp.policy.rest.XACMLRestProperties;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-import com.att.research.xacml.std.IdentifierImpl;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
 import org.openecomp.policy.xacml.util.XACMLPolicyWriter;
+
+import com.att.research.xacml.std.IdentifierImpl;
 import com.att.research.xacml.util.XACMLProperties;
 import com.att.research.xacmlatt.pdp.policy.PolicyDef;
 import com.att.research.xacmlatt.pdp.policy.dom.DOMPolicyDef;
 
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-
 public abstract class Policy {
 
 	/**
@@ -70,22 +64,21 @@
 	public static final String ECOMPID = "ECOMPName";
 	public static final String CONFIGID = "ConfigName";
 	public static final String CLOSEDLOOPID = "ServiceType";
-	
+
 	public static final String CONFIG_POLICY = "Config";
 	public static final String ACTION_POLICY = "Action";
 	public static final String DECISION_POLICY = "Decision";
 
 	protected String policyName = null;
-	private static final Logger logger = FlexLogger.getLogger(Policy.class);
-	
-	boolean isValidForm = true;
-	
+
+	protected boolean isValidForm = true;
+
 	private Path finalPolicyPath = null;
-	
+
 	private boolean preparedToSave = false;
-	
+
 	private boolean policyExists = false;
-	
+
 	public Path getFinalPolicyPath() {
 		return finalPolicyPath;
 	}
@@ -94,362 +87,318 @@
 		this.finalPolicyPath = finalPolicyPath;
 	}
 
-		// Constants Used in XML Creation
-		public static final String CATEGORY_RECIPIENT_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject";
-		public static final String CATEGORY_RESOURCE = "urn:oasis:names:tc:xacml:3.0:attribute-category:resource";
-		public static final String CATEGORY_ACTION = "urn:oasis:names:tc:xacml:3.0:attribute-category:action";
-		public static final String CATEGORY_ACCESS_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
-		public static final String ACTION_ID = "urn:oasis:names:tc:xacml:1.0:action:action-id";
-		public static final String SUBJECT_ID = "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
-		public static final String RESOURCE_ID = "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
-		public static final String FUNTION_INTEGER_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only";
-		public static final String FUNCTION_STRING_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:string-one-and-only";
-		public static final String FUNCTION_BOOLEAN_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:boolean-one-and-only";
-		public static final String FUNCTION_STRING_EQUAL = "urn:oasis:names:tc:xacml:1.0:function:string-equal";
-		public static final String FUNCTION_STRING_REGEX_MATCH = "org.openecomp.function.regex-match";
-		public static final String FUNCTION_STRING_EQUAL_IGNORE = "urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case";
-		public static final String INTEGER_DATATYPE = "http://www.w3.org/2001/XMLSchema#integer";
-		public static final String BOOLEAN_DATATYPE = "http://www.w3.org/2001/XMLSchema#boolean";
-		public static final String STRING_DATATYPE = "http://www.w3.org/2001/XMLSchema#string";
-		public static final String URI_DATATYPE = "http://www.w3.org/2001/XMLSchema#anyURI";
-		public static final String RULE_VARIABLE = "var:";
-		public static final String EMPTY_STRING = "";
-		private static final String String = null;
-		
-		public static String CONFIG_HOME = null;
-		public static String ACTION_HOME = null;
-		public static String CONFIG_URL = null;
-		
-		protected Map<String, String> performer = new HashMap<String, String>();
-		
-		private static String actionHome = null;
-		private static String configHome = null;
+	// Constants Used in XML Creation
+	public static final String CATEGORY_RECIPIENT_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject";
+	public static final String CATEGORY_RESOURCE = "urn:oasis:names:tc:xacml:3.0:attribute-category:resource";
+	public static final String CATEGORY_ACTION = "urn:oasis:names:tc:xacml:3.0:attribute-category:action";
+	public static final String CATEGORY_ACCESS_SUBJECT = "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject";
+	public static final String ACTION_ID = "urn:oasis:names:tc:xacml:1.0:action:action-id";
+	public static final String SUBJECT_ID = "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
+	public static final String RESOURCE_ID = "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
+	public static final String FUNTION_INTEGER_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only";
+	public static final String FUNCTION_STRING_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:string-one-and-only";
+	public static final String FUNCTION_BOOLEAN_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:boolean-one-and-only";
+	public static final String FUNCTION_STRING_EQUAL = "urn:oasis:names:tc:xacml:1.0:function:string-equal";
+	public static final String FUNCTION_STRING_REGEX_MATCH = "org.openecomp.function.regex-match";
+	public static final String FUNCTION_STRING_EQUAL_IGNORE = "urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case";
+	public static final String INTEGER_DATATYPE = "http://www.w3.org/2001/XMLSchema#integer";
+	public static final String BOOLEAN_DATATYPE = "http://www.w3.org/2001/XMLSchema#boolean";
+	public static final String STRING_DATATYPE = "http://www.w3.org/2001/XMLSchema#string";
+	public static final String URI_DATATYPE = "http://www.w3.org/2001/XMLSchema#anyURI";
+	public static final String RULE_VARIABLE = "var:";
+	public static final String EMPTY_STRING = "";
+	private static final String String = null;
 
-		public PolicyRestAdapter policyAdapter = null;
-		String ruleID = "";
-		
-		public Policy() {
-			CONFIG_HOME = getConfigHome();
-			ACTION_HOME = getActionHome();
-			CONFIG_URL = "$URL";
-			performer.put("PDP", "PDPAction");
-			performer.put("PEP", "PEPAction");
+	public static String CONFIG_HOME = null;
+	public static String ACTION_HOME = null;
+	public static String CONFIG_URL = null;
+
+	protected Map<String, String> performer = new HashMap<String, String>();
+
+	private static String actionHome = null;
+	private static String configHome = null;
+
+	public PolicyRestAdapter policyAdapter = null;
+	String ruleID = "";
+
+	public Policy() {
+		CONFIG_HOME = getConfigHome();
+		ACTION_HOME = getActionHome();
+		CONFIG_URL = "$URL";
+		performer.put("PDP", "PDPAction");
+		performer.put("PEP", "PEPAction");
+	}
+
+	//Each policy type seems to either use policyData or data field policy adapter when
+	//getting the xml to save the policy. Instead of keep this hardcoded in the save method,
+	//this method makes it usable outside.
+	/**
+	 * Return the data field of the PolicyAdapter that will be used when saving this policy
+	 * with the savePolicies method.
+	 * @return Either the PolicyAdapter.getData() or PolicyAdapter.getPolicyData()
+	 */
+	public abstract Object getCorrectPolicyDataObject();
+	public abstract Map<String, String>  savePolicies() throws Exception;
+
+	//This is the method for preparing the policy for saving.  We have broken it out
+	//separately because the fully configured policy is used for multiple things
+	public abstract boolean prepareToSave() throws Exception;
+
+
+	// create match for ecomp and config name
+	protected MatchType createMatch(String key, String value) {
+		MatchType match = new MatchType();
+
+		AttributeValueType attributeValue = new AttributeValueType();
+		attributeValue.setDataType(STRING_DATATYPE);
+		attributeValue.getContent().add(value);
+		match.setAttributeValue(attributeValue);
+		AttributeDesignatorType attributeDesignator = new AttributeDesignatorType();
+		URI uri = null;
+		try {
+			uri = new URI(key);
+		} catch (URISyntaxException e) {
+			e.printStackTrace();
 		}
+		attributeDesignator.setCategory(CATEGORY_ACCESS_SUBJECT);
+		attributeDesignator.setDataType(STRING_DATATYPE);
+		attributeDesignator.setAttributeId(new IdentifierImpl(uri).stringValue());
+		match.setAttributeDesignator(attributeDesignator);
+		match.setMatchId(FUNCTION_STRING_REGEX_MATCH);
+		return match;
+	}
 
-		//Each policy type seems to either use policyData or data field policy adapter when
-		//getting the xml to save the policy. Instead of keep this hardcoded in the save method,
-		//this method makes it usable outside.
-		/**
-		 * Return the data field of the PolicyAdapter that will be used when saving this policy
-		 * with the savePolicies method.
-		 * @return Either the PolicyAdapter.getData() or PolicyAdapter.getPolicyData()
-		 */
-		public abstract Object getCorrectPolicyDataObject();
-		public abstract Map<String, String>  savePolicies() throws Exception;
-		
-		//This is the method for preparing the policy for saving.  We have broken it out
-		//separately because the fully configured policy is used for multiple things
-		public abstract boolean prepareToSave() throws Exception;
+	// Creating the match for dynamically added components.
+	protected MatchType createDynamicMatch(String key, String value) {
+		MatchType dynamicMatch = new MatchType();
+		AttributeValueType dynamicAttributeValue = new AttributeValueType();
+		String dataType = null;
+		dataType = STRING_DATATYPE;
+		dynamicAttributeValue.setDataType(dataType);
+		dynamicAttributeValue.getContent().add(value);
+		dynamicMatch.setAttributeValue(dynamicAttributeValue);
 
-		
-		// create match for ecomp and config name
-		protected MatchType createMatch(String key, String value) {
-			MatchType match = new MatchType();
+		AttributeDesignatorType dynamicAttributeDesignator = new AttributeDesignatorType();
 
-			AttributeValueType attributeValue = new AttributeValueType();
-			attributeValue.setDataType(STRING_DATATYPE);
-			attributeValue.getContent().add(value);
-			match.setAttributeValue(attributeValue);
-			AttributeDesignatorType attributeDesignator = new AttributeDesignatorType();
-			URI uri = null;
-			try {
-				uri = new URI(key);
-			} catch (URISyntaxException e) {
-				e.printStackTrace();
+		URI dynamicURI = null;
+		try {
+			dynamicURI = new URI(key);
+		} catch (URISyntaxException e) {
+			e.printStackTrace();// log msg
+		}
+		dynamicAttributeDesignator.setCategory(CATEGORY_RESOURCE);
+		dynamicAttributeDesignator.setDataType(dataType);
+		dynamicAttributeDesignator.setAttributeId(new IdentifierImpl(dynamicURI).stringValue());
+		dynamicMatch.setAttributeDesignator(dynamicAttributeDesignator);
+		dynamicMatch.setMatchId(FUNCTION_STRING_REGEX_MATCH);
+
+		return dynamicMatch;
+	}
+
+	//validation for numeric
+	protected boolean isNumeric(String str){
+		for (char c : str.toCharArray()){
+			if (!Character.isDigit(c)) return false;
+		}
+		return true;
+	}
+
+	// Validation for json.
+	protected static boolean isJSONValid(String data) {
+		try {
+			new JSONObject(data);
+			InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
+			JsonReader jsonReader = Json.createReader(stream);
+			System.out.println("Json Value is: " + jsonReader.read().toString() );
+		} catch (Exception e) {
+			return false;
+		}
+		return true;
+	}
+
+	//  the Policy Name as Unique One throws error
+	@SuppressWarnings("static-access")
+	protected Path getNextFilename(Path parent, String policyType, String polcyFileName, Integer version) {
+		policyType = FilenameUtils.removeExtension(policyType);
+		polcyFileName = FilenameUtils.removeExtension(polcyFileName);
+		Path newFile = null;
+		String policyDir = EMPTY_STRING;
+		String absolutePath = parent.toString();
+		if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
+			policyDir = absolutePath.substring(absolutePath.lastIndexOf("\\") + 1, absolutePath.length());
+			if (policyDir == null || policyDir.equals(EMPTY_STRING)) {
+				policyDir = absolutePath.substring(absolutePath.lastIndexOf("/") + 1, absolutePath.length());
 			}
-			attributeDesignator.setCategory(CATEGORY_ACCESS_SUBJECT);
-			attributeDesignator.setDataType(STRING_DATATYPE);
-			attributeDesignator.setAttributeId(new IdentifierImpl(uri).stringValue());
-			match.setAttributeDesignator(attributeDesignator);
-			match.setMatchId(FUNCTION_STRING_REGEX_MATCH);
-			return match;
 		}
-		
-		// Creating the match for dynamically added components.
-		protected MatchType createDynamicMatch(String key, String value) {
-			MatchType dynamicMatch = new MatchType();
-			AttributeValueType dynamicAttributeValue = new AttributeValueType();
-			//Attribute attribute = findAttributeByAttributeId(key);
-			String dataType = null;
-	//		if (value.matches("[0-9]+")) {
-	//			dataType = INTEGER_DATATYPE;
-	//		} else {
-	//			dataType = STRING_DATATYPE;
-	//		}
-			dataType = STRING_DATATYPE;
-			dynamicAttributeValue.setDataType(dataType);
-			dynamicAttributeValue.getContent().add(value);
-			dynamicMatch.setAttributeValue(dynamicAttributeValue);
 
-			AttributeDesignatorType dynamicAttributeDesignator = new AttributeDesignatorType();
+		String fileName = "default";
+		if (policyDir != null && !policyDir.equals(EMPTY_STRING)) {
+			fileName = policyType + "_" + String.format(polcyFileName) + "." + version + ".xml";
+		} 
+		if (fileName != null) {
+			newFile = Paths.get(parent.toString(), fileName);
+		}
+		if (Files.notExists(newFile)) {
+			return newFile;
+		}
+		return null;
+	}
 
-			URI dynamicURI = null;
-			try {
-				dynamicURI = new URI(key);
-			} catch (URISyntaxException e) {
-				e.printStackTrace();// log msg
+	protected Path getNextLoopFilename(Path parentPath, String policyType, String policyConfigType, String policyFileName, Integer version) {
+		policyType = FilenameUtils.removeExtension(policyType);
+		policyConfigType = FilenameUtils.removeExtension(policyConfigType);
+		policyFileName = FilenameUtils.removeExtension(policyFileName);
+		Path newFile = null;
+		String policyDir = EMPTY_STRING;
+		String absolutePath = parentPath.toString();
+		if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
+			policyDir = absolutePath.substring(absolutePath.lastIndexOf("\\") + 1, absolutePath.length());
+			if (policyDir == null || policyDir.equals(EMPTY_STRING)) {
+				policyDir = absolutePath.substring(absolutePath.lastIndexOf("/") + 1, absolutePath.length());
 			}
-			dynamicAttributeDesignator.setCategory(CATEGORY_RESOURCE);
-			dynamicAttributeDesignator.setDataType(dataType);
-			dynamicAttributeDesignator.setAttributeId(new IdentifierImpl(dynamicURI).stringValue());
-			dynamicMatch.setAttributeDesignator(dynamicAttributeDesignator);
-			dynamicMatch.setMatchId(FUNCTION_STRING_REGEX_MATCH);
-
-			return dynamicMatch;
 		}
 
-		//validation for numeric
-		protected boolean isNumeric(String str)
-		{
-			for (char c : str.toCharArray())
-			{
-				if (!Character.isDigit(c)) return false;
+		String fileName = "default";
+		if (policyDir != null && !policyDir.equals(EMPTY_STRING)) {
+			if(policyConfigType.equals("ClosedLoop_PM")){
+				fileName = policyType + "_" + "PM" + "_" +java.lang.String.format(policyFileName) + "." +version +".xml";
+			}else if(policyConfigType.equals("ClosedLoop_Fault")){
+				fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) +  "." + version + ".xml";
+			}else if(policyConfigType.equals("ClosedLoop_Fault")){
+				fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) +  "." + version + ".xml";
+			}else if(policyConfigType.equals("Micro Service")){
+				fileName = policyType + "_" + "MS" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
 			}
-			return true;
+		} 
+		if (fileName != null) {
+			newFile = Paths.get(parentPath.toString(), fileName);
 		}
-		
-		// Validation for json.
-		protected static boolean isJSONValid(String data) {
+		if (Files.notExists(newFile)) {
+			return newFile;
+		}
+		return null;
+	}
+
+
+	//create policy once all the validations are completed
+	protected Map<String, String> createPolicy(final Path policyPath, final Object policyData) {
+		Map<String, String> success = new HashMap<String, String>(); 
+		//
+		// Is the root a PolicySet or Policy?
+		//
+
+		if (policyData instanceof PolicyType) {
+			//
+			// Write it out
+			//
+			//Does not need to be XACMLPolicyWriterWithPapNotify since it is already in the PAP
+			//and this transaction is intercepted up stream.
+			InputStream inputStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType) policyData);
 			try {
-				new JSONObject(data);
-				InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
-				JsonReader jsonReader = Json.createReader(stream);
-				System.out.println("Json Value is: " + jsonReader.read().toString() );
+				PolicyDef policyDef = DOMPolicyDef.load(inputStream);
+				if (policyDef == null) {
+					success.put("validation", "PolicyDef Validation Failed");
+				}else{
+					success.put("success", "success");
+				}
 			} catch (Exception e) {
-				return false;
+				success.put("error", "Validation Failed");
 			}
-			return true;
-		}
-		
-		//  the Policy Name as Unique One throws error
-		protected Path getNextFilename(Path parent, String policyType, String polcyFileName, Integer version) {
-			policyType = FilenameUtils.removeExtension(policyType);
-			polcyFileName = FilenameUtils.removeExtension(polcyFileName);
-			Path newFile = null;
-			String policyDir = EMPTY_STRING;
-			String absolutePath = parent.toString();
-			if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
-				policyDir = absolutePath.substring(absolutePath.lastIndexOf("\\") + 1, absolutePath.length());
-				if (policyDir == null || policyDir.equals(EMPTY_STRING)) {
-					policyDir = absolutePath.substring(absolutePath.lastIndexOf("/") + 1, absolutePath.length());
-				}
-			}
-
-			String fileName = "default";
-			if (policyDir != null && !policyDir.equals(EMPTY_STRING)) {
-				fileName = policyType + "_" + String.format(polcyFileName) + "." + version + ".xml";
-			} 
-			if (fileName != null) {
-				newFile = Paths.get(parent.toString(), fileName);
-			}
-			if (Files.notExists(newFile)) {
-				return newFile;
-			}
-			return null;
-		}
-		
-		protected Path getNextLoopFilename(Path parentPath, String policyType,
-				String policyConfigType, String policyFileName, Integer version) {
-			policyType = FilenameUtils.removeExtension(policyType);
-			policyConfigType = FilenameUtils.removeExtension(policyConfigType);
-			policyFileName = FilenameUtils.removeExtension(policyFileName);
-			Path newFile = null;
-			String policyDir = EMPTY_STRING;
-			String absolutePath = parentPath.toString();
-			if (absolutePath != null && !absolutePath.equals(EMPTY_STRING)) {
-				policyDir = absolutePath.substring(absolutePath.lastIndexOf("\\") + 1, absolutePath.length());
-				if (policyDir == null || policyDir.equals(EMPTY_STRING)) {
-					policyDir = absolutePath.substring(absolutePath.lastIndexOf("/") + 1, absolutePath.length());
-				}
-			}
-
-			String fileName = "default";
-			if (policyDir != null && !policyDir.equals(EMPTY_STRING)) {
-				if(policyConfigType.equals("ClosedLoop_PM")){
-					fileName = policyType + "_" + "PM" + "_" +java.lang.String.format(policyFileName) + "." +version +".xml";
-				}else if(policyConfigType.equals("ClosedLoop_Fault")){
-					fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) +  "." + version + ".xml";
-				}else if(policyConfigType.equals("ClosedLoop_Fault")){
-					fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) +  "." + version + ".xml";
-				}else if(policyConfigType.equals("DCAE Micro Service")){
-					fileName = policyType + "_" + "MS" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
-				}
-			} 
-			if (fileName != null) {
-				newFile = Paths.get(parentPath.toString(), fileName);
-			}
-			if (Files.notExists(newFile)) {
-				return newFile;
-			}
-			return null;
-		}
-		
-		
-		//create policy once all the validations are completed
-		protected Map<String, String> createPolicy(final Path policyPath, final Object policyData) {
-			Map<String, String> success = new HashMap<String, String>(); 
-			//
-			// Is the root a PolicySet or Policy?
-			//
-			
-			if (policyData instanceof PolicyType) {
-				//
-				// Write it out
-				//
-				//Does not need to be XACMLPolicyWriterWithPapNotify since it is already in the PAP
-				//and this transaction is intercepted up stream.
-				InputStream inputStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType) policyData);
-				try {
-					PolicyDef policyDef = DOMPolicyDef.load(inputStream);
-					if (policyDef != null) {
-						//This is does not need to be XACMLPolicyWriterWithPapNotification since it is already in the PAP
-						//and the transaction was intercepted up stream
-						finalPolicyPath = XACMLPolicyWriter.writePolicyFile(policyPath, (PolicyType) policyData);
-						this.setFinalPolicyPath(finalPolicyPath);
-					} else{
-						success.put("validation", "PolicyDef Validation Failed");
-					}
-				} catch (Exception e) {
-					success.put("error", "Validation Failed");
-				}
-				
-			} else {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Unknown data type sent back.");
-				PolicyLogger.error("Unknown data type sent back.");
-				return success;
-			}
-			//
-			// Did it get written?
-			//
-			if (finalPolicyPath == null || !Files.exists(finalPolicyPath)) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Failed to write policy file.");
-				PolicyLogger.error("Failed to write policy file.");
-				return success;
-			}
-			try {
-				success.put("success", "success");
-			} finally {
-				// vaadin framework will handle exception.
-			}
+		} else {
+			PolicyLogger.error("Unknown data type sent back.");
 			return success;
 		}
-		
-		public static String getConfigHome(){
-			try {
-				loadWebapps();
-			} catch (Exception e) {
-				return null;
+		return success;
+	}
+
+	public static String getConfigHome(){
+		try {
+			loadWebapps();
+		} catch (Exception e) {
+			return null;
+		}
+		return configHome;
+	}
+
+	public static String getActionHome(){
+		try {
+			loadWebapps();
+		} catch (Exception e) {
+			return null;
+		}
+		return actionHome;
+	}
+
+	private static void loadWebapps() throws Exception{
+		if(actionHome == null || configHome == null){
+			Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
+			//Sanity Check
+			if (webappsPath == null) {
+				PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
+				throw new Exception("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
 			}
-			return configHome;
-		}
-		
-		public static String getActionHome(){
-			try {
-				loadWebapps();
-			} catch (Exception e) {
-				return null;
+			Path webappsPathConfig;
+			Path webappsPathAction;
+			if(webappsPath.toString().contains("\\")){
+				webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
+				webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
+			}else{
+				webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
+				webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
 			}
-			return actionHome;
-		}
-		
-		private static void loadWebapps() throws Exception{
-			if(actionHome == null || configHome == null){
-				Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
-				//Sanity Check
-				if (webappsPath == null) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
-					PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
-					throw new Exception("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
+			if(Files.notExists(webappsPathConfig)){
+				try {
+					Files.createDirectories(webappsPathConfig);
+				} catch (IOException e) {
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
 				}
-				Path webappsPathConfig;
-				Path webappsPathAction;
-				if(webappsPath.toString().contains("\\"))
-				{
-					webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
-					webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
-				}
-				else
-				{
-					webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
-					webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
-				}
-				if (Files.notExists(webappsPathConfig)) 
-				{
-					try {
-						Files.createDirectories(webappsPathConfig);
-					} catch (IOException e) {
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
-								//+ webappsPathConfig.toAbsolutePath().toString(), e);
-						PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
-					}
-				}
-				if (Files.notExists(webappsPathAction)) 
-				{
-					try {
-						Files.createDirectories(webappsPathAction);
-					} catch (IOException e) {
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
-								//+ webappsPathAction.toAbsolutePath().toString(), e);
-						PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
-					}
-				}
-				actionHome = webappsPathAction.toString();
-				configHome = webappsPathConfig.toString();
 			}
+			if(Files.notExists(webappsPathAction)){
+				try {
+					Files.createDirectories(webappsPathAction);
+				} catch (IOException e) {
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Policy", "Failed to create config directory");
+				}
+			}
+			actionHome = webappsPathAction.toString();
+			configHome = webappsPathConfig.toString();
 		}
-		
-		protected String getParentPathSubScopeDir() {
+	}
 
-			final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
-			String policyDir = policyAdapter.getParentPath().toString();
-			int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
-			policyDir = policyDir.substring(startIndex, policyDir.length());
-			
-			return policyDir;
-		}
+	protected String getParentPathSubScopeDir() {
+		final Path gitPath = Paths.get(policyAdapter.getUserGitPath().toString());
+		String policyDir = policyAdapter.getParentPath().toString();
+		int startIndex = policyDir.indexOf(gitPath.toString()) + gitPath.toString().length() + 1;
+		policyDir = policyDir.substring(startIndex, policyDir.length());
+		return policyDir;
+	}
 
 
-		public boolean validateConfigForm() {
-			// TODO Auto-generated method stub
-			return true;
-		}
+	public boolean validateConfigForm() {
+		return true;
+	}
 
-		/**
-		 * @return the preparedToSave
-		 */
-		public boolean isPreparedToSave() {
-			return preparedToSave;
-		}
+	/**
+	 * @return the preparedToSave
+	 */
+	public boolean isPreparedToSave() {
+		return preparedToSave;
+	}
 
-		/**
-		 * @param preparedToSave the preparedToSave to set
-		 */
-		protected void setPreparedToSave(boolean preparedToSave) {
-			this.preparedToSave = preparedToSave;
-		}
+	/**
+	 * @param preparedToSave the preparedToSave to set
+	 */
+	protected void setPreparedToSave(boolean preparedToSave) {
+		this.preparedToSave = preparedToSave;
+	}
 
-		public boolean isPolicyExists() {
-			return policyExists;
-		}
+	public boolean isPolicyExists() {
+		return policyExists;
+	}
 
-		public void setPolicyExists(boolean policyExists) {
-			this.policyExists = policyExists;
-		}
-		
-		
+	public void setPolicyExists(boolean policyExists) {
+		this.policyExists = policyExists;
+	}
+
+
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
index bdd7534..a63dacb 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -22,6 +22,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -68,14 +69,18 @@
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
 import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
 import org.openecomp.policy.rest.jpa.ActionBodyEntity;
 import org.openecomp.policy.rest.jpa.ConfigurationDataEntity;
 import org.openecomp.policy.rest.jpa.DatabaseLockEntity;
@@ -85,31 +90,20 @@
 import org.openecomp.policy.rest.jpa.PolicyEntity;
 import org.openecomp.policy.rest.jpa.PolicyVersion;
 import org.openecomp.policy.rest.util.Webapps;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-
-import org.xml.sax.InputSource;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.openecomp.policy.xacml.api.pap.EcompPDP;
 import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
 import org.openecomp.policy.xacml.api.pap.PAPPolicyEngine;
-
-import com.att.research.xacml.api.pap.PAPEngine;
-import com.att.research.xacml.api.pap.PAPException;
-import com.att.research.xacml.api.pap.PDP;
-//import com.att.research.xacml.api.pap.PDPGroup;
-import com.att.research.xacml.api.pap.PDPPolicy;
 import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
 import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
 import org.openecomp.policy.xacml.util.XACMLPolicyScanner;
 import org.openecomp.policy.xacml.util.XACMLPolicyWriter;
-import com.att.research.xacml.util.XACMLProperties;
-
 import org.w3c.dom.Document;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.xml.sax.InputSource;
+
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDP;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.util.XACMLProperties;
 
 public class PolicyDBDao {
 	private static final Logger logger	= FlexLogger.getLogger(PolicyDBDao.class);		
@@ -117,13 +111,13 @@
 	private EntityManagerFactory emf;
 	private static PolicyDBDao currentInstance = null;
 	private PAPPolicyEngine papEngine;
-	
+
 	public static final String JSON_CONFIG = "JSON";
 	public static final String XML_CONFIG = "XML";
 	public static final String PROPERTIES_CONFIG = "PROPERTIES";
 	public static final String OTHER_CONFIG = "OTHER";
 	public static final String AUDIT_USER = "audit";
-	
+
 	/**
 	 * Get an instance of a PolicyDBDao. It creates one if it does not exist.
 	 * Only one instance is allowed to be created per server.
@@ -142,7 +136,7 @@
 		}
 		return currentInstance;
 	}
-	
+
 	/**
 	 * Gets the current instance of PolicyDBDao. 
 	 * @return The instance of PolicyDBDao or throws exception if the given instance is null.
@@ -161,14 +155,12 @@
 	private PolicyDBDao(EntityManagerFactory emf){
 		logger.debug("PolicyDBDao(EntityManagerFactory emf) as PolicyDBDao("+emf+") called");
 		this.emf = emf;
-		
+
 		//not needed in this release
 		if(!register()){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("This server's PolicyDBDao instance could not be registered and may not reveive updates");
 			PolicyLogger.error("This server's PolicyDBDao instance could not be registered and may not reveive updates");
 		}
-		
+
 		otherServers = getRemotePolicyDBDaoList();
 		if(logger.isDebugEnabled()){
 			logger.debug("Number of remote PolicyDBDao instances: "+otherServers.size());
@@ -176,42 +168,40 @@
 		if(otherServers.size() < 1){
 			logger.warn("List of PolicyDBDao servers is empty or could not be retrieved");
 		}
-		//otherServers = new LinkedList();		
-		//otherServers.add((Object)"http://localhost:8071/pap/");		
 	}
-	
+
 	//not static because we are going to be using the instance's emf
 	//waitTime in ms to wait for lock, or -1 to wait forever (no)
 	private void startTransactionSynced(EntityManager entityMgr,int waitTime){
 		logger.debug("\n\nstartTransactionSynced(EntityManager entityMgr,int waitTime) as "
 				+ "\n   startTransactionSynced("+entityMgr+","+waitTime+") called\n\n");
 		DatabaseLockEntity lock = null;		
-		
+
 		entityMgr.setProperty("javax.persistence.query.timeout", waitTime);
 		entityMgr.getTransaction().begin();
-		
+
+		if(logger.isDebugEnabled()){
+			Map<String,Object> properties = entityMgr.getProperties();
+			logger.debug("\n\nstartTransactionSynced():"
+					+ "\n   entityManager.getProperties() = " + properties 
+					+ "\n\n");
+		}
+		try{
 			if(logger.isDebugEnabled()){
-				Map<String,Object> properties = entityMgr.getProperties();
 				logger.debug("\n\nstartTransactionSynced():"
-						+ "\n   entityManager.getProperties() = " + properties 
+						+ "\n   ATTEMPT to get the DB lock"
 						+ "\n\n");
 			}
-			try{
-				if(logger.isDebugEnabled()){
-					logger.debug("\n\nstartTransactionSynced():"
-							+ "\n   ATTEMPT to get the DB lock"
-							+ "\n\n");
-				}
-				lock = entityMgr.find(DatabaseLockEntity.class, 1, LockModeType.PESSIMISTIC_WRITE);
-				if(logger.isDebugEnabled()){
-					logger.debug("\n\nstartTransactionSynced():"
-							+ "\n   GOT the DB lock"
-							+ "\n\n");
-				}
-			} catch(Exception e){
-				System.out.println("Could not get lock entity");
-				e.printStackTrace();
+			lock = entityMgr.find(DatabaseLockEntity.class, 1, LockModeType.PESSIMISTIC_WRITE);
+			if(logger.isDebugEnabled()){
+				logger.debug("\n\nstartTransactionSynced():"
+						+ "\n   GOT the DB lock"
+						+ "\n\n");
 			}
+		} catch(Exception e){
+			System.out.println("Could not get lock entity");
+			e.printStackTrace();
+		}
 		if(lock == null){
 			throw new IllegalStateException("The lock row does not exist in the table. Please create a primary key with value = 1.");	
 		}
@@ -229,31 +219,29 @@
 		try{						
 			Query getPolicyDBDaoEntityQuery = em.createNamedQuery("PolicyDBDaoEntity.findAll");			
 			policyDBDaoEntityList = getPolicyDBDaoEntityQuery.getResultList();
-			
+
 		} catch(Exception e){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Caught Exception on: getPolicyDBDaoEntityQuery.getResultList()",e);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Exception querying for other registered PolicyDBDaos");
 			logger.warn("List of remote PolicyDBDaos will be empty");
 		}
 		try{
-		em.getTransaction().commit();
+			em.getTransaction().commit();
 		} catch(Exception e){
 			try{
 				em.getTransaction().rollback();
 			} catch(Exception e2){
-				
+
 			}
 		}
 		em.close();
 		return policyDBDaoEntityList;
 	}
-	
+
 	public PolicyDBDaoTransaction getNewTransaction(){
 		logger.debug("getNewTransaction() as getNewTransaction() called");
 		return (PolicyDBDaoTransaction)(new PolicyDBDaoTransactionInstance());
 	}
-	
+
 	/*
 	 * Because the normal transactions are not used in audits, we can use the same transaction
 	 * mechanism to get a transaction and obtain the emlock and the DB lock.  We just need to
@@ -268,8 +256,8 @@
 		int auditTimeoutMs = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_AUDIT_TIMEOUT)); 
 		return (PolicyDBDaoTransaction)(new PolicyDBDaoTransactionInstance(auditTimeoutMs, auditWaitMs));
 	}
-	
-	
+
+
 	/**
 	 * Checks if two strings are equal. Null strings ARE allowed.
 	 * @param one A String or null to compare
@@ -285,7 +273,7 @@
 		}
 		return one.equals(two);
 	}
-	
+
 	/**
 	 * Computes the scope in dotted format based on an absolute path and a path that divides the scope.
 	 * @param fullPath An absolute path including scope folders and other folders(does not have to be absolute, must just contain scope and other folders before)
@@ -344,7 +332,7 @@
 		//if there is no comma, for some reason there is no username and password, so don't try to cut them off
 		return urlUserPass;
 	}
-	
+
 	private static String encryptPassword(String password) throws Exception{
 		Cipher cipher = Cipher.getInstance("AES");		
 		cipher.init(Cipher.ENCRYPT_MODE, aesKey());
@@ -352,7 +340,7 @@
 		System.out.println(encryption);
 		return new String(Base64.getMimeEncoder().encode(encryption),"UTF-8");
 	}
-	
+
 	private static String decryptPassword(String encryptedPassword) throws Exception{
 		Cipher cipher = Cipher.getInstance("AES");
 		cipher.init(Cipher.DECRYPT_MODE, aesKey());
@@ -386,8 +374,6 @@
 					em.getTransaction().commit();
 					em.close();					
 				} catch(Exception e2){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("COULD NOT CREATE DATABASELOCK ROW.  WILL TRY ONE MORE TIME \n\n Exception: \n" + e2);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "COULD NOT CREATE DATABASELOCK ROW.  WILL TRY ONE MORE TIME");
 					e2.printStackTrace();
 				}
@@ -396,10 +382,7 @@
 				try{
 					startTransactionSynced(em, 1000);
 				} catch(Exception e3){
-					//still not working
 					String msg = "DATABASE LOCKING NOT WORKING. CONCURRENCY CONTROL NOT WORKING";
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error(msg);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e3, "PolicyDBDao", msg);
 					throw new IllegalStateException("msg" + "\n" + e3);
 				}
@@ -410,56 +393,35 @@
 		Query getPolicyDBDaoEntityQuery = em.createQuery("SELECT e FROM PolicyDBDaoEntity e WHERE e.policyDBDaoUrl=:url");
 		getPolicyDBDaoEntityQuery.setParameter("url", url[0]);
 		if(foundPolicyDBDaoEntity == null){
-			//em.getTransaction().begin();
 			PolicyDBDaoEntity newPolicyDBDaoEntity = new PolicyDBDaoEntity();
 			em.persist(newPolicyDBDaoEntity);
 			newPolicyDBDaoEntity.setPolicyDBDaoUrl(url[0]);
 			newPolicyDBDaoEntity.setDescription("PAP server at "+url[0]);
 			newPolicyDBDaoEntity.setUsername(url[1]);
 			try{
-			newPolicyDBDaoEntity.setPassword(encryptPassword(url[2]));
+				newPolicyDBDaoEntity.setPassword(encryptPassword(url[2]));
 			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Could not encrypt PAP password",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not encrypt PAP password");
 			}
-			/*
 			try{
 				em.getTransaction().commit();
-			} catch(RollbackException e){
-				logger.error("Caught RollbackException during PolicyDBDao Registration on: em.getTransaction().commit()",e);
-				em.close();
-				return false;
-			} catch(Exception e2){
-				logger.error("Caught Exception during PolicyDBDao Registration on: em.getTransaction().commit()",e2);
-				em.close();
-				return false;
-			}
-			*/
-			try{
-				em.getTransaction().commit();
-				} catch(Exception e){
-					try{
-						em.getTransaction().rollback();
-					} catch(Exception e2){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Could not add new PolicyDBDao to the database",e);
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Could not add new PolicyDBDao to the database");
-					}
+			} catch(Exception e){
+				try{
+					em.getTransaction().rollback();
+				} catch(Exception e2){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Could not add new PolicyDBDao to the database");
 				}
+			}
 		} else {
-			//em.getTransaction().begin();
 			//just want to update in order to change modified date
 			String encryptedPassword = null;
 			try{
-			encryptedPassword = encryptPassword(url[2]);
+				encryptedPassword = encryptPassword(url[2]);
 			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Could not encrypt PAP password",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not encrypt PAP password");
 			}
 			if(url[1] != null && !stringEquals(url[1], foundPolicyDBDaoEntity.getUsername())){
-			foundPolicyDBDaoEntity.setUsername(url[1]);
+				foundPolicyDBDaoEntity.setUsername(url[1]);
 			}
 			if(encryptedPassword != null && !stringEquals(encryptedPassword, foundPolicyDBDaoEntity.getPassword())){
 				foundPolicyDBDaoEntity.setPassword(encryptedPassword);
@@ -467,28 +429,13 @@
 			foundPolicyDBDaoEntity.preUpdate();
 			try{
 				em.getTransaction().commit();
-				} catch(Exception e){
-					try{
-						em.getTransaction().rollback();
-					} catch(Exception e2){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Could not update PolicyDBDao in the database",e);
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Could not update PolicyDBDao in the database");
-					}
+			} catch(Exception e){
+				try{
+					em.getTransaction().rollback();
+				} catch(Exception e2){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Could not update PolicyDBDao in the database");
 				}
-			/*
-			try{
-				em.getTransaction().commit();
-			} catch(RollbackException e){
-				logger.error("Caught RollbackException during PolicyDBDao Registration on: em.getTransaction().commit()",e);
-				em.close();
-				return false;
-			} catch(Exception e2){
-				logger.error("Caught Exception during PolicyDBDao Registration on: em.getTransaction().commit()",e2);
-				em.getTransaction().rollback();
-				return false;
 			}
-			*/
 		}
 		em.close();
 		logger.debug("\nPolicyDBDao.register(). Success!!\n");
@@ -500,12 +447,12 @@
 	public void notifyOthers(long entityId, String entityType, String newGroupId){
 		logger.debug("notifyOthers(long entityId, String entityType, long newGroupId) as notifyOthers("+entityId+","+entityType+","+newGroupId+") called");		
 		LinkedList<Thread> notifyThreads = new LinkedList<Thread>();
-		
+
 		//we're going to run notiftions in parellel threads to speed things up
 		for(Object obj : otherServers){
 
 			Thread newNotifyThread = new Thread(new NotifyOtherThread(obj, entityId, entityType, newGroupId));
-			
+
 			newNotifyThread.start();
 
 			notifyThreads.add(newNotifyThread);
@@ -520,7 +467,7 @@
 			}
 		}
 
-		
+
 	}
 
 	private class NotifyOtherThread implements Runnable {
@@ -542,7 +489,7 @@
 			String username = dbdEntity.getUsername();
 			String password;
 			try{
-			password = decryptPassword(dbdEntity.getPassword());
+				password = decryptPassword(dbdEntity.getPassword());
 			} catch(Exception e){
 				//if we can't decrypt, might as well try it anyway
 				password = dbdEntity.getPassword();
@@ -551,8 +498,6 @@
 			String encoding = encoder.encodeToString((username+":"+password).getBytes(StandardCharsets.UTF_8));
 			HttpURLConnection connection = null;
 			UUID requestID = UUID.randomUUID();
-			//loggingContext.setRequestID(requestID.toString());
-			//loggingContext.transactionStarted();
 			URL url;
 			try {
 				String papUrl = getPapUrlUserPass()[0];
@@ -575,7 +520,7 @@
 					return;
 				}
 				if(newGroupId == null){
-				url = new URL(((String)o)+"?policydbdaourl="+papUrl+"&entityid="+entityId+"&entitytype="+entityType);
+					url = new URL(((String)o)+"?policydbdaourl="+papUrl+"&entityid="+entityId+"&entitytype="+entityType);
 				} else {
 					url = new URL(((String)o)+"?policydbdaourl="+papUrl+"&entityid="+entityId+"&entitytype="+entityType+"&extradata="+newGroupId);
 				}
@@ -596,45 +541,45 @@
 			//
 			// Setup our method and headers
 			//
-	        try {
+			try {
 				connection.setRequestMethod("PUT");
 			} catch (ProtocolException e) {
 				//why would this error ever occur?
 				logger.warn("Caught ProtocolException on connection.setRequestMethod(\"PUT\");",e);			
 				return;
 			}
-	        connection.setRequestProperty("Authorization", "Basic " + encoding);
+			connection.setRequestProperty("Authorization", "Basic " + encoding);
 			connection.setRequestProperty("Accept", "text/x-java-properties");
-	        connection.setRequestProperty("Content-Type", "text/x-java-properties");	  	        	        
-	        connection.setRequestProperty("requestID", requestID.toString());
-	        int readTimeout;
-	        try{
-	        	readTimeout = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_NOTIFY_TIMEOUT));
-	        	
-	        } catch(Exception e){
-	        	logger.error("xacml.rest.pap.notify.timeoutms property not set, using a default.");
-	        	readTimeout = 10000;
-	        }
-	        connection.setReadTimeout(readTimeout);
-	        connection.setConnectTimeout(readTimeout);
-	        connection.setUseCaches(false);
-	        //
-	        // Adding this in. It seems the HttpUrlConnection class does NOT
-	        // properly forward our headers for POST re-direction. It does so
-	        // for a GET re-direction.
-	        //
-	        // So we need to handle this ourselves.
-	        //
-	        connection.setInstanceFollowRedirects(false);
+			connection.setRequestProperty("Content-Type", "text/x-java-properties");	  	        	        
+			connection.setRequestProperty("requestID", requestID.toString());
+			int readTimeout;
+			try{
+				readTimeout = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_NOTIFY_TIMEOUT));
+
+			} catch(Exception e){
+				logger.error("xacml.rest.pap.notify.timeoutms property not set, using a default.");
+				readTimeout = 10000;
+			}
+			connection.setReadTimeout(readTimeout);
+			connection.setConnectTimeout(readTimeout);
+			connection.setUseCaches(false);
+			//
+			// Adding this in. It seems the HttpUrlConnection class does NOT
+			// properly forward our headers for POST re-direction. It does so
+			// for a GET re-direction.
+			//
+			// So we need to handle this ourselves.
+			//
+			connection.setInstanceFollowRedirects(false);
 			connection.setDoOutput(true);
 			connection.setDoInput(true);
-	        try {
+			try {
 				connection.connect();
 			} catch (Exception e) {
 				logger.warn("Caught exception on: connection.connect()",e);
 				return;
 			}
-	        try {
+			try {
 				if (connection.getResponseCode() == 200) {
 					logger.info("Received response 200 from pap server on notify");
 					//notified = true;
@@ -644,12 +589,12 @@
 			} catch (Exception e) {
 				logger.warn("Caught Exception on: connection.getResponseCode() ", e);
 			}
-			
-			
+
+
 			connection.disconnect();
 		}
 	}
-	
+
 	private static String getElementFromXMLString(String element, String xml) {
 		InputSource source = new InputSource(new StringReader(xml));
 
@@ -661,14 +606,14 @@
 
 			XPathFactory xpathFactory = XPathFactory.newInstance();
 			XPath xpath = xpathFactory.newXPath();
-			
+
 			if (element.endsWith("/")){
 				element = element.substring(0, element.length() -1);
 			}
 
 			description = xpath.evaluate("/Policy" + element + "/text()", document);		
 		}catch(Exception e){
-			
+
 		}
 
 
@@ -686,20 +631,19 @@
 
 			XPathFactory xpathFactory = XPathFactory.newInstance();
 			XPath xpath = xpathFactory.newXPath();
-			
+
 
 			description = xpath.evaluate(expression, document);		
 		}catch(Exception e){
-			
+
 		}
 
 
 		System.out.println("description_" + description);
 		return description;
 	}
-	
+
 	private static String getDescriptionFromXacml(String xacmlData){
-		//FIXME completely untested. Probably not a good idea to use. UPDATE: kind of tested
 		String openTag = "<Description>";
 		String closeTag = "</Description>";
 		int descIndex = xacmlData.indexOf(openTag);
@@ -707,39 +651,72 @@
 		String desc = xacmlData.substring(descIndex+openTag.length(),endDescIndex);
 		return desc;
 	}
+	
 	private final String POLICY_NOTIFICATION = "policy";
 	private final String PDP_NOTIFICATION = "pdp";
 	private final String GROUP_NOTIFICATION = "group";
 	public void handleIncomingHttpNotification(String url, String entityId, String entityType, String extraData, XACMLPapServlet xacmlPapServlet){
 		logger.info("DBDao url: " + url + " has reported an update on "+entityType+" entity "+entityId);		
 		PolicyDBDaoTransaction transaction = this.getNewTransaction();
+		//although its named retries, this is the total number of tries
+		int retries;
+		try{
+			retries = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_INCOMINGNOTIFICATION_TRIES));
+
+		} catch(Exception e){
+			logger.error("xacml.rest.pap.incomingnotification.tries property not set, using a default of 3.");
+			retries = 3;
+		}
+		//if someone sets it to some dumb value, we need to make sure it will try at least once
+		if(retries < 1){
+			retries = 1;
+		}
+		int pauseBetweenRetries = 1000;
 		switch(entityType){	
-		
+
 		case POLICY_NOTIFICATION:
-			try{
-			handleIncomingPolicyChange(url, entityId,extraData);
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught exception on handleIncomingPolicyChange("+url+", "+entityId+", "+extraData+")",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught exception on handleIncomingPolicyChange("+url+", "+entityId+", "+extraData+")");
+			for(int i=0; i<retries;i++){
+				try{
+					handleIncomingPolicyChange(url, entityId,extraData);
+					break;
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught exception on handleIncomingPolicyChange("+url+", "+entityId+", "+extraData+")");
+				}
+				try{
+					Thread.sleep(pauseBetweenRetries);
+				}catch(InterruptedException ie){
+					break;
+				}
 			}
 			break;
 		case PDP_NOTIFICATION:
-			try{
-			handleIncomingPdpChange(url, entityId, transaction);
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught exception on handleIncomingPdpChange("+url+", "+entityId+", "+transaction+")",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught exception on handleIncomingPdpChange("+url+", "+entityId+", "+transaction+")");
+			for(int i=0; i<retries;i++){
+				try{
+					handleIncomingPdpChange(url, entityId, transaction);
+					break;
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught exception on handleIncomingPdpChange("+url+", "+entityId+", "+transaction+")");
+				}
+				try{
+					Thread.sleep(pauseBetweenRetries);
+				}catch(InterruptedException ie){
+					break;
+				}
 			}
 			break;
 		case GROUP_NOTIFICATION:
-			try{
-			handleIncomingGroupChange(url, entityId, extraData, transaction, xacmlPapServlet);
-			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught exception on handleIncomingGroupChange("+url+", "+entityId+", "+extraData+", "+transaction+", "+xacmlPapServlet+")",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught exception on handleIncomingGroupChange("+url+", "+entityId+", "+extraData+", "+transaction+", "+xacmlPapServlet+")");
+			for(int i=0; i<retries;i++){
+				try{
+					handleIncomingGroupChange(url, entityId, extraData, transaction, xacmlPapServlet);
+					break;
+				}catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught exception on handleIncomingGroupChange("+url+", "+entityId+", "+extraData+", "+transaction+", "+xacmlPapServlet+")");
+				}
+				try{
+					Thread.sleep(pauseBetweenRetries);
+				}catch(InterruptedException ie){
+					break;
+				}
 			}
 			break;		
 		}
@@ -747,7 +724,6 @@
 		transaction.rollbackTransaction();
 	}
 	private void handleIncomingGroupChange(String url, String groupId, String extraData,PolicyDBDaoTransaction transaction,XACMLPapServlet xacmlPapServlet) throws PAPException{
-				
 		GroupEntity groupRecord = null;
 		long groupIdLong = -1;
 		try{
@@ -756,10 +732,8 @@
 			throw new IllegalArgumentException("groupId "+groupId+" cannot be parsed into a long");
 		}
 		try{
-				groupRecord = transaction.getGroup(groupIdLong);
+			groupRecord = transaction.getGroup(groupIdLong);
 		} catch(Exception e){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Caught Exception trying to get pdp group record with transaction.getGroup("+groupIdLong+");",e);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get pdp group record with transaction.getGroup("+groupIdLong+");");
 			throw new PAPException("Could not get local group "+groupIdLong);
 		}
@@ -773,7 +747,6 @@
 			localGroup = papEngine.getGroup(groupRecord.getGroupId());
 		} catch (Exception e) {
 			logger.warn("Caught PAPException trying to get local pdp group with papEngine.getGroup("+groupId+");",e);
-			//throw new PAPException("Could not get local group "+groupId);
 		}
 		if(localGroup == null && extraData != null){
 			//here we can try to load an old group id from the extraData
@@ -786,21 +759,15 @@
 		if(localGroup != null && groupRecord.isDeleted()){
 			EcompPDPGroup newLocalGroup = null;
 			if(extraData != null){
-			try {
-				newLocalGroup = papEngine.getGroup(extraData);
-			} catch (PAPException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to get new pdp group with papEngine.getGroup("+extraData+");",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get new pdp group with papEngine.getGroup("+extraData+");");
-				//throw new PAPException("Could not get new local group "+newGroupId);
-				
-			}
+				try {
+					newLocalGroup = papEngine.getGroup(extraData);
+				} catch (PAPException e) {
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get new pdp group with papEngine.getGroup("+extraData+");");
+				}
 			}
 			try {
 				papEngine.removeGroup(localGroup, newLocalGroup);
 			} catch (NullPointerException | PAPException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to get remove pdp group with papEngine.removeGroup("+localGroup+", "+newLocalGroup+");",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get remove pdp group with papEngine.removeGroup("+localGroup+", "+newLocalGroup+");");
 				throw new PAPException("Could not remove group "+groupId);
 			}
@@ -810,19 +777,14 @@
 			try {
 				papEngine.newGroup(groupRecord.getgroupName(), groupRecord.getDescription());
 			} catch (NullPointerException | PAPException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to create pdp group with papEngine.newGroup(groupRecord.getgroupName(), groupRecord.getDescription());",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to create pdp group with papEngine.newGroup(groupRecord.getgroupName(), groupRecord.getDescription());");
 				throw new PAPException("Could not create group "+groupRecord);
 			}
 			try {
 				localGroup = papEngine.getGroup(groupRecord.getGroupId());
 			} catch (PAPException e1) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to get pdp group we just created with papEngine.getGroup(groupRecord.getGroupId());\nAny PDPs or policies in the new group may not have been added",e1);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "Caught PAPException trying to get pdp group we just created with papEngine.getGroup(groupRecord.getGroupId());\nAny PDPs or policies in the new group may not have been added");
 				return;
-				//throw new PAPException("Could not get group "+groupRecord);
 			}
 			//add possible pdps to group
 			List<?> pdpsInGroup = transaction.getPdpsInGroup(Long.parseLong(groupRecord.getGroupId()));
@@ -831,8 +793,6 @@
 				try {
 					papEngine.newPDP(pdp.getPdpId(), localGroup, pdp.getPdpName(), pdp.getDescription(), pdp.getJmxPort());
 				} catch (NullPointerException | PAPException e) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught PAPException trying to get create pdp with papEngine.newPDP(pdp.getPdpId(), localGroup, pdp.getPdpName(), pdp.getDescription(), pdp.getJmxPort());",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get create pdp with papEngine.newPDP(pdp.getPdpId(), localGroup, pdp.getPdpName(), pdp.getDescription(), pdp.getJmxPort());");
 					throw new PAPException("Could not create pdp "+pdp);
 				}
@@ -855,8 +815,6 @@
 					papEngine.SetDefaultGroup(localGroup);
 					return;
 				} catch (PAPException e) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught PAPException trying to set default group with papEngine.SetDefaultGroup("+localGroupClone+");",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to set default group with papEngine.SetDefaultGroup("+localGroupClone+");");
 					throw new PAPException("Could not set default group to "+localGroupClone);
 				}				
@@ -877,16 +835,14 @@
 			}
 			if(needToUpdate){
 				try {
-					
+
 					papEngine.updateGroup(localGroupClone);
 				} catch (PAPException e) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught PAPException trying to update group with papEngine.updateGroup("+localGroupClone+");",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to update group with papEngine.updateGroup("+localGroupClone+");");
 					throw new PAPException("Could not update group "+localGroupClone);
 				}
 			}				
-			
+
 		}
 		//call command that corresponds to the change that was made
 	}
@@ -916,8 +872,7 @@
 					try {
 						policyStream.close();
 					} catch (IOException e) {
-						// TODO Auto-generated catch block
-						e.printStackTrace();
+						PolicyLogger.error(e.getMessage());
 					}
 				}
 			}
@@ -927,22 +882,40 @@
 			group.setPolicies(newPolicySet);
 		}
 		return didUpdate;
-		
+
 	}
 	private String removeExtensionAndVersionFromPolicyName(String originalPolicyName){
-		String policyName = originalPolicyName;
-		try{
-			policyName = removeFileExtension(policyName);
-			policyName = policyName.substring(0,policyName.lastIndexOf('.'));
-			if(isNullOrEmpty(policyName)){
-				throw new Exception();
-			}
-		} catch(Exception e){
-			policyName = originalPolicyName;
-		}
-		return policyName;
-	}
-	
+        return getPolicyNameAndVersionFromPolicyFileName(originalPolicyName)[0];
+    }
+
+    /**
+     * Splits apart the policy name and version from a policy file path
+     * @param originalPolicyName: a policy file name ex: Config_policy.2.xml
+     * @return An array [0]: The policy name, [1]: the policy version, as a string
+     */
+    private String[] getPolicyNameAndVersionFromPolicyFileName(String originalPolicyName){
+        String policyName = originalPolicyName;
+        String[] nameAndVersion = new String[2];
+        try{
+            policyName = removeFileExtension(policyName);
+            nameAndVersion[0] = policyName.substring(0,policyName.lastIndexOf('.'));
+            if(isNullOrEmpty(nameAndVersion[0])){
+                throw new Exception();
+            }
+        } catch(Exception e){
+            nameAndVersion[0] = originalPolicyName;         
+        }
+        try{
+            nameAndVersion[1] = policyName.substring(policyName.lastIndexOf('.')+1);
+            if(isNullOrEmpty(nameAndVersion[1])){
+                throw new Exception();
+            }
+        } catch(Exception e){
+            nameAndVersion[1] = "1";
+        }
+        return nameAndVersion;
+    }
+    
 	private void handleIncomingPdpChange(String url, String pdpId, PolicyDBDaoTransaction transaction) throws PAPException{
 		//get pdp
 		long pdpIdLong = -1;
@@ -953,10 +926,8 @@
 		}
 		PdpEntity pdpRecord = null;
 		try{
-		pdpRecord = transaction.getPdp(pdpIdLong);
+			pdpRecord = transaction.getPdp(pdpIdLong);
 		}catch(Exception e){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Caught Exception trying to get pdp record with transaction.getPdp("+pdpIdLong+");",e);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get pdp record with transaction.getPdp("+pdpIdLong+");");
 			throw new PAPException("Could not get local pdp "+pdpIdLong);
 		}
@@ -973,8 +944,6 @@
 			try {
 				papEngine.removePDP((EcompPDP) localPdp);
 			} catch (PAPException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to get remove pdp with papEngine.removePDP("+localPdp+");",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get remove pdp with papEngine.removePDP("+localPdp+");");
 				throw new PAPException("Could not remove pdp "+pdpId);
 			}
@@ -982,21 +951,16 @@
 		else if(localPdp == null){
 			//add new pdp
 			//get group
-			
 			EcompPDPGroup localGroup = null;
 			try {
 				localGroup = papEngine.getGroup(pdpRecord.getGroup().getGroupId());
 			} catch (PAPException e1) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to get local group to add pdp to with papEngine.getGroup(pdpRecord.getGroup().getGroupId());",e1);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "Caught PAPException trying to get local group to add pdp to with papEngine.getGroup(pdpRecord.getGroup().getGroupId());");
 				throw new PAPException("Could not get local group");
 			}			
 			try {
 				papEngine.newPDP(pdpRecord.getPdpId(), localGroup, pdpRecord.getPdpName(), pdpRecord.getDescription(), pdpRecord.getJmxPort());
 			} catch (NullPointerException | PAPException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught PAPException trying to create pdp with papEngine.newPDP("+pdpRecord.getPdpId()+", "+localGroup+", "+pdpRecord.getPdpName()+", "+pdpRecord.getDescription()+", "+pdpRecord.getJmxPort()+");",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to create pdp with papEngine.newPDP("+pdpRecord.getPdpId()+", "+localGroup+", "+pdpRecord.getPdpName()+", "+pdpRecord.getDescription()+", "+pdpRecord.getJmxPort()+");");
 				throw new PAPException("Could not create pdp "+pdpRecord);
 			}
@@ -1012,33 +976,28 @@
 				needToUpdate = true;
 			}
 			String localPdpGroupId = null;
-					try{
-			localPdpGroupId = papEngine.getPDPGroup((EcompPDP) localPdp).getId();
-					} catch(PAPException e){
-						//could be null or something, just warn at this point
-						logger.warn("Caught PAPException trying to get id of local group that pdp is in with localPdpGroupId = papEngine.getPDPGroup(localPdp).getId();",e);
-						//throw new PAPException("Could not get local group");
-					}
-					if(!stringEquals(localPdpGroupId,pdpRecord.getGroup().getGroupId())){
-						EcompPDPGroup newPdpGroup = null;
-						try{
-						newPdpGroup = papEngine.getGroup(pdpRecord.getGroup().getGroupId());
-						}catch(PAPException e){
-							//ok, now we have an issue. Time to stop things
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught PAPException trying to get id of local group to move pdp to with papEngine.getGroup(pdpRecord.getGroup().getGroupId());",e);
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get id of local group to move pdp to with papEngine.getGroup(pdpRecord.getGroup().getGroupId());");
-							throw new PAPException("Could not get local group");
-						}
-						try{
-						papEngine.movePDP((EcompPDP) localPdp, newPdpGroup);
-						}catch(PAPException e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught PAPException trying to move pdp with papEngine.movePDP(localPdp, newPdpGroup);",e);
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to move pdp with papEngine.movePDP(localPdp, newPdpGroup);");
-							throw new PAPException("Could not move pdp "+localPdp);
-						}
-					}
+			try{
+				localPdpGroupId = papEngine.getPDPGroup((EcompPDP) localPdp).getId();
+			} catch(PAPException e){
+				//could be null or something, just warn at this point
+				logger.warn("Caught PAPException trying to get id of local group that pdp is in with localPdpGroupId = papEngine.getPDPGroup(localPdp).getId();",e);
+			}
+			if(!stringEquals(localPdpGroupId,pdpRecord.getGroup().getGroupId())){
+				EcompPDPGroup newPdpGroup = null;
+				try{
+					newPdpGroup = papEngine.getGroup(pdpRecord.getGroup().getGroupId());
+				}catch(PAPException e){
+					//ok, now we have an issue. Time to stop things
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to get id of local group to move pdp to with papEngine.getGroup(pdpRecord.getGroup().getGroupId());");
+					throw new PAPException("Could not get local group");
+				}
+				try{
+					papEngine.movePDP((EcompPDP) localPdp, newPdpGroup);
+				}catch(PAPException e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to move pdp with papEngine.movePDP(localPdp, newPdpGroup);");
+					throw new PAPException("Could not move pdp "+localPdp);
+				}
+			}
 			if(((PdpEntity) localPdp).getJmxPort() != pdpRecord.getJmxPort()){
 				((PdpEntity) localPdp).setJmxPort(pdpRecord.getJmxPort());
 				needToUpdate = true;
@@ -1047,8 +1006,6 @@
 				try {
 					papEngine.updatePDP((EcompPDP) localPdp);
 				} catch (PAPException e) {
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught PAPException trying to update pdp with papEngine.updatePdp("+localPdp+");",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PAPException trying to update pdp with papEngine.updatePdp("+localPdp+");");
 					throw new PAPException("Could not update pdp "+localPdp);
 				}
@@ -1061,16 +1018,16 @@
 		EntityManager em = emf.createEntityManager();
 		Query getPolicyEntityQuery = em.createNamedQuery("PolicyEntity.FindById");
 		getPolicyEntityQuery.setParameter("id", Long.valueOf(policyId));
-		
+
 		@SuppressWarnings("unchecked")
 		List<PolicyEntity> policies = getPolicyEntityQuery.getResultList();
 		PolicyEntity policy = null;
 		if (policies.size() > 0){
 			policy = policies.get(0);
 		}
-		
+
 		String policyRepo = buildPolicyScopeDirectory(policy);
-		
+
 		Path policyPath = Paths.get(policyRepo);
 		String action = "unknown action";
 		try {
@@ -1080,19 +1037,19 @@
 				action = "delete";
 				Path newPath = Paths.get(policyPath.toString(), policy.getPolicyName());
 				Files.deleteIfExists(newPath);
-				
+
 				Path subFile = null;
-				
+
 				if (policy.getConfigurationData()!= null){
 					subFile = getPolicySubFile(policy.getConfigurationData().getConfigurationName(), "Config");
 				}else if(policy.getActionBodyEntity()!= null){
 					subFile = getPolicySubFile(policy.getActionBodyEntity().getActionBodyName(), "Action");
 				}
-				
+
 				if(subFile != null){
 					Files.deleteIfExists(subFile);
 				}
-				
+
 			}else{
 				logger.debug("Updating/Creating Policy: " + policy.getPolicyName());
 				action = "update";
@@ -1102,215 +1059,240 @@
 				if(!isNullOrEmpty(oldPathString)){
 					try{
 						String[] scopeName = getScopeAndNameAndType(oldPathString);
-					Path oldPath = Paths.get(buildPolicyScopeDirectory(scopeName[0]),scopeName[1]);
-					Files.delete(oldPath.toAbsolutePath());
+						Path oldPath = Paths.get(buildPolicyScopeDirectory(scopeName[0]),scopeName[1]);
+						Files.delete(oldPath.toAbsolutePath());
 					}catch(Exception e){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Could not delete the old policy before rename: "+oldPathString,e);
 						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete the old policy before rename: "+oldPathString);
 					}
 				}
 				Object policyData = XACMLPolicyScanner.readPolicy(IOUtils.toInputStream(policy.getPolicyData()));
 				XACMLPolicyWriter.writePolicyFile(newPath, (PolicyType) policyData);		
-				
+
 				if (policy.getConfigurationData()!= null){
 					if(!isNullOrEmpty(oldPathString)){
 						try{						
-						String[] oldPolicyScopeName = getScopeAndNameAndType(oldPathString);
-						String oldConfigFileName = getConfigFile(oldPolicyScopeName[1],oldPolicyScopeName[0],policy.getConfigurationData().getConfigType());
-						Path oldConfigFilePath = getPolicySubFile(oldConfigFileName, "Config");
-						logger.debug("Trying to delete: "+oldConfigFilePath.toString());
-						Files.delete(oldConfigFilePath);						
+							String[] oldPolicyScopeName = getScopeAndNameAndType(oldPathString);
+							String oldConfigFileName = getConfigFile(oldPolicyScopeName[1],policy.getConfigurationData().getConfigType());
+							Path oldConfigFilePath = getPolicySubFile(oldConfigFileName, "Config");
+							logger.debug("Trying to delete: "+oldConfigFilePath.toString());
+							Files.delete(oldConfigFilePath);						
 						}catch(Exception e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Could not delete the old policy config before rename for policy: "+oldPathString,e);
 							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete the old policy config before rename for policy: "+oldPathString);
 						}
 					}
 					writePolicySubFile(policy, "Config");
-					
+
 				}else if(policy.getActionBodyEntity()!= null){
 					if(!isNullOrEmpty(oldPathString)){
 						try{						
-						String[] oldPolicyScopeName = getScopeAndNameAndType(oldPathString);
-						String oldActionFileName = getConfigFile(oldPolicyScopeName[1],oldPolicyScopeName[0],ConfigPolicy.JSON_CONFIG);
-						Path oldActionFilePath = getPolicySubFile(oldActionFileName, "Action");
-						logger.debug("Trying to delete: "+oldActionFilePath.toString());
-						Files.delete(oldActionFilePath);						
+							String[] oldPolicyScopeName = getScopeAndNameAndType(oldPathString);
+							String oldActionFileName = getConfigFile(oldPolicyScopeName[1],ConfigPolicy.JSON_CONFIG);
+							Path oldActionFilePath = getPolicySubFile(oldActionFileName, "Action");
+							logger.debug("Trying to delete: "+oldActionFilePath.toString());
+							Files.delete(oldActionFilePath);						
 						}catch(Exception e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Could not delete the old policy action body before rename for policy: "+oldPathString,e);
 							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete the old policy action body before rename for policy: "+oldPathString);
 						}
 					}
 					writePolicySubFile(policy, "Action");
 				}
-					
+
 			}
 		} catch (IOException e1) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Error occurred while performing [" + action + "] of Policy File: " +  policy.getPolicyName(), e1);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "Error occurred while performing [" + action + "] of Policy File: " +  policy.getPolicyName());
 		}	
 	}
-	
-	//FIXME error correcting and logs
+
 	private void createGroupsFromDatabase(){
 		//get list of groups
 		boolean foundDefault = false;
 		//need to avoid infinite loop, just in case
 		boolean alreadyRunAdd = false;
 		while(!foundDefault){			
-		
-		EntityManager em = emf.createEntityManager();
-		Query getGroups = em.createQuery("SELECT g FROM GroupEntity g WHERE g.deleted=:deleted");
-		getGroups.setParameter("deleted", false);
-		List<?> groups = getGroups.getResultList();
-		em.close();
-		//make a folder for each group in pdps folders
-		Path pdpsPath = Paths.get("pdps");
-		try {
-			FileUtils.forceDelete(pdpsPath.toFile());
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		try {
-			FileUtils.forceMkdir(pdpsPath.toFile());
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		Properties propertyFileProperties = new Properties();
-		String groupList = "";
-		String defaultGroup = "";
-		for(Object o : groups){
-			GroupEntity group = (GroupEntity)o;
-			Path groupPath = Paths.get(pdpsPath.toString(), group.getGroupId());
-			try {
-				FileUtils.forceMkdir(groupPath.toFile());
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			Properties policyProperties = new Properties();
-			String rootPolicies = "";
-			for(PolicyEntity policy : group.getPolicies()){
-				Path newPolicyPath = Paths.get(groupPath.toString(),getPdpPolicyName(policy.getPolicyName(),policy.getScope()));
-				File newPolicyFile = newPolicyPath.toFile();
+
+			EntityManager em = emf.createEntityManager();
+			Query getGroups = em.createQuery("SELECT g FROM GroupEntity g WHERE g.deleted=:deleted");
+			getGroups.setParameter("deleted", false);
+			List<?> groups = getGroups.getResultList();
+			em.close();
+			//make a folder for each group in pdps folders
+			Path pdpsPath = Paths.get(XACMLProperties.getProperty("xacml.pap.pdps"));
+			if(!pdpsPath.toFile().exists()){
 				try {
-					newPolicyFile.createNewFile();
+					FileUtils.forceMkdir(pdpsPath.toFile());
 				} catch (IOException e) {
-					// TODO Auto-generated catch block
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not make the new pdps folder; one does not exist");
+				}
+			}
+			Properties propertyFileProperties = new Properties();
+			String groupList = "";
+			String defaultGroup = "";
+			HashSet<String> currentGroupPaths = new HashSet<String>();
+			for(Object o : groups){
+				GroupEntity group = (GroupEntity)o;
+				Path groupPath = Paths.get(pdpsPath.toString(), group.getGroupId());
+	            currentGroupPaths.add(groupPath.getFileName().toString());
+	            if(groupPath.toFile().exists()){
+	                try {
+	                    FileUtils.forceDelete(Paths.get(groupPath.toString(), "xacml.policy.properties").toFile());
+	                } catch (IOException e) {
+	                    PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete old xacml.policy.properties file");
+	                }
+	                File[] xmlFiles = groupPath.toFile().listFiles(new FileFilter(){
+	     
+	                    @Override
+	                    public boolean accept(File pathname) {
+	                        return pathname.toString().endsWith(".xml");
+	                    }
+	                    
+	                });
+	                for(File deleteMe : xmlFiles){
+	                    try {
+	                        FileUtils.forceDelete(deleteMe);
+	                    } catch (IOException e) {
+	                        PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete one of the policy files that we are going to replace: "+deleteMe.toString());
+	                    }
+	                }
+	            } else {
+				try {
+					FileUtils.forceMkdir(groupPath.toFile());
+				} catch (IOException e) {
 					e.printStackTrace();
 				}
-				try {
-					FileOutputStream policyFileStream = new FileOutputStream(newPolicyFile);
+			}
+				Properties policyProperties = new Properties();
+				String rootPolicies = "";
+				for(PolicyEntity policy : group.getPolicies()){
+					Path newPolicyPath = Paths.get(groupPath.toString(),getPdpPolicyName(policy.getPolicyName(),policy.getScope()));
+					File newPolicyFile = newPolicyPath.toFile();
+					try {
+						newPolicyFile.createNewFile();
+					} catch (IOException e) {
+						PolicyLogger.error(e.getMessage());
+					}
+					try {
+						FileOutputStream policyFileStream = new FileOutputStream(newPolicyFile);
 						policyFileStream.write(policy.getPolicyData().getBytes("UTF-8"));
-					policyFileStream.close();
-				} catch (IOException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
+						policyFileStream.close();
+					} catch (IOException e) {
+						PolicyLogger.error(e.getMessage());
+					}
+					policyProperties.setProperty(getPdpPolicyName(policy.getPolicyName(),policy.getScope())+".name",removeExtensionAndVersionFromPolicyName(policy.getPolicyName()));
+					rootPolicies += ",".concat(getPdpPolicyName(policy.getPolicyName(),policy.getScope()));
 				}
-				policyProperties.setProperty(getPdpPolicyName(policy.getPolicyName(),policy.getScope())+".name",removeExtensionAndVersionFromPolicyName(policy.getPolicyName()));
-				rootPolicies += ",".concat(getPdpPolicyName(policy.getPolicyName(),policy.getScope()));
+				Path xacmlPolicyPropertiesPath = Paths.get(groupPath.toString(),"xacml.policy.properties");
+				File xacmlPolicyPropertiesFile = xacmlPolicyPropertiesPath.toFile();
+				if(rootPolicies.length() > 0){
+					rootPolicies = rootPolicies.substring(1);
+				}
+				policyProperties.setProperty("xacml.referencedPolicies", "");
+				policyProperties.setProperty("xacml.rootPolicies", rootPolicies);
+
+				try {
+					xacmlPolicyPropertiesFile.createNewFile();
+				} catch (IOException e) {
+					PolicyLogger.error(e.getMessage());
+				}
+				try {
+					FileOutputStream xacmlPolicyPropertiesFileStream = new FileOutputStream(xacmlPolicyPropertiesFile);
+					policyProperties.store(xacmlPolicyPropertiesFileStream, "");
+					xacmlPolicyPropertiesFileStream.close();
+				} catch (IOException e) {
+					PolicyLogger.error(e.getMessage());
+				}
+
+				em = emf.createEntityManager();
+				Query getPdpsQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.groupEntity=:group AND p.deleted=:deleted");
+				getPdpsQuery.setParameter("group", group);
+				getPdpsQuery.setParameter("deleted", false);
+				List<?> pdps = getPdpsQuery.getResultList();
+				em.close();			
+				String pdpLine = "";
+				for(Object o2 : pdps){
+					PdpEntity pdp = (PdpEntity)o2;
+					pdpLine += ",".concat(pdp.getPdpId());
+					propertyFileProperties.setProperty(pdp.getPdpId()+".description",pdp.getDescription());
+					propertyFileProperties.setProperty(pdp.getPdpId()+".jmxport",String.valueOf(pdp.getJmxPort()));
+					propertyFileProperties.setProperty(pdp.getPdpId()+".name",pdp.getPdpName());
+				}
+				if(pdpLine.length() > 0){
+					pdpLine = pdpLine.substring(1);
+				}
+				propertyFileProperties.setProperty(group.getGroupId()+".description", group.getDescription());
+				propertyFileProperties.setProperty(group.getGroupId()+".name", group.getgroupName());
+				propertyFileProperties.setProperty(group.getGroupId()+".pdps",pdpLine);
+				groupList += ",".concat(group.getGroupId());
+				if(group.isDefaultGroup()){
+					defaultGroup = group.getGroupId();
+					foundDefault = true;
+				}
 			}
-			Path xacmlPolicyPropertiesPath = Paths.get(groupPath.toString(),"xacml.policy.properties");
-			File xacmlPolicyPropertiesFile = xacmlPolicyPropertiesPath.toFile();
-			if(rootPolicies.length() > 0){
-				rootPolicies = rootPolicies.substring(1);
+	        //check the list of directories in the pdps folder and make sure none should be deleted
+	        File[] filesInPdpsFolder = pdpsPath.toFile().listFiles(new FileFilter(){
+	            @Override
+	            public boolean accept(File pathname) {
+	                return pathname.isDirectory();
+	            }
+	        });
+	        for(File f : filesInPdpsFolder){
+	            if(f.isDirectory()){
+	                if(!currentGroupPaths.contains(f.toPath().getFileName().toString())){
+	                    try {
+	                        FileUtils.forceDelete(f);
+	                    } catch (IOException e) {
+	                        PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete pdp group folder, which has been deleted from the database");
+	                    }
+	                }
+	            }
+	        }
+			if(!foundDefault && !alreadyRunAdd){
+				alreadyRunAdd = true;
+				//add default group to db
+				try{
+					em = emf.createEntityManager();
+					em.getTransaction().begin();
+					GroupEntity newDefaultGroup = new GroupEntity();
+					em.persist(newDefaultGroup);
+					newDefaultGroup.setDescription("The default group where new PDP's are put.");
+					newDefaultGroup.setGroupId("default");
+					newDefaultGroup.setGroupName("default");
+					newDefaultGroup.setDefaultGroup(true);
+					newDefaultGroup.setCreatedBy("automaticallyAdded");
+					newDefaultGroup.setModifiedBy("automaticallyAdded");
+					em.flush();
+					em.getTransaction().commit();		
+					continue;
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not add a new default group to the database");
+				}
 			}
-			policyProperties.setProperty("xacml.referencedPolicies", "");
-			policyProperties.setProperty("xacml.rootPolicies", rootPolicies);
-			
+
+			Path xacmlPropertiesPath = Paths.get(pdpsPath.toString(),"xacml.properties");
+			File xacmlPropertiesFile = xacmlPropertiesPath.toFile();
+			if(groupList.length()>0){
+				groupList = groupList.substring(1);
+			}
+			propertyFileProperties.setProperty("xacml.pap.groups",groupList);
+			propertyFileProperties.setProperty("xacml.pap.groups.default",defaultGroup);
+	        try {
+	            FileUtils.forceDelete(xacmlPropertiesFile);
+	        } catch (IOException e) {
+	            PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not delete the old xacml.properties file");
+	        }
 			try {
-				xacmlPolicyPropertiesFile.createNewFile();
+				xacmlPropertiesFile.createNewFile();
 			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+				PolicyLogger.error(e.getMessage());
 			}
 			try {
-				FileOutputStream xacmlPolicyPropertiesFileStream = new FileOutputStream(xacmlPolicyPropertiesFile);
-				//xacmlPolicyPropertiesFileStream.write(xacmlPolicyProperties.getBytes("UTF-8"));
-				policyProperties.store(xacmlPolicyPropertiesFileStream, "");
-				xacmlPolicyPropertiesFileStream.close();
+				FileOutputStream xacmlPropertiesFileStream = new FileOutputStream(xacmlPropertiesFile);
+				propertyFileProperties.store(xacmlPropertiesFileStream, "");
+				xacmlPropertiesFileStream.close();
 			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
+				PolicyLogger.error(e.getMessage());
 			}
-			
-			em = emf.createEntityManager();
-			Query getPdpsQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.groupEntity=:group AND p.deleted=:deleted");
-			getPdpsQuery.setParameter("group", group);
-			getPdpsQuery.setParameter("deleted", false);
-			List<?> pdps = getPdpsQuery.getResultList();
-			em.close();			
-			String pdpLine = "";
-			for(Object o2 : pdps){
-				PdpEntity pdp = (PdpEntity)o2;
-				pdpLine += ",".concat(pdp.getPdpId());
-				propertyFileProperties.setProperty(pdp.getPdpId()+".description",pdp.getDescription());
-				propertyFileProperties.setProperty(pdp.getPdpId()+".jmxport",String.valueOf(pdp.getJmxPort()));
-				propertyFileProperties.setProperty(pdp.getPdpId()+".name",pdp.getPdpName());
-			}
-			if(pdpLine.length() > 0){
-				pdpLine = pdpLine.substring(1);
-			}
-			propertyFileProperties.setProperty(group.getGroupId()+".description", group.getDescription());
-			propertyFileProperties.setProperty(group.getGroupId()+".name", group.getgroupName());
-			propertyFileProperties.setProperty(group.getGroupId()+".pdps",pdpLine);
-			groupList += ",".concat(group.getGroupId());
-			if(group.isDefaultGroup()){
-				defaultGroup = group.getGroupId();
-				foundDefault = true;
-			}
-		}
-		if(!foundDefault && !alreadyRunAdd){
-			alreadyRunAdd = true;
-			//add default group to db
-			try{
-			em = emf.createEntityManager();
-			em.getTransaction().begin();
-			GroupEntity newDefaultGroup = new GroupEntity();
-			em.persist(newDefaultGroup);
-			newDefaultGroup.setDescription("The default group where new PDP's are put.");
-			newDefaultGroup.setGroupId("default");
-			newDefaultGroup.setGroupName("default");
-			newDefaultGroup.setDefaultGroup(true);
-			newDefaultGroup.setCreatedBy("automaticallyAdded");
-			newDefaultGroup.setModifiedBy("automaticallyAdded");
-			em.flush();
-			em.getTransaction().commit();		
-			continue;
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Could not add a new default group to the database",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not add a new default group to the database");
-			}
-		}
-		
-		Path xacmlPropertiesPath = Paths.get(pdpsPath.toString(),"xacml.properties");
-		File xacmlPropertiesFile = xacmlPropertiesPath.toFile();
-		if(groupList.length()>0){
-			groupList = groupList.substring(1);
-		}
-		propertyFileProperties.setProperty("xacml.pap.groups",groupList);
-		propertyFileProperties.setProperty("xacml.pap.groups.default",defaultGroup);
-		try {
-			xacmlPropertiesFile.createNewFile();
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		try {
-			FileOutputStream xacmlPropertiesFileStream = new FileOutputStream(xacmlPropertiesFile);
-			//xacmlPropertiesFileStream.write(fileContents.getBytes("UTF-8"));
-			propertyFileProperties.store(xacmlPropertiesFileStream, "");
-			xacmlPropertiesFileStream.close();
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		//if we get this far down, something went wrong and we don't want to get stuck in the loop
-		foundDefault = true;
+			//if we get this far down, something went wrong and we don't want to get stuck in the loop
+			foundDefault = true;
 		}
 		//put policies in group folder
 		//create xacml.policy.properties in each folder with list of policies in that folder
@@ -1318,8 +1300,6 @@
 		//create xacml.properties with list of groups and pdps and other info
 	}
 
-	
-	//FIXME error checking and logging
 	private String getPdpPolicyName(String name, String scope){
 		String finalName = "";
 		finalName += scope;
@@ -1331,28 +1311,22 @@
 	private String removeFileExtension(String fileName){
 		return fileName.substring(0, fileName.lastIndexOf('.'));
 	}
-	
+
 	private String buildPolicyScopeDirectory(PolicyEntity policy){
 		String repo = buildPolicyDirectory();
 
 		String policyScope = policy.getScope();
 		if(policyScope == null){
 			policyScope = "";
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("buildPolicyScopeDirectory("+policy+") computed null policyScope. Using blank.");
 			PolicyLogger.error("buildPolicyScopeDirectory("+policy+") computed null policyScope. Using blank.");
 		} else {
 			policyScope = policyScope.replace(".", FileSystems.getDefault().getSeparator());	
 		}
 		if(policyScope == null){
 			policyScope = "";
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("buildPolicyScopeDirectory("+policy+") computed null policyScope. Using blank.");
 			PolicyLogger.error("buildPolicyScopeDirectory("+policy+") computed null policyScope. Using blank.");
 		}
 		if(repo == null){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("buildPolicyScopeDirectory("+policy+") received null repo. Using blank.");
 			PolicyLogger.error("buildPolicyScopeDirectory("+policy+") received null repo. Using blank.");
 			repo = "";
 		}
@@ -1360,8 +1334,6 @@
 		if(returnPath !=  null){
 			return returnPath.toString();
 		} else {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("buildPolicyScopeDirectory("+policy+") computed null path");
 			PolicyLogger.error("buildPolicyScopeDirectory("+policy+") received null repo. Using blank.");
 			return "";
 		}
@@ -1372,25 +1344,20 @@
 		String repo = buildPolicyDirectory();		
 		policyScope = policyScope.replace(".", FileSystems.getDefault().getSeparator());
 		return repo + FileSystems.getDefault().getSeparator() + policyScope;
-		
+
 	}
-	
+
 	private static String buildPolicyDirectory(){
 		Path workspacePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE), getDefaultWorkspace());
 		Path repositoryPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
 		Path gitPath = Paths.get(workspacePath.toString(), repositoryPath.getFileName().toString());
-		
-    	/*
-    	 * Getting and Setting the parent path for Admin Console use when reading the policy files
-    	 */
-    	//domain chosen by the client to store the policy action files 
-    	//String domain = policy.getDomainDir();
-    	    	   
-    	
-    		
-    	//getting the fullpath of the gitPath and convert to string
-    	String policyDir = gitPath.toAbsolutePath().toString();
-    	
+
+		/*
+		 * Getting and Setting the parent path for Admin Console use when reading the policy files
+		 */
+		//getting the fullpath of the gitPath and convert to string
+		String policyDir = gitPath.toAbsolutePath().toString();
+
 
 		if(policyDir.contains("\\")){
 			policyDir = policyDir.replace("XACML-PAP-REST", "XACML-PAP-ADMIN");
@@ -1399,32 +1366,32 @@
 				policyDir = policyDir.replace("pap", "console");
 			}
 		}
-    	logger.debug("policyDir: " + policyDir);
+		logger.debug("policyDir: " + policyDir);
 		return policyDir;
 	}
-	
+
 	private Path getPolicySubFile(String filename, String subFileType){
 		logger.debug("getPolicySubFile(" + filename + ", " + subFileType + ")");
 		Path filePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS).toString(), subFileType);
 		File file = null;
-		
+
 		filename = FilenameUtils.removeExtension(filename);
-		
+
 		for(File tmpFile : filePath.toFile().listFiles()){
 			if (FilenameUtils.removeExtension(tmpFile.getName()).equals(filename)){
 				file = tmpFile;
 			}
 		}
-		
+
 		Path finalPath = null;
 		if (file!= null){
 			finalPath = Paths.get(file.getAbsolutePath());
 		}
-		
+
 		logger.debug("end of getPolicySubFile: " + finalPath);
 		return finalPath;	
 	}
-		
+
 	private boolean writePolicySubFile(PolicyEntity policy, String policyType){
 		logger.info("writePolicySubFile with policyName[" + policy.getPolicyName() + "] and policyType[" + policyType + "]");
 		String type = null;
@@ -1434,10 +1401,10 @@
 			type = "Config";
 			subTypeName = FilenameUtils.removeExtension(policy.getConfigurationData().getConfigurationName());
 			subTypeBody = policy.getConfigurationData().getConfigBody();
-			
+
 			String configType = policy.getConfigurationData().getConfigType();
-			
-			
+
+
 			if (configType != null) {
 				if (configType.equals(JSON_CONFIG)) {
 					subTypeName = subTypeName + ".json";
@@ -1452,13 +1419,13 @@
 					subTypeName = subTypeName + ".txt";
 				}
 			}
-			
+
 		}else if (policyType.equalsIgnoreCase("action")){
 			type = "Action";
 			subTypeName = policy.getActionBodyEntity().getActionBodyName();
 			subTypeBody = policy.getActionBodyEntity().getActionBody();
-			
-			
+
+
 		}
 		Path filePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS).toString(), type);
 
@@ -1466,28 +1433,26 @@
 			subTypeBody = "";
 		}
 		boolean success = false;
-			try {
-				Files.deleteIfExists(Paths.get(filePath.toString(), subTypeName));
-				File file = Paths.get(filePath.toString(),subTypeName).toFile();
-				file.createNewFile();
-				FileWriter fileWriter = new FileWriter(file, false); // false to overwrite
-				fileWriter.write(subTypeBody);
-				fileWriter.close();
-				success = true;
+		try {
+			Files.deleteIfExists(Paths.get(filePath.toString(), subTypeName));
+			File file = Paths.get(filePath.toString(),subTypeName).toFile();
+			file.createNewFile();
+			FileWriter fileWriter = new FileWriter(file, false); // false to overwrite
+			fileWriter.write(subTypeBody);
+			fileWriter.close();
+			success = true;
 
-			} catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Exception occured while creating Configuration File for Policy : " + policy.getPolicyName(), e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Exception occured while creating Configuration File for Policy : " + policy.getPolicyName());
-			}					
-		
+		} catch (Exception e) {
+			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Exception occured while creating Configuration File for Policy : " + policy.getPolicyName());
+		}					
+
 		return success;
-		
+
 	}
-	
+
 	private String getPolicySubType(String filename){
 		String type = null;
-	
+
 		if (filename != null) {
 			if (FilenameUtils.getExtension(filename).equalsIgnoreCase("json")) {
 				type = ConfigPolicy.JSON_CONFIG;
@@ -1502,36 +1467,34 @@
 				type = ConfigPolicy.OTHER_CONFIG;
 			}
 		}
-			
+
 		return type;
-		
+
 	}
-	
-	
+
+
 	private  void convertFileToDBEntry(Path path){
 		logger.info("convertFileToDBEntry");
-		
+
 		if(path.toString().contains(".git")){
 			return;
 		}
-		
+
 		String filename = path.getFileName().toString();
 		if (filename.contains(".svnignore")){
 			return;
 		}
 
 		String[] scopeAndName = getScopeAndNameAndType(path.toString());
-		
+
 		if(scopeAndName == null){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("convertFileToDBEntry error: getScopeAndNameAndType(" + path.toString() + " is null!");
 			PolicyLogger.error("convertFileToDBEntry error: getScopeAndNameAndType(" + path.toString() + " is null!");
 			return;
 		}
 
 		EntityManager em = emf.createEntityManager();
 		em.getTransaction().begin();
-		
+
 		PolicyEntity policy = new PolicyEntity();
 		em.persist(policy);
 		String policyScope = scopeAndName[0];
@@ -1548,18 +1511,16 @@
 			//we want the last index +1 because we don't want the dot
 			version = Integer.parseInt(newName.substring(newName.lastIndexOf(".")+1)); 
 		} catch(Exception e){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Could not get the policy version number from "+newName);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not get the policy version number from "+newName);
 		}
 		newName = newScope + File.separator + newName.substring(0, newName.lastIndexOf("."));	
 
 		Query query = em.createNamedQuery("PolicyVersion.findByPolicyName");
 		query.setParameter("pname", newName);
-		
+
 		List<?> result = query.getResultList();
 		PolicyVersion versionEntity = null;
-		
+
 		if (!result.isEmpty()) {
 			logger.info("Result is not empty");
 			versionEntity = (PolicyVersion) result.get(0);
@@ -1570,7 +1531,7 @@
 			logger.info("result is empty");
 			Calendar calendar = Calendar.getInstance();
 			Timestamp createdDate = new Timestamp(calendar.getTime().getTime());
-			
+
 			versionEntity = new PolicyVersion();
 			em.persist(versionEntity);
 			versionEntity.setPolicyName(newName);
@@ -1581,21 +1542,19 @@
 			versionEntity.setCreatedDate(createdDate);
 			versionEntity.setModifiedDate(createdDate);
 		}
-		
-		
+
+
 		try {
 			String policyContent = new String(Files.readAllBytes(path));
 			policy.setDescription(getElementFromXMLString("/Description", policyContent));
 			policy.setPolicyData(policyContent);
 		} catch (IOException e1) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("convertFileToDBEntry error settingPolicyData: " + e1.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "convertFileToDBEntry error settingPolicyData");
 			em.getTransaction().rollback();
 			em.close();
 			return;
 		}
-		
+
 		if((scopeAndName[2].equalsIgnoreCase("Config"))){
 			String scopeName = scopeAndName[0] + "." + scopeAndName[1];
 			Path subFilePath = getPolicySubFile(scopeName, scopeAndName[2]);
@@ -1610,10 +1569,8 @@
 				configData.setCreatedBy(AUDIT_USER);
 				configData.setModifiedBy(AUDIT_USER);
 				policy.setConfigurationData(configData);
-				
+
 			} catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("convertFileToDBEntry error for Config policy: " + e.getMessage());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "convertFileToDBEntry error for Config policy");
 				em.getTransaction().rollback();
 				em.close();
@@ -1631,10 +1588,8 @@
 				actionBody.setCreatedBy(AUDIT_USER);
 				actionBody.setModifiedBy(AUDIT_USER);
 				policy.setActionBodyEntity(actionBody);
-				
+
 			} catch (Exception e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("convertFileToDBEntry error for Action policy: " + e.getMessage());
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "convertFileToDBEntry error for Action policy");
 				em.getTransaction().rollback();
 				em.close();
@@ -1645,7 +1600,7 @@
 		em.getTransaction().commit();
 		em.close();
 	}
-	
+
 	private void deleteAllPolicyTables(){
 		EntityManager em = emf.createEntityManager();
 		em.getTransaction().begin();
@@ -1659,9 +1614,9 @@
 		deletePolicyVersionEntityTableUpdate.executeUpdate();
 		em.getTransaction().commit();
 		em.close();
-		
+
 	}
-		
+
 	public void auditLocalDatabase(PAPPolicyEngine papEngine2){
 		logger.debug("PolicyDBDao.auditLocalDatabase() is called");
 		Path webappsPath = Paths.get(buildPolicyDirectory());
@@ -1672,13 +1627,11 @@
 			Files.walk(webappsPath).filter(Files::isRegularFile).forEach(this::convertFileToDBEntry);
 			auditGroups(papEngine2);
 		} catch(Exception e){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("auditLocalDatabase() error: " + e.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "auditLocalDatabase() error");
 			e.printStackTrace();
 		}		
 	}
-	
+
 	/**
 	 * Audits and loads the local file system to match the database version.
 	 */
@@ -1700,8 +1653,6 @@
 			Path repoWithScope = Paths.get(webappsPath.toString(), XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DOMAIN));
 			Files.createDirectories(repoWithScope);
 		} catch (IOException e2) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("Error occurred while creating / clearing Config and Policy filesystem directories", e2);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Error occurred while creating / clearing Config and Policy filesystem directories");
 		}
 
@@ -1739,14 +1690,12 @@
 					XACMLPolicyWriter.writePolicyFile(newPath, (PolicyType) policyData);		
 				}
 			} catch (Exception e1) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Error occurred while creating Policy File: " + name, e1);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "Error occurred while creating Policy File: " + name);
 			}		
 		}	
 		createGroupsFromDatabase();
 	}
-	
+
 	public void deleteAllGroupTables(){
 		logger.debug("PolicyDBDao.deleteAllGroupTables() called");
 		EntityManager em = emf.createEntityManager();
@@ -1754,95 +1703,89 @@
 
 		Query deletePdpEntityEntityTableUpdate = em.createNamedQuery("PdpEntity.deleteAll");
 		deletePdpEntityEntityTableUpdate.executeUpdate();
-		
+
 		Query deleteGroupEntityTableUpdate = em.createNamedQuery("GroupEntity.deleteAll");
 		deleteGroupEntityTableUpdate.executeUpdate();
-		
+
 		em.getTransaction().commit();
 		em.close();
 	}
-	
+
 	@SuppressWarnings("unchecked")
 	public void auditGroups(PAPPolicyEngine papEngine2){
 		logger.debug("PolicyDBDao.auditGroups() called");
-		
+
 		EntityManager em = emf.createEntityManager();
 		em.getTransaction().begin();
 		final String AUDIT_STR = "Audit";
 		try{
 
 			Set<EcompPDPGroup> groups = papEngine2.getEcompPDPGroups();
-			
+
 			for (EcompPDPGroup grp : groups){
 				try{
-				GroupEntity groupEntity = new GroupEntity();
-				em.persist(groupEntity);
-				groupEntity.setGroupName(grp.getName());
-				groupEntity.setDescription(grp.getDescription());
-				groupEntity.setDefaultGroup(grp.isDefaultGroup());
-				groupEntity.setCreatedBy(AUDIT_STR);
-				groupEntity.setGroupId(createNewPDPGroupId(grp.getId()));
-				groupEntity.setModifiedBy(AUDIT_STR);
-				Set<EcompPDP> pdps =  grp.getEcompPdps();				
-				
-				for(EcompPDP pdp : pdps){
-					PdpEntity pdpEntity = new PdpEntity();
-					em.persist(pdpEntity);
-					pdpEntity.setGroup(groupEntity);
-					pdpEntity.setJmxPort(pdp.getJmxPort());
-					pdpEntity.setPdpId(pdp.getId());
-					pdpEntity.setPdpName(pdp.getName());
-					pdpEntity.setModifiedBy(AUDIT_STR);
-					pdpEntity.setCreatedBy(AUDIT_STR);
-					
-				}
-				
-				Set<PDPPolicy> policies = grp.getPolicies();
-				
-				for(PDPPolicy policy : policies){
-					try{
-					String[] stringArray = getNameScopeAndVersionFromPdpPolicy(policy.getId());
-					List<PolicyEntity> policyEntityList;
-					Query getPolicyEntitiesQuery = em.createNamedQuery("PolicyEntity.findByNameAndScope");
-					getPolicyEntitiesQuery.setParameter("name", stringArray[0]);
-					getPolicyEntitiesQuery.setParameter("scope", stringArray[1]);
-					
-					policyEntityList = getPolicyEntitiesQuery.getResultList();
-					PolicyEntity policyEntity = null;
-					if(policyEntityList.size() < 1){
-						policyEntity = addPolicyThatOnlyExistsInPdpGroup(policy.getId(),Paths.get("pdps",grp.getId(),policy.getId()),em);
-					} else {
-						policyEntity = policyEntityList.get(0);
+					GroupEntity groupEntity = new GroupEntity();
+					em.persist(groupEntity);
+					groupEntity.setGroupName(grp.getName());
+					groupEntity.setDescription(grp.getDescription());
+					groupEntity.setDefaultGroup(grp.isDefaultGroup());
+					groupEntity.setCreatedBy(AUDIT_STR);
+					groupEntity.setGroupId(createNewPDPGroupId(grp.getId()));
+					groupEntity.setModifiedBy(AUDIT_STR);
+					Set<EcompPDP> pdps =  grp.getEcompPdps();				
+
+					for(EcompPDP pdp : pdps){
+						PdpEntity pdpEntity = new PdpEntity();
+						em.persist(pdpEntity);
+						pdpEntity.setGroup(groupEntity);
+						pdpEntity.setJmxPort(pdp.getJmxPort());
+						pdpEntity.setPdpId(pdp.getId());
+						pdpEntity.setPdpName(pdp.getName());
+						pdpEntity.setModifiedBy(AUDIT_STR);
+						pdpEntity.setCreatedBy(AUDIT_STR);
+
 					}
-					if(policyEntity != null){
-						groupEntity.addPolicyToGroup(policyEntity);
+
+					Set<PDPPolicy> policies = grp.getPolicies();
+
+					for(PDPPolicy policy : policies){
+						try{
+							String[] stringArray = getNameScopeAndVersionFromPdpPolicy(policy.getId());
+							List<PolicyEntity> policyEntityList;
+							Query getPolicyEntitiesQuery = em.createNamedQuery("PolicyEntity.findByNameAndScope");
+							getPolicyEntitiesQuery.setParameter("name", stringArray[0]);
+							getPolicyEntitiesQuery.setParameter("scope", stringArray[1]);
+
+							policyEntityList = getPolicyEntitiesQuery.getResultList();
+							PolicyEntity policyEntity = null;
+							if(policyEntityList.size() < 1){
+								policyEntity = addPolicyThatOnlyExistsInPdpGroup(policy.getId(),Paths.get(XACMLProperties.getProperty("xacml.pap.pdps"),grp.getId(),policy.getId()),em);
+							} else {
+								policyEntity = policyEntityList.get(0);
+							}
+							if(policyEntity != null){
+								groupEntity.addPolicyToGroup(policyEntity);
+							}
+						}catch(Exception e2){
+							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Exception auditGroups inner catch");
+						}
 					}
-					}catch(Exception e2){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("ERROR: " + e2);
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Exception auditGroups inner catch");
-					}
-				}
 				}catch(Exception e1){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("ERROR: " + e1);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "Exception auditGroups middle catch");
 				}
 			}
 		}catch(Exception e){
 			em.getTransaction().rollback();
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("ERROR: " + e);
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Exception auditGroups outer catch");
 			em.close();
 			return;
 		}
-		
+
 		em.getTransaction().commit();
 		em.close();
-		
+
 	}
-	
+
 	private PolicyEntity addPolicyThatOnlyExistsInPdpGroup(String polId, Path path,EntityManager em){
 		String filename = path.getFileName().toString();
 		if (filename.contains(".svnignore")){
@@ -1850,15 +1793,12 @@
 		}
 
 		String[] scopeAndName = getNameScopeAndVersionFromPdpPolicy(polId);
-		
+
 		if(scopeAndName == null){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("convertFileToDBEntry error: getScopeAndNameAndType(" + polId.toString() + " is null!");
 			PolicyLogger.error("convertFileToDBEntry error: getScopeAndNameAndType(" + polId.toString() + " is null!");
 			return null;
 		}
 
-		
 		PolicyEntity policy = new PolicyEntity();
 		em.persist(policy);
 		String policyScope = scopeAndName[1];
@@ -1868,39 +1808,31 @@
 		policy.setCreatedBy(AUDIT_USER);
 		policy.setModifiedBy(AUDIT_USER);
 		policy.setDeleted(true);
-		
+
 		try {
 			String policyContent = new String(Files.readAllBytes(path));
 			policy.setDescription(getElementFromXMLString("/Description", policyContent));
 			policy.setPolicyData(policyContent);
 			em.flush();
-			//em.getTransaction().commit();
 		} catch (IOException e1) {
-			// TODO Auto-generated catch block
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error("convertFileToDBEntry error settingPolicyData: " + e1.getMessage());
 			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "convertFileToDBEntry error settingPolicyData");
 			return null;
 		}
-		//em.close();
 		return policy;
 	}
-	
-	private String getConfigFile(String filename, String scope, PolicyRestAdapter policy){
+
+	private String getConfigFile(String filename, PolicyRestAdapter policy){
 		if(policy == null){
-			return getConfigFile(filename, scope, (String)null);
+			return getConfigFile(filename, (String)null);
 		}
-		return getConfigFile(filename, scope, policy.getConfigType());
+		return getConfigFile(filename, policy.getConfigType());
 	}
 	//copied from ConfigPolicy.java and modified
 	// Here we are adding the extension for the configurations file based on the
 	// config type selection for saving.
-	private String getConfigFile(String filename, String scope, String configType) {
-		logger.debug("getConfigFile(String filename, String scope, String configType) as getConfigFile("+filename+", "+scope+", "+configType+") called");
+	private String getConfigFile(String filename, String configType) {
+		logger.debug("getConfigFile(String filename, String scope, String configType) as getConfigFile("+filename+", "+configType+") called");
 		filename = FilenameUtils.removeExtension(filename);
-//		if (filename.endsWith(".xml")) {
-//			filename = filename.substring(0, filename.length() - 4);
-//		}
 		String id = configType;
 
 		if (id != null) {
@@ -1917,9 +1849,9 @@
 				filename = filename + ".txt";
 			}
 		}
-		return scope + "." + filename;
+		return filename;
 	}
-	
+
 	/**
 	 * Constructs the file name of a policy.
 	 * @param policy The name of a policy (ex: mypolicy1)
@@ -1939,7 +1871,7 @@
 		String concats =  namePrefix + "_" +policy.getPolicyName() + ".xml";
 		return concats;
 	}
-	
+
 	private String stripPolicyName(String policyFileName){
 		String policyName = policyFileName;
 		try{
@@ -1950,17 +1882,16 @@
 		}
 		return policyName;
 	}
-	//FIXME error check, logs
+	
 	private String[] getNameScopeAndVersionFromPdpPolicy(String fileName){
 		String[] splitByDots = fileName.split("\\.");
 		if(splitByDots.length < 3){
-			//throw something
+			//should we throw something
 			return null;
 		}
 		String policyName = splitByDots[splitByDots.length-3];
 		String version = splitByDots[splitByDots.length-2];
 		//policy names now include version
-		policyName += "."+version +".xml";
 		String scope = "";
 		for(int i=0;i<splitByDots.length-3;i++){
 			scope += ".".concat(splitByDots[i]);
@@ -1970,12 +1901,12 @@
 			scope = scope.substring(1);
 		}
 		String[] returnArray = new String[3];
-		returnArray[0] = policyName;
+		returnArray[0] = policyName + "." + version + ".xml";
 		returnArray[2] = version;
 		returnArray[1] = scope;
 		return returnArray;
 	}
-	
+
 	/**
 	 * Constructs the complete repository path based on the properties files
 	 * @return The repository path
@@ -1988,7 +1919,7 @@
 		logger.debug("after gitPath: " + gitPath);
 		return gitPath.toString();
 	}
-	
+
 	//copied from StdEngine.java
 	public static String createNewPDPGroupId(String name) {
 		String id = name;
@@ -2010,7 +1941,7 @@
 
 		return id;
 	}
-	
+
 	/**
 	 * Checks if any of the given strings are empty or null
 	 * @param strings One or more Strings (or nulls) to check if they are null or empty
@@ -2027,16 +1958,16 @@
 		}
 		return false;
 	}
-	
+
 	/**
 	 * Computes the scope, name, and type of a policy based on its file path
 	 * @param path The file path of the policy (including the xml policy file)
-	 * @return A string array of size 3. 1: the scope of the policy  2: the name of the policy (Config_mypol.xml) 3: the type (Config). Or, null if the path can not be parsed.
+	 * @return A string array of size 3. 1: the scope of the policy 2: the name of the policy (Config_mypol.xml) 3: the type (Config). Or, null if the path can not be parsed.
 	 */
 	private static String[] getScopeAndNameAndType(String path){
 		logger.debug("getScopeAndNameAndType(String path) as getScopeAndNameAndType("+path+") called");
 		if(path == null){
-			
+
 		}
 		String gitPath  = getGitPath();
 
@@ -2064,7 +1995,7 @@
 			return null;
 		}
 		String scopeAndName = path.substring(path.indexOf(gitPath)+gitPath.length());
-	
+
 		logger.debug("scopeAndName: " + scopeAndName);
 		String policyType = null;
 		String[] policyTypes = {"Config_","Action_","Decision_"};
@@ -2116,7 +2047,7 @@
 		return returnArray;
 	}
 
-	
+
 	private class PolicyDBDaoTransactionInstance implements PolicyDBDaoTransaction {
 		private EntityManager em;
 		private final Object emLock = new Object();
@@ -2126,7 +2057,7 @@
 		String newGroupId;
 		private boolean operationRun = false;
 		private final Thread transactionTimer;
-		
+
 		private PolicyDBDaoTransactionInstance(){
 			//call the constructor with arguments
 			this(Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_TRANS_TIMEOUT)),
@@ -2137,8 +2068,8 @@
 		private PolicyDBDaoTransactionInstance(int transactionTimeout, int transactionWaitTime){
 			if(logger.isDebugEnabled()){
 				logger.debug("\n\nPolicyDBDaoTransactionInstance() as PolicyDBDaoTransactionInstance() called:"
-					+ "\n   transactionTimeout = " + transactionTimeout
-					+ "\n   transactionWaitTime = " + transactionWaitTime + "\n\n");
+						+ "\n   transactionTimeout = " + transactionTimeout
+						+ "\n   transactionWaitTime = " + transactionWaitTime + "\n\n");
 			}
 			this.em = emf.createEntityManager();
 			policyId = -1;
@@ -2187,12 +2118,12 @@
 					}
 					rollbackTransaction();					
 				}
-				
+
 			}
-			
+
 			transactionTimer = new Thread(new TransactionTimer(transactionTimeout),"transactionTimerThread");
 			transactionTimer.start();
-			
+
 
 		}
 
@@ -2201,14 +2132,10 @@
 		}
 		private void checkBeforeOperationRun(boolean justCheckOpen){
 			if(!isTransactionOpen()){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("There is no transaction currently open");
 				PolicyLogger.error("There is no transaction currently open");
 				throw new IllegalStateException("There is no transaction currently open");
 			}
 			if(operationRun && !justCheckOpen){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("An operation has already been performed and the current transaction should be committed");
 				PolicyLogger.error("An operation has already been performed and the current transaction should be committed");
 				throw new IllegalStateException("An operation has already been performed and the current transaction should be committed");
 			}
@@ -2220,9 +2147,8 @@
 				logger.debug("commitTransaction() as commitTransaction() called");
 				if(!isTransactionOpen()){
 					logger.warn("There is no open transaction to commit");
-					//throw new IllegalStateException("There is no open transaction to commit");
 					try{
-					em.close();
+						em.close();
 					} catch(Exception e){
 						e.printStackTrace();
 					}
@@ -2231,29 +2157,22 @@
 				try{
 					em.getTransaction().commit();
 				} catch(RollbackException e){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught RollbackException on em.getTransaction().commit()",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught RollbackException on em.getTransaction().commit()");
 					throw new PersistenceException("The commit failed. Message:\n"+e.getMessage());
 				}
 				em.close();
-				//FIXME need to revisit
+				// need to revisit
 				if(policyId >= 0){
-					
 					if(newGroupId != null){
 						try{
 							notifyOthers(policyId,POLICY_NOTIFICATION,newGroupId);
 						} catch(Exception e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught Exception on notifyOthers("+policyId+","+POLICY_NOTIFICATION+","+newGroupId+")",e);
 							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+policyId+","+POLICY_NOTIFICATION+","+newGroupId+")");
 						}
 					} else {
 						try{
 							notifyOthers(policyId,POLICY_NOTIFICATION);
 						} catch(Exception e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught Exception on notifyOthers("+policyId+","+POLICY_NOTIFICATION+")",e);
 							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+policyId+","+POLICY_NOTIFICATION+")");
 						}
 					}
@@ -2261,21 +2180,17 @@
 				if(groupId >= 0){
 					//we don't want commit to fail just because this does
 					if(newGroupId != null){
-					try{
-						notifyOthers(groupId,GROUP_NOTIFICATION,newGroupId);
-					} catch(Exception e){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Caught Exception on notifyOthers("+groupId+","+GROUP_NOTIFICATION+","+newGroupId+")",e);
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+groupId+","+GROUP_NOTIFICATION+","+newGroupId+")");
-					}
+						try{
+							notifyOthers(groupId,GROUP_NOTIFICATION,newGroupId);
+						} catch(Exception e){
+							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+groupId+","+GROUP_NOTIFICATION+","+newGroupId+")");
+						}
 					} else {
-					try{
-						notifyOthers(groupId,GROUP_NOTIFICATION);
-					} catch(Exception e){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Caught Exception on notifyOthers("+groupId+","+GROUP_NOTIFICATION+")",e);	
-						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+groupId+","+GROUP_NOTIFICATION+")");
-					}
+						try{
+							notifyOthers(groupId,GROUP_NOTIFICATION);
+						} catch(Exception e){
+							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+groupId+","+GROUP_NOTIFICATION+")");
+						}
 					}
 				}
 				if(pdpId >= 0){
@@ -2283,8 +2198,6 @@
 					try{
 						notifyOthers(pdpId,PDP_NOTIFICATION);
 					} catch(Exception e){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Caught Exception on notifyOthers("+pdpId+","+PDP_NOTIFICATION+")",e);
 						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on notifyOthers("+pdpId+","+PDP_NOTIFICATION+")");
 					}
 				}
@@ -2293,7 +2206,7 @@
 				transactionTimer.interrupt();
 			}
 		}
-		
+
 		@Override
 		public void rollbackTransaction() {
 			logger.debug("rollbackTransaction() as rollbackTransaction() called");
@@ -2301,17 +2214,13 @@
 				if(isTransactionOpen()){	
 
 					try{
-					em.getTransaction().rollback();					
+						em.getTransaction().rollback();					
 					} catch(Exception e){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Could not rollback transaction");
 						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not rollback transaction");
 					}
 					try{
 						em.close();
 					}catch(Exception e){
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Could not close EntityManager");
 						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not close EntityManager");
 					}
 
@@ -2335,239 +2244,211 @@
 			logger.debug("createPolicy(PolicyRestAdapter policy, String username, String policyScope, String policyName, String policyDataString) as createPolicy("+policy+", "+username+", "+policyScope+", "+policyName+", "+policyDataString+") called");
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			//em.getTransaction().begin();
-			//FIXME if the policy is already found but deleted, when we update it should we reset the created by and version number?
-			Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.scope=:scope AND p.policyName=:policyName");			
-			createPolicyQuery.setParameter("scope", policyScope);
-			createPolicyQuery.setParameter("policyName", policyName);
-			//createPolicyQuery.setParameter("deleted", false);
-			List<?> createPolicyQueryList = createPolicyQuery.getResultList();
-			PolicyEntity newPolicyEntity;
-			boolean update;
-			if(createPolicyQueryList.size() < 1){
-				newPolicyEntity = new PolicyEntity();
-				update = false;
-			} else if(createPolicyQueryList.size() > 1){
-				//something went wrong
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
-				PolicyLogger.error("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
-				throw new PersistenceException("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
-			} else {
-				newPolicyEntity = (PolicyEntity)createPolicyQueryList.get(0);
-				update = true;
-			}			
-			
-			ActionBodyEntity newActionBodyEntity = null;
-			if(policy.getPolicyType().equals("Action")){
-				boolean abupdate = false;
-				if(newPolicyEntity.getActionBodyEntity() == null){
-					newActionBodyEntity = new ActionBodyEntity();
-				}else{
-					newActionBodyEntity = em.find(ActionBodyEntity.class, newPolicyEntity.getActionBodyEntity().getActionBodyId());
-					abupdate = true;
+				String configName = policyName;
+				if(policyName.contains("Config_")){
+					policyName = policyName.replace(".Config_", ":Config_");
+				}else if(policyName.contains("Action_")){
+					policyName = policyName.replace(".Action_", ":Action_");
+				}else if(policyName.contains("Decision_")){
+					policyName = policyName.replace(".Decision_", ":Decision_");
 				}
-
-				if(newActionBodyEntity != null){
-					if(!abupdate){
-						em.persist(newActionBodyEntity);
-					}
-					//build the file path
-					//trim the .xml off the end
-					String policyNameClean = FilenameUtils.removeExtension(policyName);
-					String actionBodyName = policyScope + "." + policyNameClean + ".json";
-					Path actionBodyPath = Paths.get(Webapps.getActionHome(), actionBodyName);
-					if(logger.isDebugEnabled()){
-						logger.debug("\nPolicyDBDao.createPolicy"
-								+ "\n   actionBodyPath = " + actionBodyPath);
-					}
-					//get the action body
-					String actionBodyString = null;
-					String actionBodyPathStr = null;
-					InputStream fileContentStream = null;
-
-					if (Files.exists(actionBodyPath)) {
-						try {
-							actionBodyPathStr = (actionBodyPath != null ? actionBodyPath.toString() : null);
-							fileContentStream = new FileInputStream(actionBodyPathStr);
-							actionBodyString = IOUtils.toString(fileContentStream);
-							if(logger.isDebugEnabled()){
-								logger.debug("\nPolicyDBDao.createPolicy"
-										+ "\n   actionBodyPathStr = " + actionBodyPathStr
-										+ "\n   actionBodyString = " + actionBodyString);
-							}
-						} catch (FileNotFoundException e) {
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught FileNotFoundException on new actionBodyPathStr FileInputStream("+actionBodyPathStr+")",e);
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught FileNotFoundException on new actionBodyPathStr FileInputStream("+actionBodyPathStr+")");
-							throw new IllegalArgumentException("The actionBodyPathStr file path " + actionBodyPathStr + " does not exist" 
-									+ "\nEXCEPTION: " + e);
-						} catch(IOException e2){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught IOException on actionBodyPath newIOUtils.toString("+fileContentStream+")",e2);
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Caught IOException on actionBodyPath newIOUtils.toString("+fileContentStream+")");
-							throw new IllegalArgumentException("The actionBodyPath file path cannot be read" + fileContentStream 
-									+ "\nEXCEPTION: " + e2);
-						} finally {
-							IOUtils.closeQuietly(fileContentStream);
-						}
-						
-						if(actionBodyString == null){
-							throw new IllegalArgumentException("The file path (" + actionBodyPathStr + ") cannot be read");
-						}
-					
-					} else {
-						actionBodyString = "{}";
-					}
-
-					newActionBodyEntity.setActionBody(actionBodyString);
-					newActionBodyEntity.setActionBodyName(actionBodyName);
-					newActionBodyEntity.setModifiedBy("PolicyDBDao.createPolicy()");
-					newActionBodyEntity.setDeleted(false);
-					if(!abupdate){
-						newActionBodyEntity.setCreatedBy("PolicyDBDao.createPolicy()");
-					}
-					if(logger.isDebugEnabled()){
-						logger.debug("\nPolicyDBDao.createPolicy"
-								+ "\n   newActionBodyEntity.getActionBody() = " + newActionBodyEntity.getActionBody()
-								+ "\n   newActionBodyEntity.getActionBodyName() = " + newActionBodyEntity.getActionBodyName()
-								+ "\n   newActionBodyEntity.getModifiedBy() = " + newActionBodyEntity.getModifiedBy()
-								+ "\n   newActionBodyEntity.getCreatedBy() = " + newActionBodyEntity.getCreatedBy()
-								+ "\n   newActionBodyEntity.isDeleted() = " + newActionBodyEntity.isDeleted()
-								+ "\n   FLUSHING to DB");
-					}
-					//push the actionBodyEntity to the DB
-					em.flush();
-				}else{
-					//newActionBodyEntity == null
-					//We have a actionBody in the policy but we found no actionBody in the DB
-					String msg = "\n\nPolicyDBDao.createPolicy - Incoming Action policy had an "
-							+ "actionBody, but it could not be found in the DB for update."
-							+ "\n  policyScope = " + policyScope
-							+ "\n  policyName = " + policyName + "\n\n";
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error(msg);
-					PolicyLogger.error("PolicyDBDao.createPolicy - Incoming Action policy had an actionBody, but it could not be found in the DB for update: policyName = " + policyName);
-					throw new IllegalArgumentException(msg);
-				}
-			}
-
-			ConfigurationDataEntity newConfigurationDataEntity;
-			if(policy.getPolicyType().equals("Config")){
-				boolean configUpdate;
-				if(newPolicyEntity.getConfigurationData() == null){
-					newConfigurationDataEntity = new ConfigurationDataEntity();
-					configUpdate = false;
+				policyName = policyName.split(":")[1];
+				Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.scope=:scope AND p.policyName=:policyName");			
+				createPolicyQuery.setParameter("scope", policyScope);
+				createPolicyQuery.setParameter("policyName", policyName);
+				List<?> createPolicyQueryList = createPolicyQuery.getResultList();
+				PolicyEntity newPolicyEntity;
+				boolean update;
+				if(createPolicyQueryList.size() < 1){
+					newPolicyEntity = new PolicyEntity();
+					update = false;
+				} else if(createPolicyQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
+					throw new PersistenceException("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
 				} else {
-					newConfigurationDataEntity = em.find(ConfigurationDataEntity.class, newPolicyEntity.getConfigurationData().getConfigurationDataId());
-					configUpdate = true;
-				}
+					newPolicyEntity = (PolicyEntity)createPolicyQueryList.get(0);
+					update = true;
+				}			
 
-				if(newConfigurationDataEntity != null){
-					if(!configUpdate){
-						em.persist(newConfigurationDataEntity);
+				ActionBodyEntity newActionBodyEntity = null;
+				if(policy.getPolicyType().equals("Action")){
+					boolean abupdate = false;
+					if(newPolicyEntity.getActionBodyEntity() == null){
+						newActionBodyEntity = new ActionBodyEntity();
+					}else{
+						newActionBodyEntity = em.find(ActionBodyEntity.class, newPolicyEntity.getActionBodyEntity().getActionBodyId());
+						abupdate = true;
 					}
-					//ConfigPolicy configPolicy = (ConfigPolicy)policy;
-					if(!stringEquals(newConfigurationDataEntity.getConfigurationName(),getConfigFile(policyName,policyScope,policy))){
-						newConfigurationDataEntity.setConfigurationName(getConfigFile(policyName,policyScope,policy));
-					}
-					if(newConfigurationDataEntity.getConfigType() == null || !newConfigurationDataEntity.getConfigType().equals(policy.getConfigType())){
-						newConfigurationDataEntity.setConfigType(policy.getConfigType());
-					}
-					if(!configUpdate){
-						newConfigurationDataEntity.setCreatedBy(username);
-					}
-					if(newConfigurationDataEntity.getModifiedBy() == null || !newConfigurationDataEntity.getModifiedBy().equals(username)){
-						newConfigurationDataEntity.setModifiedBy(username);
-					}					
-					if(newConfigurationDataEntity.getDescription() == null || !newConfigurationDataEntity.getDescription().equals("")){
-						newConfigurationDataEntity.setDescription("");
-					}
-					if(newConfigurationDataEntity.getConfigBody() == null || newConfigurationDataEntity.getConfigBody().isEmpty() ||
-							(!newConfigurationDataEntity.getConfigBody().equals(policy.getConfigBodyData()))){
-						//hopefully one of these won't be null
-						if(policy.getConfigBodyData() == null){
-							newConfigurationDataEntity.setConfigBody(policy.getJsonBody());
-						}else{
-							newConfigurationDataEntity.setConfigBody(policy.getConfigBodyData());
+
+					if(newActionBodyEntity != null){
+						if(!abupdate){
+							em.persist(newActionBodyEntity);
 						}
-					}
-					if(newConfigurationDataEntity.isDeleted() == true){
-						newConfigurationDataEntity.setDeleted(false);
-					}
+						//build the file path
+						//trim the .xml off the end
+						String policyNameClean = FilenameUtils.removeExtension(configName);
+						String actionBodyName =  policyNameClean + ".json";
+						Path actionBodyPath = Paths.get(Webapps.getActionHome(), actionBodyName);
+						if(logger.isDebugEnabled()){
+							logger.debug("\nPolicyDBDao.createPolicy"
+									+ "\n   actionBodyPath = " + actionBodyPath);
+						}
+						//get the action body
+						String actionBodyString = null;
+						String actionBodyPathStr = null;
+						InputStream fileContentStream = null;
 
-					em.flush();
-				}else{//newConfigurationDataEntity == null
-					//We have a configurationData body in the policy but we found no configurationData body
-					//in the DB
-					String msg = "\n\nPolicyDBDao.createPolicy - Incoming Config policy had a "
-							+ "configurationData body, but it could not be found in the DB for update."
-							+ "\n  policyScope = " + policyScope
-							+ "\n  policyName = " + policyName + "\n\n";
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error(msg);
-					PolicyLogger.error("PolicyDBDao.createPolicy - Incoming Config policy had a configurationData body, but it could not be found in the DB for update: policyName = " + policyName);
-					throw new IllegalArgumentException(msg);
+						if (Files.exists(actionBodyPath)) {
+							try {
+								actionBodyPathStr = (actionBodyPath != null ? actionBodyPath.toString() : null);
+								fileContentStream = new FileInputStream(actionBodyPathStr);
+								actionBodyString = IOUtils.toString(fileContentStream);
+								if(logger.isDebugEnabled()){
+									logger.debug("\nPolicyDBDao.createPolicy"
+											+ "\n   actionBodyPathStr = " + actionBodyPathStr
+											+ "\n   actionBodyString = " + actionBodyString);
+								}
+							} catch (FileNotFoundException e) {
+								PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught FileNotFoundException on new actionBodyPathStr FileInputStream("+actionBodyPathStr+")");
+								throw new IllegalArgumentException("The actionBodyPathStr file path " + actionBodyPathStr + " does not exist" 
+										+ "\nEXCEPTION: " + e);
+							} catch(IOException e2){
+								PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Caught IOException on actionBodyPath newIOUtils.toString("+fileContentStream+")");
+								throw new IllegalArgumentException("The actionBodyPath file path cannot be read" + fileContentStream 
+										+ "\nEXCEPTION: " + e2);
+							} finally {
+								IOUtils.closeQuietly(fileContentStream);
+							}
+
+							if(actionBodyString == null){
+								throw new IllegalArgumentException("The file path (" + actionBodyPathStr + ") cannot be read");
+							}
+						} else {
+							actionBodyString = "{}";
+						}
+
+						newActionBodyEntity.setActionBody(actionBodyString);
+						newActionBodyEntity.setActionBodyName(actionBodyName);
+						newActionBodyEntity.setModifiedBy("PolicyDBDao.createPolicy()");
+						newActionBodyEntity.setDeleted(false);
+						if(!abupdate){
+							newActionBodyEntity.setCreatedBy("PolicyDBDao.createPolicy()");
+						}
+						if(logger.isDebugEnabled()){
+							logger.debug("\nPolicyDBDao.createPolicy"
+									+ "\n   newActionBodyEntity.getActionBody() = " + newActionBodyEntity.getActionBody()
+									+ "\n   newActionBodyEntity.getActionBodyName() = " + newActionBodyEntity.getActionBodyName()
+									+ "\n   newActionBodyEntity.getModifiedBy() = " + newActionBodyEntity.getModifiedBy()
+									+ "\n   newActionBodyEntity.getCreatedBy() = " + newActionBodyEntity.getCreatedBy()
+									+ "\n   newActionBodyEntity.isDeleted() = " + newActionBodyEntity.isDeleted()
+									+ "\n   FLUSHING to DB");
+						}
+						//push the actionBodyEntity to the DB
+						em.flush();
+					}else{
+						//newActionBodyEntity == null
+						//We have a actionBody in the policy but we found no actionBody in the DB
+						String msg = "\n\nPolicyDBDao.createPolicy - Incoming Action policy had an "
+								+ "actionBody, but it could not be found in the DB for update."
+								+ "\n  policyScope = " + policyScope
+								+ "\n  policyName = " + policyName + "\n\n";
+						PolicyLogger.error("PolicyDBDao.createPolicy - Incoming Action policy had an actionBody, but it could not be found in the DB for update: policyName = " + policyName);
+						throw new IllegalArgumentException(msg);
+					}
 				}
 
-			} else {
-				newConfigurationDataEntity = null;
-			}
-			if(!update){
-				em.persist(newPolicyEntity);
-			}
-			
-			policyId = newPolicyEntity.getPolicyId();
-			//policy version is now part of policy name
-			/*
-			if(update){
-				try{
-					String versionString = evaluateXPath("Policy/@Version", policyDataString);
-					int versionNum = Integer.parseInt(versionString);
-					if(versionNum < 1){
-						throw new NumberFormatException();
-					}
-					newPolicyEntity.setPolicyVersion(versionNum);
-				} catch(Exception e){
-					if(newPolicyEntity.isDeleted()){
-						newPolicyEntity.resetPolicyVersion();
+				ConfigurationDataEntity newConfigurationDataEntity;
+				if(policy.getPolicyType().equals("Config")){
+					boolean configUpdate;
+					if(newPolicyEntity.getConfigurationData() == null){
+						newConfigurationDataEntity = new ConfigurationDataEntity();
+						configUpdate = false;
 					} else {
-						newPolicyEntity.advancePolicyVersion();
+						newConfigurationDataEntity = em.find(ConfigurationDataEntity.class, newPolicyEntity.getConfigurationData().getConfigurationDataId());
+						configUpdate = true;
 					}
-				}
-				
 
-			}
-			*/
-			if(!stringEquals(newPolicyEntity.getPolicyName(),policyName)){
-				newPolicyEntity.setPolicyName(policyName);
-			}
-			if(!stringEquals(newPolicyEntity.getCreatedBy(),username)){
-				newPolicyEntity.setCreatedBy(username);
-			}
-			if(!stringEquals(newPolicyEntity.getDescription(),policy.getPolicyDescription())){
-				newPolicyEntity.setDescription(policy.getPolicyDescription());
-			}
-			if(!stringEquals(newPolicyEntity.getModifiedBy(),username)){
-				newPolicyEntity.setModifiedBy(username);
-			}
-			if(!stringEquals(newPolicyEntity.getPolicyData(),policyDataString)){
-				newPolicyEntity.setPolicyData(policyDataString);
-			}
-			if(!stringEquals(newPolicyEntity.getScope(),policyScope)){
-				newPolicyEntity.setScope(policyScope);
-			}
-			if(newPolicyEntity.isDeleted() == true){
-				newPolicyEntity.setDeleted(false);
-			}
-			newPolicyEntity.setConfigurationData(newConfigurationDataEntity);
-			newPolicyEntity.setActionBodyEntity(newActionBodyEntity);
-			
-			
+					if(newConfigurationDataEntity != null){
+						if(!configUpdate){
+							em.persist(newConfigurationDataEntity);
+						}
+						if(!stringEquals(newConfigurationDataEntity.getConfigurationName(),getConfigFile(configName,policy))){
+							newConfigurationDataEntity.setConfigurationName(getConfigFile(configName,policy));
+						}
+						if(newConfigurationDataEntity.getConfigType() == null || !newConfigurationDataEntity.getConfigType().equals(policy.getConfigType())){
+							newConfigurationDataEntity.setConfigType(policy.getConfigType());
+						}
+						if(!configUpdate){
+							newConfigurationDataEntity.setCreatedBy(username);
+						}
+						if(newConfigurationDataEntity.getModifiedBy() == null || !newConfigurationDataEntity.getModifiedBy().equals(username)){
+							newConfigurationDataEntity.setModifiedBy(username);
+						}					
+						if(newConfigurationDataEntity.getDescription() == null || !newConfigurationDataEntity.getDescription().equals("")){
+							newConfigurationDataEntity.setDescription("");
+						}
+						if(newConfigurationDataEntity.getConfigBody() == null || newConfigurationDataEntity.getConfigBody().isEmpty() ||
+								(!newConfigurationDataEntity.getConfigBody().equals(policy.getConfigBodyData()))){
+							//hopefully one of these won't be null
+							if(policy.getConfigBodyData() == null || policy.getConfigBodyData().isEmpty()){
+								newConfigurationDataEntity.setConfigBody(policy.getJsonBody());
+							}else{
+								newConfigurationDataEntity.setConfigBody(policy.getConfigBodyData());
+							}
+						}
+						if(newConfigurationDataEntity.isDeleted() == true){
+							newConfigurationDataEntity.setDeleted(false);
+						}
+
+						em.flush();
+					}else{
+						//We have a configurationData body in the policy but we found no configurationData body in the DB
+						String msg = "\n\nPolicyDBDao.createPolicy - Incoming Config policy had a "
+								+ "configurationData body, but it could not be found in the DB for update."
+								+ "\n  policyScope = " + policyScope
+								+ "\n  policyName = " + policyName + "\n\n";
+						PolicyLogger.error("PolicyDBDao.createPolicy - Incoming Config policy had a configurationData body, but it could not be found in the DB for update: policyName = " + policyName);
+						throw new IllegalArgumentException(msg);
+					}
+
+				} else {
+					newConfigurationDataEntity = null;
+				}
+				if(!update){
+					em.persist(newPolicyEntity);
+				}
+
+				policyId = newPolicyEntity.getPolicyId();
+
+				if(!stringEquals(newPolicyEntity.getPolicyName(),policyName)){
+					newPolicyEntity.setPolicyName(policyName);
+				}
+				if(!stringEquals(newPolicyEntity.getCreatedBy(),username)){
+					newPolicyEntity.setCreatedBy(username);
+				}
+				if(!stringEquals(newPolicyEntity.getDescription(),policy.getPolicyDescription())){
+					newPolicyEntity.setDescription(policy.getPolicyDescription());
+				}
+				if(!stringEquals(newPolicyEntity.getModifiedBy(),username)){
+					newPolicyEntity.setModifiedBy(username);
+				}
+				if(!stringEquals(newPolicyEntity.getPolicyData(),policyDataString)){
+					newPolicyEntity.setPolicyData(policyDataString);
+				}
+				if(!stringEquals(newPolicyEntity.getScope(),policyScope)){
+					newPolicyEntity.setScope(policyScope);
+				}
+				if(newPolicyEntity.isDeleted() == true){
+					newPolicyEntity.setDeleted(false);
+				}
+				newPolicyEntity.setConfigurationData(newConfigurationDataEntity);
+				newPolicyEntity.setActionBodyEntity(newActionBodyEntity);
+
+
 				em.flush();
 				this.policyId = newPolicyEntity.getPolicyId();
 			}
-			
+
 			return;
 		}
 
@@ -2586,7 +2467,7 @@
 
 			synchronized(emLock){
 				checkBeforeOperationRun(true);
-			//check if group exists
+				//check if group exists
 				String policyId;
 				Query policyQuery;
 				if(!isNullOrEmpty(policyName,scope)){
@@ -2599,45 +2480,36 @@
 					policyQuery = em.createNamedQuery("PolicyEntity.FindById");
 					policyQuery.setParameter("id", policyId);
 				}
-			List<?> policyQueryList;
-			try{
-				policyQueryList = policyQuery.getResultList();
-			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to get policy with policyQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get policy with policyQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get policy "+policyId);
-			}
-			if(policyQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Policy does not exist with id "+policyId);
-				PolicyLogger.error("Policy does not exist with id "+policyId);
-				throw new PersistenceException("Group policy is being added to does not exist with id "+policyId);
-			} else if(policyQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one policy with the id "+policyId+" were found in the database");
-				PolicyLogger.error("Somehow, more than one policy with the id "+policyId+" were found in the database");
-				throw new PersistenceException("Somehow, more than one policy with the id "+policyId+" were found in the database");
-			}
+				List<?> policyQueryList;
+				try{
+					policyQueryList = policyQuery.getResultList();
+				}catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get policy with policyQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get policy "+policyId);
+				}
+				if(policyQueryList.size() < 1){
+					PolicyLogger.error("Policy does not exist with id "+policyId);
+					throw new PersistenceException("Group policy is being added to does not exist with id "+policyId);
+				} else if(policyQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one policy with the id "+policyId+" were found in the database");
+					throw new PersistenceException("Somehow, more than one policy with the id "+policyId+" were found in the database");
+				}
 				return (PolicyEntity)policyQueryList.get(0);
 			}
 		}
-		
+
 		@Override
 		public void renamePolicy(String oldPath, String newPath,String username){
 			String[] oldPolicy = getScopeAndNameAndType(oldPath);
 			String[] newPolicy = getScopeAndNameAndType(newPath);
 			if(oldPolicy == null || newPolicy == null){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Could not parse one or more of the path names: "
-						//+oldPath+", "+newPath);
 				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW+"Could not parse one or more of the path names: "
 						+oldPath+", "+newPath);
 				throw new IllegalArgumentException("Could not parse one or more of the path names");
 			}
 			synchronized (emLock) {
 				checkBeforeOperationRun();
-				
+
 				PolicyEntity existingPolicy;
 				boolean existingPolicyDeleted = false;
 				List<?> groups = null;
@@ -2651,15 +2523,14 @@
 					throw new IllegalArgumentException("The policy named "+existingPolicy.getPolicyName()+" already exists, cannot rename policy: "+newPolicy);
 				} else if(existingPolicy != null && existingPolicy.isDeleted()){
 					try{
-					Query getGroups = em.createQuery("SELECT g FROM GroupEntity g JOIN g.policies p WHERE p.policyId=:pid");
+						Query getGroups = em.createQuery("SELECT g FROM GroupEntity g JOIN g.policies p WHERE p.policyId=:pid");
 
-					getGroups.setParameter("pid", existingPolicy.getPolicyId());
-					groups = getGroups.getResultList();
+						getGroups.setParameter("pid", existingPolicy.getPolicyId());
+						groups = getGroups.getResultList();
 					}catch(Exception e){
 						groups = new LinkedList<GroupEntity>();
 					}
 					for(Object o : groups){
-						
 						GroupEntity group = (GroupEntity)o;
 						group.removePolicyFromGroup(existingPolicy);
 					}
@@ -2669,8 +2540,8 @@
 						logger.error("Error while removing the policy from groups: "+existingPolicy.getPolicyName());
 					}
 					try{
-					em.remove(existingPolicy);
-					em.flush();
+						em.remove(existingPolicy);
+						em.flush();
 					}catch(Exception e){
 						logger.error("Could not remove the existing deleted policy: "+existingPolicy.getPolicyName());
 					}
@@ -2678,78 +2549,70 @@
 					//create the new policy
 					//for each of the groups, add the new policy
 				}
-				
-			PolicyEntity policyToRename;
-			try{
-			policyToRename = getPolicy(oldPolicy[1],oldPolicy[0]);
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Could not get policy record to rename: "
-					//+oldPolicy[1],e);
-				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "PolicyDBDao", "Could not get policy record to rename: "
-					+oldPolicy[1]);
-				throw new PersistenceException("Could not get policy record to rename");
-			}
-			String policyDataString = null;
-			InputStream fileContentStream = null;
-			String policyFilePath = Paths.get(oldPath).toAbsolutePath().toString();
-			//I want to try the old path first, then if it doesn't work, try the new path
-			for(int i=0;i<2;i++){
-			try {
-				fileContentStream = new FileInputStream(policyFilePath);
-				policyDataString = IOUtils.toString(fileContentStream);
-			} catch (FileNotFoundException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught FileNotFoundException on new FileInputStream("+policyFilePath+")",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught FileNotFoundException on new FileInputStream("+policyFilePath+")");
-				//if we can't find the oldPath, we'll try the new path
-				if(i == 0){
-					policyFilePath = Paths.get(newPath).toAbsolutePath().toString();
-					continue;
+
+				PolicyEntity policyToRename;
+				try{
+					policyToRename = getPolicy(oldPolicy[1],oldPolicy[0]);
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "PolicyDBDao", "Could not get policy record to rename: "
+							+oldPolicy[1]);
+					throw new PersistenceException("Could not get policy record to rename");
 				}
-				throw new IllegalArgumentException("The file path does not exist");
-			} catch(IOException e2){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught IOException on newIOUtils.toString("+fileContentStream+")",e2);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Caught IOException on newIOUtils.toString("+fileContentStream+")");
-				throw new IllegalArgumentException("The file path cannot be read");
-			} finally {
-				IOUtils.closeQuietly(fileContentStream);
-			}
-			if(policyDataString == null){
-				throw new IllegalArgumentException("The file path cannot be read");
-			}
-			//escape the loop
-			i=2;
-			}
-			policyToRename.setPolicyName(newPolicy[1]);
-			policyToRename.setPolicyData(policyDataString);
-			policyToRename.setScope(newPolicy[0]);
-			policyToRename.setModifiedBy(username);
-			if(policyToRename.getConfigurationData() != null){
-				//String configType = getPolicySubType(policyToRename.getConfigurationData().getConfigurationName());
-				String configType = policyToRename.getConfigurationData().getConfigType();
-				policyToRename.getConfigurationData().setConfigurationName(getConfigFile(newPolicy[1], newPolicy[0], configType));
-				policyToRename.getConfigurationData().setModifiedBy(username);
-			}
-			if(policyToRename.getActionBodyEntity() != null){
-				String newActionName = newPolicy[0]+"."+removeFileExtension(newPolicy[1])+".json";
-				policyToRename.getActionBodyEntity().setActionBodyName(newActionName);
-				policyToRename.getActionBodyEntity().setModifiedBy(username);
-			}
-			if(existingPolicyDeleted){
-				for(Object o : groups){
-					
-					GroupEntity group = (GroupEntity)o;
-					group.addPolicyToGroup(policyToRename);
+				String policyDataString = null;
+				InputStream fileContentStream = null;
+				String policyFilePath = Paths.get(oldPath).toAbsolutePath().toString();
+				//I want to try the old path first, then if it doesn't work, try the new path
+				for(int i=0;i<2;i++){
+					try {
+						fileContentStream = new FileInputStream(policyFilePath);
+						policyDataString = IOUtils.toString(fileContentStream);
+					} catch (FileNotFoundException e) {
+						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught FileNotFoundException on new FileInputStream("+policyFilePath+")");
+						//if we can't find the oldPath, we'll try the new path
+						if(i == 0){
+							policyFilePath = Paths.get(newPath).toAbsolutePath().toString();
+							continue;
+						}
+						throw new IllegalArgumentException("The file path does not exist");
+					} catch(IOException e2){
+						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Caught IOException on newIOUtils.toString("+fileContentStream+")");
+						throw new IllegalArgumentException("The file path cannot be read");
+					} finally {
+						IOUtils.closeQuietly(fileContentStream);
+					}
+					if(policyDataString == null){
+						throw new IllegalArgumentException("The file path cannot be read");
+					}
+					//escape the loop
+					i=2;
 				}
-			}
-			em.flush();
-			this.policyId = policyToRename.getPolicyId();
-			this.newGroupId = oldPath;
+				policyToRename.setPolicyName(newPolicy[1]);
+				policyToRename.setPolicyData(policyDataString);
+				policyToRename.setScope(newPolicy[0]);
+				policyToRename.setModifiedBy(username);
+				if(policyToRename.getConfigurationData() != null){
+					String configType = policyToRename.getConfigurationData().getConfigType();
+					policyToRename.getConfigurationData().setConfigurationName(getConfigFile(newPolicy[1], configType));
+					policyToRename.getConfigurationData().setModifiedBy(username);
+				}
+				if(policyToRename.getActionBodyEntity() != null){
+					String newActionName = newPolicy[0]+"."+removeFileExtension(newPolicy[1])+".json";
+					policyToRename.getActionBodyEntity().setActionBodyName(newActionName);
+					policyToRename.getActionBodyEntity().setModifiedBy(username);
+				}
+				if(existingPolicyDeleted){
+					for(Object o : groups){
+
+						GroupEntity group = (GroupEntity)o;
+						group.addPolicyToGroup(policyToRename);
+					}
+				}
+				em.flush();
+				this.policyId = policyToRename.getPolicyId();
+				this.newGroupId = oldPath;
 			}
 		}
-		
+
 		@Override
 		public GroupEntity getGroup(long groupKey){
 			logger.debug("getGroup(int groupKey) as getGroup("+groupKey+") called");
@@ -2758,33 +2621,27 @@
 			}
 			synchronized(emLock){
 				checkBeforeOperationRun(true);
-			//check if group exists
-			Query groupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupKey=:groupKey");
-			groupQuery.setParameter("groupKey", groupKey);			
-			List<?> groupQueryList;
-			try{
-				groupQueryList = groupQuery.getResultList();
-			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to get group with groupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get group with groupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get group "+groupKey);
-			}
-			if(groupQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Group does not exist with groupKey "+groupKey);
-				PolicyLogger.error("Group does not exist with groupKey "+groupKey);
-				throw new PersistenceException("Group does not exist with groupKey "+groupKey);
-			} else if(groupQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one group with the groupKey "+groupKey+" were found in the database");
-				PolicyLogger.error("Somehow, more than one group with the groupKey "+groupKey+" were found in the database");
-				throw new PersistenceException("Somehow, more than one group with the groupKey "+groupKey+" were found in the database");
-			}
+				//check if group exists
+				Query groupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupKey=:groupKey");
+				groupQuery.setParameter("groupKey", groupKey);			
+				List<?> groupQueryList;
+				try{
+					groupQueryList = groupQuery.getResultList();
+				}catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get group with groupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get group "+groupKey);
+				}
+				if(groupQueryList.size() < 1){
+					PolicyLogger.error("Group does not exist with groupKey "+groupKey);
+					throw new PersistenceException("Group does not exist with groupKey "+groupKey);
+				} else if(groupQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one group with the groupKey "+groupKey+" were found in the database");
+					throw new PersistenceException("Somehow, more than one group with the groupKey "+groupKey+" were found in the database");
+				}
 				return (GroupEntity)groupQueryList.get(0);
 			}
 		}
-		
+
 		@Override
 		public GroupEntity getGroup(String groupId){
 			logger.debug("getGroup(String groupId) as getGroup("+groupId+") called");
@@ -2793,29 +2650,23 @@
 			}
 			synchronized(emLock){
 				checkBeforeOperationRun(true);
-			//check if group exists
-			Query groupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId");
-			groupQuery.setParameter("groupId", groupId);			
-			List<?> groupQueryList;
-			try{
-				groupQueryList = groupQuery.getResultList();
-			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to get group with groupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get group with groupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get group "+groupId);
-			}
-			if(groupQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Group does not exist with id "+groupId);
-				PolicyLogger.error("Group does not exist with id "+groupId);
-				throw new PersistenceException("Group does not exist with id "+groupId);
-			} else if(groupQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one group with the id "+groupId+" were found in the database");
-				PolicyLogger.error("Somehow, more than one group with the id "+groupId+" were found in the database");
-				throw new PersistenceException("Somehow, more than one group with the id "+groupId+" were found in the database");
-			}
+				//check if group exists
+				Query groupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId");
+				groupQuery.setParameter("groupId", groupId);			
+				List<?> groupQueryList;
+				try{
+					groupQueryList = groupQuery.getResultList();
+				}catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get group with groupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get group "+groupId);
+				}
+				if(groupQueryList.size() < 1){
+					PolicyLogger.error("Group does not exist with id "+groupId);
+					throw new PersistenceException("Group does not exist with id "+groupId);
+				} else if(groupQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one group with the id "+groupId+" were found in the database");
+					throw new PersistenceException("Somehow, more than one group with the id "+groupId+" were found in the database");
+				}
 				return (GroupEntity)groupQueryList.get(0);
 			}
 		}
@@ -2840,51 +2691,37 @@
 			}
 			synchronized(emLock){
 				checkBeforeOperationRun(true);
-			//check if group exists
-			Query pdpQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpKey=:pdpKey");
-			pdpQuery.setParameter("pdpKey", pdpKey);			
-			List<?> pdpQueryList;
-			try{
-				pdpQueryList = pdpQuery.getResultList();
-			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to get pdp with pdpQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get pdp with pdpQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get pdp "+pdpKey);
-			}
-			if(pdpQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Pdp does not exist with pdpKey "+pdpKey);
-				PolicyLogger.error("Pdp does not exist with pdpKey "+pdpKey);
-				throw new PersistenceException("Pdp does not exist with pdpKey "+pdpKey);
-			} else if(pdpQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one pdp with the pdpKey "+pdpKey+" were found in the database");
-				PolicyLogger.error("Somehow, more than one pdp with the pdpKey "+pdpKey+" were found in the database");
-				throw new PersistenceException("Somehow, more than one pdp with the pdpKey "+pdpKey+" were found in the database");
-			}
+				//check if group exists
+				Query pdpQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpKey=:pdpKey");
+				pdpQuery.setParameter("pdpKey", pdpKey);			
+				List<?> pdpQueryList;
+				try{
+					pdpQueryList = pdpQuery.getResultList();
+				}catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get pdp with pdpQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get pdp "+pdpKey);
+				}
+				if(pdpQueryList.size() < 1){
+					PolicyLogger.error("Pdp does not exist with pdpKey "+pdpKey);
+					throw new PersistenceException("Pdp does not exist with pdpKey "+pdpKey);
+				} else if(pdpQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one pdp with the pdpKey "+pdpKey+" were found in the database");
+					throw new PersistenceException("Somehow, more than one pdp with the pdpKey "+pdpKey+" were found in the database");
+				}
 				return (PdpEntity)pdpQueryList.get(0);
 			}
 		}
 		
-		//FIXME: maybe this should be boolean
 		public void deletePolicy(String policyToDeletes){
 			synchronized(emLock){
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}
 				checkBeforeOperationRun();
-			logger.debug("deletePolicy(String policyToDeletes) as deletePolicy("+policyToDeletes+") called");
-			String[] scopeNameAndType = getScopeAndNameAndType(policyToDeletes);
-			if(scopeNameAndType == null){
-				throw new IllegalArgumentException("Could not parse file path");
-			}
-			String realScope = scopeNameAndType[0];
-			String realName = scopeNameAndType[1];
-//				if(isTransactionOpen()){
-//					throw new IllegalStateException("A transaction is already open which has not been committed");
-//				}
+				logger.debug("deletePolicy(String policyToDeletes) as deletePolicy("+policyToDeletes+") called");
+				String[] scopeNameAndType = getScopeAndNameAndType(policyToDeletes);
+				if(scopeNameAndType == null){
+					throw new IllegalArgumentException("Could not parse file path");
+				}
+				String realScope = scopeNameAndType[0];
+				String realName = scopeNameAndType[1];
 				Query deletePolicyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.scope=:scope AND p.policyName=:policyName AND p.deleted=:deleted");			
 				deletePolicyQuery.setParameter("scope",realScope);
 				deletePolicyQuery.setParameter("policyName", realName);
@@ -2894,12 +2731,9 @@
 					logger.warn("The policy being deleted could not be found.");
 					return;
 				} else if(deletePolicyQueryList.size() > 1){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
 					PolicyLogger.error("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
 					throw new PersistenceException("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
 				} else {
-					//em.getTransaction().begin();
 					PolicyEntity policyToDelete = (PolicyEntity)deletePolicyQueryList.get(0);
 					policyToDelete.setDeleted(true);
 					if(policyToDelete.getConfigurationData() != null){
@@ -2914,21 +2748,21 @@
 							abe.setDeleted(true);
 						}
 					}
-					
+
 					em.flush();
 					this.policyId = policyToDelete.getPolicyId();
-		
+
 				}
 			}
 
 		}
-		
+
 
 		@Override
 		public boolean isTransactionOpen() {
 			logger.debug("isTransactionOpen() as isTransactionOpen() called");
 			synchronized(emLock){
-			return em.isOpen() && em.getTransaction().isActive();	
+				return em.isOpen() && em.getTransaction().isActive();	
 			}
 		}
 
@@ -2938,9 +2772,6 @@
 			String[] oldPolicyData = getScopeAndNameAndType(oldPolicyPath);
 			String[] newPolicyData = getScopeAndNameAndType(newPolicyPath);
 			if(oldPolicyData == null || newPolicyData == null){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Could not parse one or more of the path names: "
-						//+oldPolicyPath+", "+newPolicyPath);
 				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW+"Could not parse one or more of the path names: "
 						+oldPolicyPath+", "+newPolicyPath);
 				throw new IllegalArgumentException("Could not parse the oldPolicyPath or newPolicyPath");
@@ -2949,12 +2780,9 @@
 			try{
 				oldPolicy = getPolicy(oldPolicyData[1],oldPolicyData[0]);
 			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Could not get policy record to clone: "
-						//+oldPolicyData[1],e);
 				PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "PolicyDBDao", "Could not get policy record to clone: "
 						+oldPolicyData[1]);
-					throw new PersistenceException("Could not get policy record to clone");
+				throw new PersistenceException("Could not get policy record to clone");
 			}
 			ConfigurationDataEntity clonedConfig = null;
 			if(oldPolicy.getConfigurationData() != null){
@@ -2963,7 +2791,7 @@
 				clonedConfig.setConfigBody(oldPolicy.getConfigurationData().getConfigBody());
 				clonedConfig.setConfigType(oldPolicy.getConfigurationData().getConfigType());
 				clonedConfig.setCreatedBy(username);
-				clonedConfig.setConfigurationName(getConfigFile(newPolicyData[1], newPolicyData[0], oldPolicy.getConfigurationData().getConfigType()));
+				clonedConfig.setConfigurationName(getConfigFile(newPolicyData[1], oldPolicy.getConfigurationData().getConfigType()));
 				clonedConfig.setDescription(oldPolicy.getConfigurationData().getDescription());
 				clonedConfig.setModifiedBy(username);
 				em.flush();
@@ -2978,10 +2806,10 @@
 				clonedAction.setModifiedBy(username);
 				em.flush();
 			}			
-			
-			
+
+
 		}
-		
+
 		@Override
 		public void createPolicy(String filePath, String username) {
 			logger.debug("createPolicy(String filePath, String username) as createPolicy("+filePath+","+username+") called");
@@ -3001,8 +2829,6 @@
 				policyName = stripPolicyName(policyName);
 			}catch(IllegalArgumentException e){
 				if(scopeAndName[2].equals("Config")){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error(e.getMessage());
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Exception calling stripPolicyName with policy name: "+policyName);
 					throw new IllegalArgumentException(e.getMessage(),e);
 				} else {
@@ -3016,13 +2842,9 @@
 				fileContentStream = new FileInputStream(filePath);
 				policyDataString = IOUtils.toString(fileContentStream);
 			} catch (FileNotFoundException e) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught FileNotFoundException on new FileInputStream("+filePath+")",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught FileNotFoundException on new FileInputStream("+filePath+")");
 				throw new IllegalArgumentException("The file path does not exist");
 			} catch(IOException e2){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught IOException on newIOUtils.toString("+fileContentStream+")",e2);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e2, "PolicyDBDao", "Caught IOException on newIOUtils.toString("+fileContentStream+")");
 				throw new IllegalArgumentException("The file path cannot be read");
 			} finally {
@@ -3032,10 +2854,10 @@
 				throw new IllegalArgumentException("The file path cannot be read");
 			}
 			try{
-			String policyDescription = getElementFromXMLString("/Description", policyDataString);
-			if(policyDescription != null){
-				policy.setPolicyDescription(policyDescription);
-			}
+				String policyDescription = getElementFromXMLString("/Description", policyDataString);
+				if(policyDescription != null){
+					policy.setPolicyDescription(policyDescription);
+				}
 			} catch(Exception e){
 				logger.warn("Could not get description from the policy file");
 			}
@@ -3043,13 +2865,11 @@
 				//this method is not used for config, since there is no way to get config info (could be modified to)
 				String configPath;
 				try{
-				configPath = evaluateXPath("/Policy/Rule/AdviceExpressions/AdviceExpression[contains(@AdviceId,'ID')]/AttributeAssignmentExpression[@AttributeId='URLID']/AttributeValue/text()", policyDataString);
-				if(configPath == null){
-					throw new NullPointerException("configPath is null");
-				}
+					configPath = evaluateXPath("/Policy/Rule/AdviceExpressions/AdviceExpression[contains(@AdviceId,'ID')]/AttributeAssignmentExpression[@AttributeId='URLID']/AttributeValue/text()", policyDataString);
+					if(configPath == null){
+						throw new NullPointerException("configPath is null");
+					}
 				} catch(Exception e){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Could not get config file path from policy file",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not get config file path from policy file");
 					throw new IllegalArgumentException("Could not get config file path from policy file");
 				}
@@ -3063,6 +2883,7 @@
 			}
 			createPolicy(policy,username,scopeAndName[0],scopeAndName[1],policyDataString);			
 		}
+		
 		private String processConfigPath(String configPath){
 			String webappsPath = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS);
 			if(webappsPath == null){
@@ -3072,7 +2893,7 @@
 			configPath = configPath.replace("$URL", webappsPath);
 			//make sure the correct slashes are in
 			try{
-			configPath = Paths.get(configPath).toString();
+				configPath = Paths.get(configPath).toString();
 			} catch(InvalidPathException e){
 				logger.error("Invalid config path: "+configPath);
 				throw new IllegalArgumentException("Invalid config path: "+configPath);
@@ -3099,12 +2920,11 @@
 			}
 			return configDataString;
 		}
-		
+
 		@Override
 		public void createPolicy(Policy policy, String username){
 			logger.debug("createPolicy(PolicyRestAdapter policy, String username) as createPolicy("+policy+","+username+") called");
-			String policyScope = computeScope(policy.policyAdapter.getParentPath(),policy.policyAdapter.getUserGitPath());
-			
+			String policyScope = policy.policyAdapter.getDomainDir().replace(File.separator, ".");
 			//Does not need to be XACMLPolicyWriterWithPapNotify since it is already in the PAP
 			//and this transaction is intercepted up stream.
 			InputStream policyXmlStream = XACMLPolicyWriter.getXmlAsInputStream((PolicyType)policy.getCorrectPolicyDataObject());
@@ -3113,8 +2933,6 @@
 				policyDataString = IOUtils.toString(policyXmlStream);
 			} catch (IOException e) {
 				policyDataString = "could not read";
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught IOException on IOUtils.toString("+policyXmlStream+")",e);
 				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught IOException on IOUtils.toString("+policyXmlStream+")");
 				throw new IllegalArgumentException("Cannot parse the policy xml from the PolicyRestAdapter.");
 			}
@@ -3125,10 +2943,10 @@
 			} else if (policy.policyAdapter.getPolicyType().equalsIgnoreCase("Action")) {
 				configPath = evaluateXPath("/Policy/Rule/ObligationExpressions/ObligationExpression[contains(@ObligationId, " +policy.policyAdapter.getActionAttribute()+ ")]/AttributeAssignmentExpression[@AttributeId='body']/AttributeValue/text()", policyDataString);
 			}
-			
+
 			String prefix = null;
 			if (policy.policyAdapter.getPolicyType().equalsIgnoreCase("Config")) {
-				
+
 				prefix = configPath.substring(configPath.indexOf(policyScope+".")+policyScope.concat(".").length(), configPath.indexOf(policy.policyAdapter.getPolicyName()));
 				if(isNullOrEmpty(policy.policyAdapter.getConfigBodyData())){
 					String configData = "";
@@ -3145,25 +2963,18 @@
 					}
 					policy.policyAdapter.setConfigBodyData(configData);
 				}
-				
 			} else if (policy.policyAdapter.getPolicyType().equalsIgnoreCase("Action")) {
-				
 				prefix = "Action_";
-				
 			} else if (policy.policyAdapter.getPolicyType().equalsIgnoreCase("Decision")) {
-				
 				prefix = "Decision_";
 			}
-			
+
 			if(!(policy.policyAdapter.getData() instanceof PolicyType)){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The data field is not an instance of PolicyType");
 				PolicyLogger.error("The data field is not an instance of PolicyType");
 				throw new IllegalArgumentException("The data field is not an instance of PolicyType");
 			}
-			String finalName = prefix+policy.policyAdapter.getPolicyName()+"."+((PolicyType)policy.policyAdapter.getData()).getVersion()+".xml";
+			String finalName = policyScope + "." + prefix+policy.policyAdapter.getPolicyName()+"."+((PolicyType)policy.policyAdapter.getData()).getVersion()+".xml";
 			if(policy.policyAdapter.getConfigType() == null || policy.policyAdapter.getConfigType().equals("")){
-				//we need to make it
 				//get the config file extension
 				String ext = "";
 				if (configPath != null) {
@@ -3171,7 +2982,7 @@
 						ext = configPath.substring(configPath.lastIndexOf('.'), configPath.length());;
 					}
 				}
-				
+
 				if(ext.contains("txt")){
 					policy.policyAdapter.setConfigType(OTHER_CONFIG);
 				} else if(ext.contains("json")){
@@ -3187,9 +2998,9 @@
 				}
 			}
 			createPolicy(policy.policyAdapter, username, policyScope,finalName,policyDataString);
-			
+
 		}
-		
+
 		@Override
 		public void close(){
 			synchronized(emLock){
@@ -3210,11 +3021,6 @@
 		@Override
 		public void createGroup(String groupId, String groupName, String groupDescription, String username) {
 			logger.debug("deletePolicy(String policyToDeletes) as createGroup("+groupId+", "+groupName+", "+groupDescription+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}			
-			//parameter check
 			if(isNullOrEmpty(groupId, groupName, username)){
 				throw new IllegalArgumentException("groupId, groupName, and username must not be null or empty");
 			}
@@ -3224,47 +3030,36 @@
 
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			checkGroupQuery.setParameter("groupId", groupId);
-			checkGroupQuery.setParameter("deleted", false);
-			List<?> checkGroupQueryList;
-			try{
-				checkGroupQueryList = checkGroupQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception on checkGroupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on checkGroupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to check for existing group");
-			}
-			if(checkGroupQueryList.size() > 0){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The group being added already exists with id "+groupId);
-				PolicyLogger.error("The group being added already exists with id "+groupId);
-				throw new PersistenceException("The group being added already exists with id "+groupId);
-			}
-			//em.getTransaction().begin();
-			GroupEntity newGroup = new GroupEntity();
-			em.persist(newGroup);
-			newGroup.setCreatedBy(username);
-			newGroup.setModifiedBy(username);
-			newGroup.setGroupName(groupName);
-			newGroup.setGroupId(groupId);
-			newGroup.setDescription(groupDescription);
-			
-			em.flush();
-			this.groupId = newGroup.getGroupKey();
+				Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				checkGroupQuery.setParameter("groupId", groupId);
+				checkGroupQuery.setParameter("deleted", false);
+				List<?> checkGroupQueryList;
+				try{
+					checkGroupQueryList = checkGroupQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on checkGroupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to check for existing group");
+				}
+				if(checkGroupQueryList.size() > 0){
+					PolicyLogger.error("The group being added already exists with id "+groupId);
+					throw new PersistenceException("The group being added already exists with id "+groupId);
+				}
+				GroupEntity newGroup = new GroupEntity();
+				em.persist(newGroup);
+				newGroup.setCreatedBy(username);
+				newGroup.setModifiedBy(username);
+				newGroup.setGroupName(groupName);
+				newGroup.setGroupId(groupId);
+				newGroup.setDescription(groupDescription);
+
+				em.flush();
+				this.groupId = newGroup.getGroupKey();
 			}
 		}
 
 		@Override
 		public void updateGroup(EcompPDPGroup group, String username){
 			logger.debug("updateGroup(PDPGroup group) as updateGroup("+group+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}			
-			
-			//parameter check
 			if(group == null){
 				throw new IllegalArgumentException("PDPGroup group must not be null");
 			}
@@ -3274,103 +3069,86 @@
 
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			Query getGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			getGroupQuery.setParameter("groupId", group.getId());
-			getGroupQuery.setParameter("deleted", false);
-			List<?> getGroupQueryList;
-			try{
-				getGroupQueryList = getGroupQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception on getGroupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getGroupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get group "+group.getId()+" for editing");
-			}
-			if(getGroupQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The group cannot be found to update with id "+group.getId());
-				PolicyLogger.error("The group cannot be found to update with id "+group.getId());
-				throw new PersistenceException("The group cannot be found to update with id "+group.getId());
-			} else if(getGroupQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
-				PolicyLogger.error("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
-				throw new PersistenceException("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
-			}
-			//em.getTransaction().begin();
-			GroupEntity groupToUpdate = (GroupEntity)getGroupQueryList.get(0);
-			if(!stringEquals(groupToUpdate.getModifiedBy(), username)){
-				groupToUpdate.setModifiedBy(username);
-			}
-			if(group.getDescription() != null && !stringEquals(group.getDescription(),groupToUpdate.getDescription())){
-				groupToUpdate.setDescription(group.getDescription());
-			}
-			//let's find out what policies have been deleted
-			StdPDPGroup oldGroup = null;
-			try {
-				oldGroup = (StdPDPGroup) papEngine.getGroup(group.getId());
-			} catch (PAPException e1) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("We cannot get the group from the papEngine to delete policies",e1);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "We cannot get the group from the papEngine to delete policies");
-			}
-			if(oldGroup == null){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("We cannot get the group from the papEngine to delete policies");
-				PolicyLogger.error("We cannot get the group from the papEngine to delete policies");
-			} else {
-
-				Set<String> newPolicySet = new HashSet<String>(group.getPolicies().size());
-				//a multiple of n runtime is faster than n^2, so I am using a hashset to do the comparison
-				for(PDPPolicy pol: group.getPolicies()){
-					newPolicySet.add(pol.getId());
+				Query getGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				getGroupQuery.setParameter("groupId", group.getId());
+				getGroupQuery.setParameter("deleted", false);
+				List<?> getGroupQueryList;
+				try{
+					getGroupQueryList = getGroupQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getGroupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get group "+group.getId()+" for editing");
 				}
-				for(PDPPolicy pol : oldGroup.getPolicies()){
-					//should be fast since getPolicies uses a HashSet in StdPDPGroup
-					if(!newPolicySet.contains(pol.getId())){
-						String[] scopeAndName = getNameScopeAndVersionFromPdpPolicy(pol.getId());
-						PolicyEntity policyToDelete;
-						try{
-						policyToDelete = getPolicy(scopeAndName[0],scopeAndName[1]);
-						}catch(Exception e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Could not get policy to remove: "+pol.getId(),e);
-							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not get policy to remove: "+pol.getId());
-							throw new PersistenceException("Could not get policy to remove: "+pol.getId());
-						}
-						groupToUpdate.getPolicies().remove(policyToDelete);
+				if(getGroupQueryList.size() < 1){
+					PolicyLogger.error("The group cannot be found to update with id "+group.getId());
+					throw new PersistenceException("The group cannot be found to update with id "+group.getId());
+				} else if(getGroupQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
+					throw new PersistenceException("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
+				}
+				GroupEntity groupToUpdate = (GroupEntity)getGroupQueryList.get(0);
+				if(!stringEquals(groupToUpdate.getModifiedBy(), username)){
+					groupToUpdate.setModifiedBy(username);
+				}
+				if(group.getDescription() != null && !stringEquals(group.getDescription(),groupToUpdate.getDescription())){
+					groupToUpdate.setDescription(group.getDescription());
+				}
+				//let's find out what policies have been deleted
+				StdPDPGroup oldGroup = null;
+				try {
+					oldGroup = (StdPDPGroup) papEngine.getGroup(group.getId());
+				} catch (PAPException e1) {
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e1, "PolicyDBDao", "We cannot get the group from the papEngine to delete policies");
+				}
+				if(oldGroup == null){
+					PolicyLogger.error("We cannot get the group from the papEngine to delete policies");
+				} else {
 
+					Set<String> newPolicySet = new HashSet<String>(group.getPolicies().size());
+					//a multiple of n runtime is faster than n^2, so I am using a hashset to do the comparison
+					for(PDPPolicy pol: group.getPolicies()){
+						newPolicySet.add(pol.getId());
+					}
+					for(PDPPolicy pol : oldGroup.getPolicies()){
+						//should be fast since getPolicies uses a HashSet in StdPDPGroup
+						if(!newPolicySet.contains(pol.getId())){
+							String[] scopeAndName = getNameScopeAndVersionFromPdpPolicy(pol.getId());
+							PolicyEntity policyToDelete;
+							try{
+								policyToDelete = getPolicy(scopeAndName[0],scopeAndName[1]);
+							}catch(Exception e){
+								PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Could not get policy to remove: "+pol.getId());
+								throw new PersistenceException("Could not get policy to remove: "+pol.getId());
+							}
+							groupToUpdate.getPolicies().remove(policyToDelete);
+
+						}
 					}
 				}
-			}
-			if(group.getName() != null && !stringEquals(group.getName(),groupToUpdate.getgroupName())){
-				//we need to check if the new id exists in the database
-				String newGroupId = createNewPDPGroupId(group.getName());
-				Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-				checkGroupQuery.setParameter("groupId", newGroupId);
-				checkGroupQuery.setParameter("deleted", false);
-				List<?> checkGroupQueryList;
-				try{
-					checkGroupQueryList = checkGroupQuery.getResultList();
-				} catch(Exception e){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught Exception on checkGroupQuery.getResultList()",e);
-					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on checkGroupQuery.getResultList()");
-					throw new PersistenceException("Query failed trying to check for existing group");
+				if(group.getName() != null && !stringEquals(group.getName(),groupToUpdate.getgroupName())){
+					//we need to check if the new id exists in the database
+					String newGroupId = createNewPDPGroupId(group.getName());
+					Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+					checkGroupQuery.setParameter("groupId", newGroupId);
+					checkGroupQuery.setParameter("deleted", false);
+					List<?> checkGroupQueryList;
+					try{
+						checkGroupQueryList = checkGroupQuery.getResultList();
+					} catch(Exception e){
+						PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on checkGroupQuery.getResultList()");
+						throw new PersistenceException("Query failed trying to check for existing group");
+					}
+					if(checkGroupQueryList.size() != 0){
+						PolicyLogger.error("The new group name already exists, group id "+newGroupId);
+						throw new PersistenceException("The new group name already exists, group id "+newGroupId);
+					}
+					groupToUpdate.setGroupId(newGroupId);
+					groupToUpdate.setGroupName(group.getName());
+					this.newGroupId = group.getId();
 				}
-				if(checkGroupQueryList.size() != 0){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("The new group name already exists, group id "+newGroupId);
-					PolicyLogger.error("The new group name already exists, group id "+newGroupId);
-					throw new PersistenceException("The new group name already exists, group id "+newGroupId);
-				}
-				groupToUpdate.setGroupId(newGroupId);
-				groupToUpdate.setGroupName(group.getName());
-				this.newGroupId = group.getId();
-			}
-			
-			em.flush();
-			this.groupId = groupToUpdate.getGroupKey();
+
+				em.flush();
+				this.groupId = groupToUpdate.getGroupKey();
 			}
 		}
 
@@ -3383,76 +3161,60 @@
 			if(!(pdpDescription instanceof String)){
 				pdpDescription = "";
 			}
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}	
-
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			checkGroupQuery.setParameter("groupId", groupID);
-			checkGroupQuery.setParameter("deleted", false);
-			List<?> checkGroupQueryList;
-			try{
-				checkGroupQueryList = checkGroupQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to check for existing group on checkGroupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check for existing group on checkGroupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to check for existing group");
-			}
-			if(checkGroupQueryList.size() != 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The group does not exist");
-				PolicyLogger.error("The group does not exist");
-				throw new PersistenceException("The group does not exist");
-			}
-			Query checkDuplicateQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpId=:pdpId AND p.deleted=:deleted");
-			checkDuplicateQuery.setParameter("pdpId", pdpID);
-			checkDuplicateQuery.setParameter("deleted", false);
-			List<?> checkDuplicateList;
-			try{
-				checkDuplicateList = checkDuplicateQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to check for duplicate PDP "+pdpID+" on checkDuplicateQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check for duplicate PDP "+pdpID+" on checkDuplicateQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to check for duplicate PDP "+pdpID);
-			}
-			PdpEntity newPdp;
-			if(checkDuplicateList.size() > 0){
-				logger.warn("PDP already exists with id "+pdpID);				
-				newPdp = (PdpEntity)checkDuplicateList.get(0);
-			} else {
-				newPdp = new PdpEntity();
-		em.persist(newPdp);
-			}			
+				Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				checkGroupQuery.setParameter("groupId", groupID);
+				checkGroupQuery.setParameter("deleted", false);
+				List<?> checkGroupQueryList;
+				try{
+					checkGroupQueryList = checkGroupQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check for existing group on checkGroupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to check for existing group");
+				}
+				if(checkGroupQueryList.size() != 1){
+					PolicyLogger.error("The group does not exist");
+					throw new PersistenceException("The group does not exist");
+				}
+				Query checkDuplicateQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpId=:pdpId AND p.deleted=:deleted");
+				checkDuplicateQuery.setParameter("pdpId", pdpID);
+				checkDuplicateQuery.setParameter("deleted", false);
+				List<?> checkDuplicateList;
+				try{
+					checkDuplicateList = checkDuplicateQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check for duplicate PDP "+pdpID+" on checkDuplicateQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to check for duplicate PDP "+pdpID);
+				}
+				PdpEntity newPdp;
+				if(checkDuplicateList.size() > 0){
+					logger.warn("PDP already exists with id "+pdpID);				
+					newPdp = (PdpEntity)checkDuplicateList.get(0);
+				} else {
+					newPdp = new PdpEntity();
+					em.persist(newPdp);
+				}			
 
-			newPdp.setCreatedBy(username);
-			newPdp.setDeleted(false);
-			newPdp.setDescription(pdpDescription);
-			newPdp.setGroup((GroupEntity)checkGroupQueryList.get(0));
-			newPdp.setJmxPort(pdpJmxPort);
-			newPdp.setModifiedBy(username);
-			newPdp.setPdpId(pdpID);
-			newPdp.setPdpName(pdpName);
-			
-			em.flush();
-			this.pdpId = newPdp.getPdpKey();
+				newPdp.setCreatedBy(username);
+				newPdp.setDeleted(false);
+				newPdp.setDescription(pdpDescription);
+				newPdp.setGroup((GroupEntity)checkGroupQueryList.get(0));
+				newPdp.setJmxPort(pdpJmxPort);
+				newPdp.setModifiedBy(username);
+				newPdp.setPdpId(pdpID);
+				newPdp.setPdpName(pdpName);
+
+				em.flush();
+				this.pdpId = newPdp.getPdpKey();
 
 			}
 		}
 
-		
+
 		@Override
 		public void updatePdp(EcompPDP pdp, String username){
 			logger.debug("updatePdp(PDP pdp, String username) as updatePdp("+pdp+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}
-			//parameter check
 			if(pdp == null){
 				throw new IllegalArgumentException("PDP pdp must not be null");
 			}
@@ -3462,187 +3224,150 @@
 
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			Query getPdpQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpId=:pdpId AND p.deleted=:deleted");
-			getPdpQuery.setParameter("pdpId", pdp.getId());
-			getPdpQuery.setParameter("deleted", false);
-			List<?> getPdpQueryList;
-			try{
-				getPdpQueryList = getPdpQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception on getPdpQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getPdpQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get PDP "+pdp.getId());
-			}
-			if(getPdpQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The pdp cannot be found to update with id "+pdp.getId());
-				PolicyLogger.error("The pdp cannot be found to update with id "+pdp.getId());
-				throw new PersistenceException("The pdp cannot be found to update with id "+pdp.getId());
-			} else if(getPdpQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
-				PolicyLogger.error("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
-				throw new PersistenceException("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
-			}
-			//em.getTransaction().begin();
-			PdpEntity pdpToUpdate = (PdpEntity)getPdpQueryList.get(0);
-			if(!stringEquals(pdpToUpdate.getModifiedBy(), username)){
-				pdpToUpdate.setModifiedBy(username);
-			}
-			if(pdp.getDescription() != null && !stringEquals(pdp.getDescription(),pdpToUpdate.getDescription())){
-				pdpToUpdate.setDescription(pdp.getDescription());
-			}
-			if(pdp.getName() != null && !stringEquals(pdp.getName(),pdpToUpdate.getPdpName())){
-				pdpToUpdate.setPdpName(pdp.getName());
-			}
-			if(pdp.getJmxPort() != null && !pdp.getJmxPort().equals(pdpToUpdate.getJmxPort())){
-				pdpToUpdate.setJmxPort(pdp.getJmxPort());
-			}
-			
-			em.flush();
-			this.pdpId = pdpToUpdate.getPdpKey();
+				Query getPdpQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpId=:pdpId AND p.deleted=:deleted");
+				getPdpQuery.setParameter("pdpId", pdp.getId());
+				getPdpQuery.setParameter("deleted", false);
+				List<?> getPdpQueryList;
+				try{
+					getPdpQueryList = getPdpQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getPdpQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get PDP "+pdp.getId());
+				}
+				if(getPdpQueryList.size() < 1){
+					PolicyLogger.error("The pdp cannot be found to update with id "+pdp.getId());
+					throw new PersistenceException("The pdp cannot be found to update with id "+pdp.getId());
+				} else if(getPdpQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
+					throw new PersistenceException("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
+				}
+				PdpEntity pdpToUpdate = (PdpEntity)getPdpQueryList.get(0);
+				if(!stringEquals(pdpToUpdate.getModifiedBy(), username)){
+					pdpToUpdate.setModifiedBy(username);
+				}
+				if(pdp.getDescription() != null && !stringEquals(pdp.getDescription(),pdpToUpdate.getDescription())){
+					pdpToUpdate.setDescription(pdp.getDescription());
+				}
+				if(pdp.getName() != null && !stringEquals(pdp.getName(),pdpToUpdate.getPdpName())){
+					pdpToUpdate.setPdpName(pdp.getName());
+				}
+				if(pdp.getJmxPort() != null && !pdp.getJmxPort().equals(pdpToUpdate.getJmxPort())){
+					pdpToUpdate.setJmxPort(pdp.getJmxPort());
+				}
+
+				em.flush();
+				this.pdpId = pdpToUpdate.getPdpKey();
 			}
 		}
-		
+
 		@Override
 		public void movePdp(EcompPDP pdp, EcompPDPGroup group, String username){
 			logger.debug("movePdp(PDP pdp, PDPGroup group, String username) as movePdp("+pdp+","+group+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");
-//			}
 			if(pdp == null || group == null){
 				throw new IllegalArgumentException("PDP pdp and PDPGroup group must not be null");
 			}
 			if(isNullOrEmpty(username,pdp.getId(),group.getId())){
 				throw new IllegalArgumentException("pdp.getId(), group.getId(), and username must not be null or empty");
 			}
-			
+
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			//check if pdp exists
-			Query getPdpQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpId=:pdpId AND p.deleted=:deleted");
-			getPdpQuery.setParameter("pdpId", pdp.getId());
-			getPdpQuery.setParameter("deleted", false);
-			List<?> getPdpQueryList;
-			try{
-				getPdpQueryList = getPdpQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception on getPdpQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getPdpQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get pdp to move with id "+pdp.getId());
-			}
-			if(getPdpQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The pdp cannot be found to move with id "+pdp.getId());
-				PolicyLogger.error("The pdp cannot be found to move with id "+pdp.getId());
-				throw new PersistenceException("The pdp cannot be found to move with id "+pdp.getId());
-			} else if(getPdpQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
-				PolicyLogger.error("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
-				throw new PersistenceException("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
-			}
-			
-			//check if new group exists
-			Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			checkGroupQuery.setParameter("groupId", group.getId());
-			checkGroupQuery.setParameter("deleted", false);
-			List<?> checkGroupQueryList;
-			try{
-				checkGroupQueryList = checkGroupQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to get group on checkGroupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get group on checkGroupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get new group "+group.getId());
-			}
-			if(checkGroupQueryList.size() != 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The group "+group.getId()+" does not exist");
-				PolicyLogger.error("The group "+group.getId()+" does not exist");
-				throw new PersistenceException("The group "+group.getId()+" does not exist");
-			}
-			GroupEntity groupToMoveInto = (GroupEntity)checkGroupQueryList.get(0);
-			//move it
-			//em.getTransaction().begin();
-			PdpEntity pdpToUpdate = (PdpEntity)getPdpQueryList.get(0);
-			pdpToUpdate.setGroup(groupToMoveInto);
-			if(!stringEquals(pdpToUpdate.getModifiedBy(), username)){
-				pdpToUpdate.setModifiedBy(username);
-			}
-			
-			em.flush();
-			this.pdpId = pdpToUpdate.getPdpKey();
+				//check if pdp exists
+				Query getPdpQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.pdpId=:pdpId AND p.deleted=:deleted");
+				getPdpQuery.setParameter("pdpId", pdp.getId());
+				getPdpQuery.setParameter("deleted", false);
+				List<?> getPdpQueryList;
+				try{
+					getPdpQueryList = getPdpQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getPdpQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get pdp to move with id "+pdp.getId());
+				}
+				if(getPdpQueryList.size() < 1){
+					PolicyLogger.error("The pdp cannot be found to move with id "+pdp.getId());
+					throw new PersistenceException("The pdp cannot be found to move with id "+pdp.getId());
+				} else if(getPdpQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
+					throw new PersistenceException("Somehow, more than one pdp with the same id "+pdp.getId()+" and deleted status were found in the database");
+				}
+
+				//check if new group exists
+				Query checkGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				checkGroupQuery.setParameter("groupId", group.getId());
+				checkGroupQuery.setParameter("deleted", false);
+				List<?> checkGroupQueryList;
+				try{
+					checkGroupQueryList = checkGroupQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get group on checkGroupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get new group "+group.getId());
+				}
+				if(checkGroupQueryList.size() != 1){
+					PolicyLogger.error("The group "+group.getId()+" does not exist");
+					throw new PersistenceException("The group "+group.getId()+" does not exist");
+				}
+				GroupEntity groupToMoveInto = (GroupEntity)checkGroupQueryList.get(0);
+				PdpEntity pdpToUpdate = (PdpEntity)getPdpQueryList.get(0);
+				pdpToUpdate.setGroup(groupToMoveInto);
+				if(!stringEquals(pdpToUpdate.getModifiedBy(), username)){
+					pdpToUpdate.setModifiedBy(username);
+				}
+
+				em.flush();
+				this.pdpId = pdpToUpdate.getPdpKey();
 			}
 		}
-		
+
 		@Override
 		public void changeDefaultGroup(EcompPDPGroup group, String username){
 			logger.debug("changeDefaultGroup(PDPGroup group, String username) as changeDefaultGroup("+group+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");
-//			}
-			//parameter check
 			if(group == null){
 				throw new IllegalArgumentException("PDPGroup group must not be null");
 			}
 			if(isNullOrEmpty(group.getId(),username)){
 				throw new IllegalArgumentException("group.getId() and username must not be null or empty");
 			}
-			
+
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			Query getGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			getGroupQuery.setParameter("groupId", group.getId());
-			getGroupQuery.setParameter("deleted", false);
-			List<?> getGroupQueryList;
-			try{
-				getGroupQueryList = getGroupQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception on getGroupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getGroupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to get group "+group.getId());
-			}
-			if(getGroupQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The group cannot be found to set default with id "+group.getId());
-				PolicyLogger.error("The group cannot be found to set default with id "+group.getId());				
-				throw new PersistenceException("The group cannot be found to set default with id "+group.getId());
-			} else if(getGroupQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
-				PolicyLogger.error("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
-				throw new PersistenceException("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
-			}
-			//em.getTransaction().begin();
-			GroupEntity newDefaultGroup = (GroupEntity)getGroupQueryList.get(0);
-			newDefaultGroup.setDefaultGroup(true);
-			if(!stringEquals(newDefaultGroup.getModifiedBy(), username)){
-				newDefaultGroup.setModifiedBy(username);
-			}
-			
-			em.flush();
-			this.groupId = newDefaultGroup.getGroupKey();
-			Query setAllGroupsNotDefault = em.createQuery("UPDATE GroupEntity g SET g.defaultGroup=:defaultGroup WHERE g.deleted=:deleted AND g.groupKey<>:groupKey");
-			//not going to set modified by for all groups
-			setAllGroupsNotDefault.setParameter("defaultGroup", false);
-			setAllGroupsNotDefault.setParameter("deleted", false);
-			setAllGroupsNotDefault.setParameter("groupKey", newDefaultGroup.getGroupKey());
-			try{
-				logger.info("set " + setAllGroupsNotDefault.executeUpdate() + " groups as not default");
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception on setAllGroupsNotDefault.executeUpdate()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on setAllGroupsNotDefault.executeUpdate()");
-				throw new PersistenceException("Could not set all other groups default to false");
-			}
-			
-			em.flush();
+				Query getGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				getGroupQuery.setParameter("groupId", group.getId());
+				getGroupQuery.setParameter("deleted", false);
+				List<?> getGroupQueryList;
+				try{
+					getGroupQueryList = getGroupQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on getGroupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to get group "+group.getId());
+				}
+				if(getGroupQueryList.size() < 1){
+					PolicyLogger.error("The group cannot be found to set default with id "+group.getId());				
+					throw new PersistenceException("The group cannot be found to set default with id "+group.getId());
+				} else if(getGroupQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
+					throw new PersistenceException("Somehow, more than one group with the same id "+group.getId()+" and deleted status were found in the database");
+				}
+				GroupEntity newDefaultGroup = (GroupEntity)getGroupQueryList.get(0);
+				newDefaultGroup.setDefaultGroup(true);
+				if(!stringEquals(newDefaultGroup.getModifiedBy(), username)){
+					newDefaultGroup.setModifiedBy(username);
+				}
+
+				em.flush();
+				this.groupId = newDefaultGroup.getGroupKey();
+				Query setAllGroupsNotDefault = em.createQuery("UPDATE GroupEntity g SET g.defaultGroup=:defaultGroup WHERE g.deleted=:deleted AND g.groupKey<>:groupKey");
+				//not going to set modified by for all groups
+				setAllGroupsNotDefault.setParameter("defaultGroup", false);
+				setAllGroupsNotDefault.setParameter("deleted", false);
+				setAllGroupsNotDefault.setParameter("groupKey", newDefaultGroup.getGroupKey());
+				try{
+					logger.info("set " + setAllGroupsNotDefault.executeUpdate() + " groups as not default");
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception on setAllGroupsNotDefault.executeUpdate()");
+					throw new PersistenceException("Could not set all other groups default to false");
+				}
+
+				em.flush();
 			}
 		}
 
@@ -3650,10 +3375,6 @@
 		@Override
 		public void deleteGroup(EcompPDPGroup group, EcompPDPGroup moveToGroup, String username) throws PAPException {
 			logger.debug("deleteGroup(PDPGroup group, PDPGroup moveToGroup, String username) as deleteGroup("+group+", "+moveToGroup+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}
 			if(group == null){
 				throw new IllegalArgumentException("PDPGroup group cannot be null");
 			}
@@ -3662,35 +3383,29 @@
 			}
 
 			if(group.isDefaultGroup()){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("The default group "+group.getId()+" was attempted to be deleted. It cannot be.");
 				PolicyLogger.error("The default group "+group.getId()+" was attempted to be deleted. It cannot be.");
 				throw new PAPException("You cannot delete the default group.");
 			}
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			Query deleteGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			deleteGroupQuery.setParameter("groupId", group.getId());
-			deleteGroupQuery.setParameter("deleted", false);
-			List<?> deleteGroupQueryList;
-			try{
-				deleteGroupQueryList = deleteGroupQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to check if group exists deleteGroupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if group exists deleteGroupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to check if group exists");
-			}
-			if(deleteGroupQueryList.size() < 1){
-				logger.warn("The group could not be found with id " + group.getId());
-				return;
-			} else if(deleteGroupQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one group with the id "+group.getId()+" were found in the database that are not deleted");
-				PolicyLogger.error("Somehow, more than one group with the id "+group.getId()+" were found in the database that are not deleted");
-				throw new PersistenceException("Somehow, more than one group with the id "+group.getId()+" were found in the database that are not deleted");
-			}				
-				
+				Query deleteGroupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				deleteGroupQuery.setParameter("groupId", group.getId());
+				deleteGroupQuery.setParameter("deleted", false);
+				List<?> deleteGroupQueryList;
+				try{
+					deleteGroupQueryList = deleteGroupQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if group exists deleteGroupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to check if group exists");
+				}
+				if(deleteGroupQueryList.size() < 1){
+					logger.warn("The group could not be found with id " + group.getId());
+					return;
+				} else if(deleteGroupQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one group with the id "+group.getId()+" were found in the database that are not deleted");
+					throw new PersistenceException("Somehow, more than one group with the id "+group.getId()+" were found in the database that are not deleted");
+				}				
+
 				Query pdpsInGroupQuery = em.createQuery("SELECT p FROM PdpEntity p WHERE p.groupEntity=:group and p.deleted=:deleted");
 				pdpsInGroupQuery.setParameter("group", ((GroupEntity)deleteGroupQueryList.get(0)));
 				pdpsInGroupQuery.setParameter("deleted", false);
@@ -3698,12 +3413,9 @@
 				try{
 					pdpsInGroupList = pdpsInGroupQuery.getResultList();
 				} catch(Exception e){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught Exception trying to get PDPs in group on pdpsInGroupQuery.getResultList()",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to get PDPs in group on pdpsInGroupQuery.getResultList()");
 					throw new PersistenceException("Query failed trying to get PDPs in group");
 				}
-				//em.getTransaction().begin();
 				if(pdpsInGroupList.size() > 0){
 					if(moveToGroup != null){
 						Query checkMoveToGroupQuery = em.createQuery("SELECT o FROM GroupEntity o WHERE o.groupId=:groupId AND o.deleted=:deleted");
@@ -3713,19 +3425,13 @@
 						try{
 							checkMoveToGroupList = checkMoveToGroupQuery.getResultList();
 						} catch(Exception e){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Caught Exception trying to check if group exists checkMoveToGroupQuery.getResultList()",e);
 							PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if group exists checkMoveToGroupQuery.getResultList()");
 							throw new PersistenceException("Query failed trying to check if group exists");
 						}
 						if(checkMoveToGroupList.size() < 1){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("The group could not be found with id " + moveToGroup.getId());
 							PolicyLogger.error("The group could not be found with id " + moveToGroup.getId());
 							throw new PersistenceException("The group could not be found with id " + moveToGroup.getId());
 						} else if(checkMoveToGroupList.size() > 1){
-							//TODO:EELF Cleanup - Remove logger
-							//logger.error("Somehow, more than one group with the id "+moveToGroup.getId()+" were found in the database that are not deleted");
 							PolicyLogger.error("Somehow, more than one group with the id "+moveToGroup.getId()+" were found in the database that are not deleted");
 							throw new PersistenceException("Somehow, more than one group with the id "+moveToGroup.getId()+" were found in the database that are not deleted");
 						} else {
@@ -3737,113 +3443,95 @@
 									pdp.setModifiedBy(username);
 								}
 								try{
-									
-								em.flush();
-								this.newGroupId = newGroup.getGroupId();
+
+									em.flush();
+									this.newGroupId = newGroup.getGroupId();
 								} catch(PersistenceException e){
-									//TODO:EELF Cleanup - Remove logger
-									//logger.error("Caught PersistenceException trying to set pdp group to null on em.flush()",e);
 									PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught PersistenceException trying to set pdp group to null on em.flush()");
 									throw new PersistenceException("Query failed trying to set pdp group to ");
 								}
 							}
 						}
 					} else {
-						//TODO:EELF Cleanup - Remove logger
-						//logger.error("Group "+group.getId()+" is trying to be delted with PDPs. No group was provided to move them to");
 						PolicyLogger.error("Group "+group.getId()+" is trying to be delted with PDPs. No group was provided to move them to");
 						throw new PAPException("Group has PDPs. Must provide a group for them to move to");
 					}
 				} 
-				
+
 				//delete group here
-								
 				GroupEntity groupToDelete = (GroupEntity)deleteGroupQueryList.get(0);
 				groupToDelete.setDeleted(true);
 				if(!stringEquals(groupToDelete.getModifiedBy(), username)){
 					groupToDelete.setModifiedBy(username);
 				}
-				
-				//try{
-								
 				em.flush();
 				this.groupId = groupToDelete.getGroupKey();
-				//return;
-				//} catch(PersistenceException pe){
-					//logger.error("Database error while marking policy or config as deleted");					
-					//throw new PersistenceException("Database error while marking policy or config as deleted");
-				//}	
 			}
-			}
+		}
 
 		@Override
 		public void addPolicyToGroup(String groupID, String policyID, String username) {
 			logger.debug("addPolicyToGroup(String groupID, String policyID, String username) as addPolicyToGroup("+groupID+", "+policyID+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}
 			if(isNullOrEmpty(groupID, policyID, username)){
 				throw new IllegalArgumentException("groupID, policyID, and username must not be null or empty");
 			}
 			synchronized(emLock){
 				checkBeforeOperationRun();
-			//check if group exists
-			Query groupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
-			groupQuery.setParameter("groupId", groupID);
-			groupQuery.setParameter("deleted", false);
-			List<?> groupQueryList;
-			try{
-				groupQueryList = groupQuery.getResultList();
-			}catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to check if group exists groupQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if group exists groupQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to check if group "+groupID+" exists");
-			}
-			if(groupQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Group policy is being added to does not exist with id "+groupID);
-				PolicyLogger.error("Group policy is being added to does not exist with id "+groupID);
-				throw new PersistenceException("Group policy is being added to does not exist with id "+groupID);
-			} else if(groupQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one group with the id "+groupID+" were found in the database that are not deleted");
-				PolicyLogger.error("Somehow, more than one group with the id "+groupID+" were found in the database that are not deleted");
-				throw new PersistenceException("Somehow, more than one group with the id "+groupID+" were found in the database that are not deleted");
-			}
-			//we need to convert the form of the policy id that is used groups into the form that is used 
-			//for the database. (com.Config_mypol.1.xml) to (Config_mypol.xml)
-			String[] policyNameScopeAndVersion = getNameScopeAndVersionFromPdpPolicy(policyID);			
-			Query policyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName=:policyName AND p.scope=:scope AND p.deleted=:deleted");
-			policyQuery.setParameter("policyName", policyNameScopeAndVersion[0]);
-			policyQuery.setParameter("scope", policyNameScopeAndVersion[1]);			
-			policyQuery.setParameter("deleted", false);
-			List<?> policyQueryList;
-			try{
-				policyQueryList = policyQuery.getResultList();
-			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Caught Exception trying to check if policy exists policyQuery.getResultList()",e);
-				PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if policy exists policyQuery.getResultList()");
-				throw new PersistenceException("Query failed trying to check if policy "+policyNameScopeAndVersion[0]+" exists");
-			}
-			if(policyQueryList.size() < 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Policy being added to the group does not exist with policy id "+policyNameScopeAndVersion[0]);
-				PolicyLogger.error("Policy being added to the group does not exist with policy id "+policyNameScopeAndVersion[0]);
-				throw new PersistenceException("Policy being added to the group does not exist with policy id "+policyNameScopeAndVersion[0]);				
-			} else if(policyQueryList.size() > 1){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error("Somehow, more than one policy with the id "+policyNameScopeAndVersion[0]+" were found in the database that are not deleted");
-				PolicyLogger.error("Somehow, more than one policy with the id "+policyNameScopeAndVersion[0]+" were found in the database that are not deleted");
-				throw new PersistenceException("Somehow, more than one group with the id "+policyNameScopeAndVersion[0]+" were found in the database that are not deleted");
-			}
-			//em.getTransaction().begin();
-			GroupEntity group = (GroupEntity)groupQueryList.get(0);
-			PolicyEntity policy = (PolicyEntity)policyQueryList.get(0);
-			group.addPolicyToGroup(policy);
-			em.flush();
+				//check if group exists
+				Query groupQuery = em.createQuery("SELECT g FROM GroupEntity g WHERE g.groupId=:groupId AND g.deleted=:deleted");
+				groupQuery.setParameter("groupId", groupID);
+				groupQuery.setParameter("deleted", false);
+				List<?> groupQueryList;
+				try{
+					groupQueryList = groupQuery.getResultList();
+				}catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if group exists groupQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to check if group "+groupID+" exists");
+				}
+				if(groupQueryList.size() < 1){
+					PolicyLogger.error("Group policy is being added to does not exist with id "+groupID);
+					throw new PersistenceException("Group policy is being added to does not exist with id "+groupID);
+				} else if(groupQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one group with the id "+groupID+" were found in the database that are not deleted");
+					throw new PersistenceException("Somehow, more than one group with the id "+groupID+" were found in the database that are not deleted");
+				}
+				//we need to convert the form of the policy id that is used groups into the form that is used 
+				//for the database. (com.Config_mypol.1.xml) to (Config_mypol.xml)
+				String[] policyNameScopeAndVersion = getNameScopeAndVersionFromPdpPolicy(policyID);			
+				Query policyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName=:policyName AND p.scope=:scope AND p.deleted=:deleted");
+				policyQuery.setParameter("policyName", policyNameScopeAndVersion[0]);
+				policyQuery.setParameter("scope", policyNameScopeAndVersion[1]);			
+				policyQuery.setParameter("deleted", false);
+				List<?> policyQueryList;
+				try{
+					policyQueryList = policyQuery.getResultList();
+				} catch(Exception e){
+					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if policy exists policyQuery.getResultList()");
+					throw new PersistenceException("Query failed trying to check if policy "+policyNameScopeAndVersion[0]+" exists");
+				}
+				if(policyQueryList.size() < 1){
+					PolicyLogger.error("Policy being added to the group does not exist with policy id "+policyNameScopeAndVersion[0]);
+					throw new PersistenceException("Policy being added to the group does not exist with policy id "+policyNameScopeAndVersion[0]);				
+				} else if(policyQueryList.size() > 1){
+					PolicyLogger.error("Somehow, more than one policy with the id "+policyNameScopeAndVersion[0]+" were found in the database that are not deleted");
+					throw new PersistenceException("Somehow, more than one group with the id "+policyNameScopeAndVersion[0]+" were found in the database that are not deleted");
+				}
+				GroupEntity group = (GroupEntity)groupQueryList.get(0);
+				PolicyEntity policy = (PolicyEntity)policyQueryList.get(0);
+	            Iterator<PolicyEntity> policyIt = group.getPolicies().iterator();
+	            String policyName = getPolicyNameAndVersionFromPolicyFileName(policy.getPolicyName())[0];
+	            try{
+	            while(policyIt.hasNext()){
+	                PolicyEntity pol = policyIt.next();
+	                if(getPolicyNameAndVersionFromPolicyFileName(pol.getPolicyName())[0].equals(policyName)){
+	                    policyIt.remove();
+	                }
+	            }
+	            }catch(Exception e){
+	                PolicyLogger.error("Could not delete old versions for policy "+policy.getPolicyName()+", ID: "+policy.getPolicyId());
+	            }
+				group.addPolicyToGroup(policy);
+				em.flush();
 			}
 		}
 
@@ -3851,10 +3539,6 @@
 		@Override
 		public void removePdpFromGroup(String pdpID, String username) {
 			logger.debug("removePdpFromGroup(String pdpID, String username) as removePdpFromGroup("+pdpID+","+username+") called");
-//			if(isTransactionOpen()){
-//				logger.error("A transaction is already open which has not been committed");
-//				throw new IllegalStateException("A transaction is already open which has not been committed");				
-//			}
 			if(isNullOrEmpty(pdpID,username)){
 				throw new IllegalArgumentException("pdpID and username must not be null or empty");
 			}
@@ -3867,47 +3551,43 @@
 				try{
 					pdpList = pdpQuery.getResultList();
 				} catch(Exception e){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Caught Exception trying to check if pdp exists  pdpQuery.getResultList()",e);
 					PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "Caught Exception trying to check if pdp exists  pdpQuery.getResultList()");
 					throw new PersistenceException("Query failed trying to check if pdp "+pdpID+" exists");
 				}
 				if(pdpList.size() > 1){
-					//TODO:EELF Cleanup - Remove logger
-					//logger.error("Somehow, more than one pdp with the id "+pdpID+" were found in the database that are not deleted");
 					PolicyLogger.error("Somehow, more than one pdp with the id "+pdpID+" were found in the database that are not deleted");
 					throw new PersistenceException("Somehow, more than one pdp with the id "+pdpID+" were found in the database that are not deleted");
 				} else if(pdpList.size() < 1){
-					//logger.warn("Pdp being removed does not exist with id "+pdpID);
 					PolicyLogger.error("Pdp being removed does not exist with id "+pdpID);
 					return;
 				}
-				//em.getTransaction().begin();
 				PdpEntity pdp = (PdpEntity)pdpList.get(0);
 				pdp.setGroup(null);
 				if(!stringEquals(pdp.getModifiedBy(),username)){
 					pdp.setModifiedBy(username);
 				}
 				pdp.setDeleted(true);
-				
+
 				em.flush();
 				this.pdpId = pdp.getPdpKey();
 			}
 		}
 	}
 
-				
-	
+
+
 	private static String getDefaultWorkspace(){
 		return "admin";
 	}
-	
+
 	private PolicyDBDao(){
-		
+
 	}
+	
 	public static PolicyDBDaoTestClass getPolicyDBDaoTestClass(){
 		return new PolicyDBDao().new PolicyDBDaoTestClass();
 	}
+	
 	final class PolicyDBDaoTestClass {
 		String[] getScopeAndNameAndType(final String path){
 			return PolicyDBDao.getScopeAndNameAndType(path);
@@ -3916,7 +3596,7 @@
 			return PolicyDBDao.getGitPath();
 		}
 		String getConfigFile(String filename, String scope, PolicyRestAdapter policy){
-			return PolicyDBDao.this.getConfigFile(filename, scope, policy);
+			return PolicyDBDao.this.getConfigFile(filename, policy);
 		}
 		String computeScope(String fullPath, String pathToExclude){
 			return PolicyDBDao.computeScope(fullPath, pathToExclude);
@@ -3930,7 +3610,9 @@
 		String getDescriptionFromXacml(String xacmlData){
 			return PolicyDBDao.getDescriptionFromXacml(xacmlData);
 		}
-		
+        String[] getPolicyNameAndVersionFromPolicyFileName(String originalPolicyName){
+            return PolicyDBDao.this.getPolicyNameAndVersionFromPolicyFileName(originalPolicyName);
+        }
 	}
-	
-}
+
+}
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTransaction.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTransaction.java
index 4e9ddb4..5ab036d 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTransaction.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTransaction.java
@@ -21,19 +21,15 @@
 package org.openecomp.policy.pap.xacml.rest.components;
 
 import java.util.List;
-import java.util.Set;
 
 import javax.persistence.PersistenceException;
 
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
 import org.openecomp.policy.rest.jpa.GroupEntity;
 import org.openecomp.policy.rest.jpa.PdpEntity;
 import org.openecomp.policy.xacml.api.pap.EcompPDP;
 import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
 
 import com.att.research.xacml.api.pap.PAPException;
-//import com.att.research.xacml.api.pap.PDP;
-//import com.att.research.xacml.api.pap.PDPGroup;
 
 public interface PolicyDBDaoTransaction {
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/package-info.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/package-info.java
index 98e1bd9..007f08d 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/package-info.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/package-info.java
@@ -18,10 +18,4 @@
  * ============LICENSE_END=========================================================
  */
 
-/**
- * 
- */
-/**
- *
- */
 package org.openecomp.policy.pap.xacml.rest.components;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
index fa00fc1..1f92503 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ActionPolicyDictionaryController.java
@@ -31,9 +31,10 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.ActionPolicyDictDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.ActionPolicyDict;
 import org.openecomp.policy.rest.jpa.UserInfo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -49,29 +50,34 @@
 @Controller
 public class ActionPolicyDictionaryController {
 
-	@Autowired
-	ActionPolicyDictDao actionPolicyDictDao;
+	private static final Logger LOGGER  = FlexLogger.getLogger(ActionPolicyDictionaryController.class);
+
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	UserInfoDao userInfoDao;
-	
-	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
-		return name;	
+	public ActionPolicyDictionaryController(CommonClassDao commonClassDao){
+		ActionPolicyDictionaryController.commonClassDao = commonClassDao;
 	}
 	
+	public ActionPolicyDictionaryController(){}
+
+	public UserInfo getUserInfo(String loginId){
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
+		return name;	
+	}
+
 	@RequestMapping(value={"/get_ActionPolicyDictDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getActionEntitybyName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(actionPolicyDictDao.getActionDictDataByName()));
+			model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ActionPolicyDict.class, "attributeName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(e.getMessage());
 		}
 	}
 
@@ -80,26 +86,61 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(actionPolicyDictDao.getActionDictData()));
+			model.put("actionPolicyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionPolicyDict.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(e.getMessage());
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/action_dictionary/save_ActionDict.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/action_dictionary/save_ActionDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			ActionPolicyDict actionPolicyDict = (ActionPolicyDict)mapper.readValue(root.get("actionPolicyDictionaryData").toString(), ActionPolicyDict.class);
-			ActionAdapter adapter = mapper.readValue(root.get("actionPolicyDictionaryData").toString(), ActionAdapter.class);
-			String userId = root.get("loginId").textValue();
+			ActionPolicyDict actionPolicyDict = null;
+			ActionAdapter adapter = null;
+			String userId = null;
+
+			if(fromAPI) {
+				actionPolicyDict = (ActionPolicyDict)mapper.readValue(root.get("dictionaryFields").toString(), ActionPolicyDict.class);
+				adapter = (ActionAdapter)mapper.readValue(root.get("dictionaryFields").toString(), ActionAdapter.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(actionPolicyDict.getAttributeName(), "attributeName", ActionPolicyDict.class);
+					int id = 0;
+					ActionPolicyDict data = (ActionPolicyDict) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						actionPolicyDict.setId(1);
+					} else {
+						actionPolicyDict.setId(id);
+					}
+					actionPolicyDict.setUserCreatedBy(this.getUserInfo(userId));
+				}
+			} else {
+				actionPolicyDict = (ActionPolicyDict)mapper.readValue(root.get("actionPolicyDictionaryData").toString(), ActionPolicyDict.class);
+				adapter = mapper.readValue(root.get("actionPolicyDictionaryData").toString(), ActionAdapter.class);
+				userId = root.get("userid").textValue();
+			}
 			String header = "";
 			int counter = 0;
 			if(adapter.getHeaders().size() > 0){
@@ -118,37 +159,54 @@
 			}
 			actionPolicyDict.setHeader(header);
 			if(actionPolicyDict.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(actionPolicyDict.getAttributeName(), "attributeName", ActionPolicyDict.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(actionPolicyDict.getAttributeName(), "attributeName", ActionPolicyDict.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					actionPolicyDict.setUserCreatedBy(this.getUserInfo(userId));
 					actionPolicyDict.setUserModifiedBy(this.getUserInfo(userId));
-					actionPolicyDictDao.Save(actionPolicyDict);
+					commonClassDao.save(actionPolicyDict);
 				}
 			}else{
-				actionPolicyDict.setUserModifiedBy(this.getUserInfo(userId));
-				actionPolicyDictDao.update(actionPolicyDict); 
+				if(!isFakeUpdate) {
+					actionPolicyDict.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(actionPolicyDict); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
 
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
+			String responseString = null;
+			if(duplicateflag) {
 				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.actionPolicyDictDao.getActionDictData());
-			}	 
-			JSONObject j = new JSONObject("{actionPolicyDictionaryDatas: " + responseString + "}");
+			} else {
+				responseString = mapper.writeValueAsString(commonClassDao.getData(ActionPolicyDict.class));
+			}
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate) {
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}   
+				}
 
-			return null;
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8"); 
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{actionPolicyDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+
+				return null;
+			}
 		}
 		catch (Exception e){
+			LOGGER.error(e.getMessage());
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -157,28 +215,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/action_dictionary/remove_actionPolicyDict.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/action_dictionary/remove_actionPolicyDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			ActionPolicyDict actionPolicyDict = (ActionPolicyDict)mapper.readValue(root.get("data").toString(), ActionPolicyDict.class);
-			actionPolicyDictDao.delete(actionPolicyDict);
+			commonClassDao.delete(actionPolicyDict);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.actionPolicyDictDao.getActionDictData());
+			String responseString = mapper.writeValueAsString(ActionPolicyDictionaryController.commonClassDao.getData(ActionPolicyDict.class));
 			JSONObject j = new JSONObject("{actionPolicyDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(e.getMessage());
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
index bdf4d2c..09c995d 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/BRMSDictionaryController.java
@@ -32,11 +32,17 @@
 
 import org.apache.commons.io.IOUtils;
 import org.json.JSONObject;
+import org.openecomp.policy.api.PEDependency;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.BRMSParamTemplateDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.BRMSController;
+import org.openecomp.policy.rest.jpa.BRMSDependency;
 import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
 import org.openecomp.policy.rest.jpa.UserInfo;
+import org.openecomp.policy.utils.PolicyUtils;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -50,17 +56,23 @@
 
 @Controller
 public class BRMSDictionaryController{
+	
+	private static final Logger LOGGER  = FlexLogger.getLogger(BRMSDictionaryController.class);
 
-	@Autowired
-	BRMSParamTemplateDao brmsParamTemplateDao;
+	
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	UserInfoDao userInfoDao;
+	public BRMSDictionaryController(CommonClassDao commonClassDao){
+		BRMSDictionaryController.commonClassDao = commonClassDao;
+	}
 	
+	public BRMSDictionaryController() {}
+
 	private String rule;
 	
 	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
 		return name;	
 	}
 
@@ -69,13 +81,13 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(brmsParamTemplateDao.getBRMSParamDataByName()));
+			model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSParamTemplate.class, "ruleName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
 	
@@ -84,17 +96,21 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(brmsParamTemplateDao.getBRMSParamTemplateData()));
+			model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSParamTemplate.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
 	
-	@RequestMapping(value={"/brms_dictionary/set_BRMSParamData.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/brms_dictionary/set_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public void SetRuleData(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		StringWriter writer = new StringWriter();
 		IOUtils.copy(request.getInputStream() , writer, StandardCharsets.UTF_8);
@@ -102,46 +118,80 @@
 		rule = cleanStreamBoundary.substring(0, cleanStreamBoundary.lastIndexOf("end")+4);
 	}
 	
-	@RequestMapping(value={"/brms_dictionary/save_BRMSParam.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/brms_dictionary/save_BRMSParam"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			BRMSParamTemplate bRMSParamTemplateData = (BRMSParamTemplate)mapper.readValue(root.get("brmsParamDictionaryData").toString(), BRMSParamTemplate.class);
-			String userId = root.get("loginId").textValue();
+			
+            BRMSParamTemplate bRMSParamTemplateData;
+            String userId = null;
+            if(fromAPI) {
+                bRMSParamTemplateData = (BRMSParamTemplate)mapper.readValue(root.get("dictionaryFields").toString(), BRMSParamTemplate.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                	List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(bRMSParamTemplateData.getRuleName(), "ruleName", BRMSParamTemplate.class);
+                	int id = 0;
+                	BRMSParamTemplate data = (BRMSParamTemplate) duplicateData.get(0);
+                	id = data.getId();
+                	bRMSParamTemplateData.setId(id);
+                	bRMSParamTemplateData.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+                bRMSParamTemplateData = (BRMSParamTemplate)mapper.readValue(root.get("brmsParamDictionaryData").toString(), BRMSParamTemplate.class);
+                userId = root.get("userid").textValue();
+            }
+            
 			bRMSParamTemplateData.setRule(rule);
 			if(bRMSParamTemplateData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(bRMSParamTemplateData.getRuleName(), "ruleName", BRMSParamTemplate.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(bRMSParamTemplateData.getRuleName(), "ruleName", BRMSParamTemplate.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					bRMSParamTemplateData.setUserCreatedBy(this.getUserInfo(userId));
-					brmsParamTemplateDao.Save(bRMSParamTemplateData);
+					commonClassDao.save(bRMSParamTemplateData);
 				}	
 			}else{
-				brmsParamTemplateDao.update(bRMSParamTemplateData); 
+				commonClassDao.update(bRMSParamTemplateData); 
 			} 
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.brmsParamTemplateDao.getBRMSParamTemplateData());
-			} 
-			JSONObject j = new JSONObject("{brmsParamDictionaryDatas: " + responseString + "}");
+				responseString = mapper.writeValueAsString(BRMSDictionaryController.commonClassDao.getData(BRMSParamTemplate.class));
+			}
+            if(fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    responseString = "Success";
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+            	response.setCharacterEncoding("UTF-8");
+            	response.setContentType("application / json");
+            	request.setCharacterEncoding("UTF-8");
 
-			out.write(j.toString());
-
-			return null;
+            	PrintWriter out = response.getWriter();
+            	JSONObject j = new JSONObject("{brmsParamDictionaryDatas: " + responseString + "}");
+            	out.write(j.toString());
+            	return null;
+            }
 		}
 		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -150,28 +200,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/brms_dictionary/remove_brmsParam.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/brms_dictionary/remove_brmsParam"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			BRMSParamTemplate bRMSParamTemplateData = (BRMSParamTemplate)mapper.readValue(root.get("data").toString(), BRMSParamTemplate.class);
-			brmsParamTemplateDao.delete(bRMSParamTemplateData);
+			commonClassDao.delete(bRMSParamTemplateData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.brmsParamTemplateDao.getBRMSParamTemplateData());
+			String responseString = mapper.writeValueAsString(BRMSDictionaryController.commonClassDao.getData(BRMSParamTemplate.class));
 			JSONObject j = new JSONObject("{brmsParamDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -180,4 +230,324 @@
 		return null;
 	}
 	
+    @RequestMapping(value={"/get_BRMSDependencyDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getBRMSDependencyDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("brmsDependencyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSDependency.class, "dependencyName")));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.getWriter().write(j.toString());
+        }
+        catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            e.printStackTrace();
+        }
+    }
+    
+    @RequestMapping(value={"/get_BRMSDependencyData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getBRMSDependencyDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("brmsDependencyDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSDependency.class)));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
+            response.getWriter().write(j.toString());
+        }
+        catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
+            e.printStackTrace();
+        }
+    }
+    
+    @RequestMapping(value={"/brms_dictionary/save_BRMSDependencyData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    public ModelAndView saveBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        try {
+            boolean duplicateflag = false;
+            LOGGER.debug("DictionaryController:  saveBRMSDependencyDictionary() is called");
+            
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+            
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode root = mapper.readTree(request.getReader());
+            
+            BRMSDependency brmsDependency;
+            String userId = null;
+            if (fromAPI) {
+                brmsDependency = (BRMSDependency)mapper.readValue(root.get("dictionaryFields").toString(), BRMSDependency.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated
+                if (request.getParameter("operation").equals("update")) {
+                	List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(brmsDependency.getDependencyName(), "dependencyName", BRMSDependency.class);
+                	int id = 0;
+                	BRMSDependency data = (BRMSDependency) duplicateData.get(0);
+                	id = data.getId();
+                	brmsDependency.setId(id);
+                	brmsDependency.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+                brmsDependency = (BRMSDependency)mapper.readValue(root.get("brmsDependencyDictionaryData").toString(), BRMSDependency.class);
+                userId = root.get("userid").textValue();
+            }
+            
+            LOGGER.audit("the userId from the ecomp portal is: " + userId);
+            String responseString = null;
+            
+            if(brmsDependency.getDependency()!=null && !brmsDependency.getDependency().trim().equals("")){
+                PEDependency dependency = null;
+                try{
+                    dependency = PolicyUtils.jsonStringToObject(brmsDependency.getDependency(), PEDependency.class);
+                }catch(Exception e){
+                    LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "wrong data given for BRMS PEDependency Dictionary : " + brmsDependency.getDependency());
+                }
+                if(dependency==null){
+                    responseString = "Error";
+                }else{
+                    if(brmsDependency.getId() == 0){
+                        List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(brmsDependency.getDependencyName(), "dependencyName", BRMSDependency.class);
+                        if(!duplicateData.isEmpty()){
+                            duplicateflag = true;
+                        }else{
+                            brmsDependency.setUserCreatedBy(getUserInfo(userId));
+                            brmsDependency.setUserModifiedBy(getUserInfo(userId));
+                            LOGGER.audit("DictionaryController:  got the user info now about to call Save() method on brmsDependencydao");
+                            commonClassDao.save(brmsDependency);
+                        }
+                    }else{
+                        brmsDependency.setUserModifiedBy(this.getUserInfo(userId));
+                        commonClassDao.update(brmsDependency); 
+                    }
+                    if(duplicateflag) {
+                        responseString = "Duplicate";
+                    } else {
+                        responseString = mapper.writeValueAsString(commonClassDao.getData(BRMSDependency.class));
+                    }
+                }
+            }
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate") && !responseString.equals("Error")) {
+                    responseString = "Success";
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{brmsDependencyDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+ 
+                return null;
+            }
+        } catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setCharacterEncoding("UTF-8");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            out.write(e.getMessage());
+        }
+        return null;
+    }
+ 
+    @RequestMapping(value={"/brms_dictionary/remove_brmsDependency"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    public ModelAndView removeBRMSDependencyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        try{
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode root = mapper.readTree(request.getReader());
+            BRMSDependency brmsDependency = (BRMSDependency)mapper.readValue(root.get("data").toString(), BRMSDependency.class);
+            commonClassDao.delete(brmsDependency);
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application / json");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            String responseString = mapper.writeValueAsString(commonClassDao.getData(BRMSDependency.class));
+            JSONObject j = new JSONObject("{brmsDependencyDictionaryDatas: " + responseString + "}");
+            out.write(j.toString());
+            return null;
+        }
+        catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setCharacterEncoding("UTF-8");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            out.write(e.getMessage());
+        }
+        return null;
+    }
+    
+    
+    @RequestMapping(value={"/get_BRMSControllerDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getBRMSControllerDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("brmsControllerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSController.class, "controllerName")));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.getWriter().write(j.toString());
+        }
+        catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            e.printStackTrace();
+        }
+    }
+    
+    @RequestMapping(value={"/get_BRMSControllerData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getBRMSControllerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("brmsControllerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSController.class)));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
+            response.getWriter().write(j.toString());
+        }
+        catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
+            e.printStackTrace();
+        }
+    }
+    
+    @RequestMapping(value={"/brms_dictionary/save_BRMSControllerData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    public ModelAndView saveBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        try {
+            boolean duplicateflag = false;
+            LOGGER.debug("DictionaryController:  saveBRMSControllerDictionary() is called");
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode root = mapper.readTree(request.getReader());
+            BRMSController brmsController;
+            String userId = null;
+            if (fromAPI) {
+                brmsController = (BRMSController)mapper.readValue(root.get("dictionaryFields").toString(), BRMSController.class);
+                userId = "API";
+                //check if update operation or create, get id for data to be updated
+                if (request.getParameter("operation").equals("update")) {
+                	List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(brmsController.getControllerName(), "controllerName", BRMSController.class);
+                	int id = 0;
+                	BRMSController data = (BRMSController) duplicateData.get(0);
+                	id = data.getId();
+                	brmsController.setId(id);
+                	brmsController.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+                brmsController = (BRMSController)mapper.readValue(root.get("brmsControllerDictionaryData").toString(), BRMSController.class);
+                userId = root.get("userid").textValue();
+            }
+            LOGGER.audit("the userId from the ecomp portal is: " + userId);
+            String responseString = null;
+            if(brmsController.getController()!=null && !brmsController.getController().trim().equals("")){
+                PEDependency dependency = null;
+                try{
+                    dependency = PolicyUtils.jsonStringToObject(brmsController.getController(), PEDependency.class);
+                }catch(Exception e){
+                    LOGGER.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + "wrong data given for BRMS Controller Dictionary : " + brmsController.getController());
+                }
+                if(dependency==null){
+                    responseString = "Error";
+                }else{
+                    if(brmsController.getId() == 0){
+                        List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(brmsController.getControllerName(), "controllerName", BRMSController.class);
+                        if(!duplicateData.isEmpty()){
+                            duplicateflag = true;
+                        }else{
+                            brmsController.setUserCreatedBy(getUserInfo(userId));
+                            brmsController.setUserModifiedBy(getUserInfo(userId));
+                            LOGGER.audit("DictionaryController:  got the user info now about to call Save() method on brmsControllerdao");
+                            commonClassDao.save(brmsController);
+                        }
+                    }else{
+                        brmsController.setUserModifiedBy(this.getUserInfo(userId));
+                        commonClassDao.update(brmsController); 
+                    }
+                    if(duplicateflag) {
+                        responseString = "Duplicate";
+                    } else {
+                        responseString = mapper.writeValueAsString(commonClassDao.getData(BRMSController.class));
+                    }
+                }
+            }
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate") && !responseString.equals("Error")) {
+                    responseString = "Success";
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{brmsControllerDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        } catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setCharacterEncoding("UTF-8");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            out.write(e.getMessage());
+        }
+        return null;
+    }
+ 
+    @RequestMapping(value={"/brms_dictionary/remove_brmsController"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    public ModelAndView removeBRMSControllerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        try{
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode root = mapper.readTree(request.getReader());
+            BRMSController brmsController = (BRMSController)mapper.readValue(root.get("data").toString(), BRMSController.class);
+            commonClassDao.delete(brmsController);
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application / json");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            String responseString = mapper.writeValueAsString(commonClassDao.getData(BRMSController.class));
+            JSONObject j = new JSONObject("{brmsControllerDictionaryDatas: " + responseString + "}");
+            out.write(j.toString());
+            return null;
+        }
+        catch (Exception e){
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setCharacterEncoding("UTF-8");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            out.write(e.getMessage());
+        }
+        return null;
+    }
+    
+    public BRMSDependency getDependencyDataByID(String dependencyName){
+        return (BRMSDependency) commonClassDao.getEntityItem(BRMSDependency.class, "dependencyName", dependencyName);
+    }
+    
+    public BRMSController getControllerDataByID(String controllerName){
+        return (BRMSController) commonClassDao.getEntityItem(BRMSController.class, "controllerName", controllerName);
+    }
+	
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/CheckDictionaryDuplicateEntries.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/CheckDictionaryDuplicateEntries.java
deleted file mode 100644
index e044340..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/CheckDictionaryDuplicateEntries.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.controller;
-
-/*
- * 
- * 
- * 
- * */
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-public class CheckDictionaryDuplicateEntries {
-
-	private static final Log logger = LogFactory.getLog(CheckDictionaryDuplicateEntries.class);
-	
-	@SuppressWarnings({ "unchecked", "rawtypes" })
-	public List<Object> CheckDuplicateEntry(String value, String columnName, Class class1) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<Object> data = null;
-		try {
-			Criteria cr = session.createCriteria(class1);
-			cr.add(Restrictions.eq(columnName,value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying for Duplicate Entries for Table"+e + class1);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
index d70661f..26d9a65 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
@@ -21,7 +21,6 @@
 package org.openecomp.policy.pap.xacml.rest.controller;
 
 import java.io.PrintWriter;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -31,15 +30,11 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.adapters.GridData;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.PEPOptionsDao;
-import org.openecomp.policy.rest.dao.ServiceDictionaryDao;
-import org.openecomp.policy.rest.dao.SiteDictionaryDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
-import org.openecomp.policy.rest.dao.VNFTypeDao;
-import org.openecomp.policy.rest.dao.VSCLActionDao;
-import org.openecomp.policy.rest.dao.VarbindDictionaryDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.ClosedLoopD2Services;
 import org.openecomp.policy.rest.jpa.ClosedLoopSite;
 import org.openecomp.policy.rest.jpa.PEPOptions;
@@ -47,6 +42,7 @@
 import org.openecomp.policy.rest.jpa.VNFType;
 import org.openecomp.policy.rest.jpa.VSCLAction;
 import org.openecomp.policy.rest.jpa.VarbindDictionary;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -60,705 +56,969 @@
 @Controller
 public class ClosedLoopDictionaryController{
 
-	@Autowired
-	VSCLActionDao vsclActionDao;
+	private static final Logger LOGGER = FlexLogger.getLogger(ClosedLoopDictionaryController.class);
+
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	VNFTypeDao vnfTypeDao;
-	
-	@Autowired
-	PEPOptionsDao pepOptionsDao;
-	
-	@Autowired
-	VarbindDictionaryDao varbindDao;
-	
-	@Autowired
-	ServiceDictionaryDao closedLoopServiceDao;
-	
-	@Autowired
-	SiteDictionaryDao closedLoopSiteDao;
-	
-	@Autowired
-	UserInfoDao userInfoDao;
-	
-	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
-		return name;	
+	public ClosedLoopDictionaryController(CommonClassDao commonClassDao){
+		ClosedLoopDictionaryController.commonClassDao = commonClassDao;
 	}
 	
-	
+	public ClosedLoopDictionaryController(){}
+
+	public UserInfo getUserInfo(String loginId){
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
+		return name;
+	}
+
+
 	@RequestMapping(value={"/get_VSCLActionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getVSCLActionDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(vsclActionDao.getVsclActionDataByName()));
-			org.openecomp.policy.pap.xacml.rest.util.JsonMessage msg = new org.openecomp.policy.pap.xacml.rest.util.JsonMessage(mapper.writeValueAsString(model));
+			model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")));
+			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
-	
+
+
 	@RequestMapping(value={"/get_VSCLActionData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getVSCLActionDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(vsclActionDao.getVSCLActionData()));
+			model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_VNFTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getVNFTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(vnfTypeDao.getVNFTypeDataByName()));
+			model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VNFType.class, "vnftype")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-		
+
 	@RequestMapping(value={"/get_VNFTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getVNFTypeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(vnfTypeDao.getVNFTypeData()));
+			model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VNFType.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PEPOptionsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPEPOptionsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(pepOptionsDao.getPEPOptionsDataByName()));
+			model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PEPOptionsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPEPOptionsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(pepOptionsDao.getPEPOptionsData()));
+			model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_VarbindDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getVarbindDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("varbindDictionaryDatas", mapper.writeValueAsString(varbindDao.getVarbindDataByName()));
+			model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VarbindDictionary.class, "varbindName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_VarbindDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getVarbindDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("varbindDictionaryDatas", mapper.writeValueAsString(varbindDao.getVarbindDictionaryData()));
+			model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ClosedLoopServicesDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(closedLoopServiceDao.getCLServiceDictDataByName()));
+			model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopD2Services.class, "serviceName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ClosedLoopServicesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getClosedLoopServiceDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(closedLoopServiceDao.getClosedLoopD2ServicesData()));
+			model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ClosedLoopSiteDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getClosedLoopSiteDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(closedLoopSiteDao.getCLSiteDataByName()));
+			model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopSite.class, "siteName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ClosedLoopSiteData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getClosedLoopSiteDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(closedLoopSiteDao.getClosedLoopSiteData()));
+			model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/cl_dictionary/save_vsclAction.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
-	    try {
-	    	boolean duplicateflag = false;
-		      ObjectMapper mapper = new ObjectMapper();
-		      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-		      JsonNode root = mapper.readTree(request.getReader());
-		      VSCLAction vSCLAction = (VSCLAction)mapper.readValue(root.get("vsclActionDictionaryData").toString(), VSCLAction.class);
-		      String userId = root.get("loginId").textValue();
-		      if(vSCLAction.getId() == 0){
-		    	  CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-		    	  List<Object> duplicateData =  entry.CheckDuplicateEntry(vSCLAction.getVsclaction(), "vsclaction", VSCLAction.class);
-		    	  if(!duplicateData.isEmpty()){
-		    		  duplicateflag = true;
-		    	  }else{
-		    		  vSCLAction.setUserCreatedBy(this.getUserInfo(userId));
-		    		  vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
-		    		  vsclActionDao.Save(vSCLAction);
-		    	  }
-		      }else{
-		    	  vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
-		    	  vsclActionDao.update(vSCLAction); 
-		      } 
-		      response.setCharacterEncoding("UTF-8");
-		      response.setContentType("application / json");
-		      request.setCharacterEncoding("UTF-8");
-		      
-		      PrintWriter out = response.getWriter();
-		      String responseString = "";
-			  if(duplicateflag){
-				responseString = "Duplicate";
-			  }else{
-				responseString = mapper.writeValueAsString(this.vsclActionDao.getVSCLActionData());
-			  }	  
-		      JSONObject j = new JSONObject("{vsclActionDictionaryDatas: " + responseString + "}");
-		      
-		      out.write(j.toString());
-		      
-		      return null;
-	    }
-	    catch (Exception e){
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/remove_VsclAction.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView removeVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
-	    try{
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      VSCLAction vSCLAction = (VSCLAction)mapper.readValue(root.get("data").toString(), VSCLAction.class);
-	      vsclActionDao.delete(vSCLAction);
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      
-	      String responseString = mapper.writeValueAsString(this.vsclActionDao.getVSCLActionData());
-	      JSONObject j = new JSONObject("{vsclActionDictionaryDatas: " + responseString + "}");
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      System.out.println(e);
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/save_vnfType.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
-	    try {
-	    	boolean duplicateflag = false;
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      VNFType vNFType = (VNFType)mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VNFType.class);
-		  String userId = root.get("loginId").textValue();
-	      if(vNFType.getId() == 0){
-	    	  CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-	    	  List<Object> duplicateData =  entry.CheckDuplicateEntry(vNFType.getVnftype(), "vnftype", VNFType.class);
-	    	  if(!duplicateData.isEmpty()){
-	    	  	duplicateflag = true;
-	    	  }else{
-	    		  vNFType.setUserCreatedBy(this.getUserInfo(userId));
-		    	  vNFType.setUserModifiedBy(this.getUserInfo(userId));
-		    	  vnfTypeDao.Save(vNFType);
-	    	  }  	 
-	      }else{
-	    	  vNFType.setUserModifiedBy(this.getUserInfo(userId));
-	    	  vnfTypeDao.update(vNFType); 
-	      } 
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      String responseString = "";
+
+	@RequestMapping(value={"/cl_dictionary/save_vsclAction"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			VSCLAction vSCLAction;
+			String userId = null;
+			if (fromAPI) {
+				vSCLAction = (VSCLAction)mapper.readValue(root.get("dictionaryFields").toString(), VSCLAction.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vSCLAction.getVsclaction(), "vsclaction", VSCLAction.class);
+					int id = 0;
+					VSCLAction data = (VSCLAction) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						vSCLAction.setId(1);
+					} else {
+						vSCLAction.setId(id);
+					}
+
+					vSCLAction.setUserCreatedBy(this.getUserInfo(userId));
+				}
+
+			} else {
+				vSCLAction = (VSCLAction)mapper.readValue(root.get("vsclActionDictionaryData").toString(), VSCLAction.class);
+				userId = root.get("userid").textValue();
+			}
+			if(vSCLAction.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vSCLAction.getVsclaction(), "vsclaction", VSCLAction.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					vSCLAction.setUserCreatedBy(this.getUserInfo(userId));
+					vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(vSCLAction);
+				}
+			}else{
+				if(!isFakeUpdate) {
+					vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(vSCLAction); 
+				}
+			}
+
+			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.vnfTypeDao.getVNFTypeData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
+			}	
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate) {
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}               
+
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json"); 
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{vsclActionDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/remove_VsclAction"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			VSCLAction vSCLAction = (VSCLAction)mapper.readValue(root.get("data").toString(), VSCLAction.class);
+			commonClassDao.delete(vSCLAction);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
+			JSONObject j = new JSONObject("{vsclActionDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/save_vnfType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			VNFType vNFType;
+			String userId = null;
+
+			if (fromAPI) {
+				vNFType = (VNFType)mapper.readValue(root.get("dictionaryFields").toString(), VNFType.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vNFType.getVnftype(), "vnftype", VNFType.class);
+					int id = 0;
+					VNFType data = (VNFType) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						vNFType.setId(1);
+					} else {
+						vNFType.setId(id);
+					}
+					vNFType.setUserCreatedBy(this.getUserInfo(userId));
+				}
+			} else {
+				vNFType = (VNFType)mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VNFType.class);
+				userId = root.get("userid").textValue();
+			}
+			if(vNFType.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vNFType.getVnftype(), "vnftype", VNFType.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					vNFType.setUserCreatedBy(this.getUserInfo(userId));
+					vNFType.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(vNFType);
+				}  	 
+			}else{
+				if(!isFakeUpdate) {
+					vNFType.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(vNFType); 
+				}
 			} 
-	      JSONObject j = new JSONObject("{vnfTypeDictionaryDatas: " + responseString + "}");
-	      
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/remove_vnfType.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView removeVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception {
-	    try{
-		      ObjectMapper mapper = new ObjectMapper();
-		      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-		      JsonNode root = mapper.readTree(request.getReader());
-		      VNFType vNFType = (VNFType)mapper.readValue(root.get("data").toString(), VNFType.class);
-		      vnfTypeDao.delete(vNFType);
-		      response.setCharacterEncoding("UTF-8");
-		      response.setContentType("application / json");
-		      request.setCharacterEncoding("UTF-8");
-		      
-		      PrintWriter out = response.getWriter();
-		      
-		      String responseString = mapper.writeValueAsString(this.vnfTypeDao.getVNFTypeData());
-		      JSONObject j = new JSONObject("{vnfTypeDictionaryDatas: " + responseString + "}");
-		      out.write(j.toString());
-		      
-		      return null;
-		    }
-		    catch (Exception e){
-		      System.out.println(e);
-		      response.setCharacterEncoding("UTF-8");
-		      request.setCharacterEncoding("UTF-8");
-		      PrintWriter out = response.getWriter();
-		      out.write(e.getMessage());
-		    }
-		    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/save_pepOptions.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
-	    try {
-	    	boolean duplicateflag = false;
-		      ObjectMapper mapper = new ObjectMapper();
-		      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-		      JsonNode root = mapper.readTree(request.getReader());
-		      PEPOptions pEPOptions = (PEPOptions)mapper.readValue(root.get("pepOptionsDictionaryData").toString(), PEPOptions.class);
-		      GridData gridData = (GridData)mapper.readValue(root.get("pepOptionsDictionaryData").toString(), GridData.class);
-		      String userId = root.get("loginId").textValue();
-		      String actions = "";
-				int counter = 0;
-				if(gridData.getAttributes().size() > 0){
-					for(Object attribute : gridData.getAttributes()){
-						if(attribute instanceof LinkedHashMap<?, ?>){
-							String key = ((LinkedHashMap<?, ?>) attribute).get("option").toString();
-							String value = ((LinkedHashMap<?, ?>) attribute).get("number").toString();
-							if(counter>0){
-								actions = actions + ":#@";
-							}
-							actions = actions + key + "=#@";
-							actions = actions + value;
-							counter ++;
+			String responseString = "";
+			if(duplicateflag){
+				responseString = "Duplicate";
+			}else{
+				responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
+			} 
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate) {
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}        
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result; 
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{vnfTypeDictionaryDatas: " + responseString + "}");
+				out.write(j.toString()); 
+				return null;
+			}
+		} 
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/remove_vnfType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			VNFType vNFType = (VNFType)mapper.readValue(root.get("data").toString(), VNFType.class);
+			commonClassDao.delete(vNFType);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
+			JSONObject j = new JSONObject("{vnfTypeDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/save_pepOptions"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+            PEPOptions pEPOptions;
+            GridData gridData;
+            String userId = null;
+            if (fromAPI) {
+                pEPOptions = (PEPOptions)mapper.readValue(root.get("dictionaryFields").toString(), PEPOptions.class);
+                gridData = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), "pepName", PEPOptions.class);
+                    int id = 0;
+                    PEPOptions data = (PEPOptions) duplicateData.get(0);
+                    id = data.getId();
+                    if(id==0){
+                        isFakeUpdate=true;
+                        pEPOptions.setId(1);
+                    } else {
+                        pEPOptions.setId(id);
+                    }
+                    pEPOptions.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	pEPOptions = (PEPOptions)mapper.readValue(root.get("pepOptionsDictionaryData").toString(), PEPOptions.class);
+            	gridData = (GridData)mapper.readValue(root.get("pepOptionsDictionaryData").toString(), GridData.class);
+            	userId = root.get("userid").textValue();
+            }
+			String actions = "";
+			int counter = 0;
+			if(gridData.getAttributes().size() > 0){
+				for(Object attribute : gridData.getAttributes()){
+					if(attribute instanceof LinkedHashMap<?, ?>){
+						String key = ((LinkedHashMap<?, ?>) attribute).get("option").toString();
+						String value = ((LinkedHashMap<?, ?>) attribute).get("number").toString();
+						if(counter>0){
+							actions = actions + ":#@";
 						}
+						actions = actions + key + "=#@";
+						actions = actions + value;
+						counter ++;
 					}
 				}
-				pEPOptions.setActions(actions);
-		      if(pEPOptions.getId() == 0){
-		    	  CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-		    	  List<Object> duplicateData =  entry.CheckDuplicateEntry(pEPOptions.getPepName(), "pepName", PEPOptions.class);
-		    	  if(!duplicateData.isEmpty()){
-		    	  	duplicateflag = true;
-		    	  }else{
-		    		  pEPOptions.setUserCreatedBy(this.getUserInfo(userId));
-			    	  pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
-			    	  pepOptionsDao.Save(pEPOptions);
-		    	  }   	 
-		      }else{
-		    	  pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
-		    	  pepOptionsDao.update(pEPOptions); 
-		      } 
-		      response.setCharacterEncoding("UTF-8");
-		      response.setContentType("application / json");
-		      request.setCharacterEncoding("UTF-8");
-		      
-		      PrintWriter out = response.getWriter();
-		      String responseString = "";
-		      if(duplicateflag){
-		      	responseString = "Duplicate";
-		      }else{
-		    	  responseString = mapper.writeValueAsString(this.pepOptionsDao.getPEPOptionsData());
-		      } 
-		      JSONObject j = new JSONObject("{pepOptionsDictionaryDatas: " + responseString + "}");
-		      
-		      out.write(j.toString());
-		      
-		      return null;
-		    }
-		    catch (Exception e){
-		      response.setCharacterEncoding("UTF-8");
-		      request.setCharacterEncoding("UTF-8");
-		      PrintWriter out = response.getWriter();
-		      out.write(e.getMessage());
-		    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/remove_pepOptions.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception {
-	    try{
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      PEPOptions pEPOptions = (PEPOptions)mapper.readValue(root.get("data").toString(), PEPOptions.class);
-	      pepOptionsDao.delete(pEPOptions);
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      
-	      String responseString = mapper.writeValueAsString(this.pepOptionsDao.getPEPOptionsData());
-	      JSONObject j = new JSONObject("{pepOptionsDictionaryDatas: " + responseString + "}");
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      System.out.println(e);
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/save_service.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
-	    try {
-	    	boolean duplicateflag = false;
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      ClosedLoopD2Services serviceData = (ClosedLoopD2Services)mapper.readValue(root.get("closedLoopServiceDictionaryData").toString(), ClosedLoopD2Services.class);
-	      String userId = root.get("loginId").textValue();
-	      if(serviceData.getId() == 0){
-	    	  CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-	    	  List<Object> duplicateData =  entry.CheckDuplicateEntry(serviceData.getServiceName(), "serviceName", ClosedLoopD2Services.class);
-	    	  if(!duplicateData.isEmpty()){
-	    	  	duplicateflag = true;
-	    	  }else{
-	    		  serviceData.setUserCreatedBy(this.getUserInfo(userId));
-		    	  serviceData.setUserModifiedBy(this.getUserInfo(userId));
-		    	  closedLoopServiceDao.Save(serviceData);
-	    	  }
-	      }else{
-	    	  serviceData.setUserModifiedBy(this.getUserInfo(userId));
-	    	  closedLoopServiceDao.update(serviceData); 
-	      } 
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      String responseString = "";
-	      if(duplicateflag){
-	      	responseString = "Duplicate";
-	      }else{
-	    	  responseString = mapper.writeValueAsString(this.closedLoopServiceDao.getClosedLoopD2ServicesData());
-	      } 
-	      JSONObject j = new JSONObject("{closedLoopServiceDictionaryDatas: " + responseString + "}");
-	      
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/remove_Service.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView removeServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception {
-	    try{
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      ClosedLoopD2Services closedLoopD2Services = (ClosedLoopD2Services)mapper.readValue(root.get("data").toString(), ClosedLoopD2Services.class);
-	      closedLoopServiceDao.delete(closedLoopD2Services);
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      
-	      String responseString = mapper.writeValueAsString(this.closedLoopServiceDao.getClosedLoopD2ServicesData());
-	      JSONObject j = new JSONObject("{closedLoopServiceDictionaryDatas: " + responseString + "}");
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      System.out.println(e);
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/save_siteName.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
-	    try {
-	    	boolean duplicateflag = false;
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      ClosedLoopSite siteData = (ClosedLoopSite)mapper.readValue(root.get("closedLoopSiteDictionaryData").toString(), ClosedLoopSite.class);
-	      String userId = root.get("loginId").textValue();
-	      if(siteData.getId() == 0){
-	    	  CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-	    	  List<Object> duplicateData =  entry.CheckDuplicateEntry(siteData.getSiteName(), "siteName", ClosedLoopSite.class);
-	    	  if(!duplicateData.isEmpty()){
-	    	  	duplicateflag = true;
-	    	  }else{
-	    		  siteData.setUserCreatedBy(this.getUserInfo(userId));
-		    	  siteData.setUserModifiedBy(this.getUserInfo(userId));
-		    	  closedLoopSiteDao.Save(siteData);
-	    	  }
-	      }else{
-	    	  siteData.setUserModifiedBy(this.getUserInfo(userId));
-	    	  closedLoopSiteDao.update(siteData); 
-	      } 
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      String responseString = "";
-	      if(duplicateflag){
-	      	responseString = "Duplicate";
-	      }else{
-	      	responseString = mapper.writeValueAsString(this.closedLoopSiteDao.getClosedLoopSiteData());
-	      }	
-	      JSONObject j = new JSONObject("{closedLoopSiteDictionaryDatas: " + responseString + "}");
-	      
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/remove_site.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView removeSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception {
-	    try{
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      ClosedLoopSite closedLoopSite = (ClosedLoopSite)mapper.readValue(root.get("data").toString(), ClosedLoopSite.class);
-	      closedLoopSiteDao.delete(closedLoopSite);
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      
-	      String responseString = mapper.writeValueAsString(this.closedLoopSiteDao.getClosedLoopSiteData());
-	      JSONObject j = new JSONObject("{closedLoopSiteDictionaryDatas: " + responseString + "}");
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      System.out.println(e);
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/save_varbind.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
-	    try {
-	    	boolean duplicateflag = false;
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      VarbindDictionary varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("varbindDictionaryData").toString(), VarbindDictionary.class);
-	      String userId = root.get("loginId").textValue();
-	      if(varbindDictionary.getId() == 0){
-	    	  CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-	    	  List<Object> duplicateData =  entry.CheckDuplicateEntry(varbindDictionary.getVarbindName(), "varbindName", VarbindDictionary.class);
-	    	  if(!duplicateData.isEmpty()){
-	    	  	duplicateflag = true;
-	    	  }else{
-	    		  varbindDictionary.setUserCreatedBy(this.getUserInfo(userId));
-		    	  varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
-		    	  varbindDao.Save(varbindDictionary);
-	    	  }	  
-	      }else{
-	    	  varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
-	    	  varbindDao.update(varbindDictionary); 
-	      } 
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      String responseString = "";
-	      if(duplicateflag){
-	      	responseString = "Duplicate";
-	      }else{
-	      	responseString = mapper.writeValueAsString(this.varbindDao.getVarbindDictionaryData());
-	      }
-	      JSONObject j = new JSONObject("{varbindDictionaryDatas: " + responseString + "}");
-	      
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
-	@RequestMapping(value={"/cl_dictionary/remove_varbindDict.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	  public ModelAndView removeVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception {
-	    try{
-	      ObjectMapper mapper = new ObjectMapper();
-	      mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-	      JsonNode root = mapper.readTree(request.getReader());
-	      VarbindDictionary varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("data").toString(), VarbindDictionary.class);
-	      varbindDao.delete(varbindDictionary);
-	      response.setCharacterEncoding("UTF-8");
-	      response.setContentType("application / json");
-	      request.setCharacterEncoding("UTF-8");
-	      
-	      PrintWriter out = response.getWriter();
-	      
-	      String responseString = mapper.writeValueAsString(this.varbindDao.getVarbindDictionaryData());
-	      JSONObject j = new JSONObject("{varbindDictionaryDatas: " + responseString + "}");
-	      out.write(j.toString());
-	      
-	      return null;
-	    }
-	    catch (Exception e){
-	      System.out.println(e);
-	      response.setCharacterEncoding("UTF-8");
-	      request.setCharacterEncoding("UTF-8");
-	      PrintWriter out = response.getWriter();
-	      out.write(e.getMessage());
-	    }
-	    return null;
-	  }
-	
+			}
+			pEPOptions.setActions(actions);
+			if(pEPOptions.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), "pepName", PEPOptions.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					pEPOptions.setUserCreatedBy(this.getUserInfo(userId));
+					pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(pEPOptions);
+				}   	 
+			}else{
+				if(!isFakeUpdate){
+					pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(pEPOptions);
+				}
+			}
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class));
+            } 
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    } 
+                }
+                
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{pepOptionsDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+ 
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/remove_pepOptions"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			PEPOptions pEPOptions = (PEPOptions)mapper.readValue(root.get("data").toString(), PEPOptions.class);
+			commonClassDao.delete(pEPOptions);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class));
+			JSONObject j = new JSONObject("{pepOptionsDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/save_service"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+            ClosedLoopD2Services serviceData;
+            String userId = null;
+            if (fromAPI) {
+                serviceData = (ClosedLoopD2Services)mapper.readValue(root.get("dictionaryFields").toString(), ClosedLoopD2Services.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceData.getServiceName(), "serviceName", ClosedLoopD2Services.class);
+                    int id = 0;
+                    ClosedLoopD2Services data = (ClosedLoopD2Services) duplicateData.get(0);
+                    id = data.getId();
+                    if(id==0){
+                        isFakeUpdate=true;
+                        serviceData.setId(1);
+                    } else {
+                        serviceData.setId(id);
+                    }
+                    serviceData.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	serviceData = (ClosedLoopD2Services)mapper.readValue(root.get("closedLoopServiceDictionaryData").toString(), ClosedLoopD2Services.class);
+            	userId = root.get("userid").textValue();
+            }
+			if(serviceData.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceData.getServiceName(), "serviceName", ClosedLoopD2Services.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					serviceData.setUserCreatedBy(this.getUserInfo(userId));
+					serviceData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(serviceData);
+				}
+			}else{
+				if(!isFakeUpdate){
+					serviceData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(serviceData); 
+				}
+			}
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class));
+            } 
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{closedLoopServiceDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/remove_Service"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			ClosedLoopD2Services closedLoopD2Services = (ClosedLoopD2Services)mapper.readValue(root.get("data").toString(), ClosedLoopD2Services.class);
+			commonClassDao.delete(closedLoopD2Services);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class));
+			JSONObject j = new JSONObject("{closedLoopServiceDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/save_siteName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+            ClosedLoopSite siteData;
+            String userId = null;
+            if (fromAPI) {
+                siteData = (ClosedLoopSite)mapper.readValue(root.get("dictionaryFields").toString(), ClosedLoopSite.class);
+                userId = "API";
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(siteData.getSiteName(), "siteName", ClosedLoopSite.class);
+                    int id = 0;
+                    ClosedLoopSite data = (ClosedLoopSite) duplicateData.get(0);
+                    id = data.getId();
+                    if(id==0){
+                        isFakeUpdate=true;
+                        siteData.setId(1);
+                    } else {
+                        siteData.setId(id);
+                    }
+                    siteData.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	siteData = (ClosedLoopSite)mapper.readValue(root.get("closedLoopSiteDictionaryData").toString(), ClosedLoopSite.class);
+            	userId = root.get("userid").textValue();
+            }
+			if(siteData.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(siteData.getSiteName(), "siteName", ClosedLoopSite.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					siteData.setUserCreatedBy(this.getUserInfo(userId));
+					siteData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(siteData);
+				}
+			}else{
+				if(!isFakeUpdate) {
+					siteData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(siteData);
+				}
+			}
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class));
+            }   
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{closedLoopSiteDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/remove_site"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			ClosedLoopSite closedLoopSite = (ClosedLoopSite)mapper.readValue(root.get("data").toString(), ClosedLoopSite.class);
+			commonClassDao.delete(closedLoopSite);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class));
+			JSONObject j = new JSONObject("{closedLoopSiteDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/save_varbind"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+            VarbindDictionary varbindDictionary;
+            String userId = null;
+            if (fromAPI) {
+                varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("dictionaryFields").toString(), VarbindDictionary.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(varbindDictionary.getVarbindName(), "varbindName", VarbindDictionary.class);
+                    int id = 0;
+                    VarbindDictionary data = (VarbindDictionary) duplicateData.get(0);
+                    id = data.getId();
+                    if(id==0){
+                        isFakeUpdate=true;
+                        varbindDictionary.setId(1);
+                    } else {
+                        varbindDictionary.setId(id);
+                    }
+                    varbindDictionary.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("varbindDictionaryData").toString(), VarbindDictionary.class);
+            	userId = root.get("userid").textValue();
+            }
+			if(varbindDictionary.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(varbindDictionary.getVarbindName(), "varbindName", VarbindDictionary.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					varbindDictionary.setUserCreatedBy(this.getUserInfo(userId));
+					varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(varbindDictionary);
+				}	  
+			}else{
+				if(!isFakeUpdate){
+					varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(varbindDictionary);
+				}
+			}
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{varbindDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/cl_dictionary/remove_varbindDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			VarbindDictionary varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("data").toString(), VarbindDictionary.class);
+			commonClassDao.delete(varbindDictionary);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class));
+			JSONObject j = new JSONObject("{varbindDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
 }
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
index 3308a99..60ed95a 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
@@ -29,12 +29,14 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.DecisionPolicyDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.Datatype;
 import org.openecomp.policy.rest.jpa.DecisionSettings;
 import org.openecomp.policy.rest.jpa.UserInfo;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -48,14 +50,19 @@
 @Controller
 public class DecisionPolicyDictionaryController {
 
-	@Autowired
-	DecisionPolicyDao decisionPolicyDao;
+	private static final Logger LOGGER  = FlexLogger.getLogger(DecisionPolicyDictionaryController.class);
+	
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	UserInfoDao userInfoDao;
+	public DecisionPolicyDictionaryController(CommonClassDao commonClassDao){
+		DecisionPolicyDictionaryController.commonClassDao = commonClassDao;
+	}
+	
+	public DecisionPolicyDictionaryController(){}
 	
 	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
 		return name;	
 	}
 	
@@ -64,13 +71,13 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("settingsDictionaryDatas", mapper.writeValueAsString(decisionPolicyDao.getDecisionDataByName()));
+			model.put("settingsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DecisionSettings.class, "xacmlId")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
 
@@ -80,25 +87,57 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("settingsDictionaryDatas", mapper.writeValueAsString(decisionPolicyDao.getDecisionSettingsData()));
+			model.put("settingsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DecisionSettings.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
 	
-	@RequestMapping(value={"/decision_dictionary/save_Settings.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/decision_dictionary/save_Settings"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			DecisionSettings decisionSettings = (DecisionSettings)mapper.readValue(root.get("settingsDictionaryData").toString(), DecisionSettings.class);
-		    String userId = root.get("loginId").textValue();
+			DecisionSettings decisionSettings;
+            String userId = null;
+            
+            if (fromAPI) {
+            	decisionSettings = (DecisionSettings)mapper.readValue(root.get("dictionaryFields").toString(), DecisionSettings.class);
+            	userId = "API";
+
+            	//check if update operation or create, get id for data to be updated and update attributeData
+            	if (request.getParameter("operation").equals("update")) {
+            		List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(decisionSettings.getXacmlId(), "xacmlId", DecisionSettings.class);
+            		int id = 0;
+            		DecisionSettings data = (DecisionSettings) duplicateData.get(0);
+            		id = data.getId();
+            		if(id==0){
+            			isFakeUpdate=true;
+            			decisionSettings.setId(1);
+            		} else {
+            			decisionSettings.setId(id);
+            		}
+            		decisionSettings.setUserCreatedBy(this.getUserInfo(userId));
+            	}
+            } else {
+            	decisionSettings = (DecisionSettings)mapper.readValue(root.get("settingsDictionaryData").toString(), DecisionSettings.class);
+            	userId = root.get("userid").textValue();
+            }
 			if(decisionSettings.getDatatypeBean().getShortName() != null){
 				String datatype = decisionSettings.getDatatypeBean().getShortName();
 				Datatype a = new Datatype();
@@ -116,37 +155,51 @@
 				decisionSettings.setDatatypeBean(a);
 			}
 			if(decisionSettings.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(decisionSettings.getXacmlId(), "xacmlId", DecisionSettings.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(decisionSettings.getXacmlId(), "xacmlId", DecisionSettings.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					decisionSettings.setUserCreatedBy(this.getUserInfo(userId));
 					decisionSettings.setUserModifiedBy(this.getUserInfo(userId));
-					decisionPolicyDao.Save(decisionSettings);
+					commonClassDao.save(decisionSettings);
 				}
 			}else{
-				decisionSettings.setUserModifiedBy(this.getUserInfo(userId));
-				decisionPolicyDao.update(decisionSettings); 
-			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString =  mapper.writeValueAsString(this.decisionPolicyDao.getDecisionSettingsData());
+				if(!isFakeUpdate) {
+					decisionSettings.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(decisionSettings); 
+				}
 			}
-			JSONObject j = new JSONObject("{settingsDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString =  mapper.writeValueAsString(commonClassDao.getData(DecisionSettings.class));
+            }
+          
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{settingsDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+ 
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -155,28 +208,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/settings_dictionary/remove_settings.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/settings_dictionary/remove_settings"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			DecisionSettings decisionSettings = (DecisionSettings)mapper.readValue(root.get("data").toString(), DecisionSettings.class);
-			decisionPolicyDao.delete(decisionSettings);
+			commonClassDao.delete(decisionSettings);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.decisionPolicyDao.getDecisionSettingsData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(DecisionSettings.class));
 			JSONObject j = new JSONObject("{settingsDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
index c184464..aa05f52 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DescriptiveDictionaryController.java
@@ -30,12 +30,14 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.adapters.GridData;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.DescriptiveScopeDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.DescriptiveScope;
 import org.openecomp.policy.rest.jpa.UserInfo;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -49,14 +51,19 @@
 @Controller
 public class DescriptiveDictionaryController {
 
-	@Autowired
-	DescriptiveScopeDao descriptiveScopeDao;
+	private static final Logger LOGGER  = FlexLogger.getLogger(DescriptiveDictionaryController.class);
+	
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	UserInfoDao userInfoDao;
+	public DescriptiveDictionaryController(CommonClassDao commonClassDao){
+		DescriptiveDictionaryController.commonClassDao = commonClassDao;
+	}
+	
+	public DescriptiveDictionaryController(){}
 	
 	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
 		return name;	
 	}
 
@@ -65,13 +72,13 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(descriptiveScopeDao.getDescriptiveScopeDataByName()));
+			model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DescriptiveScope.class, "descriptiveScopeName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
 	
@@ -80,26 +87,59 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(descriptiveScopeDao.getDescriptiveScope()));
+			model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DescriptiveScope.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
 	
-	@RequestMapping(value={"/descriptive_dictionary/save_descriptive.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/descriptive_dictionary/save_descriptive"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			DescriptiveScope descriptiveScope = (DescriptiveScope)mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), DescriptiveScope.class);
-			GridData data = (GridData)mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), GridData.class);
-		    String userId = root.get("loginId").textValue();
+            DescriptiveScope descriptiveScope;
+            GridData data;
+            String userId = null;
+            if (fromAPI) {
+                descriptiveScope = (DescriptiveScope)mapper.readValue(root.get("dictionaryFields").toString(), DescriptiveScope.class);
+                data = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                	List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(descriptiveScope.getScopeName(), "descriptiveScopeName", DescriptiveScope.class);
+                	int id = 0;
+                	DescriptiveScope dbdata = (DescriptiveScope) duplicateData.get(0);
+                	id = dbdata.getId();
+                	if(id==0){
+                		isFakeUpdate=true;
+                		descriptiveScope.setId(1);
+                	} else {
+                		descriptiveScope.setId(id);
+                	}
+                	descriptiveScope.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	descriptiveScope = (DescriptiveScope)mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), DescriptiveScope.class);
+            	data = (GridData)mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), GridData.class);
+            	userId = root.get("userid").textValue();
+            }
 			String header = "";
 			int counter = 0;
 			if(data.getAttributes().size() > 0){
@@ -118,37 +158,51 @@
 			}
 			descriptiveScope.setSearch(header);
 			if(descriptiveScope.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(descriptiveScope.getScopeName(), "descriptiveScopeName", DescriptiveScope.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(descriptiveScope.getScopeName(), "descriptiveScopeName", DescriptiveScope.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					descriptiveScope.setUserCreatedBy(this.getUserInfo(userId));
 					descriptiveScope.setUserModifiedBy(this.getUserInfo(userId));
-					descriptiveScopeDao.Save(descriptiveScope);
+					commonClassDao.save(descriptiveScope);
 				}
 			}else{
-				descriptiveScope.setUserModifiedBy(this.getUserInfo(userId));
-				descriptiveScopeDao.update(descriptiveScope); 
+				if(!isFakeUpdate){
+					descriptiveScope.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(descriptiveScope); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString =  mapper.writeValueAsString(this.descriptiveScopeDao.getDescriptiveScope());
-			}
-			JSONObject j = new JSONObject("{descriptiveScopeDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString =  mapper.writeValueAsString(commonClassDao.getData(DescriptiveScope.class));
+            }
+            
+            if (fromAPI) {
+            	if (responseString!=null && !responseString.equals("Duplicate")) {
+            		if(isFakeUpdate){
+            			responseString = "Exists";
+            		} else {
+            			responseString = "Success";
+            		}
+            	}
+            	ModelAndView result = new ModelAndView();
+            	result.setViewName(responseString);
+            	return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{descriptiveScopeDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+ 
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -157,28 +211,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/descriptive_dictionary/remove_descriptiveScope.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/descriptive_dictionary/remove_descriptiveScope"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			DescriptiveScope descriptiveScope = (DescriptiveScope)mapper.readValue(root.get("data").toString(), DescriptiveScope.class);
-			descriptiveScopeDao.delete(descriptiveScope);
+			commonClassDao.delete(descriptiveScope);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.descriptiveScopeDao.getDescriptiveScope());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(DescriptiveScope.class));
 			JSONObject j = new JSONObject("{descriptiveScopeDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
index aa2fb4a..c08bba6 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryController.java
@@ -34,15 +34,13 @@
 import org.apache.commons.logging.LogFactory;
 import org.json.JSONObject;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.AttributeDao;
-import org.openecomp.policy.rest.dao.CategoryDao;
-import org.openecomp.policy.rest.dao.EcompNameDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.Attribute;
 import org.openecomp.policy.rest.jpa.Category;
 import org.openecomp.policy.rest.jpa.Datatype;
 import org.openecomp.policy.rest.jpa.EcompName;
 import org.openecomp.policy.rest.jpa.UserInfo;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -57,36 +55,33 @@
 @Controller
 public class DictionaryController {
 	
-	private static final Log logger	= LogFactory.getLog(DictionaryController.class);
+	private static final Log LOGGER	= LogFactory.getLog(DictionaryController.class);
 
-	@Autowired
-	AttributeDao attributeDao;
-
-	@Autowired
-	EcompNameDao ecompNameDao;
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	UserInfoDao userInfoDao;
+	public DictionaryController(CommonClassDao commonClassDao){
+		DictionaryController.commonClassDao = commonClassDao;
+	}
 	
-	@Autowired
-	CategoryDao categoryDao;
+	public DictionaryController(){}
+	
+	public UserInfo getUserInfo(String loginId){
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
+		return name;	
+	}
 	
 	
 	public Category getCategory(){
-		for (int i = 0; i < categoryDao.getCategoryListData().size() ; i++) {
-			Category value = categoryDao.getCategoryListData().get(i);
+		List<Object> list = commonClassDao.getData(Category.class);
+		for (int i = 0; i < list.size() ; i++) {
+			Category value = (Category) list.get(i);
 			if (value.getShortName().equals("resource")) {
 				return value;
 			}
 		}
 		return null;	
 	}
-	
-	
-	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
-		return name;	
-	}
 
 	@RequestMapping(value={"/get_AttributeDatabyAttributeName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getAttributeDictionaryEntityDatabyAttributeName(HttpServletRequest request, HttpServletResponse response){
@@ -94,13 +89,13 @@
 			System.out.println();
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("attributeDictionaryDatas", mapper.writeValueAsString(attributeDao.getAttributeData()));
+			model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Attribute.class, "xacmlId")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
 	
@@ -111,26 +106,60 @@
 			System.out.println();
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("attributeDictionaryDatas", mapper.writeValueAsString(attributeDao.getData()));
+			model.put("attributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Attribute.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
 	
-	@RequestMapping(value={"/attribute_dictionary/save_attribute.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/attribute_dictionary/save_attribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			Attribute attributeData = (Attribute)mapper.readValue(root.get("attributeDictionaryData").toString(), Attribute.class);
-			AttributeValues attributeValueData = (AttributeValues)mapper.readValue(root.get("attributeDictionaryData").toString(), AttributeValues.class);
-			String userId = root.get("loginId").textValue();
+            Attribute attributeData = null;
+            AttributeValues attributeValueData = null;
+            String userId = null;
+            if (fromAPI) {
+                //JsonNode json = root.get("dictionaryFields");
+                attributeData = (Attribute)mapper.readValue(root.get("dictionaryFields").toString(), Attribute.class);
+                attributeValueData = (AttributeValues)mapper.readValue(root.get("dictionaryFields").toString(), AttributeValues.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                	List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(attributeData.getXacmlId(), "xacmlId", Attribute.class);
+                	int id = 0;
+                	Attribute data = (Attribute) duplicateData.get(0);
+                	id = data.getId();
+                	if(id==0){
+                		isFakeUpdate=true;
+                		attributeData.setId(1);
+                	} else {
+                		attributeData.setId(id);
+                	}
+                	attributeData.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	attributeData = (Attribute)mapper.readValue(root.get("attributeDictionaryData").toString(), Attribute.class);
+            	attributeValueData = (AttributeValues)mapper.readValue(root.get("attributeDictionaryData").toString(), AttributeValues.class);
+            	userId = root.get("userid").textValue();
+            }
 			String userValue = "";
 			int counter = 0;
 			if(attributeValueData.getUserDataTypeValues().size() > 0){
@@ -163,38 +192,51 @@
 				attributeData.setDatatypeBean(a);
 			}
 			if(attributeData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(attributeData.getXacmlId(), "xacmlId", Attribute.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(attributeData.getXacmlId(), "xacmlId", Attribute.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					attributeData.setCategoryBean(this.getCategory());
 					attributeData.setUserCreatedBy(this.getUserInfo(userId));
 					attributeData.setUserModifiedBy(this.getUserInfo(userId));
-					attributeDao.Save(attributeData);
+					commonClassDao.save(attributeData);
 				}
 			}else{
-				attributeData.setUserModifiedBy(this.getUserInfo(userId));
-				attributeDao.update(attributeData); 
+				if(!isFakeUpdate) {
+					attributeData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(attributeData); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.attributeDao.getData());
-			}
-			JSONObject j = new JSONObject("{attributeDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = null;
+            if(duplicateflag) {
+                responseString = "Duplicate";
+            } else {
+                responseString = mapper.writeValueAsString(commonClassDao.getData(Attribute.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate) {
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{attributeDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
+        	LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -203,28 +245,26 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/attribute_dictionary/remove_attribute.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/attribute_dictionary/remove_attribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			Attribute attributeData = (Attribute)mapper.readValue(root.get("data").toString(), Attribute.class);
-			attributeDao.delete(attributeData);
+			commonClassDao.delete(attributeData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
-
-			String responseString = mapper.writeValueAsString(this.attributeDao.getData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(Attribute.class));
 			JSONObject j = new JSONObject("{attributeDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -236,82 +276,120 @@
 	//EcompName Dictionary
 	@RequestMapping(value={"/get_EcompNameDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getEcompNameDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
-		logger.info("get_EcompNameDataByName is called");
+		LOGGER.info("get_EcompNameDataByName is called");
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(ecompNameDao.getEcompNameDataByName()));
+			model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(EcompName.class, "ecompName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
 	
 	@RequestMapping(value={"/get_EcompNameData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getEcompNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
-		logger.info("get_EcompNameData is called");
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(ecompNameDao.getEcompName()));
+			model.put("ecompNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(EcompName.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
-			logger.error("ERROR While callinge DAO: " + e.getMessage());
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
 
-	@RequestMapping(value={"/ecomp_dictionary/save_ecompName.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ecomp_dictionary/save_ecompName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveEcompDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
-			System.out.println("DictionaryController:  saveEcompDictionary() is called");
-			logger.debug("DictionaryController:  saveEcompDictionary() is called");
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			EcompName ecompData = (EcompName)mapper.readValue(root.get("ecompNameDictionaryData").toString(), EcompName.class);
-			String userId = root.get("loginId").textValue();
-			System.out.println("the userId from the ecomp portal is: " + userId);
+			EcompName ecompData;
+			String userId = null;
+			if (fromAPI) {
+				ecompData = (EcompName)mapper.readValue(root.get("dictionaryFields").toString(), EcompName.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getEcompName(), "ecompName", EcompName.class);
+					int id = 0;
+					EcompName data = (EcompName) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						ecompData.setId(1);
+					} else {
+						ecompData.setId(id);
+					}
+					ecompData.setUserCreatedBy(this.getUserInfo(userId));
+				}
+			} else {
+				ecompData = (EcompName)mapper.readValue(root.get("ecompNameDictionaryData").toString(), EcompName.class);
+				userId = root.get("userid").textValue();
+			}
 			if(ecompData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(ecompData.getEcompName(), "ecompName", EcompName.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getEcompName(), "ecompName", EcompName.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					ecompData.setUserCreatedBy(getUserInfo(userId));
 					ecompData.setUserModifiedBy(getUserInfo(userId));
-					System.out.println("DictionaryController:  got the user info now about to call Save() method on ecompNamedao");
-					ecompNameDao.Save(ecompData);
+					commonClassDao.save(ecompData);
 				}
 			}else{
-				ecompData.setUserModifiedBy(this.getUserInfo(userId));
-				ecompNameDao.update(ecompData); 
+				if(!isFakeUpdate){
+					ecompData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(ecompData);
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
+			String responseString = null;
+			if(duplicateflag) {
 				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.ecompNameDao.getEcompName());
+			} else {
+				responseString = mapper.writeValueAsString(commonClassDao.getData(EcompName.class));
 			}
-			JSONObject j = new JSONObject("{ecompNameDictionaryDatas: " + responseString + "}");
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
 
-			out.write(j.toString());
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{ecompNameDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -320,28 +398,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ecomp_dictionary/remove_ecomp.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ecomp_dictionary/remove_ecomp"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeEcompDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			EcompName ecompData = (EcompName)mapper.readValue(root.get("data").toString(), EcompName.class);
-			ecompNameDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.ecompNameDao.getEcompName());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(EcompName.class));
 			JSONObject j = new JSONObject("{ecompNameDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryImportController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryImportController.java
index 3ed8f5d..95172ac 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryImportController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/DictionaryImportController.java
@@ -33,31 +33,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.openecomp.policy.rest.dao.ActionListDao;
-import org.openecomp.policy.rest.dao.ActionPolicyDictDao;
-import org.openecomp.policy.rest.dao.AddressGroupDao;
-import org.openecomp.policy.rest.dao.AttributeDao;
-import org.openecomp.policy.rest.dao.BRMSParamTemplateDao;
-import org.openecomp.policy.rest.dao.DecisionPolicyDao;
-import org.openecomp.policy.rest.dao.DescriptiveScopeDao;
-import org.openecomp.policy.rest.dao.EcompNameDao;
-import org.openecomp.policy.rest.dao.PEPOptionsDao;
-import org.openecomp.policy.rest.dao.PortListDao;
-import org.openecomp.policy.rest.dao.PrefixListDao;
-import org.openecomp.policy.rest.dao.ProtocolListDao;
-import org.openecomp.policy.rest.dao.SecurityZoneDao;
-import org.openecomp.policy.rest.dao.ServiceDictionaryDao;
-import org.openecomp.policy.rest.dao.ServiceGroupDao;
-import org.openecomp.policy.rest.dao.ServiceListDao;
-import org.openecomp.policy.rest.dao.SiteDictionaryDao;
-import org.openecomp.policy.rest.dao.TermListDao;
-import org.openecomp.policy.rest.dao.VNFTypeDao;
-import org.openecomp.policy.rest.dao.VSCLActionDao;
-import org.openecomp.policy.rest.dao.VarbindDictionaryDao;
-import org.openecomp.policy.rest.dao.ZoneDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.ActionList;
 import org.openecomp.policy.rest.jpa.ActionPolicyDict;
 import org.openecomp.policy.rest.jpa.AddressGroup;
@@ -70,7 +46,7 @@
 import org.openecomp.policy.rest.jpa.EcompName;
 import org.openecomp.policy.rest.jpa.GroupServiceList;
 import org.openecomp.policy.rest.jpa.PEPOptions;
-import org.openecomp.policy.rest.jpa.PREFIXLIST;
+import org.openecomp.policy.rest.jpa.PrefixList;
 import org.openecomp.policy.rest.jpa.ProtocolList;
 import org.openecomp.policy.rest.jpa.SecurityZone;
 import org.openecomp.policy.rest.jpa.ServiceList;
@@ -94,524 +70,470 @@
 public class DictionaryImportController {
 	private String newFile;
 
+	private static CommonClassDao commonClassDao;
+	
 	@Autowired
-	AttributeDao attributeDao;
+	public DictionaryImportController(CommonClassDao commonClassDao){
+		DictionaryImportController.commonClassDao = commonClassDao;
+	}
+	
+	public DictionaryImportController(){}	
 
-	@Autowired
-	ActionPolicyDictDao  actionPolicyDictDao;
 
-	@Autowired
-	EcompNameDao ecompNameDao;
-
-	@Autowired
-	VNFTypeDao vnfTypeDao;
-
-	@Autowired
-	VSCLActionDao vsclActionDao;
-
-	@Autowired
-	PEPOptionsDao pepOptionsDao;
-
-	@Autowired
-	VarbindDictionaryDao varbindDao;
-
-	@Autowired
-	ServiceDictionaryDao closedLoopServiceDao;
-
-	@Autowired
-	SiteDictionaryDao closedLoopSiteDao;
-
-	@Autowired
-	DescriptiveScopeDao descriptiveScopeDao;
-
-	@Autowired
-	PrefixListDao prefixListDao;
-
-	@Autowired
-	PortListDao portListDao;
-
-	@Autowired
-	ProtocolListDao protocolListDao;
-
-	@Autowired
-	AddressGroupDao addressGroupDao;
-
-	@Autowired
-	ActionListDao actionListDao;
-
-	@Autowired
-	SecurityZoneDao securityZoneDao;
-
-	@Autowired
-	ServiceGroupDao serviceGroupDao;
-
-	@Autowired
-	ServiceListDao serviceListDao;
-
-	@Autowired
-	TermListDao termListDao;
-
-	@Autowired
-	ZoneDao zoneDao;
-
-	@Autowired
-	DecisionPolicyDao decisionSettingsDao;
-
-	@Autowired
-	BRMSParamTemplateDao brmsParamTemplateDao;
-
-	@RequestMapping(value={"/dictionary/import_dictionary.htm/*"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/dictionary/import_dictionary"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public void ImportDictionaryData(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		ObjectMapper mapper = new ObjectMapper();
 		mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 		//JsonNode root = mapper.readTree(request.getReader());
-		String userId = request.getPathInfo().substring(request.getPathInfo().lastIndexOf("/")+1);
-		List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
-		for (FileItem item : items) {
-			File file = new File(item.getName());
-			OutputStream outputStream = new FileOutputStream(file);
-			IOUtils.copy(item.getInputStream(), outputStream);
-			outputStream.close();
-			this.newFile = file.toString();
-			CSVReader csvReader = new CSVReader(new FileReader(this.newFile));
-			List<String[]> dictSheet = csvReader.readAll();
-			if(item.getName().startsWith("Attribute")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					Attribute attribute = new Attribute("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("xacml_id") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute ID")){
-							attribute.setXacmlId(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("priority")){
-							attribute.setPriority(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("datatype") || dictSheet.get(0)[j].equalsIgnoreCase("Data Type")){
-							Datatype dataType = new Datatype();
-							if(rows[j].equalsIgnoreCase("string")){
-								dataType.setId(26);
-							}else if(rows[j].equalsIgnoreCase("integer")){
-								dataType.setId(12);
-							}else if(rows[j].equalsIgnoreCase("double")){
-								dataType.setId(25);
-							}else if(rows[j].equalsIgnoreCase("boolean")){
-								dataType.setId(18);
-							}else if(rows[j].equalsIgnoreCase("user")){
-								dataType.setId(29);
-							}
-							attribute.setDatatypeBean(dataType);
-							Category category = new Category();
-							category.setId(5);
-							attribute.setCategoryBean(category);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("attribute_value") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute Value")){
-							attribute.setAttributeValue(rows[j]);
-						}
+		String userId = request.getParameter("userId");
+		String dictionaryName = request.getParameter("dictionaryName");
+
+		File file = new File(dictionaryName);
+		OutputStream outputStream = new FileOutputStream(file);
+		IOUtils.copy(request.getInputStream(), outputStream);
+		outputStream.close();
+		this.newFile = file.toString();
+		CSVReader csvReader = new CSVReader(new FileReader(this.newFile));
+		List<String[]> dictSheet = csvReader.readAll();
+		if(dictionaryName.startsWith("Attribute")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				Attribute attribute = new Attribute("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("xacml_id") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute ID")){
+						attribute.setXacmlId(rows[j]);
 					}
-					attributeDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("ActionPolicyDictionary")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					ActionPolicyDict attribute = new ActionPolicyDict("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("attribute_name") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute Name")){
-							attribute.setAttributeName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("body")){
-							attribute.setBody(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("headers")){
-							attribute.setHeader(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("method")){
-							attribute.setMethod(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("type")){
-							attribute.setMethod(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("url")){
-							attribute.setMethod(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
 					}
-					actionPolicyDictDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("EcompName")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					EcompName attribute = new EcompName("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("ecomp_name") || dictSheet.get(0)[j].equalsIgnoreCase("Ecomp Name")){
-							attribute.setEcompName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("priority")){
+						attribute.setPriority(rows[j]);
 					}
-					ecompNameDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("VNFType")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					VNFType attribute = new VNFType("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("vnf_type") || dictSheet.get(0)[j].equalsIgnoreCase("VNF Type")){
-							attribute.setVnftype(rows[j]);
+					if(dictSheet.get(0)[j].equalsIgnoreCase("datatype") || dictSheet.get(0)[j].equalsIgnoreCase("Data Type")){
+						Datatype dataType = new Datatype();
+						if(rows[j].equalsIgnoreCase("string")){
+							dataType.setId(26);
+						}else if(rows[j].equalsIgnoreCase("integer")){
+							dataType.setId(12);
+						}else if(rows[j].equalsIgnoreCase("double")){
+							dataType.setId(25);
+						}else if(rows[j].equalsIgnoreCase("boolean")){
+							dataType.setId(18);
+						}else if(rows[j].equalsIgnoreCase("user")){
+							dataType.setId(29);
 						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
+						attribute.setDatatypeBean(dataType);
+						Category category = new Category();
+						category.setId(5);
+						attribute.setCategoryBean(category);
 					}
-					vnfTypeDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("VSCLAction")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					VSCLAction attribute = new VSCLAction("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("vscl_action") || dictSheet.get(0)[j].equalsIgnoreCase("VSCL Action")){
-							attribute.setVsclaction(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("attribute_value") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute Value")){
+						attribute.setAttributeValue(rows[j]);
 					}
-					vsclActionDao.Save(attribute);
 				}
+				commonClassDao.save(attribute);
 			}
-			if(item.getName().startsWith("PEPOptions")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					PEPOptions attribute = new PEPOptions("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("PEP_NAME") || dictSheet.get(0)[j].equalsIgnoreCase("PEP Name")){
-							attribute.setPepName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("Actions")){
-							attribute.setActions(rows[j]);
-						}
+		}
+		if(dictionaryName.startsWith("ActionPolicyDictionary")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				ActionPolicyDict attribute = new ActionPolicyDict("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("attribute_name") || dictSheet.get(0)[j].equalsIgnoreCase("Attribute Name")){
+						attribute.setAttributeName(rows[j]);
 					}
-					pepOptionsDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("VarbindDictionary")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					VarbindDictionary attribute = new VarbindDictionary("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_Name") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind Name")){
-							attribute.setVarbindName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_Description") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind Description")){
-							attribute.setVarbindDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_oid") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind OID")){
-							attribute.setVarbindOID(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("body")){
+						attribute.setBody(rows[j]);
 					}
-					varbindDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("BRMSParamDictionary")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					BRMSParamTemplate attribute = new BRMSParamTemplate();
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("param_template_name") || dictSheet.get(0)[j].equalsIgnoreCase("Rule Name")){
-							attribute.setRuleName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("DESCRIPTION") || dictSheet.get(0)[j].equalsIgnoreCase("Description")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("rule")){
-							attribute.setRule(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
 					}
-					brmsParamTemplateDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("Settings")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					DecisionSettings attribute = new DecisionSettings("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("xacml_id") || dictSheet.get(0)[j].equalsIgnoreCase("Settings ID")){
-							attribute.setXacmlId(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("priority")){
-							attribute.setPriority(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("datatype") || dictSheet.get(0)[j].equalsIgnoreCase("Data Type")){
-							Datatype dataType = new Datatype();
-							if(rows[j].equalsIgnoreCase("string")){
-								dataType.setId(26);
-							}else if(rows[j].equalsIgnoreCase("integer")){
-								dataType.setId(12);
-							}else if(rows[j].equalsIgnoreCase("double")){
-								dataType.setId(25);
-							}else if(rows[j].equalsIgnoreCase("boolean")){
-								dataType.setId(18);
-							}else if(rows[j].equalsIgnoreCase("user")){
-								dataType.setId(29);
-							}
-							attribute.setDatatypeBean(dataType);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("headers")){
+						attribute.setHeader(rows[j]);
 					}
-					decisionSettingsDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("PrefixList")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					PREFIXLIST attribute = new PREFIXLIST("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("prefixListName") || dictSheet.get(0)[j].equalsIgnoreCase("PrefixList Name")){
-							attribute.setPrefixListName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setPrefixListValue(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("prefixListValue") || dictSheet.get(0)[j].equalsIgnoreCase("PrefixList Value")){
-							attribute.setDescription(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("method")){
+						attribute.setMethod(rows[j]);
 					}
-					prefixListDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("SecurityZone")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					SecurityZone attribute = new SecurityZone("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("zoneName") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Name")){
-							attribute.setZoneName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("zoneValue")  || dictSheet.get(0)[j].equalsIgnoreCase("Zone Value")){
-							attribute.setZoneValue(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("type")){
+						attribute.setMethod(rows[j]);
 					}
-					securityZoneDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("Zone")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					Zone attribute = new Zone("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("zoneName") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Name")){
-							attribute.setZoneName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("zoneValue")  || dictSheet.get(0)[j].equalsIgnoreCase("Zone Value")){
-							attribute.setZoneValue(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("url")){
+						attribute.setMethod(rows[j]);
 					}
-					zoneDao.Save(attribute);
 				}
+				commonClassDao.save(attribute);
 			}
-			if(item.getName().startsWith("ServiceList")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					ServiceList attribute = new ServiceList("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceName") || dictSheet.get(0)[j].equalsIgnoreCase("Service Name")){
-							attribute.setServiceName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceDesc")  || dictSheet.get(0)[j].equalsIgnoreCase("Description")){
-							attribute.setServiceDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceType")  || dictSheet.get(0)[j].equalsIgnoreCase("Service Type")){
-							attribute.setServiceType(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceTrasProtocol")  || dictSheet.get(0)[j].equalsIgnoreCase("Transport Protocol")){
-							attribute.setServiceTransProtocol(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceAppProtocol")  || dictSheet.get(0)[j].equalsIgnoreCase("APP Protocol")){
-							attribute.setServiceAppProtocol(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("servicePorts")  || dictSheet.get(0)[j].equalsIgnoreCase("Ports")){
-							attribute.setServicePorts(rows[j]);
-						}
+		}
+		if(dictionaryName.startsWith("EcompName")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				EcompName attribute = new EcompName("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("ecomp_name") || dictSheet.get(0)[j].equalsIgnoreCase("Ecomp Name")){
+						attribute.setEcompName(rows[j]);
 					}
-					serviceListDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("ServiceGroup")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					GroupServiceList attribute = new GroupServiceList("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("name") || dictSheet.get(0)[j].equalsIgnoreCase("Group Name")){
-							attribute.setGroupName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceList")  || dictSheet.get(0)[j].equalsIgnoreCase("Service List")){
-							attribute.setServiceList(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
 					}
-					serviceGroupDao.Save(attribute);
 				}
+				commonClassDao.save(attribute);
 			}
-			if(item.getName().startsWith("AddressGroup")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					AddressGroup attribute = new AddressGroup("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("name") || dictSheet.get(0)[j].equalsIgnoreCase("Group Name")){
-							attribute.setGroupName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("serviceList")  || dictSheet.get(0)[j].equalsIgnoreCase("Prefix List")){
-							attribute.setServiceList(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
+		}
+		if(dictionaryName.startsWith("VNFType")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				VNFType attribute = new VNFType("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("vnf_type") || dictSheet.get(0)[j].equalsIgnoreCase("VNF Type")){
+						attribute.setVnftype(rows[j]);
 					}
-					addressGroupDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("ProtocolList")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					ProtocolList attribute = new ProtocolList("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("protocolName") || dictSheet.get(0)[j].equalsIgnoreCase("Protocol Name")){
-							attribute.setProtocolName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
 					}
-					protocolListDao.Save(attribute);
 				}
+				commonClassDao.save(attribute);
 			}
-			if(item.getName().startsWith("ActionList")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					ActionList attribute = new ActionList("",  userId);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("actionName") || dictSheet.get(0)[j].equalsIgnoreCase("Action Name")){
-							attribute.setActionName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
+		}
+		if(dictionaryName.startsWith("VSCLAction")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				VSCLAction attribute = new VSCLAction("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("vscl_action") || dictSheet.get(0)[j].equalsIgnoreCase("VSCL Action")){
+						attribute.setVsclaction(rows[j]);
 					}
-					actionListDao.Save(attribute);
-				}
-			}
-			if(item.getName().startsWith("TermList")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					TermList attribute = new TermList("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("termName") || dictSheet.get(0)[j].equalsIgnoreCase("Term-Name")){
-							attribute.setTermName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("Term-Description") || dictSheet.get(0)[j].equalsIgnoreCase("termDescription")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("fromZone")  || dictSheet.get(0)[j].equalsIgnoreCase("From Zone")){
-							attribute.setFromZones(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("toZone") || dictSheet.get(0)[j].equalsIgnoreCase("To Zone")){
-							attribute.setToZones(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("srcIPList") || dictSheet.get(0)[j].equalsIgnoreCase("Source-IP-List")){
-							attribute.setSrcIPList(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("destIPList") || dictSheet.get(0)[j].equalsIgnoreCase("Destination-IP-List")){
-							attribute.setDestIPList(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("srcPortList") || dictSheet.get(0)[j].equalsIgnoreCase("Source-Port-List")){
-							attribute.setSrcPortList(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("destPortList") || dictSheet.get(0)[j].equalsIgnoreCase("Destination-Port-List")){
-							attribute.setDestPortList(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("action") || dictSheet.get(0)[j].equalsIgnoreCase("Action List")){
-							attribute.setAction(rows[j]);
-						}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
 					}
-					termListDao.Save(attribute);
 				}
+				commonClassDao.save(attribute);
 			}
-			if(item.getName().startsWith("SearchCriteria")){
-				for(int i = 1; i< dictSheet.size(); i++){
-					DescriptiveScope attribute = new DescriptiveScope("",  userId);
-					UserInfo userinfo = new UserInfo();
-					userinfo.setUserLoginId(userId);
-					attribute.setUserCreatedBy(userinfo);
-					attribute.setUserModifiedBy(userinfo);
-					String[] rows = dictSheet.get(i);
-					for (int j=0 ; j<rows.length; j++ ){
-						if(dictSheet.get(0)[j].equalsIgnoreCase("descriptiveScopeName") || dictSheet.get(0)[j].equalsIgnoreCase("Descriptive ScopeName")){
-							attribute.setScopeName(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
-							attribute.setDescription(rows[j]);
-						}
-						if(dictSheet.get(0)[j].equalsIgnoreCase("search") || dictSheet.get(0)[j].equalsIgnoreCase("Search Criteria")){
-							attribute.setSearch(rows[j]);
-						}
+		}
+		if(dictionaryName.startsWith("PEPOptions")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				PEPOptions attribute = new PEPOptions("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("PEP_NAME") || dictSheet.get(0)[j].equalsIgnoreCase("PEP Name")){
+						attribute.setPepName(rows[j]);
 					}
-					descriptiveScopeDao.Save(attribute);
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("Actions")){
+						attribute.setActions(rows[j]);
+					}
 				}
+				commonClassDao.save(attribute);
 			}
-			csvReader.close();
+		}
+		if(dictionaryName.startsWith("VarbindDictionary")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				VarbindDictionary attribute = new VarbindDictionary("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_Name") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind Name")){
+						attribute.setVarbindName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_Description") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind Description")){
+						attribute.setVarbindDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("varbind_oid") || dictSheet.get(0)[j].equalsIgnoreCase("Varbind OID")){
+						attribute.setVarbindOID(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("BRMSParamDictionary")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				BRMSParamTemplate attribute = new BRMSParamTemplate();
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("param_template_name") || dictSheet.get(0)[j].equalsIgnoreCase("Rule Name")){
+						attribute.setRuleName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("DESCRIPTION") || dictSheet.get(0)[j].equalsIgnoreCase("Description")){
+						attribute.setDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("rule")){
+						attribute.setRule(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("Settings")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				DecisionSettings attribute = new DecisionSettings("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("xacml_id") || dictSheet.get(0)[j].equalsIgnoreCase("Settings ID")){
+						attribute.setXacmlId(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("priority")){
+						attribute.setPriority(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("datatype") || dictSheet.get(0)[j].equalsIgnoreCase("Data Type")){
+						Datatype dataType = new Datatype();
+						if(rows[j].equalsIgnoreCase("string")){
+							dataType.setId(26);
+						}else if(rows[j].equalsIgnoreCase("integer")){
+							dataType.setId(12);
+						}else if(rows[j].equalsIgnoreCase("double")){
+							dataType.setId(25);
+						}else if(rows[j].equalsIgnoreCase("boolean")){
+							dataType.setId(18);
+						}else if(rows[j].equalsIgnoreCase("user")){
+							dataType.setId(29);
+						}
+						attribute.setDatatypeBean(dataType);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("PrefixList")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				PrefixList attribute = new PrefixList("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("prefixListName") || dictSheet.get(0)[j].equalsIgnoreCase("PrefixList Name")){
+						attribute.setPrefixListName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setPrefixListValue(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("prefixListValue") || dictSheet.get(0)[j].equalsIgnoreCase("PrefixList Value")){
+						attribute.setDescription(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("SecurityZone")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				SecurityZone attribute = new SecurityZone("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("zoneName") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Name")){
+						attribute.setZoneName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("zoneValue")  || dictSheet.get(0)[j].equalsIgnoreCase("Zone Value")){
+						attribute.setZoneValue(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("Zone")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				Zone attribute = new Zone("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("zoneName") || dictSheet.get(0)[j].equalsIgnoreCase("Zone Name")){
+						attribute.setZoneName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("zoneValue")  || dictSheet.get(0)[j].equalsIgnoreCase("Zone Value")){
+						attribute.setZoneValue(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("ServiceList")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				ServiceList attribute = new ServiceList("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceName") || dictSheet.get(0)[j].equalsIgnoreCase("Service Name")){
+						attribute.setServiceName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceDesc")  || dictSheet.get(0)[j].equalsIgnoreCase("Description")){
+						attribute.setServiceDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceType")  || dictSheet.get(0)[j].equalsIgnoreCase("Service Type")){
+						attribute.setServiceType(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceTrasProtocol")  || dictSheet.get(0)[j].equalsIgnoreCase("Transport Protocol")){
+						attribute.setServiceTransProtocol(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceAppProtocol")  || dictSheet.get(0)[j].equalsIgnoreCase("APP Protocol")){
+						attribute.setServiceAppProtocol(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("servicePorts")  || dictSheet.get(0)[j].equalsIgnoreCase("Ports")){
+						attribute.setServicePorts(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("ServiceGroup")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				GroupServiceList attribute = new GroupServiceList("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("name") || dictSheet.get(0)[j].equalsIgnoreCase("Group Name")){
+						attribute.setGroupName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceList")  || dictSheet.get(0)[j].equalsIgnoreCase("Service List")){
+						attribute.setServiceList(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("AddressGroup")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				AddressGroup attribute = new AddressGroup("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("name") || dictSheet.get(0)[j].equalsIgnoreCase("Group Name")){
+						attribute.setGroupName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("serviceList")  || dictSheet.get(0)[j].equalsIgnoreCase("Prefix List")){
+						attribute.setServiceList(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("ProtocolList")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				ProtocolList attribute = new ProtocolList("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("protocolName") || dictSheet.get(0)[j].equalsIgnoreCase("Protocol Name")){
+						attribute.setProtocolName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("ActionList")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				ActionList attribute = new ActionList("",  userId);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("actionName") || dictSheet.get(0)[j].equalsIgnoreCase("Action Name")){
+						attribute.setActionName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("TermList")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				TermList attribute = new TermList("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("termName") || dictSheet.get(0)[j].equalsIgnoreCase("Term-Name")){
+						attribute.setTermName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("Term-Description") || dictSheet.get(0)[j].equalsIgnoreCase("termDescription")){
+						attribute.setDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("fromZone")  || dictSheet.get(0)[j].equalsIgnoreCase("From Zone")){
+						attribute.setFromZones(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("toZone") || dictSheet.get(0)[j].equalsIgnoreCase("To Zone")){
+						attribute.setToZones(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("srcIPList") || dictSheet.get(0)[j].equalsIgnoreCase("Source-IP-List")){
+						attribute.setSrcIPList(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("destIPList") || dictSheet.get(0)[j].equalsIgnoreCase("Destination-IP-List")){
+						attribute.setDestIPList(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("srcPortList") || dictSheet.get(0)[j].equalsIgnoreCase("Source-Port-List")){
+						attribute.setSrcPortList(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("destPortList") || dictSheet.get(0)[j].equalsIgnoreCase("Destination-Port-List")){
+						attribute.setDestPortList(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("action") || dictSheet.get(0)[j].equalsIgnoreCase("Action List")){
+						attribute.setAction(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		if(dictionaryName.startsWith("SearchCriteria")){
+			for(int i = 1; i< dictSheet.size(); i++){
+				DescriptiveScope attribute = new DescriptiveScope("",  userId);
+				UserInfo userinfo = new UserInfo();
+				userinfo.setUserLoginId(userId);
+				attribute.setUserCreatedBy(userinfo);
+				attribute.setUserModifiedBy(userinfo);
+				String[] rows = dictSheet.get(i);
+				for (int j=0 ; j<rows.length; j++ ){
+					if(dictSheet.get(0)[j].equalsIgnoreCase("descriptiveScopeName") || dictSheet.get(0)[j].equalsIgnoreCase("Descriptive ScopeName")){
+						attribute.setScopeName(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("description")){
+						attribute.setDescription(rows[j]);
+					}
+					if(dictSheet.get(0)[j].equalsIgnoreCase("search") || dictSheet.get(0)[j].equalsIgnoreCase("Search Criteria")){
+						attribute.setSearch(rows[j]);
+					}
+				}
+				commonClassDao.save(attribute);
+			}
+		}
+		csvReader.close();
+		if(file.exists()){
+			file.delete();
 		}
 	}
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
index 7bdb376..7bf0a03 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/EnforcerDictionaryController.java
@@ -21,7 +21,9 @@
 package org.openecomp.policy.pap.xacml.rest.controller;
 
 import java.io.PrintWriter;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
@@ -29,7 +31,7 @@
 
 import org.json.JSONObject;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.EnforcerPolicyDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.EnforcingType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
@@ -45,14 +47,20 @@
 public class EnforcerDictionaryController {
 
 	@Autowired
-	EnforcerPolicyDao enforcerPolicyDao;
+	CommonClassDao commonClassDao;
 
 	@RequestMapping(value={"/get_EnforcerTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getEnforcerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("enforcerDictionaryDatas", mapper.writeValueAsString(enforcerPolicyDao.getEnforcingTypeData()));
+			List<Object> list = commonClassDao.getData(EnforcingType.class);
+			List<String> dictList = new ArrayList<String>();
+			for(int i = 0; i < list.size(); i++){
+				EnforcingType dict = (EnforcingType) list.get(i);
+				dictList.add(dict.getEnforcingType());
+			}
+			model.put("enforcerDictionaryDatas", mapper.writeValueAsString(dictList));
 			org.openecomp.policy.pap.xacml.rest.util.JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -62,7 +70,7 @@
 		}
 	}
 	
-	@RequestMapping(value={"/enforcer_dictionary/save_enforcerType.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/enforcer_dictionary/save_enforcerType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			ObjectMapper mapper = new ObjectMapper();
@@ -70,16 +78,16 @@
 			JsonNode root = mapper.readTree(request.getReader());
 			EnforcingType enforcingType = (EnforcingType)mapper.readValue(root.get("enforcerDictionaryData").toString(), EnforcingType.class);
 			if(enforcingType.getId() == 0){
-				enforcerPolicyDao.Save(enforcingType);
+				commonClassDao.save(enforcingType);
 			}else{
-				enforcerPolicyDao.update(enforcingType); 
+				commonClassDao.update(enforcingType); 
 			} 
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
-			String responseString = mapper.writeValueAsString(this.enforcerPolicyDao.getEnforcingTypeData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(EnforcingType.class));
 			JSONObject j = new JSONObject("{enforcerDictionaryDatas: " + responseString + "}");
 
 			out.write(j.toString());
@@ -95,21 +103,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/enforcer_dictionary/remove_enforcer.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/enforcer_dictionary/remove_enforcer"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			EnforcingType enforcingType = (EnforcingType)mapper.readValue(root.get("data").toString(), EnforcingType.class);
-			enforcerPolicyDao.delete(enforcingType);
+			commonClassDao.delete(enforcingType);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.enforcerPolicyDao.getEnforcingTypeData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(EnforcingType.class));
 			JSONObject j = new JSONObject("{enforcerDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
index d2c3715..2c0d3de 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
@@ -33,25 +33,18 @@
 
 import org.jboss.netty.handler.ipfilter.CIDR;
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.adapters.GridData;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.ActionListDao;
-import org.openecomp.policy.rest.dao.AddressGroupDao;
-import org.openecomp.policy.rest.dao.FirewallDictionaryListDao;
-import org.openecomp.policy.rest.dao.PortListDao;
-import org.openecomp.policy.rest.dao.PrefixListDao;
-import org.openecomp.policy.rest.dao.ProtocolListDao;
-import org.openecomp.policy.rest.dao.SecurityZoneDao;
-import org.openecomp.policy.rest.dao.ServiceGroupDao;
-import org.openecomp.policy.rest.dao.ServiceListDao;
-import org.openecomp.policy.rest.dao.TermListDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
-import org.openecomp.policy.rest.dao.ZoneDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.ActionList;
 import org.openecomp.policy.rest.jpa.AddressGroup;
+import org.openecomp.policy.rest.jpa.FWTag;
+import org.openecomp.policy.rest.jpa.FWTagPicker;
 import org.openecomp.policy.rest.jpa.FirewallDictionaryList;
 import org.openecomp.policy.rest.jpa.GroupServiceList;
-import org.openecomp.policy.rest.jpa.PREFIXLIST;
+import org.openecomp.policy.rest.jpa.PrefixList;
 import org.openecomp.policy.rest.jpa.PortList;
 import org.openecomp.policy.rest.jpa.ProtocolList;
 import org.openecomp.policy.rest.jpa.SecurityZone;
@@ -59,6 +52,7 @@
 import org.openecomp.policy.rest.jpa.TermList;
 import org.openecomp.policy.rest.jpa.UserInfo;
 import org.openecomp.policy.rest.jpa.Zone;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -73,116 +67,131 @@
 @Controller
 public class FirewallDictionaryController {
 
-	@Autowired
-	PrefixListDao prefixListDao;
-	
-	@Autowired
-	PortListDao portListDao;
-	
-	@Autowired
-	ProtocolListDao protocolListDao;
-	
-	@Autowired
-	AddressGroupDao addressGroupDao;
-	
-	@Autowired
-	ActionListDao actionListDao;
-	
-	@Autowired
-	SecurityZoneDao securityZoneDao;
-	
-	@Autowired
-	ServiceGroupDao serviceGroupDao;
-	
-	@Autowired
-	ServiceListDao serviceListDao;
-	
-	@Autowired
-	TermListDao termListDao;
-	
-	@Autowired
-	ZoneDao zoneDao;
-	
-	@Autowired
-	UserInfoDao userInfoDao;
-	
-	@Autowired
-	FirewallDictionaryListDao fwDictionaryListDao;
-	
+	private static final Logger LOGGER  = FlexLogger.getLogger(FirewallDictionaryController.class);
 
+	private static CommonClassDao commonClassDao;
 	
-	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
-		return name;		
+	@Autowired
+	public FirewallDictionaryController(CommonClassDao commonClassDao){
+		FirewallDictionaryController.commonClassDao = commonClassDao;
 	}
+	
+	public FirewallDictionaryController(){}	
+
+	public UserInfo getUserInfo(String loginId){
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
+		return name;	
+	}
+
 
 	@RequestMapping(value={"/get_PrefixListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPrefixListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("prefixListDictionaryDatas", mapper.writeValueAsString(prefixListDao.getPrefixListDataByName()));
+			model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PrefixList.class, "prefixListName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PrefixListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPrefixListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("prefixListDictionaryDatas", mapper.writeValueAsString(prefixListDao.getPREFIXLISTData()));
+			model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PrefixList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_prefixList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_prefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PREFIXLIST prefixList = (PREFIXLIST)mapper.readValue(root.get("prefixListDictionaryData").toString(), PREFIXLIST.class);
+			PrefixList prefixList;
+			if (fromAPI) {
+				prefixList = (PrefixList)mapper.readValue(root.get("dictionaryFields").toString(), PrefixList.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(prefixList.getPrefixListName(), "prefixListName", PrefixList.class);
+					int id = 0;
+					PrefixList data = (PrefixList) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						prefixList.setId(1);
+					} else {
+						prefixList.setId(id);
+					}
+				}
+			} else {
+				prefixList = (PrefixList)mapper.readValue(root.get("prefixListDictionaryData").toString(), PrefixList.class);
+			}
 			if(prefixList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(prefixList.getPrefixListName(), "prefixListName", PREFIXLIST.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(prefixList.getPrefixListName(), "prefixListName", PrefixList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					prefixListDao.Save(prefixList);
+					commonClassDao.save(prefixList);
 				}		
 			}else{
-				prefixListDao.update(prefixList); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(prefixList); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.prefixListDao.getPREFIXLISTData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(PrefixList.class));
 			}
-			JSONObject j = new JSONObject("{prefixListDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{prefixListDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -191,28 +200,26 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_PrefixList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_PrefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PREFIXLIST prefixList = (PREFIXLIST)mapper.readValue(root.get("data").toString(), PREFIXLIST.class);
-			prefixListDao.delete(prefixList);
+			PrefixList prefixList = (PrefixList)mapper.readValue(root.get("data").toString(), PrefixList.class);
+			commonClassDao.delete(prefixList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
-
-			String responseString = mapper.writeValueAsString(this.prefixListDao.getPREFIXLISTData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PrefixList.class));
 			JSONObject j = new JSONObject("{prefixListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -220,21 +227,20 @@
 		}
 		return null;
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/validate_prefixList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/validate_prefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView validatePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PREFIXLIST prefixList = (PREFIXLIST)mapper.readValue(root.get("prefixListDictionaryData").toString(), PREFIXLIST.class);
+			PrefixList prefixList = (PrefixList)mapper.readValue(root.get("prefixListDictionaryData").toString(), PrefixList.class);
 			String responseValidation = "success";
-			 try{
-				 CIDR.newCIDR(prefixList.getPrefixListValue());
-			 }catch(UnknownHostException e){
-				 responseValidation = "error";
-				 //AdminNotification.warn("IP not according to CIDR notation");
-			 }		
+			try{
+				CIDR.newCIDR(prefixList.getPrefixListValue());
+			}catch(UnknownHostException e){
+				responseValidation = "error";
+			}		
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
@@ -242,10 +248,10 @@
 			PrintWriter out = response.getWriter();
 			JSONObject j = new JSONObject("{result: " + responseValidation + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -253,23 +259,27 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_PortListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPortListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("portListDictionaryDatas", mapper.writeValueAsString(portListDao.getPortListData()));
+			model.put("portListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PortList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_portName.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_portName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
@@ -278,15 +288,14 @@
 			JsonNode root = mapper.readTree(request.getReader());
 			PortList portList = (PortList)mapper.readValue(root.get("portListDictionaryData").toString(), PortList.class);
 			if(portList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(portList.getPortName(), "portName", PortList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(portList.getPortName(), "portName", PortList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					portListDao.Save(portList);
+					commonClassDao.save(portList);
 				}
 			}else{
-				portListDao.update(portList); 
+				commonClassDao.update(portList); 
 			} 
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
@@ -297,7 +306,7 @@
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.portListDao.getPortListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(PortList.class));
 			}
 			JSONObject j = new JSONObject("{portListDictionaryDatas: " + responseString + "}");
 
@@ -306,6 +315,7 @@
 			return null;
 		}
 		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -314,28 +324,26 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_PortList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_PortList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			PortList portList = (PortList)mapper.readValue(root.get("data").toString(), PortList.class);
-			portListDao.delete(portList);
+			commonClassDao.delete(portList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
-
-			String responseString = mapper.writeValueAsString(this.portListDao.getPortListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PortList.class));
 			JSONObject j = new JSONObject("{portListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -343,74 +351,115 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_ProtocolListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getProtocolListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("protocolListDictionaryDatas", mapper.writeValueAsString(protocolListDao.getProtocolListData()));
+			model.put("protocolListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ProtocolListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getProtocolListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("protocolListDictionaryDatas", mapper.writeValueAsString(protocolListDao.getProtocolListDataByName()));
+			model.put("protocolListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ProtocolList.class, "protocolName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_protocolList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_protocolList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			ProtocolList protocolList = (ProtocolList)mapper.readValue(root.get("protocolListDictionaryData").toString(), ProtocolList.class);
+			ProtocolList protocolList;
+			if (fromAPI) {
+				protocolList = (ProtocolList)mapper.readValue(root.get("dictionaryFields").toString(), ProtocolList.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(protocolList.getProtocolName(), "protocolName", ProtocolList.class);
+					int id = 0;
+					ProtocolList data = (ProtocolList) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						protocolList.setId(1);
+					} else {
+						protocolList.setId(id);
+					}
+				}
+			} else {
+				protocolList = (ProtocolList)mapper.readValue(root.get("protocolListDictionaryData").toString(), ProtocolList.class);
+			}
 			if(protocolList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(protocolList.getProtocolName(), "protocolName", ProtocolList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(protocolList.getProtocolName(), "protocolName", ProtocolList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					protocolListDao.Save(protocolList);
+					commonClassDao.save(protocolList);
 				}
 			}else{
-				protocolListDao.update(protocolList); 
+				if(!isFakeUpdate){
+					commonClassDao.update(protocolList);
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.protocolListDao.getProtocolListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class));
 			}
-			JSONObject j = new JSONObject("{protocolListDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{protocolListDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -419,28 +468,27 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_protocol.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_protocol"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			ProtocolList protocolList = (ProtocolList)mapper.readValue(root.get("data").toString(), ProtocolList.class);
-			protocolListDao.delete(protocolList);
+			commonClassDao.delete(protocolList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.protocolListDao.getProtocolListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class));
 			JSONObject j = new JSONObject("{protocolListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -448,49 +496,84 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_AddressGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getAddressGroupDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(addressGroupDao.getAddressGroupDataByName()));
+			model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(AddressGroup.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_AddressGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getAddressGroupDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(addressGroupDao.getAddressGroupData()));
+			model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_addressGroup.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_addressGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			AddressGroup addressGroup = (AddressGroup)mapper.readValue(root.get("addressGroupDictionaryData").toString(), AddressGroup.class);
-			GridData gridData = (GridData)mapper.readValue(root.get("addressGroupDictionaryData").toString(), GridData.class);
-			if(!addressGroup.getGroupName().startsWith("Group_")){
-				String groupName = "Group_"+addressGroup.getGroupName();
-				addressGroup.setGroupName(groupName);
+			AddressGroup addressGroup;
+			GridData gridData;
+			if (fromAPI) {
+				addressGroup = (AddressGroup)mapper.readValue(root.get("dictionaryFields").toString(), AddressGroup.class);
+				gridData = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
+
+				if(!addressGroup.getGroupName().startsWith("Group_")){
+					String groupName = "Group_"+addressGroup.getGroupName();
+					addressGroup.setGroupName(groupName);
+				}
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(addressGroup.getGroupName(), "name", AddressGroup.class);
+					int id = 0;
+					AddressGroup data = (AddressGroup) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						addressGroup.setId(1);
+					} else {
+						addressGroup.setId(id);
+					}            
+				}
+			} else {
+				addressGroup = (AddressGroup)mapper.readValue(root.get("addressGroupDictionaryData").toString(), AddressGroup.class);
+				gridData = (GridData)mapper.readValue(root.get("addressGroupDictionaryData").toString(), GridData.class);
+				if(!addressGroup.getGroupName().startsWith("Group_")){
+					String groupName = "Group_"+addressGroup.getGroupName();
+					addressGroup.setGroupName(groupName);
+				}
 			}
 			String userValue = "";
 			int counter = 0;
@@ -508,34 +591,46 @@
 			}
 			addressGroup.setServiceList(userValue);
 			if(addressGroup.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(addressGroup.getGroupName(), "name", AddressGroup.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(addressGroup.getGroupName(), "name", AddressGroup.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					addressGroupDao.Save(addressGroup);
+					commonClassDao.save(addressGroup);
 				}
 			}else{
-				addressGroupDao.update(addressGroup); 
+				if (!isFakeUpdate) {
+					commonClassDao.update(addressGroup); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.addressGroupDao.getAddressGroupData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class));
 			}
-			JSONObject j = new JSONObject("{addressGroupDictionaryDatas: " + responseString + "}");
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{addressGroupDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -544,28 +639,27 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_AddressGroup.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_AddressGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			AddressGroup addressGroup = (AddressGroup)mapper.readValue(root.get("data").toString(), AddressGroup.class);
-			addressGroupDao.delete(addressGroup);
+			commonClassDao.delete(addressGroup);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.addressGroupDao.getAddressGroupData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class));
 			JSONObject j = new JSONObject("{addressGroupDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -573,74 +667,121 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_ActionListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getActionListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("actionListDictionaryDatas", mapper.writeValueAsString(actionListDao.getActionListDataByName()));
+			List<Object> list = commonClassDao.getData(ActionList.class);
+			List<String> dictList = new ArrayList<String>();
+			for(int i = 0; i < list.size(); i++){
+				ActionList dict = (ActionList) list.get(i);
+				dictList.add(dict.getActionName());
+			}
+			model.put("actionListDictionaryDatas", mapper.writeValueAsString(dictList));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ActionListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getActionListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("actionListDictionaryDatas", mapper.writeValueAsString(actionListDao.getActionListData()));
+			model.put("actionListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_ActionList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_ActionList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			ActionList actionList = (ActionList)mapper.readValue(root.get("actionListDictionaryData").toString(), ActionList.class);
+			ActionList actionList;
+			if (fromAPI) {
+				actionList = (ActionList)mapper.readValue(root.get("dictionaryFields").toString(), ActionList.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(actionList.getActionName(), "actionName", ActionList.class);
+					int id = 0;
+					ActionList data = (ActionList) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						actionList.setId(1);
+					} else {
+						actionList.setId(id);
+					}  
+				}
+			} else {
+				actionList = (ActionList)mapper.readValue(root.get("actionListDictionaryData").toString(), ActionList.class);
+			}
 			if(actionList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(actionList.getActionName(), "actionName", ActionList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(actionList.getActionName(), "actionName", ActionList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					actionListDao.Save(actionList);
+					commonClassDao.save(actionList);
 				}
 			}else{
-				actionListDao.update(actionList); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(actionList);
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.actionListDao.getActionListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(ActionList.class));
 			}
-			JSONObject j = new JSONObject("{actionListDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{actionListDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -649,28 +790,26 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_ActionList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_ActionList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			ActionList actionList = (ActionList)mapper.readValue(root.get("data").toString(), ActionList.class);
-			actionListDao.delete(actionList);
+			commonClassDao.delete(actionList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
-
-			String responseString = mapper.writeValueAsString(this.actionListDao.getActionListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(ActionList.class));
 			JSONObject j = new JSONObject("{actionListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
-
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -678,46 +817,81 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_ServiceGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getServiceGroupDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(serviceGroupDao.getGroupServiceListData()));
+			model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ServiceGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getServiceGroupDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(serviceGroupDao.getGroupServiceDataByName()));
+			model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupServiceList.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_serviceGroup.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_serviceGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			GroupServiceList groupServiceList = (GroupServiceList)mapper.readValue(root.get("serviceGroupDictionaryData").toString(), GroupServiceList.class);
-			GridData gridData = (GridData)mapper.readValue(root.get("serviceGroupDictionaryData").toString(), GridData.class);
+			GroupServiceList groupServiceList;
+			GridData gridData;
+			if (fromAPI) {
+				groupServiceList = (GroupServiceList)mapper.readValue(root.get("dictionaryFields").toString(), GroupServiceList.class);
+				gridData = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
+
+				if(!groupServiceList.getGroupName().startsWith("Group_")){
+					String groupName = "Group_"+groupServiceList.getGroupName();
+					groupServiceList.setGroupName(groupName);
+				}
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(groupServiceList.getGroupName(), "name", GroupServiceList.class);
+					int id = 0;
+					GroupServiceList data = (GroupServiceList) duplicateData.get(0);
+					id = data.getId();
+
+					if(id==0){
+						isFakeUpdate=true;
+						groupServiceList.setId(1);
+					} else {
+						groupServiceList.setId(id);
+					}   
+				}
+			} else {
+				groupServiceList = (GroupServiceList)mapper.readValue(root.get("serviceGroupDictionaryData").toString(), GroupServiceList.class);
+				gridData = (GridData)mapper.readValue(root.get("serviceGroupDictionaryData").toString(), GridData.class);
+			}
 			if(!groupServiceList.getGroupName().startsWith("Group_")){
 				String groupName = "Group_"+groupServiceList.getGroupName();
 				groupServiceList.setGroupName(groupName);
@@ -738,34 +912,47 @@
 			}
 			groupServiceList.setServiceList(userValue);
 			if(groupServiceList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(groupServiceList.getGroupName(), "name", GroupServiceList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(groupServiceList.getGroupName(), "name", GroupServiceList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					serviceGroupDao.Save(groupServiceList);
+					commonClassDao.save(groupServiceList);
 				}
 			}else{
-				serviceGroupDao.update(groupServiceList); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(groupServiceList); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.serviceGroupDao.getGroupServiceListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class));
 			}
-			JSONObject j = new JSONObject("{serviceGroupDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{serviceGroupDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -774,21 +961,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_serviceGroup.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_serviceGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			GroupServiceList groupServiceList = (GroupServiceList)mapper.readValue(root.get("data").toString(), GroupServiceList.class);
-			serviceGroupDao.delete(groupServiceList);
+			commonClassDao.delete(groupServiceList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.serviceGroupDao.getGroupServiceListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class));
 			JSONObject j = new JSONObject("{serviceGroupDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -803,74 +990,116 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_SecurityZoneDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getSecurityZoneDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(securityZoneDao.getSecurityZoneDataByName()));
+			model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(SecurityZone.class, "zoneName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_SecurityZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getSecurityZoneDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(securityZoneDao.getSecurityZoneData()));
+			model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_securityZone.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_securityZone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			SecurityZone securityZone = (SecurityZone)mapper.readValue(root.get("securityZoneDictionaryData").toString(), SecurityZone.class);
+			SecurityZone securityZone;
+			if (fromAPI) {
+				securityZone = (SecurityZone)mapper.readValue(root.get("dictionaryFields").toString(), SecurityZone.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(securityZone.getZoneName(), "zoneName", SecurityZone.class);
+					int id = 0;
+					SecurityZone data = (SecurityZone) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						securityZone.setId(1);
+					} else {
+						securityZone.setId(id);
+					}               
+				}
+			} else {
+				securityZone = (SecurityZone)mapper.readValue(root.get("securityZoneDictionaryData").toString(), SecurityZone.class);
+			}
 			if(securityZone.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(securityZone.getZoneName(), "zoneName", SecurityZone.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(securityZone.getZoneName(), "zoneName", SecurityZone.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					securityZoneDao.Save(securityZone);
+					commonClassDao.save(securityZone);
 				}			
 			}else{
-				securityZoneDao.update(securityZone); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(securityZone); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.securityZoneDao.getSecurityZoneData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class));
 			}
-			JSONObject j = new JSONObject("{securityZoneDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}   
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{securityZoneDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -879,28 +1108,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_securityZone.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_securityZone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			SecurityZone securityZone = (SecurityZone)mapper.readValue(root.get("data").toString(), SecurityZone.class);
-			securityZoneDao.delete(securityZone);
+			commonClassDao.delete(securityZone);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.securityZoneDao.getSecurityZoneData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class));
 			JSONObject j = new JSONObject("{securityZoneDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -908,47 +1137,77 @@
 		}
 		return null;
 	}
-	
-	
+
+
 	@RequestMapping(value={"/get_ServiceListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getServiceListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("serviceListDictionaryDatas", mapper.writeValueAsString(serviceListDao.getServiceListData()));
+			model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ServiceList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ServiceListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getServiceListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("serviceListDictionaryDatas", mapper.writeValueAsString(serviceListDao.getServiceListDataByName()));
+			model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ServiceList.class, "serviceName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_serviceList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_serviceList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			ServiceList serviceList = (ServiceList)mapper.readValue(root.get("serviceListDictionaryData").toString(), ServiceList.class);
-			GridData serviceListGridData = (GridData)mapper.readValue(root.get("serviceListDictionaryData").toString(), GridData.class);
+			ServiceList serviceList;
+			GridData serviceListGridData;
+			if (fromAPI) {
+				serviceList = (ServiceList)mapper.readValue(root.get("dictionaryFields").toString(), ServiceList.class);
+				serviceListGridData = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceList.getServiceName(), "serviceName", ServiceList.class);
+					int id = 0;
+					ServiceList data = (ServiceList) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						serviceList.setId(1);
+					} else {
+						serviceList.setId(id);
+					}
+				}
+			}else{
+				serviceList = (ServiceList)mapper.readValue(root.get("serviceListDictionaryData").toString(), ServiceList.class);
+				serviceListGridData = (GridData)mapper.readValue(root.get("serviceListDictionaryData").toString(), GridData.class);
+			}
 			String tcpValue = "";
 			int counter = 0;
 			if(serviceListGridData.getTransportProtocols().size() > 0){
@@ -981,58 +1240,71 @@
 			serviceList.setServiceAppProtocol(appValue);
 			serviceList.setServiceType("SERVICE");
 			if(serviceList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(serviceList.getServiceName(), "serviceName", ServiceList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceList.getServiceName(), "serviceName", ServiceList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					serviceListDao.Save(serviceList);
+					commonClassDao.save(serviceList);
 				}
-				
 			}else{
-				serviceListDao.update(serviceList); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(serviceList); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
 
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.serviceListDao.getServiceListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(ServiceList.class));
 			} 
-			JSONObject j = new JSONObject("{serviceListDictionaryDatas: " + responseString + "}");
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{serviceListDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
 			out.write(e.getMessage());
 		}
+
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_serviceList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_serviceList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			ServiceList serviceList = (ServiceList)mapper.readValue(root.get("data").toString(), ServiceList.class);
-			serviceListDao.delete(serviceList);
+			commonClassDao.delete(serviceList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.serviceListDao.getServiceListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(ServiceList.class));
 			JSONObject j = new JSONObject("{serviceListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -1047,74 +1319,113 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_ZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getZoneDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("zoneDictionaryDatas", mapper.writeValueAsString(zoneDao.getZoneData()));
+			model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Zone.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
 			e.printStackTrace();
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_ZoneDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getZoneDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("zoneDictionaryDatas", mapper.writeValueAsString(zoneDao.getZoneDataByName()));
+			model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Zone.class, "zoneName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_zoneName.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_zoneName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			Zone zone = (Zone)mapper.readValue(root.get("zoneDictionaryData").toString(), Zone.class);
+			Zone zone;
+			if (fromAPI) {
+				zone = (Zone)mapper.readValue(root.get("dictionaryFields").toString(), Zone.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData = commonClassDao.checkDuplicateEntry(zone.getZoneName(), "zoneName", Zone.class);
+					int id = 0;
+					Zone data = (Zone) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						zone.setId(1);
+					} else {
+						zone.setId(id);
+					}
+				}
+			} else {
+				zone = (Zone)mapper.readValue(root.get("zoneDictionaryData").toString(), Zone.class);
+			}
 			if(zone.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(zone.getZoneName(), "zoneName", Zone.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(zone.getZoneName(), "zoneName", Zone.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					zoneDao.Save(zone);
+					commonClassDao.save(zone);
 				}	
 			}else{
-				zoneDao.update(zone); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(zone); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.zoneDao.getZoneData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(Zone.class));
 			}
-			JSONObject j = new JSONObject("{zoneDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{zoneDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -1123,28 +1434,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_zone.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_zone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			Zone zone = (Zone)mapper.readValue(root.get("data").toString(), Zone.class);
-			zoneDao.delete(zone);
+			commonClassDao.delete(zone);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.zoneDao.getZoneData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(Zone.class));
 			JSONObject j = new JSONObject("{zoneDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -1152,47 +1463,80 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_TermListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getTermListDictionaryEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("termListDictionaryDatas", mapper.writeValueAsString(termListDao.getTermListDataByName()));
+			model.put("termListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(TermList.class, "termName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_TermListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getTermListDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("termListDictionaryDatas", mapper.writeValueAsString(termListDao.getTermListData()));
+			model.put("termListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(TermList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_termList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_termList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			TermList termList = (TermList)mapper.readValue(root.get("termListDictionaryData").toString(), TermList.class);
-			TermListData termListDatas = (TermListData)mapper.readValue(root.get("termListDictionaryData").toString(), TermListData.class);
-			String userId = root.get("loginId").textValue();
+			TermList termList;
+			TermListData termListDatas;
+			String userId = null;
+			if (fromAPI) {
+				termList = (TermList)mapper.readValue(root.get("dictionaryFields").toString(), TermList.class);
+				termListDatas = (TermListData)mapper.readValue(root.get("dictionaryFields").toString(), TermListData.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(termList.getTermName(), "termName", TermList.class);
+					int id = 0;
+					TermList data = (TermList) duplicateData.get(0);
+					id = data.getId();
+					if(id==0){
+						isFakeUpdate=true;
+						termList.setId(1);
+					} else {
+						termList.setId(id);
+					}                 
+					termList.setUserCreatedBy(this.getUserInfo(userId));
+				}
+			} else {
+				termList = (TermList)mapper.readValue(root.get("termListDictionaryData").toString(), TermList.class);
+				termListDatas = (TermListData)mapper.readValue(root.get("termListDictionaryData").toString(), TermListData.class);
+				userId = root.get("userid").textValue();
+			}
 			String fromZoneValue = "";
 			int counter = 0;
 			if(termListDatas.getFromZoneDatas().size() > 0){
@@ -1208,7 +1552,7 @@
 				}
 			}
 			termList.setFromZones(fromZoneValue);
-			
+
 			String toZoneValue = "";
 			int toZonecounter = 0;
 			if(termListDatas.getToZoneDatas().size() > 0){
@@ -1224,7 +1568,7 @@
 				}
 			}
 			termList.setToZones(toZoneValue);
-			
+
 			String srcListValues = "";
 			int srcListcounter = 0;
 			if(termListDatas.getSourceListDatas().size() > 0){
@@ -1240,7 +1584,7 @@
 				}
 			}
 			termList.setSrcIPList(srcListValues);
-			
+
 			String desListValues = "";
 			int destListcounter = 0;
 			if(termListDatas.getDestinationListDatas().size() > 0){
@@ -1256,7 +1600,7 @@
 				}
 			}
 			termList.setDestIPList(desListValues);
-			
+
 			String srcSerValue = "";
 			int srcSercounter = 0;
 			if(termListDatas.getSourceServiceDatas().size() > 0){
@@ -1272,7 +1616,7 @@
 				}
 			}
 			termList.setSrcPortList(srcSerValue);
-			
+
 			String desSrcValue = "";
 			int desSrccounter = 0;
 			if(termListDatas.getDestinationServiceDatas().size() > 0){
@@ -1288,7 +1632,7 @@
 				}
 			}
 			termList.setDestPortList(desSrcValue);
-			
+
 			String actionValue = "";
 			int actioncounter = 0;
 			if(termListDatas.getActionListDatas().size() > 0){
@@ -1304,40 +1648,52 @@
 				}
 			}
 			termList.setAction(actionValue);
-			
+
 			if(termList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(termList.getTermName(), "termName", TermList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(termList.getTermName(), "termName", TermList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					termList.setUserCreatedBy(this.getUserInfo(userId));
 					termList.setUserModifiedBy(this.getUserInfo(userId));
-					termListDao.Save(termList);
+					commonClassDao.save(termList);
 				}
 			}else{
-				termList.setUserModifiedBy(this.getUserInfo(userId));
-				termListDao.update(termList); 
+				if(!isFakeUpdate) {
+					termList.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(termList); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.termListDao.getTermListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(TermList.class));
 			}
-			JSONObject j = new JSONObject("{termListDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{termListDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -1346,28 +1702,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_termList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_termList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			TermList termList = (TermList)mapper.readValue(root.get("data").toString(), TermList.class);
-			termListDao.delete(termList);
+			commonClassDao.delete(termList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.termListDao.getTermListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(TermList.class));
 			JSONObject j = new JSONObject("{termListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -1381,32 +1737,36 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(fwDictionaryListDao.getFWDictionaryListDataByName()));
+			model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FirewallDictionaryList.class, "parentItemName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_FWDictionaryListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getFWDictionaryListEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(fwDictionaryListDao.getFWDictionaryListData()));
+			model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
-	
-	@RequestMapping(value={"/fw_dictionary/save_FWDictionaryList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/fw_dictionary/save_FWDictionaryList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveFWDictionaryList(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
@@ -1446,15 +1806,14 @@
 			}
 			fwDictList.setAddressList(userALValue);
 			if(fwDictList.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(fwDictList.getParentItemName(), "parentItemName", FirewallDictionaryList.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwDictList.getParentItemName(), "parentItemName", FirewallDictionaryList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					fwDictionaryListDao.Save(fwDictList);
+					commonClassDao.save(fwDictList);
 				}
 			}else{
-				fwDictionaryListDao.update(fwDictList); 
+				commonClassDao.update(fwDictList); 
 			} 
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
@@ -1465,7 +1824,7 @@
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.fwDictionaryListDao.getFWDictionaryListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class));
 			}
 			JSONObject j = new JSONObject("{fwDictListDictionaryDatas: " + responseString + "}");
 
@@ -1474,6 +1833,7 @@
 			return null;
 		}
 		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -1482,28 +1842,28 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/fw_dictionary/remove_FWDictionaryList.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/fw_dictionary/remove_FWDictionaryList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeFWDictionaryListy(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			FirewallDictionaryList fwDictList = (FirewallDictionaryList)mapper.readValue(root.get("data").toString(), FirewallDictionaryList.class);
-			fwDictionaryListDao.delete(fwDictList);
+			commonClassDao.delete(fwDictList);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.fwDictionaryListDao.getFWDictionaryListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class));
 			JSONObject j = new JSONObject("{fwDictListDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		}
 		catch (Exception e){
-			System.out.println(e);
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -1511,6 +1871,348 @@
 		}
 		return null;
 	}
+
+
+	@RequestMapping(value={"/get_TagPickerNameByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+	public void getTagPickerNameEntityDataByName(HttpServletRequest request, HttpServletResponse response){
+		try{
+			Map<String, Object> model = new HashMap<String, Object>();
+			ObjectMapper mapper = new ObjectMapper();
+			model.put("fwTagPickerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FWTagPicker.class, "tagPickerName")));
+			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+			JSONObject j = new JSONObject(msg);
+			response.getWriter().write(j.toString());
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+
+	@RequestMapping(value={"/get_TagPickerListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+	public void getTagPickerDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+		try{
+			Map<String, Object> model = new HashMap<String, Object>();
+			ObjectMapper mapper = new ObjectMapper();
+			model.put("fwTagPickerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class)));
+			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+			JSONObject j = new JSONObject(msg);
+			response.getWriter().write(j.toString());
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+
+	@RequestMapping(value={"/fw_dictionary/save_fwTagPicker"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
+
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+
+
+			FWTagPicker fwTagPicker;
+			TagGridValues data;
+			String userId = null;
+			if (fromAPI) {
+				fwTagPicker = (FWTagPicker)mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), FWTagPicker.class);
+				data = (TagGridValues)mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), TagGridValues.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTagPicker.getTagPickerName(), "tagPickerName", FWTagPicker.class);
+					int id = 0;
+					FWTagPicker dbdata = (FWTagPicker) duplicateData.get(0);
+					id = dbdata.getId();
+					fwTagPicker.setId(id);
+					fwTagPicker.setUserCreatedBy(this.getUserInfo(userId));
+				}
+			} else {
+
+				fwTagPicker = (FWTagPicker)mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), FWTagPicker.class);
+				data = (TagGridValues)mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), TagGridValues.class);
+				userId = root.get("userid").textValue();
+			}
+
+			String header = "";
+			int counter = 0;
+			if(data.getTags().size() > 0){
+				for(Object attribute : data.getTags()){
+					if(attribute instanceof LinkedHashMap<?, ?>){
+						String key = ((LinkedHashMap<?, ?>) attribute).get("option").toString();
+						String value = ((LinkedHashMap<?, ?>) attribute).get("number").toString();
+						if(counter>0){
+							header = header + "#";
+						}
+						header = header + key + ":";
+						header = header + value;
+						counter ++;
+					}
+				}
+			}
+			fwTagPicker.setTagValues(header);
+			if(fwTagPicker.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTagPicker.getTagPickerName(), "tagPickerName", FWTagPicker.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					fwTagPicker.setUserCreatedBy(this.getUserInfo(userId));
+					fwTagPicker.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(fwTagPicker);
+				}
+			}else{
+				fwTagPicker.setUserModifiedBy(this.getUserInfo(userId));
+				commonClassDao.update(fwTagPicker); 
+			} 
+
+			String responseString = "";
+			if(duplicateflag){
+				responseString = "Duplicate";
+			}else{
+				responseString =  mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class));
+			}
+
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					responseString = "Success";
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{fwTagPickerDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/fw_dictionary/remove_tagPicker"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			FWTagPicker fwTagPicker = (FWTagPicker)mapper.readValue(root.get("data").toString(), FWTagPicker.class);
+			commonClassDao.delete(fwTagPicker);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class));
+			JSONObject j = new JSONObject("{fwTagPickerDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+
+	@RequestMapping(value={"/get_TagNameByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+	public void getTagNameEntityDataByName(HttpServletRequest request, HttpServletResponse response){
+		try{
+			Map<String, Object> model = new HashMap<String, Object>();
+			ObjectMapper mapper = new ObjectMapper();
+			model.put("fwTagDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FWTag.class, "fwTagName")));
+			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+			JSONObject j = new JSONObject(msg);
+			response.getWriter().write(j.toString());
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+
+	@RequestMapping(value={"/get_TagListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+	public void getTagDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+		try{
+			Map<String, Object> model = new HashMap<String, Object>();
+			ObjectMapper mapper = new ObjectMapper();
+			model.put("fwTagDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FWTag.class)));
+			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+			JSONObject j = new JSONObject(msg);
+			response.getWriter().write(j.toString());
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+
+	@RequestMapping(value={"/fw_dictionary/save_fwTag"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView saveFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try {
+			boolean duplicateflag = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
+
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+
+
+			FWTag fwTag;
+			TagGridValues tagGridValues;
+			String userId = null;
+			if (fromAPI) {
+				fwTag = (FWTag)mapper.readValue(root.get("fwTagDictionaryDatas").toString(), FWTag.class);
+				tagGridValues = (TagGridValues)mapper.readValue(root.get("fwTagDictionaryDatas").toString(), TagGridValues.class);
+				userId = "API";
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "tagName", FWTag.class);
+					int id = 0;
+					FWTag data = (FWTag) duplicateData.get(0);
+					id = data.getId();
+					fwTag.setId(id);
+					fwTag.setUserCreatedBy(this.getUserInfo(userId));
+
+				}
+			} else {
+				fwTag = (FWTag)mapper.readValue(root.get("fwTagDictionaryData").toString(), FWTag.class);
+				tagGridValues = (TagGridValues)mapper.readValue(root.get("fwTagDictionaryData").toString(), TagGridValues.class);
+				userId = root.get("userid").textValue();
+			}
+
+			String userValue = "";
+			int counter = 0;
+			if(tagGridValues.getTags().size() > 0){
+				for(Object attribute : tagGridValues.getTags()){
+					if(attribute instanceof LinkedHashMap<?, ?>){
+						String key = ((LinkedHashMap<?, ?>) attribute).get("tags").toString();
+						if(counter>0){
+							userValue = userValue + ",";
+						}
+						userValue = userValue + key ;
+						counter ++;
+					}
+				}
+			}
+			fwTag.setTagValues(userValue);
+			if(fwTag.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "fwTagName", FWTag.class);
+				if(!duplicateData.isEmpty()){
+					duplicateflag = true;
+				}else{
+					fwTag.setUserCreatedBy(this.getUserInfo(userId));
+					fwTag.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.save(fwTag);
+				}   
+			}else{
+				fwTag.setUserModifiedBy(this.getUserInfo(userId));
+				commonClassDao.update(fwTag); 
+			} 
+
+			String responseString = "";
+			if(duplicateflag){
+				responseString = "Duplicate";
+			}else{
+				responseString =  mapper.writeValueAsString(commonClassDao.getData(FWTag.class));
+			}
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					responseString = "Success";
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{fwTagDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	@RequestMapping(value={"/fw_dictionary/remove_tagList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView removeFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			FWTag fwTag = (FWTag)mapper.readValue(root.get("data").toString(), FWTag.class);
+			commonClassDao.delete(fwTag);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(FWTag.class));
+			JSONObject j = new JSONObject("{fwTagDictionaryDatas: " + responseString + "}");
+			out.write(j.toString());
+
+			return null;
+		}
+		catch (Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+}
+
+class TagGridValues{
+	private ArrayList<Object> tags;
+
+	public ArrayList<Object> getTags() {
+		return tags;
+	}
+
+	public void setTags(ArrayList<Object> tags) {
+		this.tags = tags;
+	}
 }
 
 class AGGridData{
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
index c3329db..75a3c7f 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
@@ -20,46 +20,32 @@
 
 package org.openecomp.policy.pap.xacml.rest.controller;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
+import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.compress.utils.IOUtils;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.DCAEUUIDDao;
-import org.openecomp.policy.rest.dao.MicroServiceConfigNameDao;
-import org.openecomp.policy.rest.dao.MicroServiceLocationDao;
-import org.openecomp.policy.rest.dao.MicroServiceModelsDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.DCAEuuid;
+import org.openecomp.policy.rest.jpa.MicroServiceAttribute;
 import org.openecomp.policy.rest.jpa.MicroServiceConfigName;
 import org.openecomp.policy.rest.jpa.MicroServiceLocation;
 import org.openecomp.policy.rest.jpa.MicroServiceModels;
 import org.openecomp.policy.rest.jpa.UserInfo;
 import org.openecomp.policy.rest.util.MSAttributeObject;
-import org.openecomp.policy.rest.util.MSModelUtitils;
+import org.openecomp.policy.rest.util.MSModelUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
@@ -72,42 +58,43 @@
 
 @Controller
 public class MicroServiceDictionaryController {
-	private static final Log logger	= LogFactory.getLog(MicroServiceDictionaryController.class);
+	private static final Logger LOGGER  = FlexLogger.getLogger(MicroServiceDictionaryController.class);
 
-	@Autowired
-	MicroServiceConfigNameDao microServiceConfigNameDao;
+	private static CommonClassDao commonClassDao;
 	
 	@Autowired
-	MicroServiceLocationDao microServiceLocationDao;
+	public MicroServiceDictionaryController(CommonClassDao commonClassDao){
+		MicroServiceDictionaryController.commonClassDao = commonClassDao;
+	}
 	
-	@Autowired
-	MicroServiceModelsDao microServiceModelsDao;
-	
-	@Autowired
-	DCAEUUIDDao dcaeUUIDDao;
-	
-	@Autowired
-	UserInfoDao userInfoDao;
-	
-
-	private String newFile;
-	private String directory;
-	private List<String> dirDependencyList = new ArrayList<String>();
-	private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>();
-	MSModelUtitils utils = new MSModelUtitils();
-	private MicroServiceModels newModel;
+	public MicroServiceDictionaryController(){}	
 	
 	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
 		return name;	
 	}
 	
+    private static String SUCCESSKEY= "successMapKey";
+    private static String SUCCESS = "success";
+    private static String OPERATION = "operation";
+    private static String GETDICTIONARY = "getDictionary";
+    private static String ERROR = "error";
+    private static String DICTIONARYDBQUERY = "dictionaryDBQuery";
+    private HashMap<String,MSAttributeObject > classMap;
+    private List<String> modelList = new ArrayList<String>();
+    
+	
+
+	MSModelUtils utils = new MSModelUtils(XACMLPapServlet.msEcompName, XACMLPapServlet.msPolicyName);
+	private MicroServiceModels newModel;
+	
+	
 	@RequestMapping(value={"/get_DCAEUUIDDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getDCAEUUIDDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(dcaeUUIDDao.getDCAEuuidDataByName()));
+			model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DCAEuuid.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -122,53 +109,93 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(dcaeUUIDDao.getDCAEuuidData()));
+			model.put("dcaeUUIDDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader(SUCCESSKEY, SUCCESS);    
+            response.addHeader(OPERATION, GETDICTIONARY);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader(ERROR, DICTIONARYDBQUERY);
+            LOGGER.error(e.getMessage());
 		}
 	}
 	
-	@RequestMapping(value={"/ms_dictionary/save_dcaeUUID.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/save_dcaeUUID"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			DCAEuuid dCAEuuid = (DCAEuuid)mapper.readValue(root.get("dcaeUUIDDictionaryData").toString(), DCAEuuid.class);
+            DCAEuuid dCAEuuid;
+            if (fromAPI) {
+                dCAEuuid = (DCAEuuid)mapper.readValue(root.get("dictionaryFields").toString(), DCAEuuid.class);
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter(OPERATION).equals("update")) {
+                	List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(dCAEuuid.getName(), "name", DCAEuuid.class);
+                	int id = 0;
+                	DCAEuuid data = (DCAEuuid) duplicateData.get(0);
+                	id = data.getId();
+                	if(id==0){
+                		isFakeUpdate=true;
+                		dCAEuuid.setId(1);
+                	} else {
+                		dCAEuuid.setId(id);
+                	}       
+                }
+            } else {
+            	dCAEuuid = (DCAEuuid)mapper.readValue(root.get("dcaeUUIDDictionaryData").toString(), DCAEuuid.class);
+            }
 			if(dCAEuuid.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(dCAEuuid.getName(), "name", DCAEuuid.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(dCAEuuid.getName(), "name", DCAEuuid.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					dcaeUUIDDao.Save(dCAEuuid);
+					commonClassDao.save(dCAEuuid);
 				}
 			}else{
-				dcaeUUIDDao.update(dCAEuuid); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(dCAEuuid); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.dcaeUUIDDao.getDCAEuuidData());
-			} 
-			JSONObject j = new JSONObject("{dcaeUUIDDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class));
+            } 
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{dcaeUUIDDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -177,21 +204,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ms_dictionary/remove_dcaeuuid.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/remove_dcaeuuid"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			DCAEuuid dCAEuuid = (DCAEuuid)mapper.readValue(root.get("data").toString(), DCAEuuid.class);
-			dcaeUUIDDao.delete(dCAEuuid);
+			commonClassDao.delete(dCAEuuid);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.dcaeUUIDDao.getDCAEuuidData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(DCAEuuid.class));
 			JSONObject j = new JSONObject("{dcaeUUIDDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -213,7 +240,7 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(microServiceConfigNameDao.getMSConfigDataByName()));
+			model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceConfigName.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -230,53 +257,94 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(microServiceConfigNameDao.getMicroServiceConfigNameData()));
+			model.put("microServiceCongigNameDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceConfigName.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader(SUCCESSKEY, SUCCESS);    
+            response.addHeader(OPERATION, GETDICTIONARY);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader(ERROR, DICTIONARYDBQUERY);
+            LOGGER.error(e.getMessage());
 		}
 	}
 	
-	@RequestMapping(value={"/ms_dictionary/save_configName.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/save_configName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			MicroServiceConfigName microServiceConfigName = (MicroServiceConfigName)mapper.readValue(root.get("microServiceCongigNameDictionaryData").toString(), MicroServiceConfigName.class);
+            MicroServiceConfigName microServiceConfigName;
+            if (fromAPI) {
+                microServiceConfigName = (MicroServiceConfigName)mapper.readValue(root.get("dictionaryFields").toString(), MicroServiceConfigName.class);
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter(OPERATION).equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(microServiceConfigName.getName(), "name", MicroServiceConfigName.class);
+                    int id = 0;
+                    MicroServiceConfigName data = (MicroServiceConfigName) duplicateData.get(0);
+                    id = data.getId();
+                
+                    if(id==0){
+                        isFakeUpdate=true;
+                        microServiceConfigName.setId(1);
+                    } else {
+                        microServiceConfigName.setId(id);
+                    }  
+                }
+            } else {
+            	microServiceConfigName = (MicroServiceConfigName)mapper.readValue(root.get("microServiceCongigNameDictionaryData").toString(), MicroServiceConfigName.class);
+            }
 			if(microServiceConfigName.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(microServiceConfigName.getName(), "name", MicroServiceConfigName.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(microServiceConfigName.getName(), "name", MicroServiceConfigName.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					microServiceConfigNameDao.Save(microServiceConfigName);
+					commonClassDao.save(microServiceConfigName);
 				}
 			}else{
-				microServiceConfigNameDao.update(microServiceConfigName); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(microServiceConfigName); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.microServiceConfigNameDao.getMicroServiceConfigNameData());
-			}
-			JSONObject j = new JSONObject("{microServiceCongigNameDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceConfigName.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{microServiceCongigNameDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -285,21 +353,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ms_dictionary/remove_msConfigName.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/remove_msConfigName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			MicroServiceConfigName microServiceConfigName = (MicroServiceConfigName)mapper.readValue(root.get("data").toString(), MicroServiceConfigName.class);
-			microServiceConfigNameDao.delete(microServiceConfigName);
+			commonClassDao.delete(microServiceConfigName);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.microServiceConfigNameDao.getMicroServiceConfigNameData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceConfigName.class));
 			JSONObject j = new JSONObject("{microServiceCongigNameDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -320,7 +388,7 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(microServiceLocationDao.getMSLocationDataByName()));
+			model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceLocation.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -335,53 +403,94 @@
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(microServiceLocationDao.getMicroServiceLocationData()));
+			model.put("microServiceLocationDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceLocation.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader(SUCCESSKEY, SUCCESS);    
+            response.addHeader(OPERATION, GETDICTIONARY);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader(ERROR, DICTIONARYDBQUERY);
+            LOGGER.error(e.getMessage());
 		}
 	}
 	
-	@RequestMapping(value={"/ms_dictionary/save_location.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/save_location"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			MicroServiceLocation microServiceLocation = (MicroServiceLocation)mapper.readValue(root.get("microServiceLocationDictionaryData").toString(), MicroServiceLocation.class);
+            MicroServiceLocation microServiceLocation;
+            if (fromAPI) {
+                microServiceLocation = (MicroServiceLocation)mapper.readValue(root.get("dictionaryFields").toString(), MicroServiceLocation.class);
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter(OPERATION).equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(microServiceLocation.getName(), "name", MicroServiceLocation.class);
+                    int id = 0;
+                    MicroServiceLocation data = (MicroServiceLocation) duplicateData.get(0);
+                    id = data.getId();
+                  
+                    if(id==0){
+                        isFakeUpdate=true;
+                        microServiceLocation.setId(1);
+                    } else {
+                        microServiceLocation.setId(id);
+                    }
+                }
+            } else {
+            	microServiceLocation = (MicroServiceLocation)mapper.readValue(root.get("microServiceLocationDictionaryData").toString(), MicroServiceLocation.class);
+            }
 			if(microServiceLocation.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(microServiceLocation.getName(), "name", MicroServiceLocation.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(microServiceLocation.getName(), "name", MicroServiceLocation.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					microServiceLocationDao.Save(microServiceLocation);
+					commonClassDao.save(microServiceLocation);
 				}
 			}else{
-				microServiceLocationDao.update(microServiceLocation); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(microServiceLocation); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.microServiceLocationDao.getMicroServiceLocationData());
-			}
-			JSONObject j = new JSONObject("{microServiceLocationDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceLocation.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{microServiceLocationDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+		}catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -390,21 +499,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ms_dictionary/remove_msLocation.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/remove_msLocation"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			MicroServiceLocation microServiceLocation = (MicroServiceLocation)mapper.readValue(root.get("data").toString(), MicroServiceLocation.class);
-			microServiceLocationDao.delete(microServiceLocation);
+			commonClassDao.delete(microServiceLocation);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.microServiceLocationDao.getMicroServiceLocationData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceLocation.class));
 			JSONObject j = new JSONObject("{microServiceLocationDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -420,81 +529,367 @@
 		return null;
 	}
 	
+    @RequestMapping(value={"/get_MicroServiceAttributeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getMicroServiceAttributeByNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceAttribute.class, "name")));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.getWriter().write(j.toString());
+        }
+        catch (Exception e){
+            LOGGER.error(e.getMessage());
+        }
+    }
+    
+    @RequestMapping(value={"/get_MicroServiceAttributeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getMicroServiceAttributeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("microServiceAttributeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceAttribute.class)));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.addHeader(SUCCESSKEY, SUCCESS);    
+            response.addHeader(OPERATION, GETDICTIONARY);
+            response.getWriter().write(j.toString());
+ 
+        }
+        catch (Exception e){
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader(ERROR, DICTIONARYDBQUERY);
+            LOGGER.error(e.getMessage());
+        }
+    }
+    
+    @RequestMapping(value={"/ms_dictionary/save_modelAttribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    public ModelAndView saveMicroServiceAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        try {
+            boolean duplicateflag = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
+            
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode root = mapper.readTree(request.getReader());
+            
+            MicroServiceAttribute microServiceAttribute;
+            if (fromAPI) {
+                microServiceAttribute = (MicroServiceAttribute)mapper.readValue(root.get("dictionaryFields").toString(), MicroServiceAttribute.class);
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter(OPERATION).equals("update")) {
+                    MicroServiceAttribute initialAttribute = (MicroServiceAttribute)mapper.readValue(root.get("initialFields").toString(), MicroServiceAttribute.class);
+ 
+                    String checkValue = initialAttribute.getName() + ":" + initialAttribute.getValue() + ":" + initialAttribute.getModelName();
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(checkValue, "name:value:modelName", MicroServiceAttribute.class);
+                    int id=0;
+                    for (int i= 0; i<duplicateData.size(); i++){
+                        MicroServiceAttribute data = (MicroServiceAttribute) duplicateData.get(0);
+                        id = data.getId();
+                    }
+                    microServiceAttribute.setId(id);                
+                }
+            } else {
+                microServiceAttribute = (MicroServiceAttribute)mapper.readValue(root.get("modelAttributeDictionaryData").toString(), MicroServiceAttribute.class);
+            }
+            
+            if(microServiceAttribute.getId() == 0){
+                String checkValue = microServiceAttribute.getName() + ":" + microServiceAttribute.getValue() + ":" + microServiceAttribute.getModelName();
+                List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(checkValue, "name:value:modelName", MicroServiceAttribute.class);
+                if(!duplicateData.isEmpty()){
+                    duplicateflag = true;
+                }else{
+                	commonClassDao.save(microServiceAttribute);
+                }
+            }else{
+            	commonClassDao.update(microServiceAttribute); 
+            } 
+ 
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceAttribute.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    responseString = "Success";
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{microServiceAttributeDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }
+        catch (Exception e){
+            response.setCharacterEncoding("UTF-8");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            out.write(e.getMessage());
+        }
+        return null;
+    }
+ 
+    @RequestMapping(value={"/ms_dictionary/remove_modelAttribute"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    public ModelAndView removeMicroServiceAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
+        try{
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode root = mapper.readTree(request.getReader());
+            MicroServiceAttribute microServiceAttribute = (MicroServiceAttribute)mapper.readValue(root.get("data").toString(), MicroServiceAttribute.class);
+            commonClassDao.delete(microServiceAttribute);
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application / json");
+            request.setCharacterEncoding("UTF-8");
+ 
+            PrintWriter out = response.getWriter();
+ 
+            String responseString = mapper.writeValueAsString(MicroServiceDictionaryController.commonClassDao.getData(MicroServiceAttribute.class));
+            JSONObject j = new JSONObject("{microServiceAttributeDictionaryDatas: " + responseString + "}");
+            out.write(j.toString());
+ 
+            return null;
+        }
+        catch (Exception e){
+            LOGGER.error(e.getMessage());
+            response.setCharacterEncoding("UTF-8");
+            request.setCharacterEncoding("UTF-8");
+            PrintWriter out = response.getWriter();
+            out.write(e.getMessage());
+        }
+        return null;
+    }
+ 
+	
 	@RequestMapping(value={"/get_MicroServiceModelsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getMicroServiceModelsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(microServiceModelsDao.getMSModelsDataByName()));
+			model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(MicroServiceModels.class, "modelName")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			 LOGGER.error(e.getMessage());
 		}
 	}
 	
+    @RequestMapping(value={"/get_MicroServiceModelsDataByVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getMicroServiceModelsDictionaryByVersionEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            JsonNode root = mapper.readTree(request.getReader());
+            String modelName = null;
+            if (root.get("microServiceModelsDictionaryData").has("modelName")){
+                modelName = root.get("microServiceModelsDictionaryData").get("modelName").asText().replace("\"", "");
+            }
+             if (modelName!=null){
+                    model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataById(MicroServiceModels.class, "modelName", modelName)));
+             } else{
+                 model.put(ERROR, "No model name given");
+             }
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.getWriter().write(j.toString());
+        }
+        catch (Exception e){
+            LOGGER.error(e.getMessage());
+        }
+    }
+    
 	@RequestMapping(value={"/get_MicroServiceModelsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getMicroServiceModelsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(microServiceModelsDao.getMicroServiceModelsData()));
+			model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(MicroServiceModels.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader(SUCCESSKEY, SUCCESS);    
+            response.addHeader(OPERATION, GETDICTIONARY);
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader(ERROR, DICTIONARYDBQUERY);
+            LOGGER.error(e.getMessage());
 		}
 	}
 	
-	@RequestMapping(value={"/ms_dictionary/save_model.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+    @RequestMapping(value={"/get_MicroServiceModelsDataServiceVersion"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getMicroServiceModelsDictionaryEntityDataServiceVersion(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            List<String> data = new ArrayList<String>();
+            List<Object> datas = commonClassDao.getData(MicroServiceModels.class);
+            for(int i = 0; i < datas.size(); i++){
+            	MicroServiceModels msmodel = (MicroServiceModels) datas.get(i);
+                if (!data.contains(msmodel.getModelName())){
+                	data.add(msmodel.getModelName() + "-v" + msmodel.getVersion());
+                }
+            }
+            model.put("microServiceModelsDictionaryDatas", mapper.writeValueAsString(data));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
+            response.getWriter().write(j.toString());
+ 
+        }
+        catch (Exception e){
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
+            e.printStackTrace();
+        }
+    }
+    
+    @RequestMapping(value={"/get_MicroServiceModelsDataByClass"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+    public void getMicroServiceModelsDictionaryClassEntityData(HttpServletRequest request, HttpServletResponse response){
+        try{
+            Map<String, Object> model = new HashMap<String, Object>();
+            ObjectMapper mapper = new ObjectMapper();
+            model.put("microServiceModelsDictionaryClassDatas", mapper.writeValueAsString(modelList));
+            JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+            JSONObject j = new JSONObject(msg);
+            response.addHeader(SUCCESSKEY, SUCCESS);    
+            response.addHeader(OPERATION, GETDICTIONARY);
+            response.getWriter().write(j.toString());
+ 
+        }
+        catch (Exception e){
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader(ERROR, DICTIONARYDBQUERY);
+            LOGGER.error(e.getMessage());
+        }
+    }
+    
+	@RequestMapping(value={"/ms_dictionary/save_model"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+            boolean fromAPI = false;
+            this.newModel = new MicroServiceModels();
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			MicroServiceModels microServiceModels = (MicroServiceModels)mapper.readValue(root.get("microServiceModelsDictionaryData").toString(), MicroServiceModels.class);
-			String userId = root.get("loginId").textValue();
+            MicroServiceModels microServiceModels = new MicroServiceModels();
+            String userId = null;
+            if (fromAPI) {
+                microServiceModels = (MicroServiceModels)mapper.readValue(root.get("dictionaryFields").toString(), MicroServiceModels.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter(OPERATION).equals("update")) {
+                    String checkName = microServiceModels.getModelName() + ":" + microServiceModels.getVersion();
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(checkName, "modelName:version", MicroServiceModels.class);
+                    int id = 0;
+                    for (int i=0; i< duplicateData.size(); i++){
+                        MicroServiceModels data = (MicroServiceModels) duplicateData.get(0);
+                        id = data.getId();
+                    }
+                    microServiceModels.setId(id);
+                    microServiceModels.setUserCreatedBy(this.getUserInfo(userId));
+                
+                }
+            } else {
+            	//microServiceModels = (MicroServiceModels)mapper.readValue(root.get("microServiceModelsDictionaryData").toString(), MicroServiceModels.class);
+            	if (root.has("microServiceModelsDictionaryData")){
+            		if (root.get("microServiceModelsDictionaryData").has("description")){
+            			microServiceModels.setDescription(root.get("microServiceModelsDictionaryData").get("description").asText().replace("\"", ""));
+            		}
+            		if (root.get("microServiceModelsDictionaryData").has("modelName")){
+            			microServiceModels.setModelName(root.get("microServiceModelsDictionaryData").get("modelName").asText().replace("\"", ""));
+            			this.newModel.setModelName(microServiceModels.getModelName());
+            		}
+            		if (root.get("microServiceModelsDictionaryData").has("version")){
+            			microServiceModels.setVersion(root.get("microServiceModelsDictionaryData").get("version").asText().replace("\"", ""));
+            			this.newModel.setVersion(microServiceModels.getVersion());
+            		}
+            	}
+            	if(root.has("classMap")){
+            		classMap = new HashMap<String, MSAttributeObject>();
+            		JsonNode data = root.get("classMap");
+            		ObjectMapper mapper1 = new ObjectMapper();
+            		String data1 = data.toString().substring(1, data.toString().length()-1);
+            		data1 = data1.replace("\\", "");
+            		JSONObject jsonObject = new JSONObject(data1);
+            		Set<String> keys = jsonObject.keySet();
+            		for(String key : keys){
+            			String value = jsonObject.get(key).toString();
+            			MSAttributeObject msAttributeObject = mapper1.readValue(value, MSAttributeObject.class);
+            			classMap.put(key, msAttributeObject);
+            		}
+            	}
+            	userId = root.get("userid").textValue();
+            	addValuesToNewModel(classMap);
+            }
 			microServiceModels.setAttributes(this.newModel.getAttributes());
 			microServiceModels.setRef_attributes(this.newModel.getRef_attributes());
 			microServiceModels.setDependency(this.newModel.getDependency());
 			microServiceModels.setModelName(this.newModel.getModelName());
 			microServiceModels.setSub_attributes(this.newModel.getSub_attributes());
 			microServiceModels.setVersion(this.newModel.getVersion());
+            microServiceModels.setEnumValues(this.newModel.getEnumValues());
+            microServiceModels.setAnnotation(this.newModel.getAnnotation());
+            
 			if(microServiceModels.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(microServiceModels.getModelName(), "modelName", MicroServiceModels.class);
+				String checkName = microServiceModels.getModelName() + ":" + microServiceModels.getVersion();
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(checkName, "modelName:version", MicroServiceModels.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					microServiceModels.setUserCreatedBy(this.getUserInfo(userId));
-					microServiceModelsDao.Save(microServiceModels);
+					commonClassDao.save(microServiceModels);
 				}
 			}else{
-				microServiceModelsDao.update(microServiceModels); 
+				commonClassDao.update(microServiceModels); 
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.microServiceModelsDao.getMicroServiceModelsData());
-			} 
-			JSONObject j = new JSONObject("{microServiceModelsDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		}
-		catch (Exception e){
+            String responseString = "";
+            if(duplicateflag){
+                responseString = "Duplicate";
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceModels.class));
+            } 
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals("Duplicate")) {
+                    responseString = "Success";
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{microServiceModelsDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -503,21 +898,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ms_dictionary/remove_msModel.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ms_dictionary/remove_msModel"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removeMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			MicroServiceModels microServiceModels = (MicroServiceModels)mapper.readValue(root.get("data").toString(), MicroServiceModels.class);
-			microServiceModelsDao.delete(microServiceModels);
+			commonClassDao.delete(microServiceModels);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.microServiceModelsDao.getMicroServiceModelsData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(MicroServiceModels.class));
 			JSONObject j = new JSONObject("{microServiceModelsDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -533,55 +928,12 @@
 		return null;
 	}
 	
-	@RequestMapping(value={"/ms_dictionary/set_MSModelData.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
-	public void SetRuleData(HttpServletRequest request, HttpServletResponse response) throws Exception{
-		List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
-		for (FileItem item : items) {
-			if(item.getName().endsWith(".zip")){
-				this.newModel = new MicroServiceModels();
-				try{
-					File file = new File(item.getName());
-					OutputStream outputStream = new FileOutputStream(file);
-					IOUtils.copy(item.getInputStream(), outputStream);
-					outputStream.close();
-					this.newFile = file.toString();
-					this.newModel.setModelName(this.newFile.toString().split("-v")[0]);
-					if (this.newFile.toString().contains("-v")){
-						this.newModel.setVersion(this.newFile.toString().split("-v")[1].replace(".zip", ""));
-					}
-				}catch(Exception e){
-					logger.error("Upload error : " + e);
-				}
-			}
-		}
-		extractFolder(this.newFile);
-		List<File> fileList = listModelFiles(this.directory);
-		
-		File folder = new File(this.directory);
-		File[] test = folder.listFiles();
-		
-		//Process Main Model file first
-		String ignoreFile = null;
-		for (File file : test) {
-			if(!file.isDirectory() && file.getName().endsWith(".xmi")){
-            	retreiveDependency(file.toString(), true);
-            	ignoreFile = file.toString();
-            }	
-		}
-		
-		for(File tempFile: fileList){
-			if (!tempFile.toString().contains(ignoreFile)){
-				retreiveDependency(tempFile.toString(), false);
-			}
-		}
-		
-		addValuesToNewModel();
-		
-		File deleteFile = new File(this.newFile);
-		deleteFile.delete();
-	}
 	
-	private void addValuesToNewModel() {
+
+ 
+	
+	private void addValuesToNewModel(HashMap<String,MSAttributeObject > classMap) {
+		new MicroServiceModels();
 		//Loop  through the classmap and pull out the required info for the new file.
 		MSAttributeObject mainClass  = null;
 		ArrayList<String> dependency = null;
@@ -615,7 +967,9 @@
 		this.newModel.setSub_attributes(subAttribute.toString());
 		this.newModel.setAttributes(mainClass.getAttribute().toString().replace("{", "").replace("}", ""));
 		this.newModel.setRef_attributes(mainClass.getRefAttribute().toString().replace("{", "").replace("}", ""));
-	
+        this.newModel.setEnumValues(mainClass.getEnumType().toString().replace("{", "").replace("}", ""));
+        this.newModel.setAnnotation(mainClass.getMatchingSet().toString().replace("{", "").replace("}", ""));
+
 	} 
 	
 	private ArrayList<String> getFullDependencyList(ArrayList<String> dependency) {
@@ -639,80 +993,4 @@
 		return returnList;
 	}
 
-	
-	/*
-	 * Unzip file and store in the model directory for processing
-	 */
-	@SuppressWarnings("rawtypes")
-	private void extractFolder(String zipFile )  {
-	    int BUFFER = 2048;
-	    File file = new File(zipFile);
-
-	    ZipFile zip;
-		try {
-			zip = new ZipFile(file);
-		    String newPath =  "model" + File.separator + zipFile.substring(0, zipFile.length() - 4);
-		    this.directory = "model" + File.separator + zipFile.substring(0, zipFile.length() - 4);
-		    new File(newPath).mkdir();
-		    Enumeration zipFileEntries = zip.entries();
-	
-		    // Process each entry
-		    while (zipFileEntries.hasMoreElements()){
-		        // grab a zip file entry
-		        ZipEntry entry = (ZipEntry) zipFileEntries.nextElement();
-		        String currentEntry = entry.getName();
-		        File destFile = new File("model" + File.separator + currentEntry);
-		        File destinationParent = destFile.getParentFile();
-		        
-		        destinationParent.mkdirs();
-	
-		        if (!entry.isDirectory()){
-		            BufferedInputStream is = new BufferedInputStream(zip.getInputStream(entry));
-		            int currentByte;
-		            byte data[] = new byte[BUFFER];
-		            FileOutputStream fos = new FileOutputStream(destFile);
-		            BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER);
-		            while ((currentByte = is.read(data, 0, BUFFER)) != -1) {
-		                dest.write(data, 0, currentByte);
-		            }
-		            dest.flush();
-		            dest.close();
-		            is.close();
-		        }
-	
-		        if (currentEntry.endsWith(".zip")){
-		            extractFolder(destFile.getAbsolutePath());
-		        }
-		    }
-	    } catch (IOException e) {
-			logger.error("Failed to unzip model file " + zipFile);
-		}
-	}
-	
-	private void retreiveDependency(String workingFile, Boolean modelClass) {
-		
-		MSModelUtitils utils = new MSModelUtitils();
-	    HashMap<String, MSAttributeObject> tempMap = new HashMap<String, MSAttributeObject>();
-	    
-	    tempMap = utils.processEpackage(workingFile);
-	    
-	    classMap.putAll(tempMap);
-	    System.out.println(tempMap);
-	    
-	    return;   	}
-		
-	private List<File> listModelFiles(String directoryName) {
-		File directory = new File(directoryName);
-		List<File> resultList = new ArrayList<File>();
-		File[] fList = directory.listFiles();
-		for (File file : fList) {
-			if (file.isFile()) {
-				resultList.add(file);
-			} else if (file.isDirectory()) {
-				dirDependencyList.add(file.getName());
-				resultList.addAll(listModelFiles(file.getAbsolutePath()));
-			}
-		}
-		return resultList;
-	}
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
index b8803d7..ab86ce2 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PolicyScopeDictionaryController.java
@@ -31,13 +31,10 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.GroupPolicyScopeListDao;
-import org.openecomp.policy.rest.dao.PolicyScopeClosedLoopDao;
-import org.openecomp.policy.rest.dao.PolicyScopeResourceDao;
-import org.openecomp.policy.rest.dao.PolicyScopeServiceDao;
-import org.openecomp.policy.rest.dao.PolicyScopeTypeDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.GroupPolicyScopeList;
 import org.openecomp.policy.rest.jpa.PolicyScopeClosedLoop;
 import org.openecomp.policy.rest.jpa.PolicyScopeResource;
@@ -57,36 +54,30 @@
 @Controller
 public class PolicyScopeDictionaryController {
 
-	@Autowired
-	GroupPolicyScopeListDao groupPolicyScopeListDao;
-	
-	@Autowired
-	PolicyScopeClosedLoopDao  policyScopeClosedLoopDao;
-	
-	@Autowired
-	PolicyScopeResourceDao PolicyScopeResourceDao;
-	
-	@Autowired
-	PolicyScopeTypeDao policyScopeTypeDao;
-	
-	@Autowired
-	PolicyScopeServiceDao policyScopeServiceDao;
-	
+	private static final Logger LOGGER  = FlexLogger.getLogger(PolicyScopeDictionaryController.class);
 
-	@Autowired
-	UserInfoDao userInfoDao;
+	private static CommonClassDao commonClassDao;
 	
-	public UserInfo getUserInfo(String loginId){
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
-		return name;	
+	@Autowired
+	public PolicyScopeDictionaryController(CommonClassDao commonClassDao){
+		PolicyScopeDictionaryController.commonClassDao = commonClassDao;
 	}
 	
+	public PolicyScopeDictionaryController(){}	
+
+	private static String SUCCESSMAPKEY = "successMapKey";
+
+	public UserInfo getUserInfo(String loginId){
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
+		return name;	
+	}
+
 	@RequestMapping(value={"/get_GroupPolicyScopeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getGroupPolicyScopeEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(groupPolicyScopeListDao.getGroupPolicyScopeListDataByName()));
+			model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupPolicyScopeList.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -95,41 +86,96 @@
 			e.printStackTrace();
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_GroupPolicyScopeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getGroupPolicyScopeEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(groupPolicyScopeListDao.getGroupPolicyScopeListData()));
+			model.put("groupPolicyScopeListDatas", mapper.writeValueAsString(commonClassDao.getData(GroupPolicyScopeList.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader(SUCCESSMAPKEY, "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
+			LOGGER.error(e);
 		}
 	}
-	
-	@RequestMapping(value={"/ps_dictionary/save_psGroupPolicyScope.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/ps_dictionary/save_psGroupPolicyScope"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean duplicateGroupFlag = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
+
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			GroupPolicyScopeList ecompData = (GroupPolicyScopeList)mapper.readValue(root.get("groupPolicyScopeListData").toString(), GroupPolicyScopeList.class);
+			//GroupPolicyScopeList gpdata = (GroupPolicyScopeList)mapper.readValue(root.get("groupPolicyScopeListData").toString(), GroupPolicyScopeList.class);
+			GroupPolicyScopeList gpdata = null;
 			GroupPolicyScope groupData = null;
-			try{
-				 groupData = (GroupPolicyScope)mapper.readValue(root.get("groupPolicyScopeListData1").toString(), GroupPolicyScope.class);
-			}catch(Exception e){
-				groupData = new GroupPolicyScope();
-				groupData.setResource(root.get("groupPolicyScopeListData1").get("resource").toString().replace("\"", ""));
-				groupData.setClosedloop(root.get("groupPolicyScopeListData1").get("closedloop").toString().replace("\"", ""));
-				groupData.setService(root.get("groupPolicyScopeListData1").get("service").toString().replace("\"", ""));
-				groupData.setType(root.get("groupPolicyScopeListData1").get("type").toString().replace("\"", ""));
+			if (fromAPI) {
+				gpdata = (GroupPolicyScopeList)mapper.readValue(root.get("dictionaryFields").toString(), GroupPolicyScopeList.class);
+				try{
+					groupData = (GroupPolicyScope)mapper.readValue(root.get("groupPolicyScopeListData1").toString(), GroupPolicyScope.class);
+				}catch(Exception e){
+					groupData = new GroupPolicyScope();
+					groupData.setResource(root.get("dictionaryFields").get("resource").toString().replace("\"", ""));
+					groupData.setClosedloop(root.get("dictionaryFields").get("closedloop").toString().replace("\"", ""));
+					groupData.setService(root.get("dictionaryFields").get("service").toString().replace("\"", ""));
+					groupData.setType(root.get("dictionaryFields").get("type").toString().replace("\"", ""));
+				}
+
+				if(!gpdata.getGroupName().startsWith("PolicyScope")){
+					String name = "PolicyScope_" + gpdata.getGroupName();
+					gpdata.setGroupName(name);
+				}
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(gpdata.getGroupName(), "name", GroupPolicyScopeList.class);
+					int id = 0;
+					for (int i =0; i< duplicateData.size(); i++){
+						GroupPolicyScopeList data = (GroupPolicyScopeList) duplicateData.get(0);
+						id = data.getId();
+					}                   
+
+					if(id==0){
+						isFakeUpdate=true;
+						gpdata.setId(1);
+					} else {
+						gpdata.setId(id);
+					}
+
+				}
+			} else {
+				gpdata = (GroupPolicyScopeList)mapper.readValue(root.get("groupPolicyScopeListData").toString(), GroupPolicyScopeList.class);
+
+				try{
+					groupData = (GroupPolicyScope)mapper.readValue(root.get("groupPolicyScopeListData1").toString(), GroupPolicyScope.class);
+				}catch(Exception e){
+					groupData = new GroupPolicyScope();
+					groupData.setResource(root.get("groupPolicyScopeListData1").get("resource").toString().replace("\"", ""));
+					groupData.setClosedloop(root.get("groupPolicyScopeListData1").get("closedloop").toString().replace("\"", ""));
+					groupData.setService(root.get("groupPolicyScopeListData1").get("service").toString().replace("\"", ""));
+					groupData.setType(root.get("groupPolicyScopeListData1").get("type").toString().replace("\"", ""));
+				}
+				if(!gpdata.getGroupName().startsWith("PolicyScope")){
+					String name = "PolicyScope_" + gpdata.getGroupName();
+					gpdata.setGroupName(name);
+				}
+
 			}
-			
 			ArrayList<String> valueList = new ArrayList<String>();
 			String list = null;
 			String resourceValue = groupData.getResource();
@@ -141,40 +187,66 @@
 			valueList.add("type=" + typeValue);
 			valueList.add("closedLoopControlName="  + closedLoopValue);
 			list = StringUtils.replaceEach(valueList.toString(), new String[]{"[", "]", " "}, new String[]{"", "", ""});
-			ecompData.setGroupList(list);
-			if(!ecompData.getGroupName().startsWith("PolicyScope")){
-				String name = "PolicyScope_" + ecompData.getGroupName();
-				ecompData.setGroupName(name);
+			gpdata.setGroupList(list);
+			if(!gpdata.getGroupName().startsWith("PolicyScope")){
+				String name = "PolicyScope_" + gpdata.getGroupName();
+				gpdata.setGroupName(name);
 			}
-			if(ecompData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(ecompData.getGroupName(), "name", GroupPolicyScopeList.class);
+			if(gpdata.getId() == 0){
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(gpdata.getGroupName(), "name", GroupPolicyScopeList.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					groupPolicyScopeListDao.Save(ecompData);
+					duplicateData =  commonClassDao.checkDuplicateEntry(gpdata.getGroupList(), "groupList", GroupPolicyScopeList.class);
+					if(!duplicateData.isEmpty()){
+						duplicateGroupFlag = true;
+					}else{
+						commonClassDao.save(gpdata);
+					}
 				}
 			}else{
-				groupPolicyScopeListDao.update(ecompData); 
-			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
+				if(!isFakeUpdate) {
+					List<Object> duplicateGroupList =  commonClassDao.checkExistingGroupListforUpdate(gpdata.getGroupList(), gpdata.getGroupName());
+					if(!duplicateGroupList.isEmpty()) {
+						duplicateGroupFlag = true;
+					} else {
+						commonClassDao.update(gpdata); 
+					}
+				} 
+			}
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
+			}else if(duplicateGroupFlag){
+				responseString = "DuplicateGroup";
 			}else{
-				responseString = mapper.writeValueAsString(this.groupPolicyScopeListDao.getGroupPolicyScopeListData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(GroupPolicyScopeList.class));
 			}
-			JSONObject j = new JSONObject("{groupPolicyScopeListDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate") && !responseString.equals("DuplicateGroup")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
 
-			return null;
-		}
-		catch (Exception e){
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{groupPolicyScopeListDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -183,21 +255,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ps_dictionary/remove_GroupPolicyScope.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ps_dictionary/remove_GroupPolicyScope"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			GroupPolicyScopeList ecompData = (GroupPolicyScopeList)mapper.readValue(root.get("data").toString(), GroupPolicyScopeList.class);
-			groupPolicyScopeListDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.groupPolicyScopeListDao.getGroupPolicyScopeListData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(GroupPolicyScopeList.class));
 			JSONObject j = new JSONObject("{groupPolicyScopeListDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -212,13 +284,13 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_PSClosedLoopDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSClosedLoopEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(policyScopeClosedLoopDao.getPolicyScopeClosedLoopDataByName()));
+			model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeClosedLoop.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -227,59 +299,106 @@
 			e.printStackTrace();
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PSClosedLoopData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSClosedLoopEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(policyScopeClosedLoopDao.getPolicyScopeClosedLoopData()));
+			model.put("psClosedLoopDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeClosedLoop.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader(SUCCESSMAPKEY, "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
+			LOGGER.error(e);
 		}
 	}
-	
-	@RequestMapping(value={"/ps_dictionary/save_psClosedLoop.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/ps_dictionary/save_psClosedLoop"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PolicyScopeClosedLoop ecompData = (PolicyScopeClosedLoop)mapper.readValue(root.get("psClosedLoopDictionaryData").toString(), PolicyScopeClosedLoop.class);
+			PolicyScopeClosedLoop ecompData;
+			if (fromAPI) {
+				ecompData = (PolicyScopeClosedLoop)mapper.readValue(root.get("dictionaryFields").toString(), PolicyScopeClosedLoop.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeClosedLoop.class);
+					int id = 0;
+					for (int i =0; i< duplicateData.size(); i++){
+						PolicyScopeClosedLoop data = (PolicyScopeClosedLoop) duplicateData.get(0);
+						id = data.getId();
+					}
+
+					if(id==0){
+						isFakeUpdate=true;
+						ecompData.setId(1);
+					} else {
+						ecompData.setId(id);
+					}   
+
+				}
+			} else {
+				ecompData = (PolicyScopeClosedLoop)mapper.readValue(root.get("psClosedLoopDictionaryData").toString(), PolicyScopeClosedLoop.class);
+			}
 			if(ecompData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(ecompData.getName(), "name", PolicyScopeClosedLoop.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeClosedLoop.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					policyScopeClosedLoopDao.Save(ecompData);
+					commonClassDao.save(ecompData);
 				}
 			}else{
-				policyScopeClosedLoopDao.update(ecompData); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(ecompData); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.policyScopeClosedLoopDao.getPolicyScopeClosedLoopData());
-			}	 
-			JSONObject j = new JSONObject("{psClosedLoopDictionaryDatas: " + responseString + "}");
+				responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeClosedLoop.class));
+			}
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
 
-			return null;
-		}
-		catch (Exception e){
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{psClosedLoopDictionaryDatas: " + responseString + "}");
+
+				out.write(j.toString());
+
+				return null;
+			}
+
+		}catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -288,21 +407,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ps_dictionary/remove_PSClosedLoop.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ps_dictionary/remove_PSClosedLoop"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			PolicyScopeClosedLoop ecompData = (PolicyScopeClosedLoop)mapper.readValue(root.get("data").toString(), PolicyScopeClosedLoop.class);
-			policyScopeClosedLoopDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.policyScopeClosedLoopDao.getPolicyScopeClosedLoopData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeClosedLoop.class));
 			JSONObject j = new JSONObject("{psClosedLoopDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -317,13 +436,13 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_PSServiceDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSServiceEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psServiceDictionaryDatas", mapper.writeValueAsString(policyScopeServiceDao.getPolicyScopeServiceDataByName()));
+			model.put("psServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeService.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -332,59 +451,103 @@
 			e.printStackTrace();
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PSServiceData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSServiceEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psServiceDictionaryDatas", mapper.writeValueAsString(policyScopeServiceDao.getPolicyScopeServiceData()));
+			model.put("psServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeService.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader(SUCCESSMAPKEY, "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
+			LOGGER.error(e);
 		}
 	}
-	
-	@RequestMapping(value={"/ps_dictionary/save_psService.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/ps_dictionary/save_psService"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PolicyScopeService ecompData = (PolicyScopeService)mapper.readValue(root.get("psServiceDictionaryData").toString(), PolicyScopeService.class);
+			PolicyScopeService ecompData;
+			if (fromAPI) {
+				ecompData = (PolicyScopeService)mapper.readValue(root.get("dictionaryFields").toString(), PolicyScopeService.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeService.class);
+					int id = 0;
+					for (int i =0; i< duplicateData.size(); i++){
+						PolicyScopeService data = (PolicyScopeService) duplicateData.get(0);
+						id = data.getId();
+					}
+					if(id==0){
+						isFakeUpdate=true;
+						ecompData.setId(1);
+					} else {
+						ecompData.setId(id);
+					}
+				}
+			} else {
+				ecompData = (PolicyScopeService)mapper.readValue(root.get("psServiceDictionaryData").toString(), PolicyScopeService.class);
+			}
 			if(ecompData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(ecompData.getName(), "name", PolicyScopeService.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeService.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					policyScopeServiceDao.Save(ecompData);
+					commonClassDao.save(ecompData);
 				}
 			}else{
-				policyScopeServiceDao.update(ecompData); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(ecompData); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
 
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.policyScopeServiceDao.getPolicyScopeServiceData());
-			}	
-			JSONObject j = new JSONObject("{psServiceDictionaryDatas: " + responseString + "}");
+				responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeService.class));
+			}   
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
 
-			return null;
-		}
-		catch (Exception e){
+			} else {
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{psServiceDictionaryDatas: " + responseString + "}");
+				out.write(j.toString());
+				return null;
+			}
+		}catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -393,21 +556,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ps_dictionary/remove_PSService.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ps_dictionary/remove_PSService"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			PolicyScopeService ecompData = (PolicyScopeService)mapper.readValue(root.get("data").toString(), PolicyScopeService.class);
-			policyScopeServiceDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.policyScopeServiceDao.getPolicyScopeServiceData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeService.class));
 			JSONObject j = new JSONObject("{psServiceDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -422,13 +585,13 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_PSTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSTypeEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psTypeDictionaryDatas", mapper.writeValueAsString(policyScopeTypeDao.getPolicyScopeTypeDataByName()));
+			model.put("psTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeType.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -437,59 +600,109 @@
 			e.printStackTrace();
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PSTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSTypeEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psTypeDictionaryDatas", mapper.writeValueAsString(policyScopeTypeDao.getPolicyScopeTypeData()));
+			model.put("psTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeType.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader(SUCCESSMAPKEY, "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
+			LOGGER.error(e);
 		}
 	}
-	
-	@RequestMapping(value={"/ps_dictionary/save_psType.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/ps_dictionary/save_psType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PolicyScopeType ecompData = (PolicyScopeType)mapper.readValue(root.get("psTypeDictionaryData").toString(), PolicyScopeType.class);
+			PolicyScopeType ecompData;
+			if (fromAPI) {
+				ecompData = (PolicyScopeType)mapper.readValue(root.get("dictionaryFields").toString(), PolicyScopeType.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeType.class);
+					int id = 0;
+					for (int i =0; i< duplicateData.size(); i++){
+						PolicyScopeType data = (PolicyScopeType) duplicateData.get(0);
+						id = data.getId();
+					}
+
+					if(id==0){
+						isFakeUpdate=true;
+						ecompData.setId(1);
+					} else {
+						ecompData.setId(id);
+					}   
+
+				}
+			} else {
+				ecompData = (PolicyScopeType)mapper.readValue(root.get("psTypeDictionaryData").toString(), PolicyScopeType.class);
+			}
 			if(ecompData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(ecompData.getName(), "name", PolicyScopeType.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeType.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					policyScopeTypeDao.Save(ecompData);
+					commonClassDao.save(ecompData);
 				}
 			}else{
-				policyScopeTypeDao.update(ecompData); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(ecompData); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.policyScopeTypeDao.getPolicyScopeTypeData());
+				responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeType.class));
 			} 
-			JSONObject j = new JSONObject("{psTypeDictionaryDatas: " + responseString + "}");
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
 
-			return null;
-		}
-		catch (Exception e){
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+
+			} else {
+
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{psTypeDictionaryDatas: " + responseString + "}");
+
+				out.write(j.toString());
+
+				return null;
+			}
+
+		}catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -498,21 +711,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ps_dictionary/remove_PSType.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ps_dictionary/remove_PSType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			PolicyScopeType ecompData = (PolicyScopeType)mapper.readValue(root.get("data").toString(), PolicyScopeType.class);
-			policyScopeTypeDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.policyScopeTypeDao.getPolicyScopeTypeData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeType.class));
 			JSONObject j = new JSONObject("{psTypeDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -527,13 +740,13 @@
 		}
 		return null;
 	}
-	
+
 	@RequestMapping(value={"/get_PSResourceDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSResourceEntityDataByName(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psResourceDictionaryDatas", mapper.writeValueAsString(PolicyScopeResourceDao.getPolicyScopeResourceDataByName()));
+			model.put("psResourceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PolicyScopeResource.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -542,59 +755,106 @@
 			e.printStackTrace();
 		}
 	}
-	
+
 	@RequestMapping(value={"/get_PSResourceData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 	public void getPSResourceEntityData(HttpServletRequest request, HttpServletResponse response){
 		try{
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("psResourceDictionaryDatas", mapper.writeValueAsString(PolicyScopeResourceDao.getPolicyScopeResourceData()));
+			model.put("psResourceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PolicyScopeResource.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+			response.addHeader("successMapKey", "success"); 
+			response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		}
 		catch (Exception e){
-			e.printStackTrace();
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
+			LOGGER.error(e);
 		}
 	}
-	
-	@RequestMapping(value={"/ps_dictionary/save_psResource.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+
+	@RequestMapping(value={"/ps_dictionary/save_psResource"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
 		try {
 			boolean duplicateflag = false;
+			boolean isFakeUpdate = false;
+			boolean fromAPI = false;
+			if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+				fromAPI = true;
+			}
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			PolicyScopeResource ecompData = (PolicyScopeResource)mapper.readValue(root.get("psResourceDictionaryData").toString(), PolicyScopeResource.class);
+			PolicyScopeResource ecompData;
+			if (fromAPI) {
+				ecompData = (PolicyScopeResource)mapper.readValue(root.get("dictionaryFields").toString(), PolicyScopeResource.class);
+
+				//check if update operation or create, get id for data to be updated and update attributeData
+				if (request.getParameter("operation").equals("update")) {
+					List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeResource.class);
+					int id = 0;
+					PolicyScopeResource data = (PolicyScopeResource) duplicateData.get(0);
+					id = data.getId();
+
+					if(id==0){
+						isFakeUpdate=true;
+						ecompData.setId(1);
+					} else {
+						ecompData.setId(id);
+					}
+				}
+			} else {
+				ecompData = (PolicyScopeResource)mapper.readValue(root.get("psResourceDictionaryData").toString(), PolicyScopeResource.class);
+			}
 			if(ecompData.getId() == 0){
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(ecompData.getName(), "name", PolicyScopeResource.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(ecompData.getName(), "name", PolicyScopeResource.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					PolicyScopeResourceDao.Save(ecompData);
+					commonClassDao.save(ecompData);
 				}
 			}else{
-				PolicyScopeResourceDao.update(ecompData); 
+				if(!isFakeUpdate) {
+					commonClassDao.update(ecompData); 
+				}
 			} 
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
 			String responseString = "";
 			if(duplicateflag){
 				responseString = "Duplicate";
 			}else{
-				responseString = mapper.writeValueAsString(this.PolicyScopeResourceDao.getPolicyScopeResourceData());
-			}	  
-			JSONObject j = new JSONObject("{psResourceDictionaryDatas: " + responseString + "}");
+				responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeResource.class));
+			}   
 
-			out.write(j.toString());
+			if (fromAPI) {
+				if (responseString!=null && !responseString.equals("Duplicate")) {
+					if(isFakeUpdate){
+						responseString = "Exists";
+					} else {
+						responseString = "Success";
+					}
 
-			return null;
-		}
-		catch (Exception e){
+				}
+				ModelAndView result = new ModelAndView();
+				result.setViewName(responseString);
+				return result;
+
+			} else {
+
+				response.setCharacterEncoding("UTF-8");
+				response.setContentType("application / json");
+				request.setCharacterEncoding("UTF-8");
+
+				PrintWriter out = response.getWriter();
+				JSONObject j = new JSONObject("{psResourceDictionaryDatas: " + responseString + "}");
+
+				out.write(j.toString());
+
+				return null;
+			}
+
+		}catch (Exception e){
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -603,21 +863,21 @@
 		return null;
 	}
 
-	@RequestMapping(value={"/ps_dictionary/remove_PSResource.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	@RequestMapping(value={"/ps_dictionary/remove_PSResource"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 	public ModelAndView removePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		try{
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			PolicyScopeResource ecompData = (PolicyScopeResource)mapper.readValue(root.get("data").toString(), PolicyScopeResource.class);
-			PolicyScopeResourceDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.PolicyScopeResourceDao.getPolicyScopeResourceData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(PolicyScopeResource.class));
 			JSONObject j = new JSONObject("{psResourceDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
@@ -634,7 +894,7 @@
 	}
 }
 
-	class GroupPolicyScope{
+class GroupPolicyScope{
 	String resource;
 	String type;
 	String service;
@@ -663,5 +923,5 @@
 	public void setClosedloop(String closedloop) {
 		this.closedloop = closedloop;
 	}
-	
+
 }
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PushPolicyController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PushPolicyController.java
new file mode 100644
index 0000000..046bb3c
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/PushPolicyController.java
@@ -0,0 +1,253 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.controller;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.util.List;
+import java.util.UUID;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.PolicyEntity;
+import org.openecomp.policy.rest.jpa.PolicyVersion;
+import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
+import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.att.research.xacml.api.pap.PAPException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+public class PushPolicyController {
+	private static final Logger LOGGER  = FlexLogger.getLogger(PushPolicyController.class);
+	
+	private static CommonClassDao commonClassDao;
+	
+	@Autowired
+	public PushPolicyController(CommonClassDao commonClassDao){
+		PushPolicyController.commonClassDao = commonClassDao;
+	}
+	
+	public PushPolicyController(){}
+	
+	@RequestMapping(value="/pushPolicy", method=RequestMethod.POST)
+	public void pushPolicy(HttpServletRequest request, HttpServletResponse response){
+		ObjectMapper mapper = new ObjectMapper();
+		mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+		try {
+			JsonNode root = mapper.readTree(request.getInputStream());
+			String policyScope = root.get("policyScope").asText();
+			String filePrefix = root.get("filePrefix").asText();
+			String policyName = root.get("policyName").asText();
+			String pdpGroup = root.get("pdpGroup").asText();
+			String requestID = request.getHeader("X-ECOMP-RequestID");
+			if(requestID==null){
+				requestID = UUID.randomUUID().toString();
+                LOGGER.info("No request ID provided, sending generated ID: " + requestID.toString());
+			}
+			LOGGER.info("Push policy Request : " + root.asText());
+			String policyVersionName = policyScope.replace(".", File.separator) + File.separator
+					+ filePrefix + policyName;
+			List<?> policyVersionObject = commonClassDao.getDataById(PolicyVersion.class, "policyName", policyVersionName);
+			if(policyVersionObject!=null){
+				PolicyVersion policyVersion = (PolicyVersion) policyVersionObject.get(0);
+				String policyID = policyVersionName.replace(File.separator, "."); // This is before adding version.
+				policyVersionName += "." + policyVersion.getActiveVersion() + ".xml";
+				addPolicyToGroup(policyScope, policyID, policyVersionName.replace(File.separator, "."), pdpGroup, response);
+			}else{
+				String message = "Unknown Policy '" + policyName + "'";
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
+				response.addHeader("error", "unknownPolicy");
+				response.addHeader("operation", "push");
+				response.addHeader("message", message);
+				response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+				return;
+			}
+			//safetyChecker(policyName);
+		} catch (NullPointerException | IOException e) {
+			LOGGER.error(e);
+			response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+			response.addHeader("error", "unknown");
+			response.addHeader("operation", "push");
+			return;
+		}
+	}
+
+	/*private void safetyChecker(String policyName) {
+		if (XACMLProperties.getProperty("xacml.rest.pap.safetychecker").equals("on")) {
+			if (policyName.contains("Config_MS_") || policyName.contains("BRMS_Param")) {
+				SafetyCheckerService service = new SafetyCheckerService();
+				PolicySafetyChecker safetyChecker = new PolicySafetyChecker();
+				boolean isEntered = false;
+				try {
+					JSONObject policyDataObj = service.getConfigByPolicyName(policyName, XACMLPapServlet.getConfigHome());
+					isEntered = safetyChecker.addItem(policyDataObj);
+				} catch (Exception e) {
+					PolicyLogger.warn(MessageCodes.ERROR_PROCESS_FLOW, "XACMLPapServlet", e, "Error while adding ClosedLoop in the database: "
+							+ "This is a PolicySafetyChecker warning, the push execution may proceed normally.");
+				}
+				if (isEntered) {
+					LOGGER.info("SafetyChecker successfully added the closedLoop to the DB table.");
+				} else {
+					LOGGER.info("SafetyChecker failed to add the closedLoop to the DB table.");
+				}
+			}
+		} else {
+			LOGGER.info("PolicySafetyChecker is turned off.");
+		}
+	}*/
+
+	private void addPolicyToGroup(String policyScope, String policyID, String policyName, String pdpGroup, HttpServletResponse response) {
+		StdPDPGroup selectedPDPGroup = null;
+		StdPDPPolicy selectedPolicy = null;
+		//Get the current policies from the Group and Add the new one
+		//Set<PDPPolicy> currentPoliciesInGroup = null;
+		try {
+			selectedPDPGroup = (StdPDPGroup) XACMLPapServlet.getPAPEngine().getGroup(pdpGroup);
+		} catch (PAPException e1) {
+			PolicyLogger.error(e1);
+		}
+		if(selectedPDPGroup==null){
+			String message = "Unknown groupId '" + selectedPDPGroup + "'";
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
+			response.addHeader("error", "unknownGroupId");
+			response.addHeader("operation", "push");
+			response.addHeader("message", message);
+			response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+			return;
+		}
+		//Get PolicyEntity from DB;
+		EntityManager em = XACMLPapServlet.getEmf().createEntityManager();
+		Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.scope=:scope AND p.policyName=:policyName");			
+		createPolicyQuery.setParameter("scope", policyScope);
+		createPolicyQuery.setParameter("policyName", policyName.substring(policyScope.length()+1));
+		List<?> createPolicyQueryList = createPolicyQuery.getResultList();
+		PolicyEntity policyEntity = null;
+		if(createPolicyQueryList.size()>0){
+			policyEntity = (PolicyEntity)createPolicyQueryList.get(0);
+		}else{
+			PolicyLogger.error("Somehow, more than one policy with the same scope, name, and deleted status were found in the database");
+			String message = "Unknown Policy '" + policyName + "'";
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
+			response.addHeader("error", "unknownPolicy");
+			response.addHeader("operation", "push");
+			response.addHeader("message", message);
+			response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+			return;
+		}
+		File temp = new File(policyName);
+		try {
+			BufferedWriter bw = new BufferedWriter(new FileWriter(temp));
+			bw.write(policyEntity.getPolicyData());
+			bw.close();
+			URI selectedURI = temp.toURI();
+			// Create the policy Object
+			selectedPolicy = new StdPDPPolicy(policyName, true, policyID, selectedURI);
+		} catch (IOException e) {
+			LOGGER.error("Unable to create policy '" + policyName + "': "+ e.getMessage());
+		} 
+		try {
+			new ObjectOutputStream(response.getOutputStream()).writeObject(selectedPolicy);
+		} catch (IOException e) {
+			LOGGER.error(e);
+			response.addHeader("error", "policyCopyError");
+			response.addHeader("message", e.getMessage());
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			return;
+		}
+		response.addHeader("Content-Type","application/json");
+		response.setStatus(HttpServletResponse.SC_ACCEPTED);
+		response.addHeader("operation", "push");
+		response.addHeader("policyId", policyName);
+		return;
+		// TODO : Check point to push policies within PAP. 
+		/*PolicyDBDaoTransaction addPolicyToGroupTransaction = XACMLPapServlet.getDbDaoTransaction();
+		try{
+			if (selectedPolicy != null) {
+				// Add Current policies from container
+				currentPoliciesInGroup = selectedPDPGroup.getPolicies();
+				// copy policy to PAP
+				addPolicyToGroupTransaction.addPolicyToGroup(selectedPDPGroup.getId(), policyName,"XACMLPapServlet.pushPolicyController");
+				((StdPDPGroup) selectedPDPGroup).copyPolicyToFile(policyName, policyID, new FileInputStream(temp));
+				addPolicyToGroupTransaction.commitTransaction();
+			}
+		}catch (Exception e) {
+			addPolicyToGroupTransaction.rollbackTransaction();
+			String message = "Policy '" + policyName + "' not copied to group '" + pdpGroup +"': " + e;
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " " + message);
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.addHeader("error", "policyCopyError");
+			response.addHeader("message", message);
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			return;
+		}
+		//If the selected policy is in the group we must remove it because the name is default
+		for (PDPPolicy existingPolicy : currentPoliciesInGroup) {
+			if (existingPolicy.getId().equals(selectedPolicy.getId())) {
+				selectedPDPGroup.removePolicyFromGroup(existingPolicy);
+				LOGGER.debug("Removing existing policy: " + existingPolicy);
+				break;
+			}
+		}
+		//Update the PDP Group after removing old version of policy
+		//Set<PDPPolicy> updatedPoliciesInGroup = selectedPDPGroup.getPolicies();
+		//need to remove the policy with default name from group
+		for (PDPPolicy updatedPolicy : currentPoliciesInGroup) {
+			if (updatedPolicy.getName().equalsIgnoreCase("default")) {
+				selectedPDPGroup.removePolicyFromGroup(updatedPolicy);
+			}
+		}
+		Set<PDPPolicy> policies = selectedPDPGroup.getPolicies();
+		policies.add(selectedPolicy);
+		selectedPDPGroup.setPolicies(policies);
+		// Update now. 
+		try {
+			XACMLPapServlet.getPAPEngine().updateGroup(selectedPDPGroup);
+		} catch (PAPException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		// policy file copied ok and the Group was updated on the PDP
+		response.setStatus(HttpServletResponse.SC_NO_CONTENT);
+		response.addHeader("operation", "push");
+		response.addHeader("policyId", policyName);
+		response.addHeader("groupId", pdpGroup);
+		return;*/
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
index 5ee72f4..1f84ae0 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/SafePolicyController.java
@@ -28,15 +28,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
-import org.openecomp.policy.rest.dao.CategoryDao;
-import org.openecomp.policy.rest.dao.RiskTypeDao;
-import org.openecomp.policy.rest.dao.SafePolicyWarningDao;
-import org.openecomp.policy.rest.dao.UserInfoDao;
-import org.openecomp.policy.rest.jpa.Category;
+import org.openecomp.policy.rest.dao.CommonClassDao;
 import org.openecomp.policy.rest.jpa.RiskType;
 import org.openecomp.policy.rest.jpa.SafePolicyWarning;
 import org.openecomp.policy.rest.jpa.UserInfo;
@@ -53,45 +49,31 @@
 @Controller
 public class SafePolicyController {
 
-	private static final Log logger = LogFactory.getLog(SafePolicyController.class);
-
-	@Autowired
-	SafePolicyWarningDao safePolicyWarningDao;
-
-	@Autowired
-	RiskTypeDao riskTypeDao;
-
-	@Autowired
-	UserInfoDao userInfoDao;
-
-	@Autowired
-	CategoryDao categoryDao;
+	private static final Logger LOGGER  = FlexLogger.getLogger(SafePolicyController.class);
 	
-
-	public Category getCategory() {
-		for (int i = 0; i < categoryDao.getCategoryListData().size(); i++) {
-			Category value = categoryDao.getCategoryListData().get(i);
-			if (value.getShortName().equals("resource")) {
-				return value;
-			}
-		}
-		return null;
+	private static CommonClassDao commonClassDao;
+	
+	@Autowired
+	public SafePolicyController(CommonClassDao commonClassDao){
+		SafePolicyController.commonClassDao = commonClassDao;
 	}
-
-	public UserInfo getUserInfo(String loginId) {
-		UserInfo name = userInfoDao.getUserInfoByLoginId(loginId);
-		return name;
+	
+	public SafePolicyController(){}	
+	
+	public UserInfo getUserInfo(String loginId){
+		UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
+		return name;	
 	}
+	
+	private static String DUPLICATE = "Duplicate";
 
-	// EcompName Dictionary
 	@RequestMapping(value = { "/get_RiskTypeDataByName" }, method = {
 			org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
 	public void getRiskTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response) {
-		logger.info("get_RiskTypeDataByName is called");
 		try {
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(riskTypeDao.getRiskTypeDataByName()));
+			model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(RiskType.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -103,68 +85,108 @@
 	@RequestMapping(value = { "/get_RiskTypeData" }, method = {
 			org.springframework.web.bind.annotation.RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
 	public void getEcompNameDictionaryEntityData(HttpServletRequest request, HttpServletResponse response) {
-		logger.info("get_RiskTypeData is called");
 		try {
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
-			model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(riskTypeDao.getRiskName()));
+			model.put("riskTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(RiskType.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		} catch (Exception e) {
-			e.printStackTrace();
-			logger.error("ERROR While callinge DAO: " + e.getMessage());
+            LOGGER.error(e.getMessage());
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
 		}
 	}
 
-	@RequestMapping(value = { "/sp_dictionary/save_riskType.htm" }, method = {
+	@RequestMapping(value = { "/sp_dictionary/save_riskType" }, method = {
 			org.springframework.web.bind.annotation.RequestMethod.POST })
 	public ModelAndView saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response)
 			throws Exception {
 		try {
 			boolean duplicateflag = false;
-			System.out.println("SafePolicyController:  saveRiskTypeDictionary() is called");
-			logger.debug("SafePolicyController:  saveRiskTypeDictionary() is called");
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			RiskType riskTypeData = (RiskType) mapper.readValue(root.get("riskTypeDictionaryData").toString(),
-					RiskType.class);
-			String userId = root.get("loginId").textValue();
-			System.out.println("the userId from the ecomp portal is: " + userId);
+            RiskType riskTypeData;
+            String userId = null;
+            if (fromAPI) {
+                riskTypeData = (RiskType) mapper.readValue(root.get("dictionaryFields").toString(),
+                        RiskType.class);
+                userId = "API";
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if ("update".equalsIgnoreCase(request.getParameter("operation"))){
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(riskTypeData.getRiskName(), "name", RiskType.class);
+                    int id = 0;
+                    RiskType data = (RiskType) duplicateData.get(0);
+                    id = data.getId();
+                    
+                    if(id==0){
+                        isFakeUpdate=true;
+                        riskTypeData.setId(1);
+                    } else {
+                        riskTypeData.setId(id);
+                    }
+                    
+                    riskTypeData.setUserCreatedBy(this.getUserInfo(userId));
+                }
+            } else {
+            	riskTypeData = (RiskType) mapper.readValue(root.get("riskTypeDictionaryData").toString(), RiskType.class);
+            	userId = root.get("userid").textValue();
+            }
+			 
 			if (riskTypeData.getId() == 0) {
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(riskTypeData.getRiskName(), "name", RiskType.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(riskTypeData.getRiskName(), "name", RiskType.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
 					riskTypeData.setUserCreatedBy(getUserInfo(userId));
 					riskTypeData.setUserModifiedBy(getUserInfo(userId));
-					System.out.println(
-							"SafePolicyController:  got the user info now about to call Save() method on riskTypedao");
-					riskTypeDao.Save(riskTypeData);
+					commonClassDao.save(riskTypeData);
 				}
 			} else {
-				riskTypeData.setUserModifiedBy(this.getUserInfo(userId));
-				riskTypeDao.update(riskTypeData);
+				if (!isFakeUpdate) {
+					riskTypeData.setUserModifiedBy(this.getUserInfo(userId));
+					commonClassDao.update(riskTypeData);
+				}
 			}
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.riskTypeDao.getRiskName());
-			}
-			JSONObject j = new JSONObject("{riskTypeDictionaryDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		} catch (Exception e) {
+            String responseString = "";
+            if(duplicateflag){
+                responseString = DUPLICATE;
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(RiskType.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals(DUPLICATE)) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{riskTypeDictionaryDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+        }catch (Exception e) {
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -173,7 +195,7 @@
 		return null;
 	}
 
-	@RequestMapping(value = { "/sp_dictionary/remove_riskType.htm" }, method = {
+	@RequestMapping(value = { "/sp_dictionary/remove_riskType" }, method = {
 			org.springframework.web.bind.annotation.RequestMethod.POST })
 	public ModelAndView removeEcompDictionary(HttpServletRequest request, HttpServletResponse response)
 			throws Exception {
@@ -182,20 +204,19 @@
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
 			RiskType ecompData = (RiskType) mapper.readValue(root.get("data").toString(), RiskType.class);
-			riskTypeDao.delete(ecompData);
+			commonClassDao.delete(ecompData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.riskTypeDao.getRiskName());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(RiskType.class));
 			JSONObject j = new JSONObject("{riskTypeDictionaryDatas: " + responseString + "}");
 			out.write(j.toString());
 
 			return null;
 		} catch (Exception e) {
-			System.out.println(e);
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -211,7 +232,7 @@
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
 			model.put("safePolicyWarningDatas",
-					mapper.writeValueAsString(safePolicyWarningDao.getSafePolicyWarningDataByName()));
+					mapper.writeValueAsString(commonClassDao.getDataByColumn(SafePolicyWarning.class, "name")));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
 			response.getWriter().write(j.toString());
@@ -227,55 +248,98 @@
 			Map<String, Object> model = new HashMap<String, Object>();
 			ObjectMapper mapper = new ObjectMapper();
 			model.put("safePolicyWarningDatas",
-					mapper.writeValueAsString(safePolicyWarningDao.getSafePolicyWarningData()));
+					mapper.writeValueAsString(commonClassDao.getData(SafePolicyWarning.class)));
 			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 			JSONObject j = new JSONObject(msg);
+            response.addHeader("successMapKey", "success"); 
+            response.addHeader("operation", "getDictionary");
 			response.getWriter().write(j.toString());
 		} catch (Exception e) {
-			e.printStackTrace();
+            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+            response.addHeader("error", "dictionaryDBQuery");
+            LOGGER.error(e.getMessage());
 		}
 	}
 
-	@RequestMapping(value = { "/sp_dictionary/save_safePolicyWarning.htm" }, method = {
+	@RequestMapping(value = { "/sp_dictionary/save_safePolicyWarning" }, method = {
 			org.springframework.web.bind.annotation.RequestMethod.POST })
 	public ModelAndView saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response)
 			throws Exception {
 		try {
 			boolean duplicateflag = false;
+            boolean isFakeUpdate = false;
+            boolean fromAPI = false;
+            if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
+                fromAPI = true;
+            }
 			ObjectMapper mapper = new ObjectMapper();
 			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 			JsonNode root = mapper.readTree(request.getReader());
-			SafePolicyWarning safePolicyWarning = (SafePolicyWarning) mapper
-					.readValue(root.get("safePolicyWarningData").toString(), SafePolicyWarning.class);
+			SafePolicyWarning safePolicyWarning;
+            if (fromAPI) {
+                safePolicyWarning = (SafePolicyWarning) mapper
+                        .readValue(root.get("dictionaryFields").toString(), SafePolicyWarning.class);
+                
+                //check if update operation or create, get id for data to be updated and update attributeData
+                if (request.getParameter("operation").equals("update")) {
+                    List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(safePolicyWarning.getName(), "name", SafePolicyWarning.class);
+                    int id = 0;
+                    SafePolicyWarning data = (SafePolicyWarning) duplicateData.get(0);
+                    id = data.getId();
+                    
+                    if(id==0){
+                        isFakeUpdate=true;
+                        safePolicyWarning.setId(1);
+                    } else {
+                        safePolicyWarning.setId(id);
+                    } 
+                }
+            } else {
+            	safePolicyWarning = (SafePolicyWarning) mapper.readValue(root.get("safePolicyWarningData").toString(), SafePolicyWarning.class);
+            }
 
 			if (safePolicyWarning.getId() == 0) {
-				CheckDictionaryDuplicateEntries entry = new CheckDictionaryDuplicateEntries();
-				List<Object> duplicateData =  entry.CheckDuplicateEntry(safePolicyWarning.getName(), "name", SafePolicyWarning.class);
+				List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(safePolicyWarning.getName(), "name", SafePolicyWarning.class);
 				if(!duplicateData.isEmpty()){
 					duplicateflag = true;
 				}else{
-					safePolicyWarningDao.Save(safePolicyWarning);
+					commonClassDao.save(safePolicyWarning);
 				}
 			} else {
-				safePolicyWarningDao.update(safePolicyWarning);
+				if(!isFakeUpdate) {
+					commonClassDao.update(safePolicyWarning);
+				}
 			}
-			response.setCharacterEncoding("UTF-8");
-			response.setContentType("application / json");
-			request.setCharacterEncoding("UTF-8");
-
-			PrintWriter out = response.getWriter();
-			String responseString = "";
-			if(duplicateflag){
-				responseString = "Duplicate";
-			}else{
-				responseString = mapper.writeValueAsString(this.safePolicyWarningDao.getSafePolicyWarningData());
-			}
-			JSONObject j = new JSONObject("{safePolicyWarningDatas: " + responseString + "}");
-
-			out.write(j.toString());
-
-			return null;
-		} catch (Exception e) {
+            String responseString = "";
+            if(duplicateflag){
+                responseString = DUPLICATE;
+            }else{
+                responseString = mapper.writeValueAsString(commonClassDao.getData(SafePolicyWarning.class));
+            }
+            
+            if (fromAPI) {
+                if (responseString!=null && !responseString.equals(DUPLICATE)) {
+                    if(isFakeUpdate){
+                        responseString = "Exists";
+                    } else {
+                        responseString = "Success";
+                    }
+                }
+                ModelAndView result = new ModelAndView();
+                result.setViewName(responseString);
+                return result;
+            } else {
+                response.setCharacterEncoding("UTF-8");
+                response.setContentType("application / json");
+                request.setCharacterEncoding("UTF-8");
+ 
+                PrintWriter out = response.getWriter();
+                JSONObject j = new JSONObject("{safePolicyWarningDatas: " + responseString + "}");
+                out.write(j.toString());
+                return null;
+            }
+ 
+        }catch (Exception e) {
 			response.setCharacterEncoding("UTF-8");
 			request.setCharacterEncoding("UTF-8");
 			PrintWriter out = response.getWriter();
@@ -284,7 +348,7 @@
 		return null;
 	}
 
-	@RequestMapping(value = { "/sp_dictionary/remove_SafePolicyWarning.htm" }, method = {
+	@RequestMapping(value = { "/sp_dictionary/remove_SafePolicyWarning" }, method = {
 			org.springframework.web.bind.annotation.RequestMethod.POST })
 	public ModelAndView removeSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response)
 			throws Exception {
@@ -294,14 +358,14 @@
 			JsonNode root = mapper.readTree(request.getReader());
 			SafePolicyWarning safePolicyWarningData = (SafePolicyWarning) mapper.readValue(root.get("data").toString(),
 					SafePolicyWarning.class);
-			safePolicyWarningDao.delete(safePolicyWarningData);
+			commonClassDao.delete(safePolicyWarningData);
 			response.setCharacterEncoding("UTF-8");
 			response.setContentType("application / json");
 			request.setCharacterEncoding("UTF-8");
 
 			PrintWriter out = response.getWriter();
 
-			String responseString = mapper.writeValueAsString(this.safePolicyWarningDao.getSafePolicyWarningData());
+			String responseString = mapper.writeValueAsString(commonClassDao.getData(SafePolicyWarning.class));
 			JSONObject j = new JSONObject("{groupPolicyScopeListDatas: " + responseString + "}");
 			out.write(j.toString());
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/package-info.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/package-info.java
index df0e40a..049f3c7 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/package-info.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/controller/package-info.java
@@ -18,10 +18,5 @@
  * ============LICENSE_END=========================================================
  */
 
-/**
- * 
- */
-/**
- *
- */
+
 package org.openecomp.policy.pap.xacml.rest.controller;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionListDaoImpl.java
deleted file mode 100644
index ba6c2c4..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionListDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ActionListDao;
-import org.openecomp.policy.rest.jpa.ActionList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("ActionListDao")
-public class ActionListDaoImpl implements ActionListDao{
-
-	private static final Log logger = LogFactory.getLog(ActionListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<ActionList> getActionListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<ActionList> actionListData = null;
-		try {
-			Criteria cr = session.createCriteria(ActionList.class);
-			actionListData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ActionList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return actionListData;
-
-	}
-
-	@Override
-	public void Save(ActionList actionList) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(actionList);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving ActionList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(ActionList actionList) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(actionList);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting ActionList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(ActionList actionList) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(actionList);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ActionList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getActionListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-		try {
-			Criteria cr = session.createCriteria(ActionList.class);
-			List<ActionList> actionListData = cr.list();
-			for(int i = 0; i < actionListData.size(); i++){
-				data.add(actionListData.get(i).getActionName());
-			}
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ActionList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionPolicyDictDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionPolicyDictDaoImpl.java
deleted file mode 100644
index 50d41fd..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionPolicyDictDaoImpl.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ActionPolicyDictDao;
-import org.openecomp.policy.rest.jpa.ActionPolicyDict;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-
-@Service("ActionPolicyDictDao")
-public class ActionPolicyDictDaoImpl implements ActionPolicyDictDao {
-	private static final Log logger = LogFactory.getLog(ActionPolicyDictDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<ActionPolicyDict> getActionDictData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		
-        List<ActionPolicyDict> actionDictData = null;
-        try {
-        	Criteria cr = session.createCriteria(ActionPolicyDict.class);
-        	actionDictData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ActionDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return actionDictData;
-	}
-
-	@Override
-	public void Save(ActionPolicyDict action) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(action);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving ActionDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void delete(ActionPolicyDict action) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(action);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting ActionDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(ActionPolicyDict action) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(action);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ActionDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getActionDictDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-		try {
-			Criteria cr = session.createCriteria(ActionPolicyDict.class);
-			List<ActionPolicyDict> attributeData = cr.list();  
-			for(int i = 0; i < attributeData.size(); i++){
-				data.add(attributeData.get(i).getAttributeName());
-			}	
-			tx.commit();			
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ActionDictionary Table"+e);			
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public ActionPolicyDict getActionEntityDatabyId(String action) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		ActionPolicyDict data = null;
-		try {
-			Criteria cr = session.createCriteria(ActionPolicyDict.class);	
-			List<ActionPolicyDict> attributeData = cr.add(Restrictions.eq("attributeName", action)).list();
-			for(Object entity : attributeData){
-				data = (ActionPolicyDict) entity;
-			}		
-			tx.commit();			
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ActionDictionary Table"+e);		
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AddressGroupDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AddressGroupDaoImpl.java
deleted file mode 100644
index 951a38a..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AddressGroupDaoImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.AddressGroupDao;
-import org.openecomp.policy.rest.jpa.AddressGroup;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("AddressGroupDao")
-public class AddressGroupDaoImpl implements AddressGroupDao{
-	private static final Log logger = LogFactory.getLog(AddressGroupDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<AddressGroup> getAddressGroupData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<AddressGroup> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(AddressGroup.class);
-			attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying AddressGroup Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(AddressGroup attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving AddressGroup Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(AddressGroup attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting AddressGroup Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(AddressGroup attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating AddressGroup Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getAddressGroupDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();   
-        try {
-        	Criteria cr = session.createCriteria(AddressGroup.class);
-        	 List<AddressGroup> attributeData = cr.list();
-        	 for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getGroupName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying AddressGroup Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AttributeDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AttributeDaoImpl.java
deleted file mode 100644
index 7eb51d3..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AttributeDaoImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.AttributeDao;
-import org.openecomp.policy.rest.jpa.Attribute;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("AttributeDao")
-public class AttributeDaoImpl implements AttributeDao {
-	private static final Log logger = LogFactory.getLog(AttributeDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<Attribute> getData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<Attribute> attributeData = null;
-		try {
-			Criteria cr = session.createCriteria(Attribute.class);
-			attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(Attribute attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(Attribute attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(Attribute attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getAttributeData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-		try {
-			Criteria cr = session.createCriteria(Attribute.class);
-			List<Attribute> attributeData = cr.list();
-			for(int i = 0; i < attributeData.size(); i++){
-				data.add(attributeData.get(i).getXacmlId());
-			}
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/BRMSParamTemplateDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/BRMSParamTemplateDaoImpl.java
deleted file mode 100644
index 4f8478d..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/BRMSParamTemplateDaoImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.BRMSParamTemplateDao;
-import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("BRMSParamTemplateDao")
-public class BRMSParamTemplateDaoImpl implements BRMSParamTemplateDao{
-	private static final Log logger = LogFactory.getLog(BRMSParamTemplateDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<BRMSParamTemplate> getBRMSParamTemplateData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-        List<BRMSParamTemplate> attributeData =null;
-        try {
-			Criteria cr = session.createCriteria(BRMSParamTemplate.class);
-			attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying BRMSParamTemplate Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(BRMSParamTemplate attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving BRMSParamTemplate Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(BRMSParamTemplate attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting BRMSParamTemplate Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(BRMSParamTemplate attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating BRMSParamTemplate Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getBRMSParamDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();     
-		List<String> data = new ArrayList<String>();  
-		try {
-			Criteria cr = session.createCriteria(BRMSParamTemplate.class);
-			List<BRMSParamTemplate> attributeData = cr.list();
-			for(int i = 0; i < attributeData.size(); i++){
-				data.add(attributeData.get(i).getRuleName());
-			}
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying BRMSParamTemplate Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CategoryDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CategoryDaoImpl.java
deleted file mode 100644
index f3fcbf1..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CategoryDaoImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.CategoryDao;
-import org.openecomp.policy.rest.jpa.Category;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("CategoryDao")
-public class CategoryDaoImpl implements CategoryDao {
-	private static final Log logger = LogFactory.getLog(CategoryDaoImpl.class);
-
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<Category> getCategoryListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();		
-		List<Category> categoryListData = null;
-		try {
-			Criteria cr = session.createCriteria(Category.class);
-			categoryListData = cr.list();	
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Category Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return categoryListData;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
new file mode 100644
index 0000000..256d75f
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
@@ -0,0 +1,432 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.policy.pap.xacml.rest.daoimpl;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.criterion.Conjunction;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Disjunction;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.openecomp.policy.pap.xacml.rest.HibernateSession;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.ClosedLoops;
+import org.openecomp.policy.rest.jpa.GroupPolicyScopeList;
+import org.openecomp.policy.rest.jpa.PolicyRoles;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.springframework.stereotype.Service;
+
+@Service("CommonClassDao")
+public class CommonClassDaoImpl implements CommonClassDao{
+
+	private static final Log LOGGER = LogFactory.getLog(CommonClassDaoImpl.class);
+	
+
+	
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Override
+	public List<Object> getData(Class className) {
+		Session session = HibernateSession.getSessionFactory();
+		List<Object> data = null;
+		try{
+			Criteria cr = session.createCriteria(className);
+			data = cr.list();
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e);
+			}
+		}
+		return data;
+	}
+
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Override
+	public List<Object> getDataById(Class className, String columnName, String key) {
+		Session session = HibernateSession.getSessionFactory();
+		List<Object> data = null;
+		try {
+			Criteria cr = session.createCriteria(className);
+			if(columnName.contains(":") && key.contains(":")){
+				String[] columns = columnName.split(":");
+				String[] keys = key.split(":");
+				for(int i=0; i < columns.length; i++){
+					cr.add(Restrictions.eq(columns[i], keys[i]));
+				}
+			}else{
+				cr.add(Restrictions.eq(columnName, key));	
+			}
+			data = cr.list();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Table"+e);		
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		return data;
+	}
+	
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Override
+	public List<String> getDataByColumn(Class className, String columnName) {
+		Session session = HibernateSession.getSessionFactory();
+		List<String> data = null;
+		try{
+			Criteria cr = session.createCriteria(className);
+			cr.setProjection(Projections.property(columnName));
+			data = cr.list();
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e);
+			}
+		}
+		return data;
+	}
+	
+	@Override
+	public void save(Object entity) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		try {
+			session.persist(entity);
+			tx.commit();	
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving  data to Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		
+	}
+
+	@Override
+	public void delete(Object entity) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		try {
+			session.delete(entity);
+			tx.commit();	
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting data from Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		
+	}
+
+
+	@Override
+	public void update(Object entity) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		try {
+			session.update(entity);
+			tx.commit();	
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating data to Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		
+	}
+
+
+	@SuppressWarnings({ "unchecked", "rawtypes" })
+	@Override
+	public List<Object> checkDuplicateEntry(String value, String columnName, Class className) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		List<Object> data = null;
+		
+		String[] columnNames = null;
+		if(columnName != null && columnName.contains(":")){
+			columnNames = columnName.split(":");
+		}
+		String[] values = null;
+		if(value != null && value.contains(":")){
+			values = value.split(":");
+		}		
+		try {
+			Criteria cr = session.createCriteria(className);
+			if(columnNames != null && values != null && columnNames.length == values.length){
+				for (int i = 0; i < columnNames.length; i++){
+					cr.add(Restrictions.eq(columnNames[i],values[i]));
+				}
+			}else{
+				cr.add(Restrictions.eq(columnName,value));
+			}
+
+			data = cr.list();
+			tx.commit();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying for Duplicate Entries for Table"+e + className);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		return data;
+	}
+
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public List<Object> getDataByQuery(String query) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		List<Object> data = null;
+		try {
+			Query hbquery = session.createQuery(query);
+			data = hbquery.list();
+			tx.commit();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Database Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		return data;
+	}
+
+
+	@Override
+	public void updateQuery(String query) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();	
+		try {
+			Query hbquery = session.createQuery(query);
+			hbquery.executeUpdate();
+			tx.commit();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Database Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+	}
+
+
+	@SuppressWarnings("rawtypes")
+	@Override
+	public Object getEntityItem(Class className, String columnName, String key) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		Object data = null;
+		try {
+			Criteria cr = session.createCriteria(className);
+			if(columnName.contains(":") && key.contains(":")){
+				String[] columns = columnName.split(":");
+				String[] keys = key.split(":");
+				for(int i=0; i < columns.length; i++){
+					cr.add(Restrictions.eq(columns[i], keys[i]));
+				}
+			}else{
+				cr.add(Restrictions.eq(columnName, key));	
+			}
+			data = cr.list().get(0);
+			tx.commit();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Database Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		return data;
+	}
+
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public List<PolicyRoles> getUserRoles() {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		List<PolicyRoles> rolesData = null;
+		try {
+			Criteria cr = session.createCriteria(PolicyRoles.class);		
+			Disjunction disjunction = Restrictions.disjunction(); 
+			Conjunction conjunction1  = Restrictions.conjunction();
+			conjunction1.add(Restrictions.eq("role", "admin"));
+			Conjunction conjunction2  = Restrictions.conjunction();
+			conjunction2.add(Restrictions.eq("role", "editor"));	
+			Conjunction conjunction3  = Restrictions.conjunction();
+			conjunction3.add(Restrictions.eq("role", "guest"));	
+			disjunction.add(conjunction1);
+			disjunction.add(conjunction2);
+			disjunction.add(conjunction3);
+			rolesData = cr.add(disjunction).list();
+			tx.commit();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyRoles Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		return rolesData;
+	}
+
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public void updateClAlarms(String clName, String alarms) {
+		Session session = HibernateSession.getSessionFactory();
+		List<ClosedLoops> closedloopsdata = null;
+		Transaction tx = session.beginTransaction();
+		try {
+        	Criteria cr = session.createCriteria(ClosedLoops.class);
+        	cr.add(Restrictions.eq("closedLoopControlName",clName));
+            closedloopsdata = cr.list();
+			ClosedLoops closedloop = closedloopsdata.get(0);
+			closedloop.setAlarmConditions(alarms);
+			session.update(closedloop);
+			tx.commit();	
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ClosedLoops Table"+e);	
+		}finally{
+			session.close();
+		}
+	}
+
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public void updateClYaml(String clName, String yaml) {
+		Session session = HibernateSession.getSessionFactory();
+        List<ClosedLoops> closedloopsdata = null;
+		Transaction tx = session.beginTransaction();
+		try {
+        	Criteria cr = session.createCriteria(ClosedLoops.class);
+        	cr.add(Restrictions.eq("closedLoopControlName",clName));
+            closedloopsdata = cr.list();
+			ClosedLoops closedloop = closedloopsdata.get(0);
+			closedloop.setYaml(yaml);
+			session.update(closedloop);
+			tx.commit();	
+		}catch(Exception e){
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ClosedLoops Table"+e);	
+		}finally{
+			session.close();
+		}
+	}
+
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public void deleteAll() {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		List<ClosedLoops> closedloopsdata = null;
+		try {
+			Criteria cr = session.createCriteria(ClosedLoops.class);
+			closedloopsdata = cr.list();
+
+			if(closedloopsdata!=null && !closedloopsdata.isEmpty()) {
+				LOGGER.info("ClosedLoops exist in the database, we need to delete them in our first step to buildCache().");
+				for(int i=0; i > closedloopsdata.size(); i++) {
+					ClosedLoops cl = closedloopsdata.get(i);
+					session.delete(cl);
+				}
+			} else {
+				LOGGER.info("No ClosedLoops exist in the database, no need to delete.");
+			}
+
+			tx.commit();
+		}catch(Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while deleting ClosedLoops from the table"+e);
+		}finally{
+			session.close();
+		}
+	}
+
+	@SuppressWarnings({ "unchecked"})
+	@Override
+	public List<Object> checkExistingGroupListforUpdate(String groupListValue, String groupNameValue) {
+		Session session = HibernateSession.getSessionFactory();
+		Transaction tx = session.beginTransaction();
+		List<Object> data = null;
+		try {
+			Criteria cr = session.createCriteria(GroupPolicyScopeList.class);
+			cr.add(Restrictions.eq("groupList",groupListValue));	
+			Criterion expression = Restrictions.eq("name", groupNameValue);
+			cr.add(Restrictions.not(expression));
+			data = cr.list();
+			tx.commit();
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying for Duplicate Entries for GroupPolicyScopeList Table"+e);	
+		}finally{
+			try{
+				session.close();
+			}catch(Exception e1){
+				LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+			}
+		}
+		return data;
+	}
+
+
+	@Override
+	public List<Object> getMultipleDataOnAddingConjunction(@SuppressWarnings("rawtypes") Class className, String columnName, List<String> data) {
+		return null;
+	}
+
+}
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DCAEUUIDDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DCAEUUIDDaoImpl.java
deleted file mode 100644
index ddd4606..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DCAEUUIDDaoImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.DCAEUUIDDao;
-import org.openecomp.policy.rest.jpa.DCAEuuid;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("DCAEUUIDDao")
-public class DCAEUUIDDaoImpl implements DCAEUUIDDao{
-	private static final Log logger = LogFactory.getLog(DCAEUUIDDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<DCAEuuid> getDCAEuuidData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<DCAEuuid> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(DCAEuuid.class);
-			attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DCAEUUID Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(DCAEuuid attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving DCAEUUID Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(DCAEuuid attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting DCAEUUID Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(DCAEuuid attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating DCAEUUID Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getDCAEuuidDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();  
-        List<String> data = new ArrayList<String>(); 
-        try {
-        	Criteria cr = session.createCriteria(DCAEuuid.class);
-        	 List<DCAEuuid> attributeData = cr.list();
-        	 for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DCAEUUID Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DecisionPolicyDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DecisionPolicyDaoImpl.java
deleted file mode 100644
index 9762e1d..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DecisionPolicyDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.DecisionPolicyDao;
-import org.openecomp.policy.rest.jpa.DecisionSettings;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("DecisionSettingsDao")
-public class DecisionPolicyDaoImpl implements DecisionPolicyDao{
-	private static final Log logger = LogFactory.getLog(DecisionPolicyDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<DecisionSettings> getDecisionSettingsData() {
-			Session session = HibernateSession.getSessionFactory();
-			Transaction tx = session.beginTransaction();	
-	        List<DecisionSettings> decisionSettingsData = null;
-	        try {
-	        	Criteria cr = session.createCriteria(DecisionSettings.class);
-	        	decisionSettingsData = cr.list();
-				tx.commit();
-			} catch (Exception e) {
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DecisionSettings Table"+e);	
-			}finally{
-				try{
-					session.close();
-				}catch(Exception e1){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-				}
-			}
-			return decisionSettingsData;
-			
-		}
-
-		@Override
-		public void Save(DecisionSettings decisionSettings) {
-			Session session = HibernateSession.getSessionFactory();
-			Transaction tx = session.beginTransaction();
-			try {
-				session.persist(decisionSettings);
-				tx.commit();	
-			}catch(Exception e){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving DecisionSettings Table"+e);	
-			}finally{
-				try{
-					session.close();
-				}catch(Exception e1){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-				}
-			}
-			
-		}
-
-		@Override
-		public void delete(DecisionSettings decisionSettings) {
-			Session session = HibernateSession.getSessionFactory();
-			Transaction tx = session.beginTransaction();
-			try {
-				session.delete(decisionSettings);
-				tx.commit();	
-			}catch(Exception e){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting DecisionSettings Table"+e);	
-			}finally{
-				try{
-					session.close();
-				}catch(Exception e1){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-				}
-			}
-		}
-
-		@Override
-		public void update(DecisionSettings decisionSettings) {
-			Session session = HibernateSession.getSessionFactory();
-			Transaction tx = session.beginTransaction();
-			try {
-				session.update(decisionSettings);
-				tx.commit();	
-			}catch(Exception e){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating DecisionSettings Table"+e);	
-			}finally{
-				try{
-					session.close();
-				}catch(Exception e1){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-				}
-			}
-		}
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public List<String> getDecisionDataByName() {
-			Session session = HibernateSession.getSessionFactory();
-			Transaction tx = session.beginTransaction();		
-			List<String> data = new ArrayList<String>();
-			try {
-				Criteria cr = session.createCriteria(DecisionSettings.class);
-				List<DecisionSettings> decisionSettingsData = cr.list();
-				for(int i = 0; i < decisionSettingsData.size(); i++){
-					data.add(decisionSettingsData.get(i).getXacmlId());
-				}
-				tx.commit();
-			} catch (Exception e) {
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DecisionSettings Table"+e);	
-			}finally{
-				try{
-					session.close();
-				}catch(Exception e1){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-				}
-			}
-			return data;
-		}
-
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DescriptiveScopeDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DescriptiveScopeDaoImpl.java
deleted file mode 100644
index 8d28685..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DescriptiveScopeDaoImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.DescriptiveScopeDao;
-import org.openecomp.policy.rest.jpa.DescriptiveScope;
-import org.openecomp.policy.rest.jpa.PolicyVersion;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("DescriptiveScopeDao")
-public class DescriptiveScopeDaoImpl implements DescriptiveScopeDao{
-	private static final Log logger = LogFactory.getLog(DescriptiveScopeDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<DescriptiveScope> getDescriptiveScope() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-        List<DescriptiveScope> descriptiveScopeData = null;
-        try {
-        	Criteria cr = session.createCriteria(DescriptiveScope.class);
-        	descriptiveScopeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DescriptiveScope Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return descriptiveScopeData;
-	}
-
-	@Override
-	public void Save(DescriptiveScope descriptiveScope) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(descriptiveScope);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving DescriptiveScope Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(DescriptiveScope descriptiveScope) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(descriptiveScope);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting DescriptiveScope Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(DescriptiveScope descriptiveScope) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(descriptiveScope);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating DescriptiveScope Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getDescriptiveScopeDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<String> data = new ArrayList<String>();  
-    	try {
-    		Criteria cr = session.createCriteria(DescriptiveScope.class);
-            List<DescriptiveScope> descriptiveScopeData = cr.list();
-            for(int i = 0; i < descriptiveScopeData.size(); i++){
-           	 data.add(descriptiveScopeData.get(i).getScopeName());
-           }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DescriptiveScope Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public DescriptiveScope getDescriptiveScopeById(String name) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		DescriptiveScope data = null;
-		try {
-			Criteria cr = session.createCriteria(DescriptiveScope.class);
-			cr.add(Restrictions.eq("scopename",name));
-			data = (DescriptiveScope) cr.list().get(0);
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying DescriptiveScope Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EcompNameDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EcompNameDaoImpl.java
deleted file mode 100644
index 9bafc3a..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EcompNameDaoImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.EcompNameDao;
-import org.openecomp.policy.rest.jpa.EcompName;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("EcompNameDao")
-public class EcompNameDaoImpl implements EcompNameDao {
-	private static final Log logger = LogFactory.getLog(EcompNameDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<EcompName> getEcompName() {
-		System.out.println("EcompNameDaoImpl:  getEcompName() is called");
-		logger.debug("EcompNameDaoImpl:  getEcompName() is called");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<EcompName> ecompNameData = null;
-        try {
-        	Criteria cr = session.createCriteria(EcompName.class);
-			ecompNameData = cr.list();
-			System.out.println("Data returned from ecompname table"+ecompNameData.toString());
-			logger.debug("Data returned from ecompname table:  " + ecompNameData.toString());
-			tx.commit();
-		} catch (Exception e) {
-			System.out.println("Exception Occured while Querying ecompname"+e);
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying EcompName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return ecompNameData;
-	}
-
-	@Override
-	public void Save(EcompName ecompName) {
-		System.out.println("EcompNameDaoImpl:  Save() is called");
-		logger.debug("EcompNameDaoImpl:  Save() is called");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(ecompName);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving EcompName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(EcompName ecompName) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(ecompName);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting EcompName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(EcompName ecompName) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(ecompName);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating EcompName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getEcompNameDataByName() {
-		logger.info("getEcompNameDataByName is call from the DAO implementation class.");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<String> data = new ArrayList<String>();    
-        try {
-        	Criteria cr = session.createCriteria(EcompName.class);
-            List<EcompName> ecompNameData = cr.list();
-            for(int i = 0; i < ecompNameData.size(); i++){
-           	 data.add(ecompNameData.get(i).getEcompName());
-           }
-            logger.info("data retrieved: " + data.toString());
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying EcompName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EnforcerPolicyDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EnforcerPolicyDaoImpl.java
deleted file mode 100644
index ba621ab..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EnforcerPolicyDaoImpl.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.EnforcerPolicyDao;
-import org.openecomp.policy.rest.jpa.EnforcingType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("EnforcerPolicyDao")
-public class EnforcerPolicyDaoImpl implements EnforcerPolicyDao {
-	private static final Log logger = LogFactory.getLog(EnforcerPolicyDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<EnforcingType> getEnforcingTypeData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<EnforcingType> enforcingTypeData = null;
-        try {
-        	Criteria cr = session.createCriteria(EnforcingType.class);
-            enforcingTypeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying EnforcingType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return enforcingTypeData;
-		
-	}
-
-	@Override
-	public void Save(EnforcingType enforcingType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(enforcingType);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving EnforcingType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(EnforcingType enforcingType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(enforcingType);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting EnforcingType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(EnforcingType enforcingType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(enforcingType);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating EnforcingType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/FirewallDictionaryListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/FirewallDictionaryListDaoImpl.java
deleted file mode 100644
index b19a58b..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/FirewallDictionaryListDaoImpl.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Criteria;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.FirewallDictionaryListDao;
-import org.openecomp.policy.rest.jpa.FirewallDictionaryList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-@Service("FirewallDictionaryListDao")
-public class FirewallDictionaryListDaoImpl implements FirewallDictionaryListDao {
-	private static final Log logger = LogFactory.getLog(FirewallDictionaryListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@Override
-	public List<FirewallDictionaryList> getFWDictionaryListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<FirewallDictionaryList> attributeData =  null;
-        try {
-        	Criteria cr = session.createCriteria(FirewallDictionaryList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-
-	}
-
-	@Override
-	public List<String> getFWDictionaryListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(FirewallDictionaryList.class);
-            List<FirewallDictionaryList> attributeData = cr.list();    
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getParentItemName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(FirewallDictionaryList firewallDictionaryList) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(firewallDictionaryList);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(FirewallDictionaryList firewallDictionaryList) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(firewallDictionaryList);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(FirewallDictionaryList firewallDictionaryList) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(firewallDictionaryList);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void updateQuery(String query) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-		try {
-			Query hbquery = session.createQuery(query);
-			hbquery.executeUpdate();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public FirewallDictionaryList getFWDictionaryDataById(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		FirewallDictionaryList data = null;
-        try {
-        	Criteria cr = session.createCriteria(FirewallDictionaryList.class);
-        	cr = cr.add(Restrictions.eq("parentItemName",value));
-        	data = (FirewallDictionaryList) cr.list().get(0);
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying FirewallDictionaryList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/GroupPolicyScopeListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/GroupPolicyScopeListDaoImpl.java
deleted file mode 100644
index edc147f..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/GroupPolicyScopeListDaoImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.GroupPolicyScopeListDao;
-import org.openecomp.policy.rest.jpa.GroupPolicyScopeList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("GroupPolicyScopeListDao")
-public class GroupPolicyScopeListDaoImpl implements GroupPolicyScopeListDao {
-	private static final Log logger = LogFactory.getLog(GroupPolicyScopeListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<GroupPolicyScopeList> getGroupPolicyScopeListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		 List<GroupPolicyScopeList> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(GroupPolicyScopeList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupPolicyScopeList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getGroupPolicyScopeListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-		try {
-			Criteria cr = session.createCriteria(GroupPolicyScopeList.class);
-			List<GroupPolicyScopeList> attributeData = cr.list();           
-			for(int i = 0; i < attributeData.size(); i++){
-				data.add(attributeData.get(i).getGroupName());
-			}
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupPolicyScopeList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(GroupPolicyScopeList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving GroupPolicyScopeList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(GroupPolicyScopeList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(GroupPolicyScopeList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<GroupPolicyScopeList> CheckDuplicateEntry(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<GroupPolicyScopeList> data = null;
-		try {
-			Criteria cr = session.createCriteria(GroupPolicyScopeList.class);
-			cr.add(Restrictions.eq("name",value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupPolicyScopeList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceConfigNameDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceConfigNameDaoImpl.java
deleted file mode 100644
index fdee32c..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceConfigNameDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.MicroServiceConfigNameDao;
-import org.openecomp.policy.rest.jpa.MicroServiceConfigName;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("MicroServiceConfigNameDao")
-public class MicroServiceConfigNameDaoImpl implements MicroServiceConfigNameDao{
-	private static final Log logger = LogFactory.getLog(MicroServiceConfigNameDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<MicroServiceConfigName> getMicroServiceConfigNameData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		 List<MicroServiceConfigName> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(MicroServiceConfigName.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying MicroServiceConfigName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(MicroServiceConfigName attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving MicroServiceConfigName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(MicroServiceConfigName attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting MicroServiceConfigName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(MicroServiceConfigName attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating MicroServiceConfigName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getMSConfigDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(MicroServiceConfigName.class);
-            List<MicroServiceConfigName> attributeData = cr.list();            
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying MicroServiceConfigName Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceLocationDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceLocationDaoImpl.java
deleted file mode 100644
index 91a2f42..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceLocationDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.MicroServiceLocationDao;
-import org.openecomp.policy.rest.jpa.MicroServiceLocation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("MicroServiceLocationDao")
-public class MicroServiceLocationDaoImpl implements MicroServiceLocationDao{
-	private static final Log logger = LogFactory.getLog(MicroServiceLocationDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<MicroServiceLocation> getMicroServiceLocationData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<MicroServiceLocation> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(MicroServiceLocation.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying MicroServiceLocation Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(MicroServiceLocation attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving MicroServiceLocation Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(MicroServiceLocation attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting MicroServiceLocation Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(MicroServiceLocation attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating MicroServiceLocation Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getMSLocationDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(MicroServiceLocation.class);
-            List<MicroServiceLocation> attributeData = cr.list();
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying MicroServiceLocation Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceModelsDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceModelsDaoImpl.java
deleted file mode 100644
index c4e66b5..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceModelsDaoImpl.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.MicroServiceModelsDao;
-import org.openecomp.policy.rest.jpa.MicroServiceModels;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("MicroServiceModelsDao")
-public class MicroServiceModelsDaoImpl implements MicroServiceModelsDao{
-	private static final Log logger = LogFactory.getLog(MicroServiceModelsDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<MicroServiceModels> getMicroServiceModelsData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<MicroServiceModels> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(MicroServiceModels.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying MicroServiceModels Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(MicroServiceModels attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving MicroServiceModels Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(MicroServiceModels attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting MicroServiceModels Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(MicroServiceModels attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating MicroServiceModels Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getMSModelsDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(MicroServiceModels.class);
-            List<MicroServiceModels> attributeData = cr.list();         
-            for(int i = 0; i < attributeData.size(); i++){
-            	if(attributeData.get(i).getVersion() == null || attributeData.get(i).getVersion().equals("")){
-            		data.add(attributeData.get(i).getModelName());
-            	}else{
-            		data.add(attributeData.get(i).getModelName() + "-v" + attributeData.get(i).getVersion());
-            	}
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying MicroServiceModels Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PEPOptionsDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PEPOptionsDaoImpl.java
deleted file mode 100644
index 92b89e9..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PEPOptionsDaoImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PEPOptionsDao;
-import org.openecomp.policy.rest.jpa.PEPOptions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PEPOptionsDao")
-public class PEPOptionsDaoImpl implements PEPOptionsDao{
-	private static final Log logger = LogFactory.getLog(PEPOptionsDaoImpl.class);
-
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PEPOptions> getPEPOptionsData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PEPOptions> pepOptionsData = null;
-        try {
-        	Criteria cr = session.createCriteria(PEPOptions.class);
-            pepOptionsData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PEPOptions Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return pepOptionsData;
-		
-	}
-
-	@Override
-	public void Save(PEPOptions pepOptions) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(pepOptions);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PEPOptions Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(PEPOptions pepOptions) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(pepOptions);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PEPOptions Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(PEPOptions pepOptions) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(pepOptions);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PEPOptions Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPEPOptionsDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PEPOptions.class);
-            List<PEPOptions> pepOptionsData = cr.list();  
-            for(int i = 0; i < pepOptionsData.size(); i++){
-            	 data.add(pepOptionsData.get(i).getPepName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PEPOptions Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeClosedLoopDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeClosedLoopDaoImpl.java
deleted file mode 100644
index 6ac3e5b..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeClosedLoopDaoImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PolicyScopeClosedLoopDao;
-import org.openecomp.policy.rest.jpa.PolicyScopeClosedLoop;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PolicyScopeClosedLoopDao")
-public class PolicyScopeClosedLoopDaoImpl implements PolicyScopeClosedLoopDao{
-	private static final Log logger = LogFactory.getLog(PolicyScopeClosedLoopDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeClosedLoop> getPolicyScopeClosedLoopData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeClosedLoop> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeClosedLoop.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeClosedLoop Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPolicyScopeClosedLoopDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeClosedLoop.class);
-            List<PolicyScopeClosedLoop> attributeData = cr.list();            
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeClosedLoop Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(PolicyScopeClosedLoop attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyScopeClosedLoop Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(PolicyScopeClosedLoop attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyScopeClosedLoop Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(PolicyScopeClosedLoop attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyScopeClosedLoop Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeClosedLoop> CheckDuplicateEntry(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeClosedLoop> data = null;
-		try {
-			Criteria cr = session.createCriteria(PolicyScopeClosedLoop.class);
-			cr.add(Restrictions.eq("name",value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeClosedLoop Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeResourceDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeResourceDaoImpl.java
deleted file mode 100644
index 6fe91b1..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeResourceDaoImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PolicyScopeResourceDao;
-import org.openecomp.policy.rest.jpa.PolicyScopeResource;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PolicyScopeResourceDao")
-public class PolicyScopeResourceDaoImpl implements PolicyScopeResourceDao{
-	private static final Log logger = LogFactory.getLog(PolicyScopeResourceDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeResource> getPolicyScopeResourceData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeResource> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeResource.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeResource Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPolicyScopeResourceDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeResource.class);
-            List<PolicyScopeResource> attributeData = cr.list();     
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeResource Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(PolicyScopeResource attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyScopeResource Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void delete(PolicyScopeResource attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyScopeResource Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(PolicyScopeResource attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyScopeResource Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeResource> CheckDuplicateEntry(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeResource> data = null;
-		try {
-			Criteria cr = session.createCriteria(PolicyScopeResource.class);
-			cr.add(Restrictions.eq("name",value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeResource Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-  
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeServiceDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeServiceDaoImpl.java
deleted file mode 100644
index d90d5a0..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeServiceDaoImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PolicyScopeServiceDao;
-import org.openecomp.policy.rest.jpa.PolicyScopeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PolicyScopeServiceDao")
-public class PolicyScopeServiceDaoImpl implements PolicyScopeServiceDao{
-	private static final Log logger = LogFactory.getLog(PolicyScopeServiceDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeService> getPolicyScopeServiceData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeService> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeService.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeService Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPolicyScopeServiceDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeService.class);
-            List<PolicyScopeService> attributeData = cr.list();     
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeService Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(PolicyScopeService attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyScopeService Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(PolicyScopeService attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyScopeService Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(PolicyScopeService attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyScopeService Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeService> CheckDuplicateEntry(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeService> data = null;
-		try {
-			Criteria cr = session.createCriteria(PolicyScopeService.class);
-			cr.add(Restrictions.eq("name",value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeService Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeTypeDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeTypeDaoImpl.java
deleted file mode 100644
index 66317a4..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeTypeDaoImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PolicyScopeTypeDao;
-import org.openecomp.policy.rest.jpa.PolicyScopeType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PolicyScopeTypeDao")
-public class PolicyScopeTypeDaoImpl implements  PolicyScopeTypeDao{
-	private static final Log logger = LogFactory.getLog(PolicyScopeTypeDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeType> getPolicyScopeTypeData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeType> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeType.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPolicyScopeTypeDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PolicyScopeType.class);
-            List<PolicyScopeType> attributeData = cr.list();     
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(PolicyScopeType attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyScopeType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(PolicyScopeType attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyScopeType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(PolicyScopeType attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyScopeType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PolicyScopeType> CheckDuplicateEntry(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PolicyScopeType> data = null;
-		try {
-			Criteria cr = session.createCriteria(PolicyScopeType.class);
-			cr.add(Restrictions.eq("name",value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyScopeType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PortListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PortListDaoImpl.java
deleted file mode 100644
index a3139b2..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PortListDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PortListDao;
-import org.openecomp.policy.rest.jpa.PortList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PortListDao")
-public class PortListDaoImpl implements PortListDao {
-	private static final Log logger = LogFactory.getLog(PortListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PortList> getPortListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PortList> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(PortList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PortList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(PortList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PortList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(PortList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PortList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(PortList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PortList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPortListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PortList.class);
-            List<PortList> attributeData = cr.list();      
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getPortName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PortList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PrefixListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PrefixListDaoImpl.java
deleted file mode 100644
index 2fecc7d..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PrefixListDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.PrefixListDao;
-import org.openecomp.policy.rest.jpa.PREFIXLIST;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("PrefixListDao")
-public class PrefixListDaoImpl implements PrefixListDao{
-	private static final Log logger = LogFactory.getLog(PrefixListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<PREFIXLIST> getPREFIXLISTData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<PREFIXLIST> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(PREFIXLIST.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PREFIXLIST Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(PREFIXLIST attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PREFIXLIST Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(PREFIXLIST attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PREFIXLIST Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(PREFIXLIST attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PREFIXLIST Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getPrefixListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(PREFIXLIST.class);
-            List<PREFIXLIST> attributeData = cr.list();    
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getPrefixListName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PREFIXLIST Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ProtocolListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ProtocolListDaoImpl.java
deleted file mode 100644
index 7d78d38..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ProtocolListDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ProtocolListDao;
-import org.openecomp.policy.rest.jpa.ProtocolList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("ProtocolListDao")
-public class ProtocolListDaoImpl implements ProtocolListDao {
-	private static final Log logger = LogFactory.getLog(ProtocolListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<ProtocolList> getProtocolListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<ProtocolList> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(ProtocolList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ProtocolList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(ProtocolList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving ProtocolList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(ProtocolList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting ProtocolList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(ProtocolList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ProtocolList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getProtocolListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(ProtocolList.class);
-            List<ProtocolList> attributeData = cr.list();     
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getProtocolName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ProtocolList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/RiskTypeDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/RiskTypeDaoImpl.java
deleted file mode 100644
index 1318f82..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/RiskTypeDaoImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.EcompNameDao;
-import org.openecomp.policy.rest.dao.RiskTypeDao;
-import org.openecomp.policy.rest.jpa.EcompName;
-import org.openecomp.policy.rest.jpa.RiskType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("RiskTypeDao")
-public class RiskTypeDaoImpl implements RiskTypeDao {
-	private static final Log logger = LogFactory.getLog(RiskTypeDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<RiskType> getRiskName() {
-		System.out.println("RiskTypeDaoImpl:  getRiskName() is called");
-		logger.debug("RiskTypeDaoImpl:  getRiskName() is called");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<RiskType> riskTypeData = null;
-        try {
-        	Criteria cr = session.createCriteria(RiskType.class);
-        	riskTypeData = cr.list();
-			logger.debug("Data returned from RiskType table:  " + riskTypeData.toString());
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying RiskType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return riskTypeData;
-	}
-
-	@Override
-	public void Save(RiskType riskName) {
-		System.out.println("RiskTypeDaoImpl:  Save() is called");
-		logger.debug("RiskTypeDaoImpl:  Save() is called");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(riskName);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving RiskType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(RiskType riskName) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(riskName);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting RiskType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(RiskType riskName) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(riskName);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating RiskType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getRiskTypeDataByName() {
-		logger.info("getRiskTypeDataByName is call from the DAO implementation class.");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();	
-        List<String> data = new ArrayList<String>();    
-        try {
-        	Criteria cr = session.createCriteria(RiskType.class);
-            List<RiskType> riskTypeData = cr.list();
-            for(int i = 0; i < riskTypeData.size(); i++){
-           	 data.add(riskTypeData.get(i).getRiskName());
-           }
-            logger.info("data retrieved: " + data.toString());
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying RiskType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SafePolicyWarningDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SafePolicyWarningDaoImpl.java
deleted file mode 100644
index 37a77f9..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SafePolicyWarningDaoImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.SafePolicyWarningDao;
-import org.openecomp.policy.rest.jpa.SafePolicyWarning;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("SafePolicyWarningDao")
-public class SafePolicyWarningDaoImpl implements SafePolicyWarningDao {
-	private static final Log logger = LogFactory.getLog(SafePolicyWarningDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<SafePolicyWarning> getSafePolicyWarningData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		 List<SafePolicyWarning> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(SafePolicyWarning.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SafePolicyWarning Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getSafePolicyWarningDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-		try {
-			Criteria cr = session.createCriteria(SafePolicyWarning.class);
-			List<SafePolicyWarning> attributeData = cr.list();           
-			for(int i = 0; i < attributeData.size(); i++){
-				data.add(attributeData.get(i).getName());
-			}
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SafePolicyWarning Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public void Save(SafePolicyWarning attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving SafePolicyWarning Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(SafePolicyWarning attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void update(SafePolicyWarning attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Attribute Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public SafePolicyWarning getSafePolicyWarningDataById(String riskType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		SafePolicyWarning data = null;
-		try {
-		Criteria cr = session.createCriteria(SafePolicyWarning.class);
-		cr.add(Restrictions.eq("name",riskType));
-		data = (SafePolicyWarning) cr.list().get(0);
-		tx.commit();
-		} catch (Exception e) {
-		logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SafePolicyWarning Table"+e);
-		}finally{
-		try{
-		session.close();
-		}catch(Exception e1){
-		logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-		}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SecurityZoneDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SecurityZoneDaoImpl.java
deleted file mode 100644
index 9c79773..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SecurityZoneDaoImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.SecurityZoneDao;
-import org.openecomp.policy.rest.jpa.SecurityZone;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("SecurityZoneDao")
-public class SecurityZoneDaoImpl implements SecurityZoneDao{
-	private static final Log logger = LogFactory.getLog(SecurityZoneDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<SecurityZone> getSecurityZoneData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<SecurityZone> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(SecurityZone.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SecurityZone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(SecurityZone attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving SecurityZone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void delete(SecurityZone attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting SecurityZone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(SecurityZone attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating SecurityZone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getSecurityZoneDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(SecurityZone.class);
-            List<SecurityZone> attributeData = cr.list();     
-            for(int i = 0; i < attributeData.size(); i++){
-           	 data.add(attributeData.get(i).getZoneName());
-           }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SecurityZone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceDictionaryDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceDictionaryDaoImpl.java
deleted file mode 100644
index 226c500..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceDictionaryDaoImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ServiceDictionaryDao;
-import org.openecomp.policy.rest.jpa.ClosedLoopD2Services;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("ServiceDictionaryDao")
-public class ServiceDictionaryDaoImpl implements ServiceDictionaryDao {
-	private static final Log logger = LogFactory.getLog(ServiceDictionaryDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<ClosedLoopD2Services> getClosedLoopD2ServicesData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<ClosedLoopD2Services> closedLoopD2ServicesData = null;
-        try {
-        	Criteria cr = session.createCriteria(ClosedLoopD2Services.class);
-            closedLoopD2ServicesData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ClosedLoopD2Services Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return closedLoopD2ServicesData;
-		
-	}
-
-	@Override
-	public void Save(ClosedLoopD2Services closedLoopD2Services) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(closedLoopD2Services);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving ClosedLoopD2Services Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(ClosedLoopD2Services closedLoopD2Services) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(closedLoopD2Services);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting ClosedLoopD2Services Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(ClosedLoopD2Services closedLoopD2Services) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(closedLoopD2Services);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ClosedLoopD2Services Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getCLServiceDictDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(ClosedLoopD2Services.class);
-            List<ClosedLoopD2Services> closedLoopD2ServicesData = cr.list();      
-            for(int i = 0; i < closedLoopD2ServicesData.size(); i++){
-            	 data.add(closedLoopD2ServicesData.get(i).getServiceName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ClosedLoopD2Services Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceGroupDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceGroupDaoImpl.java
deleted file mode 100644
index 7256313..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceGroupDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ServiceGroupDao;
-import org.openecomp.policy.rest.jpa.GroupServiceList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("ServiceGroupDao")
-public class ServiceGroupDaoImpl implements ServiceGroupDao{
-	private static final Log logger = LogFactory.getLog(ServiceGroupDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<GroupServiceList> getGroupServiceListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<GroupServiceList> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(GroupServiceList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(GroupServiceList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving GroupServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(GroupServiceList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting GroupServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(GroupServiceList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating GroupServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getGroupServiceDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(GroupServiceList.class);
-            List<GroupServiceList> attributeData = cr.list();      
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getGroupName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceListDaoImpl.java
deleted file mode 100644
index 01ff3e4..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceListDaoImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ServiceListDao;
-import org.openecomp.policy.rest.jpa.ServiceList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("ServiceListDao")
-public class ServiceListDaoImpl implements ServiceListDao {
-	private static final Log logger = LogFactory.getLog(ServiceListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<ServiceList> getServiceListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<ServiceList> attributeData =  null;
-        try {
-        	Criteria cr = session.createCriteria(ServiceList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(ServiceList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving ServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(ServiceList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting ServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(ServiceList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getServiceListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(ServiceList.class);
-            List<ServiceList> attributeData = cr.list();    
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getServiceName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ServiceList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-		
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SiteDictionaryDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SiteDictionaryDaoImpl.java
deleted file mode 100644
index 3b2a751..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SiteDictionaryDaoImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.SiteDictionaryDao;
-import org.openecomp.policy.rest.jpa.ClosedLoopSite;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-
-@Service("SiteDictionaryDao")
-public class SiteDictionaryDaoImpl implements SiteDictionaryDao {
-	private static final Log logger = LogFactory.getLog(SiteDictionaryDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<ClosedLoopSite> getClosedLoopSiteData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<ClosedLoopSite> closedLoopSiteData = null;
-        try {
-        	Criteria cr = session.createCriteria(ClosedLoopSite.class);
-            closedLoopSiteData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ClosedLoopSite Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return closedLoopSiteData;
-		
-	}
-
-	@Override
-	public void Save(ClosedLoopSite closedLoopSite) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(closedLoopSite);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving ClosedLoopSite Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(ClosedLoopSite closedLoopSite) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(closedLoopSite);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting ClosedLoopSite Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(ClosedLoopSite closedLoopSite) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(closedLoopSite);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating ClosedLoopSite Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getCLSiteDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(ClosedLoopSite.class);
-            List<ClosedLoopSite> closedLoopSiteData = cr.list();        
-            for(int i = 0; i < closedLoopSiteData.size(); i++){
-            	 data.add(closedLoopSiteData.get(i).getSiteName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying ClosedLoopSite Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/TermListDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/TermListDaoImpl.java
deleted file mode 100644
index 7568d60..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/TermListDaoImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.TermListDao;
-import org.openecomp.policy.rest.jpa.TermList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("TermListDao")
-public class TermListDaoImpl implements TermListDao{
-	private static final Log logger = LogFactory.getLog(TermListDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<TermList> getTermListData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<TermList> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(TermList.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying TermList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(TermList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving TermList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(TermList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting TermList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(TermList attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating TermList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getTermListDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(TermList.class);
-            List<TermList> attributeData = cr.list();   
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getTermName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying TermList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-	
-	@Override
-	public TermList getTermListValueByName(String name) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		TermList data = null;
-		try {
-			Criteria cr = session.createCriteria(TermList.class);
-			cr.add(Restrictions.eq("termName",name));
-			data = (TermList) cr.list().get(0);
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying TermList Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/UserInfoDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/UserInfoDaoImpl.java
deleted file mode 100644
index 04ad69c..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/UserInfoDaoImpl.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.UserInfoDao;
-import org.openecomp.policy.rest.jpa.UserInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-
-@Service("UserInfoDao")
-public class UserInfoDaoImpl implements UserInfoDao{
-	private static final Log logger = LogFactory.getLog(UserInfoDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@Override
-	public void save(UserInfo userInfo) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(userInfo);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving UserInfo Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}	
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<UserInfo> getUserInfo() {
-		System.out.println("UserInfoDaoImpl:  getUserInfo().. getting user info before save()");
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<UserInfo> userData = null;
-        try {
-        	Criteria cr = session.createCriteria(UserInfo.class);
-            userData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying UserInfo Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return userData;
-	}
-
-	@Override
-	public String getUserName(String loginid) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		UserInfo user = null;
-		try {
-			user = (UserInfo) session.get(UserInfo.class, loginid);
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying UserInfo Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return user.getUserName().toString();
-	}
-
-	@Override
-	public UserInfo getUserInfoByLoginId(String loginid) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		UserInfo userData = null;
-        try {
-        	Criteria cr = session.createCriteria(UserInfo.class);
-        	cr.add(Restrictions.eq("userLoginId", loginid));
-            userData = (UserInfo) cr.list().get(0);
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying UserInfo Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return userData;
-	}
-	
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VNFTypeDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VNFTypeDaoImpl.java
deleted file mode 100644
index 4d424fa..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VNFTypeDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.VNFTypeDao;
-import org.openecomp.policy.rest.jpa.VNFType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("VNFTypeDao")
-public class VNFTypeDaoImpl implements VNFTypeDao {
-	private static final Log logger = LogFactory.getLog(VNFTypeDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<VNFType> getVNFTypeData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<VNFType> vnfTypeData = null;
-        try {
-        	Criteria cr = session.createCriteria(VNFType.class);
-            vnfTypeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VNFType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return vnfTypeData;
-		
-	}
-
-	@Override
-	public void Save(VNFType vnfType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(vnfType);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving VNFType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(VNFType vnfType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(vnfType);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting VNFType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(VNFType vnfType) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(vnfType);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating VNFType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getVNFTypeDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(VNFType.class);
-            List<VNFType> vnfTypeData = cr.list();    
-            for(int i = 0; i < vnfTypeData.size(); i++){
-            	 data.add(vnfTypeData.get(i).getVnftype());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VNFType Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-		
-	}
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VSCLActionDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VSCLActionDaoImpl.java
deleted file mode 100644
index 8ab6bfd..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VSCLActionDaoImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.VSCLActionDao;
-import org.openecomp.policy.rest.jpa.VSCLAction;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("VSCLActionDao")
-public class VSCLActionDaoImpl implements VSCLActionDao{
-	private static final Log logger = LogFactory.getLog(VSCLActionDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<VSCLAction> getVSCLActionData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<VSCLAction> vSCLActionData = null;
-        try {
-        	Criteria cr = session.createCriteria(VSCLAction.class);
-            vSCLActionData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VSCLAction Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return vSCLActionData;
-		
-	}
-
-	@Override
-	public void Save(VSCLAction vSCLAction) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(vSCLAction);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving VSCLAction Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(VSCLAction vSCLAction) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(vSCLAction);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting VSCLAction Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(VSCLAction vSCLAction) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(vSCLAction);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating VSCLAction Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getVsclActionDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(VSCLAction.class);
-            List<VSCLAction> vSCLActionData = cr.list();     
-            for(int i = 0; i < vSCLActionData.size(); i++){
-            	 data.add(vSCLActionData.get(i).getVsclaction());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VSCLAction Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VarbindDictionaryDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VarbindDictionaryDaoImpl.java
deleted file mode 100644
index dba3a0d..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VarbindDictionaryDaoImpl.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.criterion.Restrictions;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.VarbindDictionaryDao;
-import org.openecomp.policy.rest.jpa.VarbindDictionary;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("VarbindDictionaryDao")
-public class VarbindDictionaryDaoImpl implements VarbindDictionaryDao {
-	private static final Log logger = LogFactory.getLog(VarbindDictionaryDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<VarbindDictionary> getVarbindDictionaryData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<VarbindDictionary> varbindDictionaryData = null;
-        try {
-        	Criteria cr = session.createCriteria(VarbindDictionary.class);
-            varbindDictionaryData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VarbindDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return varbindDictionaryData;
-		
-	}
-
-	@Override
-	public void Save(VarbindDictionary varbindDictionary) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(varbindDictionary);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving VarbindDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(VarbindDictionary varbindDictionary) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(varbindDictionary);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting VarbindDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(VarbindDictionary varbindDictionary) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(varbindDictionary);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating VarbindDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getVarbindDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(VarbindDictionary.class);
-            List<VarbindDictionary> varbindDictionaryData = cr.list();
-            for(int i = 0; i < varbindDictionaryData.size(); i++){
-            	 data.add(varbindDictionaryData.get(i).getVarbindName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VarbindDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-	@Override
-	public List<VarbindDictionary> getVarbindEntityByName(String value) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<VarbindDictionary> data = null;
-		try {
-			Criteria cr = session.createCriteria(VarbindDictionary.class);
-			cr.add(Restrictions.eq("varbindName",value));
-			data = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying VarbindDictionary Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ZoneDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ZoneDaoImpl.java
deleted file mode 100644
index 865a085..0000000
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ZoneDaoImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PAP-REST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pap.xacml.rest.daoimpl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.openecomp.policy.pap.xacml.rest.HibernateSession;
-import org.openecomp.policy.rest.dao.ZoneDao;
-import org.openecomp.policy.rest.jpa.Zone;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-
-@Service("ZoneDao")
-public class ZoneDaoImpl implements ZoneDao{
-	private static final Log logger = LogFactory.getLog(ZoneDaoImpl.class);
-	@Autowired
-	SessionFactory sessionfactory;
-	
-	public SessionFactory getSessionfactory() {
-		return sessionfactory;
-	}
-
-	public void setSessionfactory(SessionFactory sessionfactory) {
-		this.sessionfactory = sessionfactory;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<Zone> getZoneData() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<Zone> attributeData = null;
-        try {
-        	Criteria cr = session.createCriteria(Zone.class);
-            attributeData = cr.list();
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Zone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return attributeData;
-		
-	}
-
-	@Override
-	public void Save(Zone attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.persist(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving Zone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@Override
-	public void delete(Zone attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.delete(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting Zone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-	}
-
-	@Override
-	public void update(Zone attribute) {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		try {
-			session.update(attribute);
-			tx.commit();	
-		}catch(Exception e){
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating Zone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	public List<String> getZoneDataByName() {
-		Session session = HibernateSession.getSessionFactory();
-		Transaction tx = session.beginTransaction();
-		List<String> data = new ArrayList<String>();
-        try {
-        	Criteria cr = session.createCriteria(Zone.class);
-            List<Zone> attributeData = cr.list();
-            
-            for(int i = 0; i < attributeData.size(); i++){
-            	 data.add(attributeData.get(i).getZoneName());
-            }
-			tx.commit();
-		} catch (Exception e) {
-			logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Zone Table"+e);	
-		}finally{
-			try{
-				session.close();
-			}catch(Exception e1){
-				logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
-			}
-		}
-		return data;
-	}
-
-}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java
new file mode 100644
index 0000000..1fd95ab
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnector.java
@@ -0,0 +1,164 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+
+import java.util.ArrayList;
+
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import io.searchbox.client.JestResult;
+
+public interface ElkConnector {
+	
+	public static final String ELK_URL = "http://localhost:9200";
+	public static final String ELK_INDEX_POLICY = "policy";
+	
+	public enum PolicyIndexType {
+		config,
+		action,
+		decision,
+		closedloop,
+		all,
+	}
+	
+	public enum PolicyType {
+		Config,
+		Action,
+		Decision,
+		Config_Fault,
+		Config_PM,
+		Config_FW,
+		Config_MS,
+		none,
+	}
+	
+	public enum PolicyBodyType {
+		json,
+		xml,
+		properties,
+		txt,
+		none,
+	}
+
+	public JestResult policy(String policyId) 
+		   throws IllegalStateException, IllegalArgumentException;
+	
+	public boolean delete(PolicyRestAdapter policyData)
+			throws IllegalStateException;
+
+	public ArrayList<PolicyLocator> policyLocators(PolicyIndexType type, String text,int connector)
+		   throws IllegalStateException, IllegalArgumentException;
+	
+	public ArrayList<PolicyLocator> policyLocators(PolicyIndexType type, String text, 
+			                                       ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s,int connector)
+		   throws IllegalStateException, IllegalArgumentException;
+
+	public JestResult search(PolicyIndexType type, String text) 
+		   throws IllegalStateException, IllegalArgumentException;
+	
+	public JestResult search(PolicyIndexType type, String text, 
+			                 ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s) 
+			   throws IllegalStateException, IllegalArgumentException;
+	
+	public boolean update(PolicyRestAdapter policyData) throws IllegalStateException;
+	
+	public ElkConnector singleton = new ElkConnectorImpl();
+	
+	public static PolicyIndexType toPolicyIndexType(PolicyType type) 
+	       throws IllegalArgumentException {
+		if (type == null)
+			throw new IllegalArgumentException("Unsupported NULL type conversion");
+		
+		switch(type) {
+		case Config:
+			return PolicyIndexType.config;
+		case Action:
+			return PolicyIndexType.action;
+		case Decision:
+			return PolicyIndexType.decision;
+		case Config_Fault:
+			return PolicyIndexType.closedloop;
+		case Config_PM:
+			return PolicyIndexType.closedloop;
+		case Config_FW:
+			return PolicyIndexType.config;
+		case Config_MS:
+			return PolicyIndexType.config;
+		case none:
+			return PolicyIndexType.all;
+		default:
+			throw new IllegalArgumentException("Unsupported type conversion to index: " + type.name());
+		}
+	}
+	
+	public static PolicyIndexType toPolicyIndexType(String policyName) 
+		       throws IllegalArgumentException {
+			if (policyName == null)
+				throw new IllegalArgumentException("Unsupported NULL policy name conversion");
+			
+			if (policyName.startsWith("Config_Fault")) {
+				return PolicyIndexType.closedloop;
+			} else if (policyName.startsWith("Config_PM")) {
+				return PolicyIndexType.closedloop;
+			} else if (policyName.startsWith("Config_FW")) {
+				return PolicyIndexType.config;
+			} else if (policyName.startsWith("Config_MS")) {
+				return PolicyIndexType.config;
+			}else if (policyName.startsWith("Action")) {
+				return PolicyIndexType.action;
+			} else if (policyName.startsWith("Decision")) {
+				return PolicyIndexType.decision;
+			} else if (policyName.startsWith("Config")) {
+				return PolicyIndexType.config;
+			} else {
+				throw new IllegalArgumentException
+							("Unsupported policy name conversion to index: " + 
+				             policyName);
+			}
+	}
+	
+	public static PolicyType toPolicyType(String policyName) 
+		       throws IllegalArgumentException {
+		if (policyName == null)
+			throw new IllegalArgumentException("Unsupported NULL policy name conversion to Policy Type");
+		
+		if (policyName.startsWith("Config_Fault")) {
+			return PolicyType.Config_Fault;
+		} else if (policyName.startsWith("Config_PM")) {
+			return PolicyType.Config_PM;
+		} else if (policyName.startsWith("Config_FW")) {
+			return PolicyType.Config_FW;
+		} else if (policyName.startsWith("Config_MS")) {
+			return PolicyType.Config_MS;
+		}else if (policyName.startsWith("Action")) {
+			return PolicyType.Action;
+		} else if (policyName.startsWith("Decision")) {
+			return PolicyType.Decision;
+		} else if (policyName.startsWith("Config")) {
+			return PolicyType.Config;
+		} else {
+			throw new IllegalArgumentException
+						("Unsupported policy name conversion to index: " + 
+			             policyName);
+		}
+	}
+	
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
new file mode 100644
index 0000000..5a64ec2
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/ElkConnectorImpl.java
@@ -0,0 +1,845 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map.Entry;
+
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.index.query.QueryStringQueryBuilder;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+import org.json.JSONObject;
+import org.kohsuke.args4j.Option;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import io.searchbox.action.Action;
+import io.searchbox.client.JestClient;
+import io.searchbox.client.JestClientFactory;
+import io.searchbox.client.JestResult;
+import io.searchbox.client.config.HttpClientConfig;
+import io.searchbox.core.Delete;
+import io.searchbox.core.Get;
+import io.searchbox.core.Index;
+import io.searchbox.core.Search;
+import io.searchbox.core.Search.Builder;
+import io.searchbox.indices.IndicesExists;
+import io.searchbox.indices.type.TypeExist;
+import io.searchbox.params.Parameters;
+
+public class ElkConnectorImpl implements ElkConnector{
+
+	protected static class CLIOptions {
+		@Option(name="-s", usage="search", aliases={"-search", "--search"}, required=false, metaVar="<search text>")
+		protected String searchText;
+
+		@Option(name="-e", usage="test and update policy if not exists", aliases={"-exist", "--exists"}, required=false, metaVar="<policy file>")
+		protected File testFile;
+
+		@Option(name = "-h", aliases = {"-help", "--help"}, usage = "print this message")
+		private boolean help = false;		
+	};
+
+	private static final String POLICY_RESULT_FIELDS = "[ \"Policy.PolicyType\", " +
+			"\"Policy.PolicyName\", " +
+			"\"Policy.Owner\", " +
+			"\"Policy.Scope\", " +
+			"\"Policy.PolicyId\", " +
+			"\"Policy.Version\" ]";
+
+	private static final String SOURCE_RESULT_FIELDS = "\"_source\": " + POLICY_RESULT_FIELDS;
+
+	private static final Logger LOGGER = FlexLogger.getLogger(ElkConnector.class);
+
+	protected final JestClientFactory jestFactory = new JestClientFactory();
+	protected final JestClient jestClient;	
+	protected static int QUERY_MAXRECORDS = 1000;
+
+	public ElkConnectorImpl() {
+		if (LOGGER.isDebugEnabled()){
+			LOGGER.debug("ENTER: -");
+		}
+		HttpClientConfig jestClientConfig = new HttpClientConfig.Builder(ELK_URL).multiThreaded(true).build();
+		jestFactory.setHttpClientConfig(jestClientConfig);
+		jestClient = jestFactory.getObject();
+	}
+
+	protected boolean isType(PolicyIndexType type) throws IOException {
+		if (LOGGER.isDebugEnabled()){
+			LOGGER.debug("ENTER: -");
+		}
+
+		try {
+			Action<JestResult> typeQuery = new TypeExist.Builder(ELK_INDEX_POLICY).addType(type.toString()).build();
+			JestResult result = jestClient.execute(typeQuery);
+
+			if (LOGGER.isInfoEnabled()) {
+				LOGGER.info("JSON:" + result.getJsonString());
+				LOGGER.info("ERROR:" + result.getErrorMessage());
+				LOGGER.info("PATH:" + result.getPathToResult());
+				LOGGER.info(result.getJsonObject());
+			}
+			return result.isSucceeded();	
+		} catch (IOException e) {
+			LOGGER.warn("Error checking type existance of " + type.toString() + ": " + e.getMessage(), e);
+			throw e;
+		}
+	}
+
+	protected boolean isIndex() throws IOException {
+		try {
+			Action<JestResult> indexQuery = new IndicesExists.Builder(ELK_INDEX_POLICY).build();
+
+			JestResult result = jestClient.execute(indexQuery);
+			if (LOGGER.isInfoEnabled()) {
+				LOGGER.info("JSON:" + result.getJsonString());
+				LOGGER.info("ERROR:" + result.getErrorMessage());
+				LOGGER.info("PATH:" + result.getPathToResult());
+				LOGGER.info(result.getJsonObject());
+			}
+			return result.isSucceeded();	
+		} catch (IOException e) {
+			LOGGER.warn("Error checking index existance of " + ELK_INDEX_POLICY + ": " + e.getMessage(), e);
+			throw e;
+		}
+	}
+
+	@Override
+	public JestResult search(PolicyIndexType type, String text) throws IllegalStateException, IllegalArgumentException {
+		if (LOGGER.isTraceEnabled()){
+			LOGGER.trace("ENTER: " + text);
+		}
+
+		if (text == null || text.isEmpty()) {
+			throw new IllegalArgumentException("No search string provided");
+		}
+
+		// MatchQueryBuilder mQ = QueryBuilders.matchQuery("_all", text);
+		QueryStringQueryBuilder mQ = QueryBuilders.queryStringQuery(text);
+		SearchSourceBuilder searchSourceBuilder = 
+				new SearchSourceBuilder().query(mQ).
+				fetchSource(new String[]{"Policy.PolicyType",
+						"Policy.PolicyName",
+						"Policy.Owner",
+						"Policy.Scope",
+						"Policy.PolicyId",
+				"Policy.Version"},
+						null);
+		Builder searchBuilder = new Search.Builder(searchSourceBuilder.toString()).
+				addIndex(ELK_INDEX_POLICY).
+				setParameter(Parameters.SIZE, ElkConnectorImpl.QUERY_MAXRECORDS);
+
+		if (type == null || type == PolicyIndexType.all) {
+			for (PolicyIndexType pT: PolicyIndexType.values()) {
+				if (pT != PolicyIndexType.all) {
+					searchBuilder.addType(pT.toString());
+				}
+			}
+		} else {
+			searchBuilder.addType(type.toString());
+		}
+
+		Search search = searchBuilder.build();
+		JestResult result;
+		try {
+			result = jestClient.execute(search);
+		} catch (IOException ioe) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ":" + 
+					search + ": " + ioe.getMessage(), ioe);
+			throw new IllegalStateException(ioe);
+		}
+
+		if (result.isSucceeded()) {
+			if (LOGGER.isInfoEnabled()){
+				LOGGER.info("OK:" + result.getResponseCode() + ":" + search + ": " + 
+						result.getPathToResult() + ":" + System.lineSeparator() +
+						result.getJsonString());
+			}
+		} else {	
+			/* Unsuccessful search */
+			if (LOGGER.isWarnEnabled()){
+				LOGGER.warn(XACMLErrorConstants.ERROR_PROCESS_FLOW + ":" + 
+						result.getResponseCode() + ": " + 
+						search.getURI() + ":" +
+						result.getPathToResult() + ":" +
+						result.getJsonString() + ":" +
+						result.getErrorMessage());
+			}
+
+			String errorMessage = result.getErrorMessage();
+			if (errorMessage != null && !errorMessage.isEmpty()) {
+				String xMessage = errorMessage;
+				if (errorMessage.contains("TokenMgrError")) {
+					int indexError = errorMessage.lastIndexOf("TokenMgrError");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);
+				} else if (errorMessage.contains("QueryParsingException")) {
+					int indexError = errorMessage.lastIndexOf("QueryParsingException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);
+				} else if (errorMessage.contains("JsonParseException")) {
+					int indexError = errorMessage.lastIndexOf("JsonParseException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else if (errorMessage.contains("Parse Failure")) {
+					int indexError = errorMessage.lastIndexOf("Parse Failure");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else if (errorMessage.contains("SearchParseException")) {
+					int indexError = errorMessage.lastIndexOf("SearchParseException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else {
+					xMessage = result.getErrorMessage();
+				}
+				throw new IllegalStateException(xMessage);
+			}
+		}
+
+		return result;
+	}
+
+	public JestResult searchKey(PolicyIndexType type, String text, 
+			ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s,int connector) 
+					throws IllegalStateException, IllegalArgumentException {
+		if (LOGGER.isTraceEnabled()){
+			LOGGER.trace("ENTER: " + text);
+		}
+		if (filter_s == null || filter_s.size() <= 0) {
+			return search(type, text);
+		}
+
+		String matches_s = "";
+
+		if(connector==0)// AND CONNECTOR
+		{
+			matches_s = "{\n" +
+					"	 " + SOURCE_RESULT_FIELDS + ",\n" +
+					"    \"size\" : "+ ElkConnectorImpl.QUERY_MAXRECORDS + ",\n" +
+					"    \"query\": {\n" +
+					"        \"bool\" : {\n" +
+					"            \"must\" : [";
+		}
+		else if (connector ==1)//OR CONNECTOR
+		{
+			matches_s = "{\n" +
+					"	 " + SOURCE_RESULT_FIELDS + ",\n" +
+					"    \"size\" : "+ ElkConnectorImpl.QUERY_MAXRECORDS + ",\n" +
+					"    \"query\": {\n" +
+					"        \"bool\" : {\n" +
+					"            \"should\" : [";
+		}
+
+		for (Pair<ArrayList<String>,ArrayList<String>> p : filter_s) {
+			ArrayList<String> name_s = p.left();
+			ArrayList<String> value_s = p.right();
+
+			if (name_s == null || name_s.size() <= 0) {
+				if (LOGGER.isWarnEnabled()){
+					LOGGER.warn("Defaulting to text search: Empty field name array passed in");
+				}
+				return search(type, text);
+			}
+
+			if (LOGGER.isDebugEnabled()) {
+				for (String n: name_s) {
+					LOGGER.debug("Filter Name: " + n);
+				}
+			}
+
+			if (value_s == null || value_s.size() <= 0) {
+				if (LOGGER.isWarnEnabled()){
+					LOGGER.warn("Defaulting to text search: Empty field value array passed in");
+				}
+				return search(type, text);
+			}
+
+			if (LOGGER.isDebugEnabled()) {
+				for (String v: value_s) {
+					LOGGER.debug("Filter Value: " + v);
+				}
+			}
+
+			/* common case: # filter names == # filter values */
+			if (name_s.size() == value_s.size()) {
+				String match = "";
+				for (int i=0; i<name_s.size(); i++) {
+					if (name_s.get(i).contains("*")) {
+						match =
+								"{ \"query_string\": { \"fields\": [ \"" +
+										name_s.get(i) + "\" ], " +
+										"\"query\" : \"" + 
+										value_s.get(i) + "\" } },";
+					} else {
+						match =
+								"{ \"match_phrase\": { \"" + 
+										name_s.get(i) + "\" : \"" + 
+										value_s.get(i) + "\" } },";
+					}
+					if (LOGGER.isDebugEnabled()){
+						LOGGER.debug("Adding Match Line: " + match);
+					}
+					matches_s = matches_s + "\n                " + match;
+				}
+			} 
+			else if (name_s.size() > value_s.size()  && (value_s.size() == 1)) {
+				String match =
+						"{ \"multi_match\": { \"query\": \"" + value_s.get(0) + "\", \"type\": \"phrase\", \"fields\": [";
+				for (String n:  name_s) {
+					match += " \"" + n + "\",";
+				}
+				match = match.substring(0, match.length()-1); 
+				match += " ] } },";//debug
+				if (LOGGER.isDebugEnabled()){
+					LOGGER.debug("Adding Match Line: " + match);
+				}
+				matches_s = matches_s + "\n                " + match;
+			} else {
+				if (LOGGER.isWarnEnabled())
+					LOGGER.warn("Defaulting to text search: different number of filter names and values");
+				return search(type, text);
+			}
+		}		
+
+		matches_s = matches_s.substring(0, matches_s.length()-1);  // remove last comma
+
+		matches_s = matches_s  +
+				"            ]\n" +
+				"        }\n" +
+				"    }\n" +
+				"}";
+
+		if (LOGGER.isDebugEnabled()) {
+			LOGGER.debug(matches_s);
+		}
+
+		Builder searchBuilder = new Search.Builder(matches_s).
+				addIndex(ELK_INDEX_POLICY);
+
+		if (type == null || type == PolicyIndexType.all) {
+			for (PolicyIndexType pT: PolicyIndexType.values()) {
+				if (pT != PolicyIndexType.all) {
+					searchBuilder.addType(pT.toString());
+				}
+			}
+		} else {
+			searchBuilder.addType(type.toString());
+		}
+
+		Search search = searchBuilder.build();
+
+		JestResult result;
+		try {
+			result = jestClient.execute(search);
+		} catch (IOException ioe) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ":" + 
+					search + ": " + ioe.getMessage(), ioe);
+			throw new IllegalStateException(ioe);
+		}
+
+		if (result.isSucceeded()) {
+			if (LOGGER.isInfoEnabled()){
+				LOGGER.info("OK:" + result.getResponseCode() + ":" + search + ": " + 
+						result.getPathToResult() + ":" + System.lineSeparator() +
+						result.getJsonString());
+			}	
+		} else {	
+			/* Unsuccessful search */
+			if (LOGGER.isWarnEnabled()){
+				LOGGER.warn(XACMLErrorConstants.ERROR_PROCESS_FLOW + ":" + 
+						result.getResponseCode() + ": " + 
+						search.getURI() + ":" +
+						result.getPathToResult() + ":" +
+						result.getJsonString() + ":" +
+						result.getErrorMessage());
+			}
+
+			String errorMessage = result.getErrorMessage();
+			if (errorMessage != null && !errorMessage.isEmpty()) {
+				String xMessage = errorMessage;
+				if (errorMessage.contains("TokenMgrError")) {
+					int indexError = errorMessage.lastIndexOf("TokenMgrError");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);
+				} else if (errorMessage.contains("QueryParsingException")) {
+					int indexError = errorMessage.lastIndexOf("QueryParsingException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);
+				} else if (errorMessage.contains("JsonParseException")) {
+					int indexError = errorMessage.lastIndexOf("JsonParseException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else if (errorMessage.contains("Parse Failure")) {
+					int indexError = errorMessage.lastIndexOf("Parse Failure");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else if (errorMessage.contains("SearchParseException")) {
+					int indexError = errorMessage.lastIndexOf("SearchParseException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else {
+					xMessage = result.getErrorMessage();
+				}
+				throw new IllegalStateException(xMessage);
+			}
+		}
+		return result;
+	}
+
+	@Override
+	public JestResult search(PolicyIndexType type, String text, 
+			ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s) 
+					throws IllegalStateException, IllegalArgumentException {
+		if (LOGGER.isTraceEnabled()){
+			LOGGER.trace("ENTER: " + text);
+		}
+
+		if (filter_s == null || filter_s.size() <= 0) {
+			return search(type, text);
+		}
+
+		String matches_s = "";
+		matches_s = "{\n" +
+				"	 " + SOURCE_RESULT_FIELDS + ",\n" +
+				"    \"size\" : "+ ElkConnectorImpl.QUERY_MAXRECORDS + ",\n" +
+				"    \"query\": {\n" +
+				"        \"bool\" : {\n" +
+				"            \"must\" : [";
+		for (Pair<ArrayList<String>,ArrayList<String>> p : filter_s) {
+			ArrayList<String> name_s = p.left();
+			ArrayList<String> value_s = p.right();
+
+			if (name_s == null || name_s.size() <= 0) {
+				if (LOGGER.isWarnEnabled()){
+					LOGGER.warn("Defaulting to text search: Empty field name array passed in");
+				}	
+				return search(type, text);
+			}
+
+			if (LOGGER.isDebugEnabled()) {
+				for (String n: name_s) {
+					LOGGER.debug("Filter Name: " + n);
+				}
+			}
+
+			if (value_s == null || value_s.size() <= 0) {
+				if (LOGGER.isWarnEnabled())
+					LOGGER.warn("Defaulting to text search: Empty field value array passed in");
+				return search(type, text);
+			}
+
+			if (LOGGER.isDebugEnabled()) {
+				for (String v: value_s) {
+					LOGGER.debug("Filter Value: " + v);
+				}
+			}
+
+			/* common case: # filter names == # filter values */
+			if (name_s.size() == value_s.size()) {
+				String match = "";
+				for (int i=0; i<name_s.size(); i++) {
+					if (name_s.get(i).contains("*")) {
+						match =
+								"{ \"query_string\": { \"fields\": [ \"" +
+										name_s.get(i) + "\" ], " +
+										"\"query\" : \"" + 
+										value_s.get(i) + "\" } },";
+					} else {
+						match =
+								"{ \"match_phrase\": { \"" + 
+										name_s.get(i) + "\" : \"" + 
+										value_s.get(i) + "\" } },";
+					}
+					if (LOGGER.isDebugEnabled()){
+						LOGGER.debug("Adding Match Line: " + match);
+					}	
+					matches_s = matches_s + "\n                " + match;
+				}
+			} else if (name_s.size() > value_s.size()  && (value_s.size() == 1)) {
+				String match =
+						"{ \"multi_match\": { \"query\": \"" + value_s.get(0) + "\", \"type\": \"phrase\", \"fields\": [";
+				for (String n:  name_s) {
+					match += " \"" + n + "\",";
+				}
+				match = match.substring(0, match.length()-1); 
+				match += " ] } },";	
+				if (LOGGER.isDebugEnabled()){
+					LOGGER.debug("Adding Match Line: " + match);
+				}
+				matches_s = matches_s + "\n                " + match;
+			} else {
+				if (LOGGER.isWarnEnabled()){
+					LOGGER.warn("Defaulting to text search: different number of filter names and values");
+				}	
+				return search(type, text);
+			}
+		}
+		if (text != null && !text.isEmpty()) {
+			if (LOGGER.isDebugEnabled()){
+				LOGGER.debug("Adding Match Line for search text: " + text);
+			}
+
+			final JsonObject jsonText = new JsonObject();
+			jsonText.addProperty("_all", text);
+			String escapedText = jsonText.toString();
+
+			matches_s = matches_s + "\n                " + 
+					"{ \"match\": " +
+					escapedText + " },";	
+		}
+		matches_s = matches_s.substring(0, matches_s.length()-1);  // remove last comma
+		matches_s = matches_s + "\n" +
+				"            ]\n" +
+				"        }\n" +
+				"    }\n" +
+				"}";
+
+		if (LOGGER.isDebugEnabled()) {
+			LOGGER.debug(matches_s);
+		}
+
+		Builder searchBuilder = new Search.Builder(matches_s).
+				addIndex(ELK_INDEX_POLICY);
+
+		if (type == null || type == PolicyIndexType.all) {
+			for (PolicyIndexType pT: PolicyIndexType.values()) {
+				if (pT != PolicyIndexType.all) {
+					searchBuilder.addType(pT.toString());
+				}
+			}
+		} else {
+			searchBuilder.addType(type.toString());
+		}
+
+		Search search = searchBuilder.build();
+
+		JestResult result;
+		try {
+			result = jestClient.execute(search);
+		} catch (IOException ioe) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ":" + 
+					search + ": " + ioe.getMessage(), ioe);
+			throw new IllegalStateException(ioe);
+		}
+
+		if (result.isSucceeded()) {
+			if (LOGGER.isInfoEnabled()){
+				LOGGER.info("OK:" + result.getResponseCode() + ":" + search + ": " + 
+						result.getPathToResult() + ":" + System.lineSeparator() +
+						result.getJsonString());	
+			}	
+		} else {	
+			/* Unsuccessful search */
+			if (LOGGER.isWarnEnabled()){
+				LOGGER.warn(XACMLErrorConstants.ERROR_PROCESS_FLOW + ":" + 
+						result.getResponseCode() + ": " + 
+						search.getURI() + ":" +
+						result.getPathToResult() + ":" +
+						result.getJsonString() + ":" +
+						result.getErrorMessage());
+			}
+
+			String errorMessage = result.getErrorMessage();
+			if (errorMessage != null && !errorMessage.isEmpty()) {
+				String xMessage = errorMessage;
+				if (errorMessage.contains("TokenMgrError")) {
+					int indexError = errorMessage.lastIndexOf("TokenMgrError");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);
+				} else if (errorMessage.contains("QueryParsingException")) {
+					int indexError = errorMessage.lastIndexOf("QueryParsingException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);
+				} else if (errorMessage.contains("JsonParseException")) {
+					int indexError = errorMessage.lastIndexOf("JsonParseException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else if (errorMessage.contains("Parse Failure")) {
+					int indexError = errorMessage.lastIndexOf("Parse Failure");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else if (errorMessage.contains("SearchParseException")) {
+					int indexError = errorMessage.lastIndexOf("SearchParseException");
+					xMessage = "Invalid Search Expression.  Details: " + errorMessage.substring(indexError);				
+				} else {
+					xMessage = result.getErrorMessage();
+				}
+				throw new IllegalStateException(xMessage);
+			}
+		}
+
+		return result;
+	}
+
+	@Override
+	public JestResult policy(String policyId) 
+			throws IllegalStateException, IllegalArgumentException {
+		if (LOGGER.isTraceEnabled()){
+			LOGGER.trace("ENTER: " + policyId);
+		}
+
+		if (policyId == null || policyId.isEmpty()) {
+			throw new IllegalArgumentException("No policy id string provided");
+		}
+
+		Get policyRequest = new Get.Builder(ELK_INDEX_POLICY, policyId).build();
+
+		if (LOGGER.isInfoEnabled()){
+			LOGGER.info("ELK Search body request: " + policyRequest.toString());
+		}
+
+		JestResult result;
+		try {
+			result = jestClient.execute(policyRequest);
+		} catch (IOException ioe) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ":" + 
+					policyId + ": " + ioe.getMessage(), ioe);
+			throw new IllegalStateException(ioe);
+		}
+
+		if (result.isSucceeded()) {
+			if (LOGGER.isInfoEnabled()){
+				LOGGER.info("OK:" + result.getResponseCode() + ":" + policyId + ":" + 
+						result.getPathToResult() + ":" + System.lineSeparator() +
+						result.getJsonString());
+			}
+
+			return result;
+		}
+
+		/* Unsuccessful search */
+		if (LOGGER.isWarnEnabled())
+			LOGGER.warn(XACMLErrorConstants.ERROR_PROCESS_FLOW + ":" + 
+					result.getResponseCode() + ": " + policyId + ":" +
+					result.getPathToResult() + ":" +
+					result.getErrorMessage());
+
+		return result;
+	}
+
+	protected JsonObject getJsonObject(JsonObject jsonObject, String member) throws IllegalArgumentException {
+		if (jsonObject == null) {
+			if (LOGGER.isWarnEnabled())
+				LOGGER.warn("No JSON object provided to get " + member);
+
+			throw new IllegalArgumentException("No JSON Object provided");
+		}
+
+		if (LOGGER.isTraceEnabled()) {
+			LOGGER.trace("ENTER: " + member);
+			for (Entry<String, JsonElement> entry: jsonObject.entrySet()) {
+				LOGGER.trace("JSONOBJECT: " + entry.getKey() + "->" + entry.getValue());
+			}
+		}
+
+		if (jsonObject.has(member)) {
+			JsonElement element = jsonObject.getAsJsonObject(member);
+			if (element.isJsonObject()) {
+				return (JsonObject) element;
+			}
+		}
+
+		throw new IllegalArgumentException(member + " is not a JSON Object");
+	}
+
+	protected JsonArray getJsonArray(JsonObject jsonObject, String member) throws IllegalArgumentException {
+		if (jsonObject == null) {
+			throw new IllegalArgumentException("No JSON Object provided");
+		}
+
+		if (jsonObject.has(member)) {
+			if (jsonObject.get(member).isJsonArray()) {
+				return (JsonArray) jsonObject.get(member);
+			}
+		}
+
+		throw new IllegalArgumentException(member + " is not a JSON Array");
+	}
+
+	protected String getJsonPolicyMember(JsonObject aHit, String member) throws IllegalArgumentException {
+		if (aHit == null) {
+			throw new IllegalArgumentException("No JSON Object provided");
+		}
+
+		JsonObject jSource = getJsonObject(aHit, "_source");
+		JsonObject jPolicy = getJsonObject(jSource, "Policy");
+		JsonElement jMember = jPolicy.get(member);
+		if (jMember == null) {
+			throw new IllegalArgumentException(member + " is not a JSON Object");
+		}	
+		return jMember.getAsString();
+	}
+
+	@Override
+	public ArrayList<PolicyLocator> policyLocators(PolicyIndexType indexType, String text, int connector) 
+			throws IllegalStateException, IllegalArgumentException {
+		return policyLocators(indexType, text, new ArrayList<Pair<ArrayList<String>,ArrayList<String>>>(),connector);
+	}
+
+	@Override
+	public ArrayList<PolicyLocator> policyLocators(PolicyIndexType indexType, 
+			String text, 
+			ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s, int connector) 
+					throws IllegalStateException, IllegalArgumentException {
+		final ArrayList<PolicyLocator> policyLocators = new ArrayList<PolicyLocator>();
+
+		JestResult results = searchKey(indexType, text, filter_s,connector);
+		if (!results.isSucceeded()) {			
+			return policyLocators;
+		}
+
+		JsonArray jsonHit_s = null;
+		try {
+			JsonObject jsonHits = getJsonObject(results.getJsonObject(), "hits");
+			jsonHit_s = getJsonArray(jsonHits, "hits");
+		} catch (IllegalArgumentException e) {
+			LOGGER.warn("SEARCH:" + text + " no valid element provided", e);
+			return policyLocators;
+		}
+
+		for (JsonElement e : jsonHit_s) {
+			JsonObject elkSource = (JsonObject) e;
+			try {
+				String policyType = getJsonPolicyMember(elkSource,"PolicyType");
+				String policyName = getJsonPolicyMember(elkSource,"PolicyName");
+				String owner = getJsonPolicyMember(elkSource,"Owner");
+				String scope = getJsonPolicyMember(elkSource,"Scope");
+				String policyId = getJsonPolicyMember(elkSource,"PolicyId");
+				String version = getJsonPolicyMember(elkSource,"Version");	
+				PolicyLocator policyLocator = 
+						new PolicyLocator(policyType, policyName, owner, 
+								scope, policyId, version);
+				policyLocators.add(policyLocator);
+				if (LOGGER.isInfoEnabled()) {
+					LOGGER.info("SEARCH:" + text + "|FOUND:" + policyLocator);
+				}
+			} catch (IllegalArgumentException ex) {
+				LOGGER.warn("SEARCH:" + text + " missing locator information.", ex);
+			}
+		}
+		return policyLocators;
+	}
+
+	public boolean put(PolicyRestAdapter policyData) 
+			throws IOException, IllegalStateException {
+		if (LOGGER.isTraceEnabled()) LOGGER.trace("ENTER");
+
+		PolicyIndexType indexType;
+		try {
+			String policyName = policyData.getNewFileName();
+			if(policyName.contains("Config_")){
+				policyName = policyName.replace(".Config_", ":Config_");
+			}else if(policyName.contains("Action_")){
+				policyName = policyName.replace(".Action_", ":Action_");
+			}else if(policyName.contains("Decision_")){
+				policyName = policyName.replace(".Decision_", ":Decision_");
+			}
+			
+			String[] splitPolicyName = policyName.split(":");
+			indexType = ElkConnector.toPolicyIndexType(splitPolicyName[1]);
+		} catch (IllegalArgumentException e) {
+			throw new IllegalStateException("ELK: Index: " + ELK_INDEX_POLICY + e.getMessage());			
+		}
+		PolicyElasticData elasticData = new PolicyElasticData(policyData);
+		JSONObject jsonObj = new JSONObject(elasticData);
+		Index elkPut = new Index.Builder(jsonObj.toString()).
+				index(ELK_INDEX_POLICY).
+				type(indexType.name()).
+				id(elasticData.getPolicyName()).
+				refresh(true).
+				build();
+
+		JestResult result = jestClient.execute(elkPut);
+
+		if (result.isSucceeded()) {
+			if (LOGGER.isInfoEnabled())
+				LOGGER.info("OK: PUT operation of " + "->"  + ": " +
+						"success=" + result.isSucceeded() + "[" + result.getResponseCode() + ":" +
+						result.getPathToResult() + "]" + System.lineSeparator() +
+						result.getJsonString());
+		} else {
+			if (LOGGER.isWarnEnabled())
+				LOGGER.warn("FAILURE: PUT operation of "+ "->" + ": " +
+						"success=" + result.isSucceeded() + "[" + result.getResponseCode() + ":" +
+						result.getPathToResult() + "]" + System.lineSeparator() +
+						result.getJsonString());			
+
+		}
+
+		return result.isSucceeded();
+	}
+
+	@Override
+	public boolean delete(PolicyRestAdapter policyData) throws IllegalStateException  {
+		PolicyIndexType indexType = null;
+		JestResult result;
+		try {
+			String policyName = policyData.getNewFileName();
+			if(policyName.contains("Config_")){
+				policyName = policyName.replace(".Config_", ":Config_");
+			}else if(policyName.contains("Action_")){
+				policyName = policyName.replace(".Action_", ":Action_");
+			}else if(policyName.contains("Decision_")){
+				policyName = policyName.replace(".Decision_", ":Decision_");
+			}
+			
+			String[] splitPolicyName = policyName.split(":");
+			indexType = ElkConnector.toPolicyIndexType(splitPolicyName[1]);
+			if (!isType(indexType)) {
+				throw new IllegalStateException("ELK: Index: " + ELK_INDEX_POLICY +
+						" Type: " + indexType + 
+						" is not configured");
+			}
+			PolicyElasticData elasticData = new PolicyElasticData(policyData);
+			Delete deleteRequest = new Delete.Builder(elasticData.getPolicyName()).index(ELK_INDEX_POLICY).
+					type(indexType.name()).build();
+			result = jestClient.execute(deleteRequest);
+		} catch (IllegalArgumentException | IOException e) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + ": delete:" + 
+					((indexType != null) ? indexType.name() : "null") + ":" + policyData.getNewFileName() + ": " + 
+					e.getMessage(), e);
+			throw new IllegalStateException(e);
+		}
+
+		if (result.isSucceeded()) {
+			if (LOGGER.isInfoEnabled())
+				LOGGER.info("OK: DELETE operation of " + indexType + ":" + policyData.getNewFileName() + ": " +
+						"success=" + result.isSucceeded() + "[" + result.getResponseCode() + ":" +
+						result.getPathToResult() + "]" + System.lineSeparator() +
+						result.getJsonString());
+		} else {
+			if (LOGGER.isWarnEnabled())
+				LOGGER.warn("FAILURE: DELETE operation of " + indexType + ":" + policyData.getNewFileName() + ": " +
+						"success=" + result.isSucceeded() + "[" + result.getResponseCode() + ":" +
+						result.getPathToResult() + "]" + System.lineSeparator() +
+						result.getJsonString());	
+		}
+
+		return result.isSucceeded();
+	}
+	
+	@Override
+	public boolean update(PolicyRestAdapter policyData) throws IllegalStateException  {	
+		if (LOGGER.isDebugEnabled()){
+			LOGGER.debug("ENTER");
+		}
+		try {
+			boolean success = put(policyData);	
+			return success; 	
+		} catch (Exception e) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_UNKNOWN + ":" + "cannot test and update", e);
+			throw new IllegalStateException(e);			
+		}
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/Pair.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/Pair.java
new file mode 100644
index 0000000..cf4cecb
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/Pair.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+public class Pair<L,R> {
+    private L left;
+    private R right;
+    public Pair(L l, R r){
+        this.left = l;
+        this.right = r;
+    }
+    public L left(){ return left; }
+    public R right(){ return right; }
+    public void left(L l){ this.left = l; }
+    public void right(R r){ this.right = r; }
+}
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticData.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticData.java
new file mode 100644
index 0000000..f078352
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticData.java
@@ -0,0 +1,550 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+public class PolicyElasticData {
+	
+	private String scope;
+	private String policyType;
+	private String configPolicyType;
+	private String policyName;
+	private String policyDescription;
+	private String ecompName;
+	private String configName;
+	private String configType;
+	private String jsonBody;
+
+	//Safe Policy
+	private String policyScope;
+	private String providerComboBox;
+	private String riskType;
+	private String riskLevel;
+	private String guard;
+	private String ttlDate;
+	private  Map<String,String> matching; 
+
+	private ArrayList<Object> triggerSignatures;
+	private ArrayList<Object> symptomSignatures;
+	private String logicalConnector;
+	private String policyStatus;
+	public String gocServerScope;
+	private String supressionType;
+
+	//MicroSerice
+	private String serviceType;
+	private String uuid;
+	private String location;
+	private String priority;
+	private String msLocation;
+
+	//BRMS Policies
+	private String ruleName;
+	private Map<String,String> brmsParamBody;
+	private String brmsController;
+	private ArrayList<String> brmsDependency;
+	private LinkedHashMap<?, ?>  ruleData;
+	private LinkedHashMap<?,?>   ruleListData;
+	private Map<String,String> drlRuleAndUIParams;
+
+	//ClosedLoop
+	private String clearTimeOut;
+	private String trapMaxAge;
+	private String verificationclearTimeOut;
+	public Map<String , String> dynamicLayoutMap;
+
+	//FireWall
+	private String fwPolicyType;
+	private ArrayList<Object> fwattributes;
+	private String parentForChild;
+	private String securityZone;
+
+	//Action & Decision
+	private String ruleCombiningAlgId;
+	private Map<String,String> dynamicFieldConfigAttributes;
+	private Map<String,String> dynamicSettingsMap;
+	private Map<String,String> dropDownMap;
+	private String actionPerformer;
+	private String actionAttribute;
+	private List<String> dynamicRuleAlgorithmLabels;
+	private List<String> dynamicRuleAlgorithmCombo;
+	private List<String> dynamicRuleAlgorithmField1;
+	private List<String> dynamicRuleAlgorithmField2;
+	private List<Object> dynamicVariableList;
+	private List<String> dataTypeList;
+	private String actionAttributeValue;
+	private String ruleProvider;
+	private String actionBody;
+	private String actionDictHeader;
+	private String actionDictType;
+	private String actionDictUrl;
+	private String actionDictMethod;
+
+	public PolicyElasticData(PolicyRestAdapter policyData) {
+		this.scope = policyData.getDomain();
+		this.policyType = policyData.getPolicyType();
+		this.configPolicyType = policyData.getConfigPolicyType();
+		this.policyName  = policyData.getNewFileName();
+		this.policyDescription  = policyData.getPolicyDescription();
+		this.ecompName = policyData.getEcompName();
+		this.configName = policyData.getConfigName();
+		this.configType = policyData.getConfigType();
+		this.jsonBody = policyData.getJsonBody();
+
+		//Safe Policy
+		this.policyScope = policyData.getPolicyScope();
+		this.providerComboBox = policyData.getProviderComboBox();
+		this.riskType = policyData.getRiskType();
+		this.riskLevel = policyData.getRiskLevel();
+		this.guard  = policyData.getGuard();
+		this.ttlDate = policyData.getTtlDate();
+		this.matching = policyData.getMatching(); 
+
+		this.triggerSignatures = policyData.getTriggerSignatures();
+		this.symptomSignatures = policyData.getSymptomSignatures();
+		this.logicalConnector = policyData.getLogicalConnector();
+		this.policyStatus = policyData.getPolicyStatus();
+		this.gocServerScope = policyData.getGocServerScope();
+		this.supressionType = policyData.getSupressionType();
+
+		//MicroSerice
+		this.serviceType = policyData.getServiceType();
+		this.uuid = policyData.getUuid();
+		this.location = policyData.getLocation();
+		this.priority = policyData.getPriority();
+		this.msLocation = policyData.getMsLocation();
+
+		//BRMS Policies
+		this.ruleName = policyData.getRuleName();
+		this.brmsParamBody = policyData.getBrmsParamBody();
+		this.brmsController = policyData.getBrmsController();
+		this.brmsDependency = policyData.getBrmsDependency();
+		this.ruleData = policyData.getRuleData();
+		this.ruleListData = policyData.getRuleListData();
+		this.drlRuleAndUIParams = policyData.getDrlRuleAndUIParams();
+
+		//ClosedLoop
+		this.clearTimeOut = policyData.getClearTimeOut();
+		this.trapMaxAge = policyData.getTrapMaxAge();
+		this.verificationclearTimeOut = policyData.getVerificationclearTimeOut();
+		this.dynamicLayoutMap = policyData.getDynamicLayoutMap();
+
+		//FireWall
+		this.fwPolicyType = policyData.getFwPolicyType();
+		this.fwattributes = policyData.getFwattributes();
+		this.parentForChild = policyData.getParentForChild();
+		this.securityZone = policyData.getSecurityZone();
+
+		//Action & Decision
+		this.ruleCombiningAlgId = policyData.getRuleCombiningAlgId();
+		this.dynamicFieldConfigAttributes = policyData.getDynamicFieldConfigAttributes();
+		this.dynamicSettingsMap = policyData.getDynamicSettingsMap();
+		this.dropDownMap = policyData.getDropDownMap();
+		this.actionPerformer = policyData.getActionPerformer();
+		this.actionAttribute = policyData.getActionAttribute();
+		this.dynamicRuleAlgorithmLabels = policyData.getDynamicRuleAlgorithmLabels();
+		this.dynamicRuleAlgorithmCombo = policyData.getDynamicRuleAlgorithmCombo();
+		this.dynamicRuleAlgorithmField1 = policyData.getDynamicRuleAlgorithmField1();
+		this.dynamicRuleAlgorithmField2 = policyData.getDynamicRuleAlgorithmField2();
+		this.dynamicVariableList = policyData.getDynamicVariableList();
+		this.dataTypeList = policyData.getDataTypeList();
+		this.actionAttributeValue = policyData.getActionAttributeValue();
+		this.ruleProvider = policyData.getRuleProvider();
+		this.actionBody = policyData.getActionBody();
+		this.actionDictHeader = policyData.getActionDictHeader();
+		this.actionDictType = policyData.getActionDictType();
+		this.actionDictUrl = policyData.getActionDictUrl();
+		this.actionDictMethod = policyData.getActionDictMethod();
+	}
+	
+	public String getScope() {
+		return scope;
+	}
+	public void setScope(String scope) {
+		this.scope = scope;
+	}
+	public String getPolicyType() {
+		return policyType;
+	}
+	public void setPolicyType(String policyType) {
+		this.policyType = policyType;
+	}
+	public String getConfigPolicyType() {
+		return configPolicyType;
+	}
+	public void setConfigPolicyType(String configPolicyType) {
+		this.configPolicyType = configPolicyType;
+	}
+	public String getPolicyName() {
+		return policyName;
+	}
+	public void setPolicyName(String policyName) {
+		this.policyName = policyName;
+	}
+	public String getPolicyDescription() {
+		return policyDescription;
+	}
+	public void setPolicyDescription(String policyDescription) {
+		this.policyDescription = policyDescription;
+	}
+	public String getEcompName() {
+		return ecompName;
+	}
+	public void setEcompName(String ecompName) {
+		this.ecompName = ecompName;
+	}
+	public String getConfigName() {
+		return configName;
+	}
+	public void setConfigName(String configName) {
+		this.configName = configName;
+	}
+	public String getConfigType() {
+		return configType;
+	}
+	public void setConfigType(String configType) {
+		this.configType = configType;
+	}
+	public String getJsonBody() {
+		return jsonBody;
+	}
+	public void setJsonBody(String jsonBody) {
+		this.jsonBody = jsonBody;
+	}
+	public String getPolicyScope() {
+		return policyScope;
+	}
+	public void setPolicyScope(String policyScope) {
+		this.policyScope = policyScope;
+	}
+	public String getProviderComboBox() {
+		return providerComboBox;
+	}
+	public void setProviderComboBox(String providerComboBox) {
+		this.providerComboBox = providerComboBox;
+	}
+	public String getRiskType() {
+		return riskType;
+	}
+	public void setRiskType(String riskType) {
+		this.riskType = riskType;
+	}
+	public String getRiskLevel() {
+		return riskLevel;
+	}
+	public void setRiskLevel(String riskLevel) {
+		this.riskLevel = riskLevel;
+	}
+	public String getGuard() {
+		return guard;
+	}
+	public void setGuard(String guard) {
+		this.guard = guard;
+	}
+	public String getTtlDate() {
+		return ttlDate;
+	}
+	public void setTtlDate(String ttlDate) {
+		this.ttlDate = ttlDate;
+	}
+	public Map<String, String> getMatching() {
+		return matching;
+	}
+	public void setMatching(Map<String, String> matching) {
+		this.matching = matching;
+	}
+	public ArrayList<Object> getTriggerSignatures() {
+		return triggerSignatures;
+	}
+	public void setTriggerSignatures(ArrayList<Object> triggerSignatures) {
+		this.triggerSignatures = triggerSignatures;
+	}
+	public ArrayList<Object> getSymptomSignatures() {
+		return symptomSignatures;
+	}
+	public void setSymptomSignatures(ArrayList<Object> symptomSignatures) {
+		this.symptomSignatures = symptomSignatures;
+	}
+	public String getLogicalConnector() {
+		return logicalConnector;
+	}
+	public void setLogicalConnector(String logicalConnector) {
+		this.logicalConnector = logicalConnector;
+	}
+	public String getPolicyStatus() {
+		return policyStatus;
+	}
+	public void setPolicyStatus(String policyStatus) {
+		this.policyStatus = policyStatus;
+	}
+	public String getGocServerScope() {
+		return gocServerScope;
+	}
+	public void setGocServerScope(String gocServerScope) {
+		this.gocServerScope = gocServerScope;
+	}
+	public String getSupressionType() {
+		return supressionType;
+	}
+	public void setSupressionType(String supressionType) {
+		this.supressionType = supressionType;
+	}
+	public String getServiceType() {
+		return serviceType;
+	}
+	public void setServiceType(String serviceType) {
+		this.serviceType = serviceType;
+	}
+	public String getUuid() {
+		return uuid;
+	}
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+	public String getLocation() {
+		return location;
+	}
+	public void setLocation(String location) {
+		this.location = location;
+	}
+	public String getPriority() {
+		return priority;
+	}
+	public void setPriority(String priority) {
+		this.priority = priority;
+	}
+	public String getMsLocation() {
+		return msLocation;
+	}
+	public void setMsLocation(String msLocation) {
+		this.msLocation = msLocation;
+	}
+	public String getRuleName() {
+		return ruleName;
+	}
+	public void setRuleName(String ruleName) {
+		this.ruleName = ruleName;
+	}
+	public Map<String, String> getBrmsParamBody() {
+		return brmsParamBody;
+	}
+	public void setBrmsParamBody(Map<String, String> brmsParamBody) {
+		this.brmsParamBody = brmsParamBody;
+	}
+	public String getBrmsController() {
+		return brmsController;
+	}
+	public void setBrmsController(String brmsController) {
+		this.brmsController = brmsController;
+	}
+	public ArrayList<String> getBrmsDependency() {
+		return brmsDependency;
+	}
+	public void setBrmsDependency(ArrayList<String> brmsDependency) {
+		this.brmsDependency = brmsDependency;
+	}
+	public LinkedHashMap<?, ?> getRuleData() {
+		return ruleData;
+	}
+	public void setRuleData(LinkedHashMap<?, ?> ruleData) {
+		this.ruleData = ruleData;
+	}
+	public LinkedHashMap<?, ?> getRuleListData() {
+		return ruleListData;
+	}
+	public void setRuleListData(LinkedHashMap<?, ?> ruleListData) {
+		this.ruleListData = ruleListData;
+	}
+	public Map<String, String> getDrlRuleAndUIParams() {
+		return drlRuleAndUIParams;
+	}
+	public void setDrlRuleAndUIParams(Map<String, String> drlRuleAndUIParams) {
+		this.drlRuleAndUIParams = drlRuleAndUIParams;
+	}
+	public String getClearTimeOut() {
+		return clearTimeOut;
+	}
+	public void setClearTimeOut(String clearTimeOut) {
+		this.clearTimeOut = clearTimeOut;
+	}
+	public String getTrapMaxAge() {
+		return trapMaxAge;
+	}
+	public void setTrapMaxAge(String trapMaxAge) {
+		this.trapMaxAge = trapMaxAge;
+	}
+	public String getVerificationclearTimeOut() {
+		return verificationclearTimeOut;
+	}
+	public void setVerificationclearTimeOut(String verificationclearTimeOut) {
+		this.verificationclearTimeOut = verificationclearTimeOut;
+	}
+	public Map<String, String> getDynamicLayoutMap() {
+		return dynamicLayoutMap;
+	}
+	public void setDynamicLayoutMap(Map<String, String> dynamicLayoutMap) {
+		this.dynamicLayoutMap = dynamicLayoutMap;
+	}
+	public String getFwPolicyType() {
+		return fwPolicyType;
+	}
+	public void setFwPolicyType(String fwPolicyType) {
+		this.fwPolicyType = fwPolicyType;
+	}
+	public ArrayList<Object> getFwattributes() {
+		return fwattributes;
+	}
+	public void setFwattributes(ArrayList<Object> fwattributes) {
+		this.fwattributes = fwattributes;
+	}
+	public String getParentForChild() {
+		return parentForChild;
+	}
+	public void setParentForChild(String parentForChild) {
+		this.parentForChild = parentForChild;
+	}
+	public String getSecurityZone() {
+		return securityZone;
+	}
+	public void setSecurityZone(String securityZone) {
+		this.securityZone = securityZone;
+	}
+	public String getRuleCombiningAlgId() {
+		return ruleCombiningAlgId;
+	}
+	public void setRuleCombiningAlgId(String ruleCombiningAlgId) {
+		this.ruleCombiningAlgId = ruleCombiningAlgId;
+	}
+	public Map<String, String> getDynamicFieldConfigAttributes() {
+		return dynamicFieldConfigAttributes;
+	}
+	public void setDynamicFieldConfigAttributes(Map<String, String> dynamicFieldConfigAttributes) {
+		this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
+	}
+	public Map<String, String> getDynamicSettingsMap() {
+		return dynamicSettingsMap;
+	}
+	public void setDynamicSettingsMap(Map<String, String> dynamicSettingsMap) {
+		this.dynamicSettingsMap = dynamicSettingsMap;
+	}
+	public Map<String, String> getDropDownMap() {
+		return dropDownMap;
+	}
+	public void setDropDownMap(Map<String, String> dropDownMap) {
+		this.dropDownMap = dropDownMap;
+	}
+	public String getActionPerformer() {
+		return actionPerformer;
+	}
+	public void setActionPerformer(String actionPerformer) {
+		this.actionPerformer = actionPerformer;
+	}
+	public String getActionAttribute() {
+		return actionAttribute;
+	}
+	public void setActionAttribute(String actionAttribute) {
+		this.actionAttribute = actionAttribute;
+	}
+	public List<String> getDynamicRuleAlgorithmLabels() {
+		return dynamicRuleAlgorithmLabels;
+	}
+	public void setDynamicRuleAlgorithmLabels(List<String> dynamicRuleAlgorithmLabels) {
+		this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
+	}
+	public List<String> getDynamicRuleAlgorithmCombo() {
+		return dynamicRuleAlgorithmCombo;
+	}
+	public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
+		this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
+	}
+	public List<String> getDynamicRuleAlgorithmField1() {
+		return dynamicRuleAlgorithmField1;
+	}
+	public void setDynamicRuleAlgorithmField1(List<String> dynamicRuleAlgorithmField1) {
+		this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
+	}
+	public List<String> getDynamicRuleAlgorithmField2() {
+		return dynamicRuleAlgorithmField2;
+	}
+	public void setDynamicRuleAlgorithmField2(List<String> dynamicRuleAlgorithmField2) {
+		this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
+	}
+	public List<Object> getDynamicVariableList() {
+		return dynamicVariableList;
+	}
+	public void setDynamicVariableList(List<Object> dynamicVariableList) {
+		this.dynamicVariableList = dynamicVariableList;
+	}
+	public List<String> getDataTypeList() {
+		return dataTypeList;
+	}
+	public void setDataTypeList(List<String> dataTypeList) {
+		this.dataTypeList = dataTypeList;
+	}
+	public String getActionAttributeValue() {
+		return actionAttributeValue;
+	}
+	public void setActionAttributeValue(String actionAttributeValue) {
+		this.actionAttributeValue = actionAttributeValue;
+	}
+	public String getRuleProvider() {
+		return ruleProvider;
+	}
+	public void setRuleProvider(String ruleProvider) {
+		this.ruleProvider = ruleProvider;
+	}
+	public String getActionBody() {
+		return actionBody;
+	}
+	public void setActionBody(String actionBody) {
+		this.actionBody = actionBody;
+	}
+	public String getActionDictHeader() {
+		return actionDictHeader;
+	}
+	public void setActionDictHeader(String actionDictHeader) {
+		this.actionDictHeader = actionDictHeader;
+	}
+	public String getActionDictType() {
+		return actionDictType;
+	}
+	public void setActionDictType(String actionDictType) {
+		this.actionDictType = actionDictType;
+	}
+	public String getActionDictUrl() {
+		return actionDictUrl;
+	}
+	public void setActionDictUrl(String actionDictUrl) {
+		this.actionDictUrl = actionDictUrl;
+	}
+	public String getActionDictMethod() {
+		return actionDictMethod;
+	}
+	public void setActionDictMethod(String actionDictMethod) {
+		this.actionDictMethod = actionDictMethod;
+	}
+
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
new file mode 100644
index 0000000..9e512da
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
@@ -0,0 +1,603 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.elk.client.ElkConnector.PolicyIndexType;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.ActionPolicyDict;
+import org.openecomp.policy.rest.jpa.Attribute;
+import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
+import org.openecomp.policy.rest.jpa.ClosedLoopD2Services;
+import org.openecomp.policy.rest.jpa.ClosedLoopSite;
+import org.openecomp.policy.rest.jpa.DCAEuuid;
+import org.openecomp.policy.rest.jpa.DecisionSettings;
+import org.openecomp.policy.rest.jpa.DescriptiveScope;
+import org.openecomp.policy.rest.jpa.EcompName;
+import org.openecomp.policy.rest.jpa.EnforcingType;
+import org.openecomp.policy.rest.jpa.GroupPolicyScopeList;
+import org.openecomp.policy.rest.jpa.MicroServiceLocation;
+import org.openecomp.policy.rest.jpa.MicroServiceModels;
+import org.openecomp.policy.rest.jpa.PEPOptions;
+import org.openecomp.policy.rest.jpa.RiskType;
+import org.openecomp.policy.rest.jpa.SafePolicyWarning;
+import org.openecomp.policy.rest.jpa.TermList;
+import org.openecomp.policy.rest.jpa.VNFType;
+import org.openecomp.policy.rest.jpa.VSCLAction;
+import org.openecomp.policy.rest.jpa.VarbindDictionary;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping({"/"})
+public class PolicyElasticSearchController{
+
+	private static final Logger LOGGER = FlexLogger.getLogger(PolicyElasticSearchController.class);
+	private volatile HashMap<Path, String> filteredPolicies = new HashMap<Path, String>();
+	private List<JSONObject> policyNames = null;
+
+	enum Mode{
+		attribute, ecompName, actionPolicy, brmsParam, pepOptions, clSite, clService, clVarbind, clVnf, clVSCL, decision, enforcer, fwTerm, msDCAEUUID, msConfigName, msLocation, msModels,
+		psGroupPolicy, safeRisk, safePolicyWarning
+	}
+
+	public static final HashMap<String, String> name2jsonPath = new HashMap<String, String>() {
+		private static final long serialVersionUID = 1L;
+	};
+	//For AND and OR logical connector AND=0 and OR=1
+	private int connectorSelected;
+
+	public static CommonClassDao commonClassDao;
+
+	public PolicyElasticSearchController(CommonClassDao commonClassDao) {
+		PolicyElasticSearchController.commonClassDao = commonClassDao;
+	}
+
+	public PolicyElasticSearchController() {}
+
+	public static void TurnOffCertsCheck() {
+
+		// Create a trust manager that does not validate certificate chains
+		TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
+			public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+				return null;
+			}
+
+			public void checkClientTrusted(X509Certificate[] certs,
+					String authType) {
+			}
+
+			public void checkServerTrusted(X509Certificate[] certs,
+					String authType) {
+			}
+		} };
+
+		// Install all-trusting trust manager
+		SSLContext ctx;
+		try {
+			ctx = SSLContext.getInstance("SSL");
+			ctx.init(null, trustAllCerts, new java.security.SecureRandom());
+			HttpsURLConnection.setDefaultSSLSocketFactory(ctx
+					.getSocketFactory());
+		} catch (NoSuchAlgorithmException | KeyManagementException e) {
+			LOGGER.error("SSL Security Error: " + e);
+		}
+
+		// Create all-trusting host name verifier
+		HostnameVerifier allHostsValid = new HostnameVerifier() {
+			public boolean verify(String hostname, SSLSession session) {
+				return true;
+			}
+		};
+
+		// Install the all-trusting host verifier
+		HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
+	}
+
+	protected void clSearchBody(String clPolicyType, String bodyField, String bodyValue,
+			ArrayList<Pair<ArrayList<String>, ArrayList<String>>> filter_s) {
+		if (LOGGER.isDebugEnabled())
+			LOGGER.debug("ENTER: " + clPolicyType + ":" + bodyField + ":" + bodyValue);
+
+		final ArrayList<String> clBodyField_s = new ArrayList<String>();
+		final ArrayList<String> clBodyValue_s = new ArrayList<String>();
+
+		if (clPolicyType == null || clPolicyType.isEmpty()) {
+			clBodyField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_Fault.name() + "_Body." + bodyField);
+			clBodyField_s.add("Policy.Body."+ ElkConnector.PolicyType.Config_PM.name() + "_Body." + bodyField);
+			clBodyValue_s.add(bodyValue);
+		} else {
+			clBodyField_s.add("Policy.Body." + clPolicyType + "_Body." + bodyField);
+			clBodyValue_s.add(bodyValue);
+		}
+		filter_s.add(new Pair<ArrayList<String>, ArrayList<String>>(clBodyField_s, clBodyValue_s));
+	}
+
+	protected void clSearchFilter(String clType, String clField, String clValue, 
+			ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s) {
+		if (LOGGER.isDebugEnabled())
+			LOGGER.debug("ENTER: " + clType + ":" + clField + ":" + clValue);
+
+		ArrayList<String> clSearchField_s = new ArrayList<String>();
+		clSearchField_s.add("Policy.Body." + clType + "_Body." + clField);
+
+		ArrayList<String> clSearchValue_s = new ArrayList<String>();
+		clSearchValue_s.add(clValue);
+
+		filter_s.add(new Pair<ArrayList<String>,ArrayList<String>>(clSearchField_s, clSearchValue_s));
+	}
+
+	public ElkConnector.PolicyIndexType toPolicyIndexType(String type) throws IllegalArgumentException {
+		if (type == null || type.isEmpty())
+			return PolicyIndexType.all;
+
+		return PolicyIndexType.valueOf(type);
+	}
+
+	public boolean updateElk(PolicyRestAdapter policyData) {
+		boolean success = true;
+		try {
+			success = ElkConnector.singleton.update(policyData);
+			if (!success) {
+				if (LOGGER.isWarnEnabled()) {
+					LOGGER.warn("FAILURE to create ELK record created for " + policyData.getNewFileName());
+				}
+			} else {
+				if (LOGGER.isInfoEnabled()) {
+					LOGGER.warn("SUCCESS creating ELK record created for " + policyData.getNewFileName());
+				}									
+			}									
+		} catch (Exception e) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + ": " + e.getMessage(), e);
+			success = false;
+		}
+		return success;
+	}
+
+	public boolean deleteElk(PolicyRestAdapter policyData) {
+		boolean success = true;
+		try {
+			success = ElkConnector.singleton.delete(policyData);
+			if (!success) {
+				if (LOGGER.isWarnEnabled()) {
+					LOGGER.warn("FAILURE to delete ELK record created for " + policyData.getNewFileName());
+				}
+			} else {
+				if (LOGGER.isInfoEnabled()) {
+					LOGGER.warn("SUCCESS deleting ELK record created for " + policyData.getNewFileName());
+				}									
+			}									
+		} catch (Exception e) {
+			LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + ": " + e.getMessage(), e);
+			success = false;
+		}
+		return success;
+	}
+
+	@RequestMapping(value={"/searchDictionary"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
+	public ModelAndView searchDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		try{
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			JsonNode root = mapper.readTree(request.getReader());
+			String dictionaryType = root.get("type").textValue();
+			Mode mode = Mode.valueOf(dictionaryType);
+			String value; 
+			@SuppressWarnings("unused")
+			String msg;
+			switch (mode){
+			case attribute :
+				Attribute attributedata = (Attribute)mapper.readValue(root.get("data").toString(), Attribute.class);
+				value = attributedata.getXacmlId();
+				msg = searchElkDatabase("pholder",value);
+				break;
+			case ecompName :
+				EcompName ecompName = (EcompName)mapper.readValue(root.get("data").toString(), EcompName.class);
+				value = ecompName.getEcompName();
+				msg = searchElkDatabase("pholder",value);
+				break;
+			case actionPolicy :
+				ActionPolicyDict actionPolicyDict = (ActionPolicyDict)mapper.readValue(root.get("data").toString(), ActionPolicyDict.class);
+				value = actionPolicyDict.getAttributeName();
+				msg = searchElkDatabase("pholder",value);
+				break;
+			case brmsParam :
+				BRMSParamTemplate bRMSParamTemplate = (BRMSParamTemplate)mapper.readValue(root.get("data").toString(), BRMSParamTemplate.class);
+				value = bRMSParamTemplate.getRuleName();
+				msg = searchElkDatabase("BRMSParamTemplate AND " + value);
+				break;
+			case pepOptions :
+				PEPOptions pEPOptions = (PEPOptions)mapper.readValue(root.get("data").toString(), PEPOptions.class);
+				value = pEPOptions.getPepName();
+				msg = searchElkDatabase("pepName",value);
+				break;
+			case clSite :
+				ClosedLoopSite closedLoopSite = (ClosedLoopSite)mapper.readValue(root.get("data").toString(), ClosedLoopSite.class);
+				value = closedLoopSite.getSiteName();
+				msg = searchElkDatabase("siteNames",value);
+				break;
+			case clService :
+				ClosedLoopD2Services closedLoopD2Services = (ClosedLoopD2Services)mapper.readValue(root.get("data").toString(), ClosedLoopD2Services.class);
+				value = closedLoopD2Services.getServiceName();
+				msg = searchElkDatabase("d2Services",value);
+				break;
+			case clVarbind :
+				VarbindDictionary varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("data").toString(), VarbindDictionary.class);
+				value = varbindDictionary.getVarbindName();
+				msg = searchElkDatabase("triggerSignaturesUsedForUI.signatures",value);
+				break;
+			case clVnf :
+				VNFType vNFType = (VNFType)mapper.readValue(root.get("data").toString(), VNFType.class);
+				value = vNFType.getVnftype();
+				msg = searchElkDatabase("vnfType",value);
+				break;
+			case clVSCL :
+				VSCLAction vsclAction = (VSCLAction)mapper.readValue(root.get("data").toString(), VSCLAction.class);
+				value = vsclAction.getVsclaction();
+				msg = searchElkDatabase("actions",value);
+				break;
+			case decision :
+				DecisionSettings decisionSettings = (DecisionSettings)mapper.readValue(root.get("data").toString(), DecisionSettings.class);
+				value = decisionSettings.getXacmlId();
+				msg = searchElkDatabase("pholder",value);
+				break;
+			case enforcer :
+				EnforcingType enforcingType = (EnforcingType)mapper.readValue(root.get("data").toString(), EnforcingType.class);
+				value = enforcingType.getEnforcingType();
+				msg = searchElkDatabase("pholder",value);
+				break;			
+			case fwTerm :
+				TermList term = (TermList)mapper.readValue(root.get("data").toString(), TermList.class);
+				value = term.getTermName();
+				msg = searchElkDatabase("firewallRuleList.ruleName",value);
+				break;
+			case msDCAEUUID :
+				DCAEuuid dcaeUUID = (DCAEuuid)mapper.readValue(root.get("data").toString(), DCAEuuid.class);
+				value = dcaeUUID.getName();
+				msg = searchElkDatabase("uuid",value);
+				break;
+			case msLocation :
+				MicroServiceLocation mslocation = (MicroServiceLocation)mapper.readValue(root.get("data").toString(), MicroServiceLocation.class);
+				value = mslocation.getName();
+				msg = searchElkDatabase("location",value);
+				break;
+			case msModels :
+				MicroServiceModels msModels = (MicroServiceModels)mapper.readValue(root.get("data").toString(), MicroServiceModels.class);
+				value = msModels.getModelName();
+				msg = searchElkDatabase("configName",value);
+				break;
+			case psGroupPolicy :
+				GroupPolicyScopeList groupPoilicy = (GroupPolicyScopeList)mapper.readValue(root.get("data").toString(), GroupPolicyScopeList.class);
+				value = groupPoilicy.getGroupName();
+				msg = searchElkDatabase("PolicyScope",value);
+				break;
+			case safeRisk :
+				RiskType riskType= (RiskType)mapper.readValue(root.get("data").toString(), RiskType.class);
+				value = riskType.getRiskName();
+				msg = searchElkDatabase("Risk Type",value);
+				break;
+			case safePolicyWarning :
+				SafePolicyWarning safePolicy = (SafePolicyWarning)mapper.readValue(root.get("data").toString(), SafePolicyWarning.class);
+				value = safePolicy.getName();
+				msg = searchElkDatabase("Safe Warning",value);
+				break;
+			default: 		
+			}
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application / json");
+			request.setCharacterEncoding("UTF-8");
+
+			PrintWriter out = response.getWriter();
+			JSONObject j = new JSONObject("{result: " + policyNames + "}");
+			out.write(j.toString());
+			return null;
+		}catch(Exception e){
+			response.setCharacterEncoding("UTF-8");
+			request.setCharacterEncoding("UTF-8");
+			PrintWriter out = response.getWriter();
+			out.write(e.getMessage());
+		}
+		return null;
+	}
+
+	//Search Elk database
+	public String searchElkDatabase(String value){
+		String policyType = "";
+		String searchText = value;
+		ArrayList<PolicyLocator> locators;
+		ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s = new ArrayList<Pair<ArrayList<String>,ArrayList<String>>>();
+		try {
+			locators = ElkConnector.singleton.policyLocators(toPolicyIndexType(policyType), searchText, filter_s,0);	
+		} catch (Exception ise) {
+			LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Search is unavailable: " + ise.getMessage());
+			value = "$notSuccess%";
+			return value;
+		}
+		policyNames = new ArrayList<JSONObject>();
+		for (PolicyLocator p: locators) {
+			String dbPolicyName = p.scope + "/" + p.policyType + "_" + p.policyName + "." +p.version + ".xml";
+			LOGGER.debug(dbPolicyName);
+			JSONObject el = new JSONObject();
+			el.put("name", dbPolicyName);	
+			policyNames.add(el);
+		}
+		if(!locators.isEmpty()){
+			value = "$success%";
+			return value;
+		}
+		return value;
+	}
+
+	//Search the Elk database
+	public String searchElkDatabase(String key, String value){
+		String policyType = "";
+		String searchText = key+":"+value;
+		ArrayList<PolicyLocator> locators;
+		ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s = new ArrayList<Pair<ArrayList<String>,ArrayList<String>>>();
+		LOGGER.debug("Parameter value is"+value);
+
+		String clSearchKey=null;
+		clSearchKey=key;
+
+		LOGGER.debug("Filter value is"+clSearchKey);
+
+		ArrayList<String> clSearchBoxFilterField_s = new ArrayList<String>();
+
+		clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_Fault.name() + "_Body." + clSearchKey);
+		clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_PM.name() + "_Body." + clSearchKey);
+		clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_FW.name() + "_Body." + clSearchKey);
+		clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_MS.name() + "_Body." + clSearchKey);
+		//clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_PM.name() + "_Body." + clSearchKey);
+
+		String clSearchValue=null;
+		clSearchValue=value;
+
+		LOGGER.debug("Search value is"+clSearchValue);
+
+		ArrayList<String> clSearchBoxFilterValue_s = new ArrayList<String>();
+		clSearchBoxFilterValue_s.add(clSearchValue);
+
+		filter_s.add(new Pair<ArrayList<String>,ArrayList<String>>(clSearchBoxFilterField_s, clSearchBoxFilterValue_s));
+
+		try {
+			locators = ElkConnector.singleton.policyLocators(toPolicyIndexType(policyType), searchText, filter_s,0);	
+			LOGGER.debug("No Exceptions");
+			for (PolicyLocator l: locators) {
+				LOGGER.debug(l.policyName);
+			}
+			LOGGER.debug("After for");
+		} catch (Exception ise) {
+			LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Search is unavailable: " + ise.getMessage());
+			//PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, ise, "AttributeDictionary", " Exception while searching Elk database ");
+			LOGGER.debug("Exceptions");
+			value = "$notSuccess%";
+			return value;
+		}
+		policyNames = new ArrayList<JSONObject>();
+		for (PolicyLocator p: locators) {
+			String dbPolicyName = p.scope + File.separator + p.policyType + "_" + p.policyName + ".xml";
+			LOGGER.debug(dbPolicyName);
+			JSONObject el = new JSONObject();
+			el.put("name", dbPolicyName);	
+			policyNames.add(el);
+		}
+		if(!locators.isEmpty()){
+			value = "$success%";
+			LOGGER.debug("Success");
+			return value;
+		}
+		return value;
+	}
+
+	//For AutoPush of policy using descriptive Scope. 
+	//Returns string either "UnMatched" or "Matched" or "Search Unavailable".
+	public String searchDescriptiveScope(String scopeName, String policyNameToCheck) {
+		String searchText=null;
+		String status="UnMatched";
+		ArrayList<Pair<ArrayList<String>,ArrayList<String>>> filter_s = 
+				new ArrayList<Pair<ArrayList<String>,ArrayList<String>>>();
+		//Finding the descriptive scope search tag. 		
+		LOGGER.warn("Entry into DS");				
+		DescriptiveScope dsSearch = (DescriptiveScope) commonClassDao.getEntityItem(DescriptiveScope.class, "descriptiveScopeName", scopeName);
+
+		searchText=dsSearch.getSearch();
+		LOGGER.warn("Search text is  " + searchText);
+		if (LOGGER.isDebugEnabled()) {
+			LOGGER.debug("DescriptiveScope Search String is " +searchText );	
+		}
+
+
+		if(searchText.contains(":"))
+		{
+			String connector="AND";
+
+			for (String retval: searchText.split(connector)){
+
+				int index= retval.indexOf(':');
+				String filterKey=null;
+				String filterValue=null;
+
+				filterKey=retval.substring(0,index).trim();
+				filterValue= retval.substring(index+1).trim();
+
+				LOGGER.debug("Key is "+filterKey+" and value is "+filterValue);
+				String clSearchBoxFilter=filterKey;
+
+				ArrayList<String> clSearchBoxFilterField_s = new ArrayList<String>();
+
+				clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_Fault.name() + "_Body." + clSearchBoxFilter);
+				clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_PM.name() + "_Body." + clSearchBoxFilter);
+				clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_FW.name() + "_Body." + clSearchBoxFilter);
+				clSearchBoxFilterField_s.add("Policy.Body." + ElkConnector.PolicyType.Config_MS.name() + "_Body." + clSearchBoxFilter);
+
+
+				ArrayList<String> clSearchBoxFilterValue_s = new ArrayList<String>();
+				clSearchBoxFilterValue_s.add(filterValue);
+
+				filter_s.add(new Pair<ArrayList<String>,ArrayList<String>>(clSearchBoxFilterField_s, clSearchBoxFilterValue_s));
+			}
+		}
+
+		ArrayList<PolicyLocator> locators=null;
+		try {
+			LOGGER.warn("Before calling search");
+			locators = ElkConnector.singleton.policyLocators(ElkConnector.PolicyIndexType.all, 
+					searchText, filter_s,connectorSelected);	
+			LOGGER.warn("After calling search");
+		} catch (Exception ise) {
+			//AdminNotification.warn("Search is unavailable: " + ise.getMessage());
+			status= "Search Unavailable";
+			LOGGER.warn("Search is unavailable");
+		}
+		synchronized(filteredPolicies) {
+			if (locators.isEmpty()) {
+				LOGGER.debug("No match has been found");
+				//AdminNotification.warn("No match has been found");
+				status="UnMatched";
+			}
+
+			for (PolicyLocator p: locators) {
+				LOGGER.debug("Second String "+policyNameToCheck);
+				if(p.policyName.contains(policyNameToCheck))
+				{
+					status="Matched"; 
+					LOGGER.warn("Policies matched");
+					break;
+				}
+				else
+				{
+					LOGGER.warn("Policies Unmatched");
+					status="UnMatched";
+				}
+			}
+		}
+		return status;	
+
+	}
+}
+
+class SearchData{
+	private String query;
+	private String policyType;
+	private String descriptiveScope;
+	private String closedLooppolicyType;
+	private String ecompName;
+	private String d2Service;
+	private String vnfType;
+	private String policyStatus;
+	private String vproAction;
+	private String serviceType;
+	private String bindTextSearch;
+	public String getQuery() {
+		return query;
+	}
+	public void setQuery(String query) {
+		this.query = query;
+	}
+	public String getPolicyType() {
+		return policyType;
+	}
+	public void setPolicyType(String policyType) {
+		this.policyType = policyType;
+	}
+	public String getDescriptiveScope() {
+		return descriptiveScope;
+	}
+	public void setDescriptiveScope(String descriptiveScope) {
+		this.descriptiveScope = descriptiveScope;
+	}
+	public String getClosedLooppolicyType() {
+		return closedLooppolicyType;
+	}
+	public void setClosedLooppolicyType(String closedLooppolicyType) {
+		this.closedLooppolicyType = closedLooppolicyType;
+	}
+	public String getEcompName() {
+		return ecompName;
+	}
+	public void setEcompName(String ecompName) {
+		this.ecompName = ecompName;
+	}
+	public String getD2Service() {
+		return d2Service;
+	}
+	public void setD2Service(String d2Service) {
+		this.d2Service = d2Service;
+	}
+	public String getVnfType() {
+		return vnfType;
+	}
+	public void setVnfType(String vnfType) {
+		this.vnfType = vnfType;
+	}
+	public String getPolicyStatus() {
+		return policyStatus;
+	}
+	public void setPolicyStatus(String policyStatus) {
+		this.policyStatus = policyStatus;
+	}
+	public String getVproAction() {
+		return vproAction;
+	}
+	public void setVproAction(String vproAction) {
+		this.vproAction = vproAction;
+	}
+	public String getServiceType() {
+		return serviceType;
+	}
+	public void setServiceType(String serviceType) {
+		this.serviceType = serviceType;
+	}
+	public String getBindTextSearch() {
+		return bindTextSearch;
+	}
+	public void setBindTextSearch(String bindTextSearch) {
+		this.bindTextSearch = bindTextSearch;
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyLocator.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyLocator.java
new file mode 100644
index 0000000..f246c9b
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicyLocator.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+public class PolicyLocator {
+	public final String policyType;
+	public final String policyName;
+	public final String owner;
+	public final String scope;
+	public final String policyId;
+	public final String version;
+	
+	public PolicyLocator(String policyType, String policyName,
+			             String owner, String scope, String policyId,
+			             String version) {
+		this.policyType = policyType;
+		this.policyName= policyName;
+		this.owner = owner;
+		this.scope = scope;
+		this.policyId = policyId; 
+		this.version = version;
+	}
+	
+	public String toString() {
+		return "[" + 
+		       this.owner + "|" +
+			   this.scope + "|" +
+	           this.policyType + "|" + 
+			   this.policyName + "|" + 
+			   this.policyId + "|" +
+			   "v" + this.version + "|" + "]";
+	           
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicySearchController.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicySearchController.java
new file mode 100644
index 0000000..91f97ca
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/elk/client/PolicySearchController.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.elk.client;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.util.JsonMessage;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class PolicySearchController {
+	
+	private static final Logger LOGGER = FlexLogger.getLogger(PolicySearchController.class);
+
+	@RequestMapping(value="/searchPolicy", method= RequestMethod.POST)
+	public void elkTransaction(HttpServletRequest request, HttpServletResponse response) {
+		try{
+			boolean result = false;
+			ObjectMapper mapper = new ObjectMapper();
+			mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+			PolicyRestAdapter policyData = new PolicyRestAdapter();
+			if(request.getParameter("policyName") != null){
+				String policyName = request.getParameter("policyName");
+				policyData.setNewFileName(policyName);
+				PolicyElasticSearchController controller = new PolicyElasticSearchController();
+				if("delete".equalsIgnoreCase(request.getParameter("action"))){
+					result = controller.deleteElk(policyData);
+				}else{
+					result = controller.updateElk(policyData);
+				}
+			}
+			String message="";
+			if(result){
+				message = "Elastic Server Transaction is success";
+			}else{
+				message = "Elastic Server Transaction is failed, please check the logs";
+			}
+			JsonMessage msg = new JsonMessage(mapper.writeValueAsString(message));
+			JSONObject j = new JSONObject(msg);
+			response.setStatus(HttpServletResponse.SC_OK);
+			response.addHeader("success", "success"); 
+			response.getWriter().write(j.toString());
+		}catch(Exception e){
+			 response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+			 response.addHeader("error", "Exception Occured While Performing Elastic Transaction");
+			LOGGER.error("Exception Occured While Performing Elastic Transaction"+e.getMessage());
+			e.printStackTrace();
+		}
+	}
+	
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/APIRequestHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/APIRequestHandler.java
new file mode 100644
index 0000000..efaed9f
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/APIRequestHandler.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.handler;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.ECOMPLoggingContext;
+import org.openecomp.policy.pap.xacml.rest.service.ImportService;
+import org.openecomp.policy.pap.xacml.rest.service.MetricService;
+import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
+
+public class APIRequestHandler {
+
+	private EcompPDPGroup newGroup;
+
+	public void doGet(HttpServletRequest request, HttpServletResponse response, String apiflag) throws IOException{
+		// Request from the API to get Dictionary Items
+		if ("api".equalsIgnoreCase(apiflag)) {
+			DictionaryHandler dictionaryHandler = DictionaryHandler.getInstance();
+			dictionaryHandler.doDictionaryAPIGet(request, response);
+			return;
+		}
+		// Request from the API to get the gitPath
+		if ("gitPath".equalsIgnoreCase(apiflag)) {
+			PushPolicyHandler pushHandler = new PushPolicyHandler();
+			pushHandler.getGitPath(request, response);
+			return;
+		}
+		// Request from the API to get the ActiveVersion from the PolicyVersion table
+		if ("version".equalsIgnoreCase(apiflag)){
+			PushPolicyHandler pushHandler = new PushPolicyHandler();
+			pushHandler.getActiveVersion(request, response);
+			return;
+		}
+		// Request from the API to get the URI from the gitpath
+		if ("uri".equalsIgnoreCase(apiflag)){
+			PushPolicyHandler pushHandler = new PushPolicyHandler();
+			pushHandler.getSelectedURI(request, response);
+			return;
+		}
+		if ("getMetrics".equalsIgnoreCase(apiflag)){
+			MetricService.doGetPolicyMetrics(request, response);
+			return;
+		}
+	}
+
+	public void doPut(HttpServletRequest request, HttpServletResponse response, String service) throws IOException {
+		if ("MICROSERVICE".equalsIgnoreCase(service) || "BRMSPARAM".equalsIgnoreCase(service)){
+			ImportService importService = new ImportService();
+			importService.doImportMicroServicePut(request, response);
+			return;
+		}
+		if ("dictionaryItem".equalsIgnoreCase(service)) {
+			DictionaryHandler dictionaryHandler = DictionaryHandler.getInstance();
+			dictionaryHandler.doDictionaryAPIPut(request, response);
+			return;
+		} else {
+			SavePolicyHandler savePolicy = SavePolicyHandler.getInstance();
+			savePolicy.doPolicyAPIPut(request, response);
+		}
+	}
+
+	public void doDelete(HttpServletRequest request, HttpServletResponse response, ECOMPLoggingContext loggingContext, String apiflag) throws Exception {
+		DeleteHandler deleteHandler = DeleteHandler.getInstance();
+		if ("deletePapApi".equalsIgnoreCase(apiflag)) {
+			deleteHandler.doAPIDeleteFromPAP(request, response, loggingContext);
+			return;
+		} else if ("deletePdpApi".equalsIgnoreCase(apiflag)) {
+			deleteHandler.doAPIDeleteFromPDP(request, response, loggingContext);
+			setNewGroup(deleteHandler.getDeletedGroup());
+			return;
+		}
+	}
+	
+	private void setNewGroup(EcompPDPGroup newGroup) {
+		this.newGroup = newGroup;
+	}
+
+	public EcompPDPGroup getNewGroup() {
+		return newGroup;
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
new file mode 100644
index 0000000..15e1faa
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DeleteHandler.java
@@ -0,0 +1,458 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.handler;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.ECOMPLoggingContext;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
+import org.openecomp.policy.pap.xacml.rest.elk.client.PolicyElasticSearchController;
+import org.openecomp.policy.pap.xacml.rest.model.RemoveGroupPolicy;
+import org.openecomp.policy.pap.xacml.rest.util.JPAUtils;
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.rest.jpa.PolicyEntity;
+import org.openecomp.policy.rest.jpa.PolicyVersion;
+import org.openecomp.policy.utils.PolicyUtils;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
+import org.openecomp.policy.xacml.std.pap.StdPAPPolicy;
+import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
+
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.util.XACMLProperties;
+
+public class DeleteHandler {
+
+	private EcompPDPGroup newgroup;
+	
+	private static String papDbDriver = null;
+	private static String papDbUrl = null;
+	private static String papDbUser = null;
+	private static String papDbPassword = null;
+
+	public void doAPIDeleteFromPAP(HttpServletRequest request, HttpServletResponse response, ECOMPLoggingContext loggingContext) throws Exception {
+		// get the request content into a String
+		String json = null;
+		java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
+		scanner.useDelimiter("\\A");
+		json =  scanner.hasNext() ? scanner.next() : "";
+		scanner.close();
+		PolicyLogger.info("JSON request from API: " + json);
+		// convert Object sent as JSON into local object
+		StdPAPPolicy policy = PolicyUtils.jsonStringToObject(json, StdPAPPolicy.class);
+		String policyName = policy.getPolicyName();
+		Boolean policyVersionDeleted = false;
+		String removeXMLExtension;
+		int currentVersion;
+		String removeVersionExtension;
+		String splitPolicyName = null;
+		String[] split = null;
+		String status = "error";
+		PolicyEntity policyEntity = null;
+		JPAUtils jpaUtils = null;
+
+		papDbDriver = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_DRIVER);
+		papDbUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_URL);
+		papDbUser = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_USER);
+		papDbPassword = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_PASSWORD);
+		Connection con = null;
+		
+		try {
+			jpaUtils = JPAUtils.getJPAUtilsInstance(XACMLPapServlet.getEmf());
+		} catch (Exception e) {
+			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " Could not create JPAUtils instance on the PAP");
+			response.addHeader("error", "jpautils");
+			response.addHeader("operation", "delete");
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			return;
+		}
+		if (jpaUtils.dbLockdownIgnoreErrors()) {
+			PolicyLogger.warn("Policies are locked down");
+			response.addHeader("operation", "delete");
+			response.addHeader("lockdown", "true");
+			response.setStatus(HttpServletResponse.SC_ACCEPTED);
+			return;
+		}
+		EntityManager em = (EntityManager) XACMLPapServlet.getEmf().createEntityManager();
+		Query policyEntityQuery = null;
+		try{
+			if(policyName.endsWith(".xml")){
+				removeXMLExtension = policyName.replace(".xml", "");
+				currentVersion = Integer.parseInt(removeXMLExtension.substring(removeXMLExtension.lastIndexOf(".")+1));
+				removeVersionExtension = removeXMLExtension.substring(0, removeXMLExtension.lastIndexOf("."));
+				boolean queryCheck = true;
+				if(policy.getDeleteCondition().equalsIgnoreCase("All Versions")){
+					if(policyName.contains("Config_")){
+						splitPolicyName = removeVersionExtension.replace(".Config_", ":Config_");
+					}else if(policyName.contains("Action_")){
+						splitPolicyName = removeVersionExtension.replace(".Action_", ":Action_");
+					}else if(policyName.contains("Decision_")){
+						splitPolicyName = removeVersionExtension.replace(".Decision_", ":Decision_");
+					}
+					split = splitPolicyName.split(":");
+					policyEntityQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName LIKE :pName and p.scope=:pScope");
+				}else if(policy.getDeleteCondition().equalsIgnoreCase("Current Version")) {
+					if(policyName.contains("Config_")){
+						splitPolicyName = policyName.replace(".Config_", ":Config_");
+					}else if(policyName.contains("Action_")){
+						splitPolicyName = policyName.replace(".Action_", ":Action_");
+					}else if(policyName.contains("Decision_")){
+						splitPolicyName = policyName.replace(".Decision_", ":Decision_");
+					}
+					split = splitPolicyName.split(":");
+					queryCheck = false;
+					policyEntityQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName=:pName and p.scope=:pScope");
+				}
+				
+				if(queryCheck){
+					policyEntityQuery.setParameter("pName", "%"+split[1]+"%");
+				}else{
+					policyEntityQuery.setParameter("pName", split[1]);
+				}
+				
+				policyEntityQuery.setParameter("pScope", split[0]);
+				List<?> peResult = policyEntityQuery.getResultList();
+				if(!peResult.isEmpty()){
+					Query getPolicyVersion = em.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
+					getPolicyVersion.setParameter("pname", removeVersionExtension.replace(".", File.separator));
+					List<?> pvResult = getPolicyVersion.getResultList();
+					PolicyVersion pVersion = (PolicyVersion) pvResult.get(0);
+					int highestVersion = 0; 
+					em.getTransaction().begin();
+					Class.forName(papDbDriver);
+					con = DriverManager.getConnection(papDbUrl,papDbUser,papDbPassword);
+					
+					if(policy.getDeleteCondition().equalsIgnoreCase("All Versions")){
+						boolean groupCheck = checkPolicyGroupEntity(em, con, peResult);
+						if(!groupCheck){
+							for(Object peData : peResult){
+								policyEntity = (PolicyEntity) peData;
+								status = deletePolicyEntityData(em, policyEntity);
+							}
+						}else{
+							status = "PolicyInPDP";
+						}
+						if(status.equals("error")){
+							PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Exception Occured while deleting the Entity from Database.");
+							response.addHeader("error", "unknown");
+							response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+							return;
+						}else if(status.equals("PolicyInPDP")){
+							PolicyLogger.error(MessageCodes.GENERAL_WARNING + "Policy can't be deleted, it is active in PDP Groups.");
+							response.addHeader("error", "unknown");
+							response.setStatus(HttpServletResponse.SC_CONFLICT);
+							return;
+						}else{
+							try{
+								policyVersionDeleted = true;
+								em.remove(pVersion);
+							}catch(Exception e){
+								policyVersionDeleted = false;
+							}
+						}
+					}else if(policy.getDeleteCondition().equalsIgnoreCase("Current Version")){
+						boolean groupCheck = checkPolicyGroupEntity(em, con, peResult);
+						if(!groupCheck){
+							policyEntity = (PolicyEntity) peResult.get(0);
+							status = deletePolicyEntityData(em, policyEntity);
+						}else{
+							status = "PolicyInPDP";
+						}
+						
+						if(status.equals("error")){
+							PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Exception Occured while deleting the Entity from Database.");
+							response.addHeader("error", "unknown");
+							response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+							return;
+						}else if(status.equals("PolicyInPDP")){
+							PolicyLogger.error(MessageCodes.GENERAL_WARNING + "Policy can't be deleted, it is active in PDP Groups.");
+							response.addHeader("error", "unknown");
+							response.setStatus(HttpServletResponse.SC_CONFLICT);
+							return;
+						}else{
+							if(currentVersion > 1){
+								if(!peResult.isEmpty()){
+									for(Object object : peResult){
+										policyEntity = (PolicyEntity) object;
+										String policyEntityName = policyEntity.getPolicyName().replace(".xml", "");
+										int policyEntityVersion = Integer.parseInt(policyEntityName.substring(policyEntityName.lastIndexOf(".")+1));
+										if(policyEntityVersion > highestVersion){
+											highestVersion = policyEntityVersion;
+										}
+									}
+								}
+								pVersion.setActiveVersion(highestVersion);
+								pVersion.setHigherVersion(highestVersion);
+								try{
+									policyVersionDeleted = true;
+									em.persist(pVersion);
+								}catch(Exception e){
+									policyVersionDeleted = false;
+								}
+							}else{
+								try{
+									policyVersionDeleted = true;
+									em.remove(pVersion);
+								}catch(Exception e){
+									policyVersionDeleted = false;
+								}
+							}
+						}
+					}
+				}else{
+					PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + "Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.");
+					response.addHeader("error", "unknown");
+					response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+					return;
+				}
+			}
+			em.getTransaction().commit();
+		}catch(Exception e){
+			em.getTransaction().rollback();
+			PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR");
+			response.addHeader("error", "deleteDB");
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			return;
+		} finally {
+			em.close();
+			con.close();
+		}
+
+		if (policyVersionDeleted) {
+			response.setStatus(HttpServletResponse.SC_OK);
+			response.addHeader("successMapKey", "success");
+			response.addHeader("operation", "delete");
+			return;				
+		} else {
+			PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + "Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.");
+			response.addHeader("error", "unknown");
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+			return;
+		}
+	}
+	
+	public String deletePolicyEntityData(EntityManager em, PolicyEntity policyEntity) throws SQLException{
+		PolicyElasticSearchController controller = new PolicyElasticSearchController();
+		PolicyRestAdapter policyData = new PolicyRestAdapter();
+		String policyName = policyEntity.getPolicyName();
+		try{
+			if(policyName.contains("Config_")){
+				em.remove(policyEntity.getConfigurationData());
+			}else if(policyName.contains("Action_")){
+				em.remove(policyEntity.getActionBodyEntity());
+			}
+			String searchPolicyName = policyEntity.getScope() + "." + policyEntity.getPolicyName();
+			policyData.setNewFileName(searchPolicyName);
+			controller.deleteElk(policyData);
+			em.remove(policyEntity);
+		}catch(Exception e){
+			return "error";
+		}
+		return "success";
+	}
+	
+	public boolean checkPolicyGroupEntity(EntityManager em, Connection con, List<?> peResult) throws SQLException{
+		for(Object peData : peResult){
+			PolicyEntity policyEntity = (PolicyEntity) peData;
+			Statement st = null;
+			ResultSet rs = null;
+			st = con.createStatement();
+			rs = st.executeQuery("Select * from PolicyGroupEntity where policyid = '"+policyEntity.getPolicyId()+"'");
+			boolean gEntityList = rs.next();
+			rs.close();
+			if(gEntityList){
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public void doAPIDeleteFromPDP(HttpServletRequest request, HttpServletResponse response, ECOMPLoggingContext loggingContext) throws IOException {
+		String policyName = request.getParameter("policyName");
+		String groupId = request.getParameter("groupId");
+		String responseString = null;
+		// for PUT operations the group may or may not need to exist before the operation can be done
+		EcompPDPGroup group = null;
+		try {
+			group = XACMLPapServlet.getPAPEngine().getGroup(groupId);
+		} catch (PAPException e) {
+			PolicyLogger.error("Exception occured While PUT operation is performing for PDP Group"+e);
+		}
+		if (group == null) {
+			String message = "Unknown groupId '" + groupId + "'";
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " " + message);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response.addHeader("error", "UnknownGroup");
+			response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
+			return;
+		} else {
+			loggingContext.setServiceName("API:PAP.deletPolicyFromPDPGroup");
+			if (policyName.contains("xml")) {
+				PolicyLogger.debug("The full file name including the extension was provided for policyName.. continue.");
+			} else {
+				String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid policyName... "
+						+ "policyName must be the full name of the file to be deleted including version and extension";
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Invalid policyName... "
+						+ "policyName must be the full name of the file to be deleted including version and extension");
+				response.addHeader("error", message);
+        		response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+				return;
+			}
+			RemoveGroupPolicy removePolicy = new RemoveGroupPolicy((StdPDPGroup) group);
+			PDPPolicy policy =  group.getPolicy(policyName);
+			if (policy != null) {
+				
+				if ((policy.getId().contains("Config_MS_")) || (policy.getId().contains("BRMS_Param"))) {
+					if (preSafetyCheck(policy)) {
+						PolicyLogger.debug("Precheck Successful.");
+					}
+				}
+				
+				removePolicy.prepareToRemove(policy);
+				EcompPDPGroup updatedGroup = removePolicy.getUpdatedObject();
+				responseString = deletePolicyFromPDPGroup(updatedGroup, loggingContext);
+			} else {
+				String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy does not exist on the PDP.";
+				PolicyLogger.error(message);
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Policy does not exist on the PDP.");
+				response.addHeader("error", message);
+				response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+				return;
+			}			
+		}
+		if (responseString.equals("success")) {
+			PolicyLogger.info("Policy successfully deleted!");
+			PolicyLogger.audit("Policy successfully deleted!");
+			response.setStatus(HttpServletResponse.SC_OK);
+			response.addHeader("successMapKey", "success");
+			response.addHeader("operation", "delete");
+			return;		
+		} else if (responseString.equals("No Group")) {
+			String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Group update had bad input.";
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input.");
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			response.addHeader("error", "groupUpdate");
+			response.addHeader("message", message);
+			return;	
+		} else if (responseString.equals("DB Error")) {
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " Error while updating group in the database");
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			response.addHeader("error", "deleteDB");
+			return;
+		} else {
+			PolicyLogger.error(MessageCodes.ERROR_UNKNOWN + " Failed to delete the policy for an unknown reason.  Check the file system and other logs for further information.");
+			response.addHeader("error", "unknown");
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
+			return;
+		}
+	}
+
+	private String deletePolicyFromPDPGroup (EcompPDPGroup group, ECOMPLoggingContext loggingContext){
+		PolicyDBDaoTransaction acPutTransaction = XACMLPapServlet.getDbDaoTransaction();
+		String response = null;
+		loggingContext.setServiceName("API:PAP.DeleteHandler");
+		EcompPDPGroup existingGroup = null;
+		try {
+			existingGroup = XACMLPapServlet.getPAPEngine().getGroup(group.getId());
+		} catch (PAPException e1) {
+			PolicyLogger.error("Exception occured While Deleting Policy From PDP Group"+e1);
+		}
+		if (group == null || ! (group instanceof StdPDPGroup) || ! (group.getId().equals(existingGroup.getId()))) {
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Group update had bad input. id=" + existingGroup.getId() + " objectFromJSON="+group);
+			loggingContext.transactionEnded();
+			PolicyLogger.audit("Transaction Failed - See Error.log");
+			response = "No Group";
+			return response;
+		}
+		// The Path on the PAP side is not carried on the RESTful interface with the AC
+		// (because it is local to the PAP)
+		// so we need to fill that in before submitting the group for update
+		((StdPDPGroup)group).setDirectory(((StdPDPGroup)existingGroup).getDirectory());
+		try{
+			acPutTransaction.updateGroup(group, "XACMLPapServlet.doAPIDelete");
+		} catch(Exception e){
+			PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " Error while updating group in the database: "
+					+"group="+existingGroup.getId());
+			response = "DB Error";
+			return response;
+		}
+		try {
+			XACMLPapServlet.getPAPEngine().updateGroup(group);
+		} catch (PAPException e) {
+			PolicyLogger.error("Exception occured While Updating PDP Groups"+e);
+			response = "error in updateGroup method";
+		}
+		PolicyLogger.debug("Group '" + group.getId() + "' updated");
+		acPutTransaction.commitTransaction();
+		// Group changed, which might include changing the policies
+		try {
+			newgroup = existingGroup;
+		}  catch (Exception e) {
+			PolicyLogger.error("Exception occured in Group Change Method"+e);
+			response = "error in groupChanged method";
+		}
+		if (response==null){
+			response = "success";
+			PolicyLogger.audit("Policy successfully deleted!");
+			PolicyLogger.audit("Transaction Ended Successfully");
+		}
+		loggingContext.transactionEnded();
+		PolicyLogger.audit("Transaction Ended");
+		return response;
+	}
+	
+	public EcompPDPGroup getDeletedGroup(){
+		return newgroup;
+	}
+	
+	public boolean preSafetyCheck(PDPPolicy policy) {
+		return true;
+	}
+	
+	public static DeleteHandler getInstance() {
+		try {
+			Class<?> deleteHandler = Class.forName(XACMLProperties.getProperty("deletePolicy.impl.className", DeleteHandler.class.getName()));
+			DeleteHandler instance = (DeleteHandler) deleteHandler.newInstance(); 
+			return instance;
+		} catch (Exception e) {
+			PolicyLogger.error(e.getMessage());
+		}
+		return null;
+	}
+
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DictionaryHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DictionaryHandler.java
new file mode 100644
index 0000000..43342dd
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DictionaryHandler.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.handler;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+
+import com.att.research.xacml.util.XACMLProperties;
+
+public interface DictionaryHandler {
+	String DICTIONARY_DEFAULT_CLASS = DictionaryHandlerImpl.class.getName();
+
+	/*
+	 * Get Instance
+	 */
+	public static DictionaryHandler getInstance(){
+		try {
+			Class<?> dictionaryHandler = Class.forName(XACMLProperties.getProperty("dictionary.impl.className", DICTIONARY_DEFAULT_CLASS));
+			DictionaryHandler instance = (DictionaryHandler) dictionaryHandler.newInstance(); 
+			return instance;
+		} catch (Exception e) {
+			PolicyLogger.error(e.getMessage());
+		}
+		return null;
+	}
+	
+	/*
+	 * Get Equivalent for Dictionary Services.
+	 */
+	public void doDictionaryAPIGet(HttpServletRequest request, HttpServletResponse response);
+	/*
+	 * Put Equivalent for Dictionary Services. 
+	 */
+	public void doDictionaryAPIPut(HttpServletRequest request, HttpServletResponse response);
+	
+	/**
+	 * Can be used to extend the services.
+	 * 
+	 * getflag=true indicates Get Request.
+	 * getflag=false indicates Put Request.  
+	 * @return 
+	 */
+	public String extendedOptions(String dictionaryType, HttpServletRequest request, HttpServletResponse response, boolean getflag);
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
new file mode 100644
index 0000000..8b462ba
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
@@ -0,0 +1,323 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.handler;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.service.DictionaryService;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+public class DictionaryHandlerImpl implements DictionaryHandler{
+	/*
+	 * Get Equivalent for Dictionary Services.
+	 */
+	public void doDictionaryAPIGet(HttpServletRequest request, HttpServletResponse response) {
+		String dictionaryType = request.getParameter("dictionaryType");
+		try {
+			DictionaryService dictionary = new DictionaryService();
+			switch (dictionaryType) {
+			case "EcompName":
+				dictionary.getEcompDictionary(request, response);
+				break;
+			case "Attribute":
+				dictionary.getAttributeDictionary(request, response);
+				break;
+			case "Action":
+				dictionary.getActionPolicyDictionary(request, response);
+				break;
+			case "BRMSParamTemplate":
+				dictionary.getBRMSParamDictionary(request, response);
+				break;
+			case "VSCLAction":
+				dictionary.getVSCLAction(request, response);
+				break;
+			case "VNFType":
+				dictionary.getVnfType(request, response);
+				break;
+			case "PEPOptions":
+				dictionary.getPEPOptions(request, response);
+				break;
+			case "Varbind":
+				dictionary.getVarbind(request, response);
+				break;
+			case "Service":
+				dictionary.getServiceType(request, response);
+				break;
+			case "Site":
+				dictionary.getSiteType(request, response);
+				break;
+			case "Settings":
+				dictionary.getSettingsDictionary(request, response);
+				break;
+			case "DescriptiveScope":
+				dictionary.getDescriptiveDictionary(request, response);
+				break;
+			case "Enforcer":
+				dictionary.getEnforcerDictionary(request, response);
+				break;
+			case "ActionList":
+				dictionary.getActionListDictionary(request, response);
+				break;
+			case "ProtocolList":
+				dictionary.getProtocolListDictionary(request, response);
+				break;
+			case "Zone":
+				dictionary.getZoneDictionary(request, response);
+				break;
+			case "SecurityZone":
+				dictionary.getSecurityZoneDictionary(request, response);
+				break;
+			case "PrefixList":
+				dictionary.getPrefixListDictionary(request, response);
+				break;
+			case "AddressGroup":
+				dictionary.getAddressGroupDictionary(request, response);
+				break;
+			case "ServiceGroup":
+				dictionary.getServiceGroupDictionary(request, response);
+				break;
+			case "ServiceList":
+				dictionary.getServiceListDictionary(request, response);
+				break;
+			case "TermList":
+			case "RuleList":
+			case "FirewallRuleList":
+			case "Term":
+				dictionary.getTermListDictionary(request, response);
+				break;
+			case "MicroServiceLocation":
+				dictionary.getMicroServiceLocationDictionary(request, response);
+				break;
+			case "MicroServiceConfigName":
+				dictionary.getMicroServiceConfigNameDictionary(request, response);
+				break;
+			case "DCAEUUID":
+				dictionary.getDCAEUUIDDictionary(request, response);
+				break;
+			case "MicroServiceModels":
+				dictionary.getMicroServiceModelsDictionary(request, response);
+				break;
+			case "PolicyScopeService":
+				dictionary.getPSServiceDictionary(request, response);
+				break;
+			case "PolicyScopeResource":
+				dictionary.getPSResourceDictionary(request, response);
+				break;
+			case "PolicyScopeType":
+				dictionary.getPSTypeDictionary(request, response);
+				break;
+			case "PolicyScopeClosedLoop":
+				dictionary.getPSClosedLoopDictionary(request, response);
+				break;
+			case "GroupPolicyScopeList":
+				dictionary.getPSGroupScopeDictionary(request, response);
+				break;
+			case "RiskType":
+				dictionary.getRiskTypeDictionary(request, response);
+				break;
+			case "SafePolicyWarning":
+				dictionary.getSafePolicyWarningDictionary(request, response);
+				break;
+			case "MicroServiceDictionary":
+				dictionary.getMicroServiceDictionary(request, response);
+				break;
+			default:
+				extendedOptions(dictionaryType, request, response, true);
+				return;
+			}
+		} catch (Exception e) {
+			String message = XACMLErrorConstants.ERROR_DATA_ISSUE + " Error Querying the Database: " + e.getMessage();
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "DictionaryHandler", " Error Querying the Database.");
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
+			response.addHeader("error", "dictionaryDBQuery");
+			response.addHeader("error", message);
+			return;
+		}
+	}
+	
+	/**
+	 * Can be used to extend the services.
+	 * 
+	 * getflag=true indicates Get Request.
+	 * getflag=false indicates Put Request.  
+	 * @return 
+	 */
+	public String extendedOptions(String dictionaryType, HttpServletRequest request, HttpServletResponse response, boolean getflag) {
+		// Default code
+		String message = XACMLErrorConstants.ERROR_DATA_ISSUE + " Invalid Dictionary in Request.";
+		PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "DictionaryHandler", " Invalid Dictionary in Request.");
+		response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+		response.setHeader("error", "dictionary");
+		response.addHeader("error", message);
+		return null;
+	}
+
+	public void doDictionaryAPIPut(HttpServletRequest request, HttpServletResponse response) {
+		String result = null;
+		String dictionaryType = request.getParameter("dictionaryType");
+		String operation = request.getParameter("operation");         
+		try {
+			DictionaryService dictionary = new DictionaryService();
+			switch (dictionaryType) {
+			case "EcompName":
+				result = dictionary.saveEcompDictionary(request, response);
+				break;
+			case "Attribute":
+				result = dictionary.saveAttributeDictionary(request, response);
+				break;
+			case "Action":
+				result = dictionary.saveActionPolicyDictionary(request, response);
+				break;
+			case "BRMSParamTemplate":
+				result = dictionary.saveBRMSParamDictionary(request, response);
+				break;
+			case "VSCLAction":
+				result = dictionary.saveVSCLAction(request, response);
+				break;
+			case "VNFType":
+				result = dictionary.saveVnfType(request, response);
+				break;
+			case "PEPOptions":
+				result = dictionary.savePEPOptions(request, response);
+				break;
+			case "Varbind":
+				result = dictionary.saveVarbind(request, response);
+				break;
+			case "Service":
+				result = dictionary.saveServiceType(request, response);
+				break;
+			case "Site":
+				result = dictionary.saveSiteType(request, response);
+				break;
+			case "Settings":
+				result = dictionary.saveSettingsDictionary(request, response);
+				break;
+			case "DescriptiveScope":
+				result = dictionary.saveDescriptiveDictionary(request, response);
+				break;
+			case "Enforcer":
+				result = dictionary.saveEnforcerDictionary(request, response);
+				break;
+			case "ActionList":
+				result = dictionary.saveActionListDictionary(request, response);
+				break;
+			case "ProtocolList":
+				result = dictionary.saveProtocolListDictionary(request, response);
+				break;
+			case "Zone":
+				result = dictionary.saveZoneDictionary(request, response);
+				break;
+			case "SecurityZone":
+				result = dictionary.saveSecurityZoneDictionary(request, response);
+				break;
+			case "PrefixList":
+				result = dictionary.savePrefixListDictionary(request, response);
+				break;
+			case "AddressGroup":
+				result = dictionary.saveAddressGroupDictionary(request, response);
+				break;
+			case "ServiceGroup":
+				result = dictionary.saveServiceGroupDictionary(request, response);
+				break;
+			case "ServiceList":
+				result = dictionary.saveServiceListDictionary(request, response);
+				break;
+			case "TermList":
+			case "RuleList":
+			case "FirewallRuleList":
+			case "Term":
+				result = dictionary.saveTermListDictionary(request, response);
+				break;
+			case "MicroServiceLocation":
+				result = dictionary.saveMicroServiceLocationDictionary(request, response);
+				break;
+			case "MicroServiceConfigName":
+				result = dictionary.saveMicroServiceConfigNameDictionary(request, response);
+				break;
+			case "DCAEUUID":
+				result = dictionary.saveDCAEUUIDDictionary(request, response);
+				break;
+			case "MicroServiceModels":
+				result = dictionary.saveMicroServiceModelsDictionary(request, response);
+				break;
+			case "PolicyScopeService":
+				result = dictionary.savePSServiceDictionary(request, response);
+				break;
+			case "PolicyScopeResource":
+				result = dictionary.savePSResourceDictionary(request, response);
+				break;
+			case "PolicyScopeType":
+				result = dictionary.savePSTypeDictionary(request, response);
+				break;
+			case "PolicyScopeClosedLoop":
+				result = dictionary.savePSClosedLoopDictionary(request, response);
+				break;
+			case "GroupPolicyScopeList":
+				result = dictionary.savePSGroupScopeDictionary(request, response);
+				break;
+			case "RiskType":
+				result = dictionary.saveRiskTypeDictionary(request, response);
+				break;
+			case "SafePolicyWarning":
+				result = dictionary.saveSafePolicyWarningDictionary(request, response);
+				break;
+			case "MicroServiceDictionary":
+				result = dictionary.saveMicroServiceDictionary(request, response);
+				break;
+			default:
+				result = extendedOptions(dictionaryType, request, response, false);
+				if(result==null){
+					return;
+				}else{
+					break;
+				}
+			}
+		} catch (Exception e) {
+			String message = XACMLErrorConstants.ERROR_DATA_ISSUE + " Error Updating the Database: " + e.getMessage();
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPapServlet", " Error Updating the Database.");
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+			response.addHeader("error", message);
+			return;
+		}
+		if (result.equalsIgnoreCase("Success")) {
+			response.setStatus(HttpServletResponse.SC_OK);                              
+			response.addHeader("successMapKey", "success");
+			if (operation.equalsIgnoreCase("update")) {
+				response.addHeader("operation",  "updateDictionary");
+			} else {
+				response.addHeader("operation", "createDictionary");
+			}
+		} else if (result.equalsIgnoreCase("Duplicate")) {
+			response.setStatus(HttpServletResponse.SC_CONFLICT);
+			response.addHeader("error", "dictionaryItemExists");
+		} else if (result.equalsIgnoreCase("DuplicateGroup")) {
+			response.setStatus(HttpServletResponse.SC_CONFLICT);
+			response.addHeader("error", "duplicateGroup");
+		} else {
+			String message = XACMLErrorConstants.ERROR_DATA_ISSUE + " Error Updating the Database.";
+        	PolicyLogger.error(message);
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);	
+			response.addHeader("error", message);
+		}
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/PushPolicyHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/PushPolicyHandler.java
new file mode 100644
index 0000000..59fa60a
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/PushPolicyHandler.java
@@ -0,0 +1,210 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.handler;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.jpa.PolicyVersion;
+import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
+import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
+import org.openecomp.policy.xacml.util.XACMLPolicyScanner;
+
+import com.att.research.xacml.util.XACMLProperties;
+
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+
+public class PushPolicyHandler {
+	
+	/*
+	 * Get Active Version. 
+	 */
+	public void getActiveVersion(HttpServletRequest request, HttpServletResponse response) {
+		EntityManager em = null;
+		if(XACMLPapServlet.getEmf()!=null){
+			em = (EntityManager) XACMLPapServlet.getEmf().createEntityManager();
+		}
+		if (em==null){
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Error creating entity manager with persistence unit: " + XACMLPapServlet.getPersistenceUnit());
+			return;
+		}
+		String policyScope = request.getParameter("policyScope");
+		String filePrefix = request.getParameter("filePrefix");
+		String policyName = request.getParameter("policyName");
+
+		String pvName = policyScope + File.separator + filePrefix + policyName;
+		int activeVersion = 0;
+
+		//Get the Active Version to use in the ID
+		em.getTransaction().begin();
+		Query query = em.createQuery("Select p from PolicyVersion p where p.policyName=:pname");
+		query.setParameter("pname", pvName);
+
+		@SuppressWarnings("rawtypes")
+		List result = query.getResultList();
+		PolicyVersion versionEntity = null;
+		if (!result.isEmpty()) {
+			versionEntity = (PolicyVersion) result.get(0);
+			em.persist(versionEntity);
+			activeVersion = versionEntity.getActiveVersion();
+			em.getTransaction().commit();
+		} else {
+			PolicyLogger.debug("No PolicyVersion using policyName found");
+		}
+
+		//clean up connection
+		em.close();
+		if (String.valueOf(activeVersion)!=null || !String.valueOf(activeVersion).equalsIgnoreCase("")) {							
+			response.setStatus(HttpServletResponse.SC_OK);								
+			response.addHeader("version", String.valueOf(activeVersion));								
+		} else {
+			response.setStatus(HttpServletResponse.SC_NOT_FOUND);								
+		}
+	}
+	
+	/*
+	 * Get Git Path 
+	 */
+	public void getGitPath(HttpServletRequest request, HttpServletResponse response) {
+		String policyScope = request.getParameter("policyScope");
+		String filePrefix = request.getParameter("filePrefix");
+		String policyName = request.getParameter("policyName");
+		String activeVersion = request.getParameter("activeVersion");
+		
+		Path workspacePath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE), "admin");
+		Path repositoryPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
+		Path gitPath = Paths.get(workspacePath.toString(), repositoryPath.getFileName().toString());
+		
+		//getting the fullpath of the gitPath and convert to string
+		String fullGitPath = gitPath.toAbsolutePath().toString();
+		String finalGitPath = null;
+		
+		//creating the parentPath directory for the Admin Console use
+		if(fullGitPath.contains("\\")){
+			if(fullGitPath.contains("ECOMP-PAP-REST")){
+				finalGitPath = fullGitPath.replace("ECOMP-PAP-REST", "ecomp-sdk-app");
+			}else{
+				finalGitPath = fullGitPath.replace("ATT-PAP-REST", "ATT-ecomp-sdk-app");
+			}
+		}else{
+			finalGitPath = fullGitPath.replace("pap",  "console");
+		}
+
+		finalGitPath += File.separator + policyScope + File.separator + filePrefix + policyName + "." + activeVersion + ".xml";
+		File file = new File(finalGitPath);
+		URI uri = file.toURI();
+
+		//
+		// Extract XACML policy information
+		//
+		Boolean isValid = false;
+		String policyId = null;
+		String description = null;
+		String	version = null;
+
+		URL url;
+		try {
+			url = uri.toURL();
+			Object rootElement = XACMLPolicyScanner.readPolicy(url.openStream());
+			if (rootElement == null ||
+					(
+							! (rootElement instanceof PolicySetType) &&
+							! (rootElement instanceof PolicyType)
+							)	) {
+				PolicyLogger.warn("No root policy element in URI: " + uri.toString() + " : " + rootElement);
+				isValid = false;
+			} else {
+				if (rootElement instanceof PolicySetType) {
+					policyId = ((PolicySetType)rootElement).getPolicySetId();
+					description = ((PolicySetType)rootElement).getDescription();
+					isValid = true;
+					version = ((PolicySetType)rootElement).getVersion();
+				} else if (rootElement instanceof PolicyType) {
+					policyId = ((PolicyType)rootElement).getPolicyId();
+					description = ((PolicyType)rootElement).getDescription();
+					version = ((PolicyType)rootElement).getVersion();
+					isValid = true;
+				} else {
+					PolicyLogger.error("Unknown root element: " + rootElement.getClass().getCanonicalName());
+				}
+			}
+		} catch (Exception e) {
+			PolicyLogger.error("Exception Occured While Extracting Policy Information");
+		} 
+		if (!finalGitPath.equalsIgnoreCase("") || policyId!=null || description!=null || version!=null || isValid!=null) {							
+			response.setStatus(HttpServletResponse.SC_OK);								
+			response.addHeader("gitPath", finalGitPath);
+			response.addHeader("policyId", policyId);
+			response.addHeader("description", description);
+			response.addHeader("version", version);
+			response.addHeader("isValid", isValid.toString());
+		}
+	}
+	
+	/*
+	 * Get Selected URI path. 
+	 */
+	public void getSelectedURI(HttpServletRequest request, HttpServletResponse response) {
+		String gitPath = request.getParameter("gitPath");
+		File file = new File(gitPath);
+		PolicyLogger.debug("The fileItem is : " + file.toString());
+		URI selectedURI = file.toURI();
+		String uri = selectedURI.toString();
+		if (!uri.equalsIgnoreCase("")) {							
+			response.setStatus(HttpServletResponse.SC_OK);								
+			response.addHeader("selectedURI", uri);								
+		} else {						
+			response.setStatus(HttpServletResponse.SC_NOT_FOUND);								
+		}						
+	}
+	
+	public boolean preSafetyCheck(StdPDPPolicy policy, String configHome){
+		return true;
+	}
+	
+	public boolean preSafetyCheck(EcompPDPGroup policy, String configHome){
+		return true;
+	}
+	
+	public static PushPolicyHandler getInstance() {
+		try {
+			Class<?> pushPolicyHandler = Class.forName(XACMLProperties.getProperty("pushPolicy.impl.className", PushPolicyHandler.class.getName()));
+			PushPolicyHandler instance = (PushPolicyHandler) pushPolicyHandler.newInstance(); 
+			return instance;
+		} catch (Exception e) {
+			PolicyLogger.error(e.getMessage());
+		}
+		return null;
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
new file mode 100644
index 0000000..65402d5
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/handler/SavePolicyHandler.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.handler;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.pap.xacml.rest.policycontroller.PolicyCreation;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.utils.PolicyUtils;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.openecomp.policy.xacml.std.pap.StdPAPPolicy;
+import org.xml.sax.SAXException;
+
+import com.att.research.xacml.util.XACMLProperties;
+
+public class SavePolicyHandler {
+	private HashMap<String, String> ErrorHeaders = null;
+	
+	public void doPolicyAPIPut(HttpServletRequest request, HttpServletResponse response) throws IOException {
+		String operation = request.getParameter("operation");
+		String policyType = request.getParameter("policyType");
+		String apiflag = request.getParameter("apiflag");
+		PolicyCreation creation = new PolicyCreation();
+        if ( policyType != null ) {
+			PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
+			if("update".equalsIgnoreCase(operation)){
+				policyAdapter.setEditPolicy(true);
+			}else{
+				policyAdapter.setEditPolicy(false);
+			}
+			
+			// get the request content into a String
+			String json = null;
+			// read the inputStream into a buffer (trick found online scans entire input looking for end-of-file)
+			java.util.Scanner scanner = new java.util.Scanner(request.getInputStream());
+			scanner.useDelimiter("\\A");
+			json =  scanner.hasNext() ? scanner.next() : "";
+			scanner.close();
+			PolicyLogger.info("JSON request from API: " + json);
+			// convert Object sent as JSON into local object
+			StdPAPPolicy policy = PolicyUtils.jsonStringToObject(json, StdPAPPolicy.class);
+			//Set policyAdapter values including parentPath (Common to all policy types)
+			try {
+                policyAdapter = setDataToPolicyAdapter(policy, policyType, apiflag);
+                
+                if(!extendedPolicyOptions(policyAdapter, response)){
+                	creation.savePolicy(policyAdapter, response);
+                }
+                if ("update".equalsIgnoreCase(operation)) {
+					response.addHeader("operation",  "update");
+				} else {
+					response.addHeader("operation", "create");
+				}
+			} catch (Exception e1) {
+				PolicyLogger.error(XACMLErrorConstants.ERROR_UNKNOWN + 
+						"Could not set data to policy adapter "+ e1.getMessage());
+			}
+        }
+	}
+
+	private PolicyRestAdapter setDataToPolicyAdapter(StdPAPPolicy policy, String policyType, String apiflag) throws ParserConfigurationException, ServletException, SAXException, IOException{
+		PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
+		policyAdapter.setApiflag(apiflag);
+		/*
+		 * set policy adapter values for Building JSON object containing policy data
+		 */
+		//Common among policy types
+		policyAdapter.setPolicyName(policy.getPolicyName());
+		policyAdapter.setPolicyDescription(policy.getPolicyDescription());
+		policyAdapter.setEcompName(policy.getEcompName()); //Config Base and Decision Policies
+		policyAdapter.setRuleCombiningAlgId("urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
+	
+		policyAdapter.setPolicyType(policyType);
+		policyAdapter.setDynamicFieldConfigAttributes(policy.getDynamicFieldConfigAttributes());
+		policyAdapter.setEditPolicy(policy.isEditPolicy());
+		policyAdapter.setEntityManagerFactory(XACMLPapServlet.getEmf());
+		//Config Specific
+		policyAdapter.setConfigName(policy.getConfigName());  //Base and Firewall
+		policyAdapter.setConfigBodyData(policy.getConfigBodyData()); //Base
+		policyAdapter.setConfigType((policy.getConfigType()!=null) ? policy.getConfigType().toUpperCase(): null);  //Base
+		policyAdapter.setJsonBody(policy.getJsonBody()); //Firewall, ClosedLoop
+		policyAdapter.setConfigPolicyType(policy.getConfigPolicyType());
+		policyAdapter.setDraft(policy.isDraft()); //ClosedLoop_Fault
+		policyAdapter.setServiceType(policy.getServiceType()); //ClosedLoop_PM
+		policyAdapter.setUuid(policy.getUuid()); //Micro Service
+		policyAdapter.setLocation(policy.getMsLocation()); //Micro Service
+		policyAdapter.setPriority(policy.getPriority()); //Micro Service
+		policyAdapter.setPolicyScope(policy.getDomainDir());
+		policyAdapter.setRiskType(policy.getRiskType()); //Safe Policy Attributes
+		policyAdapter.setRiskLevel(policy.getRiskLevel());//Safe Policy Attributes
+		policyAdapter.setGuard(policy.getGuard());//Safe Policy Attributes
+		policyAdapter.setTtlDate(policy.getTTLDate());//Safe Policy Attributes
+		policyAdapter.setBrmsParamBody(policy.getDrlRuleAndUIParams());
+        policyAdapter.setBrmsDependency(policy.getBrmsDependency()); // BRMS Policies.
+        policyAdapter.setBrmsController(policy.getBrmsController()); // BRMS Policies.
+		//Action Policy Specific
+		policyAdapter.setActionAttribute(policy.getActionAttribute());  //comboDictValue
+		policyAdapter.setActionPerformer(policy.getActionPerformer());
+		policyAdapter.setDynamicRuleAlgorithmLabels(policy.getDynamicRuleAlgorithmLabels());
+		policyAdapter.setDynamicRuleAlgorithmCombo(policy.getDynamicRuleAlgorithmCombo());
+		policyAdapter.setDynamicRuleAlgorithmField1(policy.getDynamicRuleAlgorithmField1());
+		policyAdapter.setDynamicRuleAlgorithmField2(policy.getDynamicRuleAlgorithmField2());
+		//Decision Policy Specific
+		policyAdapter.setDynamicSettingsMap(policy.getDynamicSettingsMap());
+		policyAdapter.setProviderComboBox(policy.getProviderComboBox());
+		policyAdapter.setDomainDir(policyAdapter.getPolicyScope());
+		policyAdapter.setDomain(policyAdapter.getPolicyScope());
+		return policyAdapter;
+	}
+	
+	public boolean extendedPolicyOptions(PolicyRestAdapter policyAdapter, HttpServletResponse response){
+		return false;
+	}
+	
+	public void addErrorHeader(String key, String value){
+		if(ErrorHeaders==null){
+			ErrorHeaders= new HashMap<String, String>();
+		}
+		ErrorHeaders.put(key, value);
+	}
+
+	public static SavePolicyHandler getInstance() {
+		try {
+			Class<?> savePolicyHandler = Class.forName(XACMLProperties.getProperty("savePolicy.impl.className", SavePolicyHandler.class.getName()));
+			SavePolicyHandler instance = (SavePolicyHandler) savePolicyHandler.newInstance(); 
+			return instance;
+		} catch (Exception e) {
+			PolicyLogger.error(e.getMessage());
+		}
+		return null;
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
index e91c79a..0482310 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/PDPPolicyContainer.java
@@ -20,23 +20,22 @@
 
 package org.openecomp.policy.pap.xacml.rest.model;
 
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.util.PolicyContainer;
 import org.openecomp.policy.pap.xacml.rest.util.PolicyItemSetChangeNotifier;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-
 import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
+
 import com.att.research.xacml.api.pap.PDP;
 import com.att.research.xacml.api.pap.PDPGroup;
 import com.att.research.xacml.api.pap.PDPPolicy;
-import org.openecomp.policy.xacml.std.pap.StdPDPPolicy;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
index bb6e118..24e2f04 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/RemoveGroupPolicy.java
@@ -24,14 +24,11 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.openecomp.policy.pap.xacml.rest.model.PDPPolicyContainer;
-
-import com.att.research.xacml.api.pap.PDPGroup;
-import com.att.research.xacml.api.pap.PDPPolicy;
-
 import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
 import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
 
+import com.att.research.xacml.api.pap.PDPPolicy;
+
 public class RemoveGroupPolicy {
 
 	
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/package-info.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/package-info.java
index 4f7d76a..d3673eb 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/package-info.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/model/package-info.java
@@ -17,11 +17,4 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/**
- * 
- */
-/**
- *
- */
 package org.openecomp.policy.pap.xacml.rest.model;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
new file mode 100644
index 0000000..a987e9a
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
@@ -0,0 +1,488 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.policycontroller;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.pap.xacml.rest.components.ActionPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.ClosedLoopPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.ConfigPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.CreateBrmsParamPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.CreateBrmsRawPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.CreateClosedLoopPerformanceMetrics;
+import org.openecomp.policy.pap.xacml.rest.components.DecisionPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.FirewallConfigPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.MicroServiceConfigPolicy;
+import org.openecomp.policy.pap.xacml.rest.components.Policy;
+import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao;
+import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
+import org.openecomp.policy.pap.xacml.rest.elk.client.PolicyElasticSearchController;
+import org.openecomp.policy.pap.xacml.rest.util.AbstractPolicyCreation;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+import org.openecomp.policy.rest.dao.CommonClassDao;
+import org.openecomp.policy.rest.jpa.ActionPolicyDict;
+import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
+import org.openecomp.policy.rest.jpa.PolicyEditorScopes;
+import org.openecomp.policy.rest.jpa.PolicyVersion;
+import org.openecomp.policy.rest.jpa.UserInfo;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+@RestController
+@RequestMapping("/")
+public class PolicyCreation extends AbstractPolicyCreation{
+
+	private static final Logger LOGGER	= FlexLogger.getLogger(PolicyCreation.class);
+
+	private String ruleID = "";
+	private PolicyDBDao policyDBDao;
+	String CLName = null;
+	
+	private static CommonClassDao commonClassDao;
+	
+	@Autowired
+	public PolicyCreation(CommonClassDao commonClassDao){
+		PolicyCreation.commonClassDao = commonClassDao;
+	}
+
+	public PolicyCreation(){}
+	
+	@RequestMapping(value="/policycreation/save_policy", method = RequestMethod.POST)
+	@ResponseBody
+	public ResponseEntity<String> savePolicy(@RequestBody PolicyRestAdapter policyData, HttpServletResponse response) throws Exception{
+		String body = null;
+		HttpStatus status = HttpStatus.BAD_REQUEST;
+		Map<String, String> successMap = new HashMap<String, String>();
+		Map<String, String> attributeMap = new HashMap<String, String>();
+		PolicyVersion policyVersionDao;
+		try {
+		
+			Policy newPolicy = null;
+			String policyConfigType = null;
+			String userId = policyData.getUserId();
+
+			if (policyData.getTtlDate()==null){
+				policyData.setTtlDate("NA");
+			}else{
+				String dateTTL = policyData.getTtlDate();
+				String newDate = convertDate(dateTTL, false);
+				policyData.setTtlDate(newDate);
+			}
+
+			String policyType = policyData.getPolicyType();
+
+			String filePrefix = null;
+			if (policyType.equalsIgnoreCase("Config")) {
+				policyConfigType = policyData.getConfigPolicyType();
+				if (policyConfigType.equalsIgnoreCase("Firewall Config")) {
+					filePrefix = "Config_FW_";
+				}else if (policyConfigType.equalsIgnoreCase("ClosedLoop_Fault")) {
+					filePrefix = "Config_Fault_";
+				}else if (policyConfigType.equalsIgnoreCase("ClosedLoop_PM")) {
+					filePrefix = "Config_PM_";
+				}else if (policyConfigType.equalsIgnoreCase("Micro Service")) {
+					filePrefix = "Config_MS_";
+				}else if (policyConfigType.equalsIgnoreCase("BRMS_Raw")) {
+					filePrefix = "Config_BRMS_Raw_";
+				}else if (policyConfigType.equalsIgnoreCase("BRMS_Param")) {
+					filePrefix = "Config_BRMS_Param_";
+				}else {
+					filePrefix = "Config_"; 
+				}
+			} else if (policyType.equalsIgnoreCase("Action")) {
+				filePrefix = "Action_";
+			} else if (policyType.equalsIgnoreCase("Decision")) {
+				filePrefix = "Decision_";
+			}
+
+			int version = 0;
+			int highestVersion = 0;
+			String createdBy = "";
+			String modifiedBy = userId;
+			String scopeCheck = policyData.getDomainDir().replace(".", File.separator);
+			PolicyEditorScopes policyEditorScope = (PolicyEditorScopes) commonClassDao.getEntityItem(PolicyEditorScopes.class, "scopeName", scopeCheck);
+			if(policyEditorScope == null){
+				UserInfo userInfo = new UserInfo();
+				userInfo.setUserName("API");
+				userInfo.setUserLoginId("API");
+				PolicyEditorScopes editorScope = new PolicyEditorScopes();
+				editorScope.setScopeName(scopeCheck);
+				editorScope.setUserCreatedBy(userInfo);
+				editorScope.setUserModifiedBy(userInfo);
+				commonClassDao.save(editorScope);
+			}
+			//get the highest version of policy from policy version table.
+			String dbCheckPolicyName = policyData.getDomainDir() + File.separator + filePrefix + policyData.getPolicyName();
+			PolicyVersion policyVersion = getPolicyVersionData(dbCheckPolicyName);	
+			if(policyVersion == null){
+				highestVersion = 0;
+			}else{
+				highestVersion = policyVersion.getHigherVersion();
+			}
+			
+			if(highestVersion != 0){
+				if(policyData.isEditPolicy){
+					version = highestVersion +1;
+					if(userId ==null){
+						modifiedBy = "API";
+					}else{
+						modifiedBy = userId;
+					}
+					policyData.setUserId("API");
+					createdBy = policyVersion.getCreatedBy();
+					policyVersionDao = policyVersion;
+					policyVersionDao.setActiveVersion(version);
+					policyVersionDao.setHigherVersion(version);
+					policyVersionDao.setModifiedBy(modifiedBy);
+				}else{
+					body = "policyExists";
+					status = HttpStatus.CONFLICT;
+					response.setStatus(HttpServletResponse.SC_CONFLICT);
+					response.addHeader("error", "policyExists");
+					response.addHeader("policyName", policyData.getPolicyName());
+					return new ResponseEntity<String>(body, status);
+				}		
+			}else{
+				version = 1;
+				if(userId == null){
+					createdBy = "API";
+					modifiedBy = "API";
+					policyData.setUserId("API");
+				}else{
+					createdBy = userId;
+					modifiedBy = userId;
+					policyData.setUserId("API");
+				}
+				policyVersionDao = new PolicyVersion();
+				policyVersionDao.setPolicyName(dbCheckPolicyName);
+				policyVersionDao.setActiveVersion(version);
+				policyVersionDao.setHigherVersion(version);
+				policyVersionDao.setCreatedBy(createdBy);
+				policyVersionDao.setModifiedBy(modifiedBy);
+			}
+			
+			policyData.setPolicyID(newPolicyID());
+			policyData.setRuleID(ruleID);
+	
+			String policyFileName = dbCheckPolicyName.replace(File.separator, ".")+ "." + version + ".xml";
+			policyData.setNewFileName(policyFileName);
+			policyData.setPolicyDescription(policyData.getPolicyDescription()+ "@CreatedBy:" +createdBy + "@CreatedBy:" + "@ModifiedBy:" +modifiedBy + "@ModifiedBy:");
+			policyData.setRuleCombiningAlgId("urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides");
+			if(policyData.getApiflag() == null){
+				//set the Rule Combining Algorithm Id to be sent to PAP-REST via JSON	
+				if(policyData.getAttributes() != null){
+					if(policyData.getAttributes().size() > 0){
+						for(Object attribute : policyData.getAttributes()){
+							if(attribute instanceof LinkedHashMap<?, ?>){
+								String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString();
+								String value = ((LinkedHashMap<?, ?>) attribute).get("value").toString();
+								attributeMap.put(key, value);	
+							}
+						}
+					}
+				}
+				policyData.setDynamicFieldConfigAttributes(attributeMap);
+			}
+			
+			policyData.setVersion(String.valueOf(version));
+			policyData.setHighestVersion(version);
+
+			// Calling Component class per policy type
+			if (policyType.equalsIgnoreCase("Config")) {
+				if (policyConfigType.equalsIgnoreCase("Firewall Config")) {
+					newPolicy = new FirewallConfigPolicy(policyData);
+				}else if (policyConfigType.equalsIgnoreCase("BRMS_Raw")) { 
+					policyData.setEcompName("DROOLS");
+					policyData.setConfigName("BRMS_RAW_RULE");
+					newPolicy = new CreateBrmsRawPolicy(policyData);
+				}else if (policyConfigType.equalsIgnoreCase("BRMS_Param")) {
+					policyData.setEcompName("DROOLS");
+					policyData.setConfigName("BRMS_PARAM_RULE");
+					Map<String, String> drlRuleAndUIParams = new HashMap<String, String>();
+					if(policyData.getApiflag() == null){
+						// If there is any dynamic field create the matches here
+						String key="templateName";
+						String value=(String) policyData.getRuleName();
+						drlRuleAndUIParams.put(key, value);
+						if(policyData.getRuleData().size() > 0){
+							for(Object keyValue: policyData.getRuleData().keySet()){
+								drlRuleAndUIParams.put(keyValue.toString(), policyData.getRuleData().get(keyValue).toString());
+							}
+						}
+						policyData.setBrmsParamBody(drlRuleAndUIParams);
+					}else{
+		                drlRuleAndUIParams=policyData.getBrmsParamBody();
+		                String modelName= drlRuleAndUIParams.get("templateName");
+		                PolicyLogger.info("Template name from API is: "+modelName);
+		                
+		                BRMSParamTemplate template = (BRMSParamTemplate) commonClassDao.getEntityItem(BRMSParamTemplate.class, "ruleName", modelName);
+		                if(template == null){
+		                	String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Template.  The template name, " 
+		                            + modelName + " was not found in the dictionary.";
+		                	body = message;
+		                	status = HttpStatus.BAD_REQUEST;
+		                    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+		                    response.addHeader("error", message);
+		                    response.addHeader("modelName", modelName);
+		                    return new ResponseEntity<String>(body, status);
+		                }
+					}		
+					newPolicy = new CreateBrmsParamPolicy(policyData);
+				}else if (policyConfigType.equalsIgnoreCase("Base")) {
+					newPolicy =  new ConfigPolicy(policyData);
+				}else if (policyConfigType.equalsIgnoreCase("ClosedLoop_Fault")) {
+					newPolicy = new ClosedLoopPolicy(policyData);
+				}else if (policyConfigType.equalsIgnoreCase("ClosedLoop_PM")) {
+					if(policyData.getApiflag() == null){
+						policyData.setServiceType(policyData.getServiceTypePolicyName().get("serviceTypePolicyName").toString());
+						ObjectMapper jsonMapper = new ObjectMapper();
+						String jsonBody = jsonMapper.writeValueAsString(policyData.getJsonBodyData());
+						jsonBody = jsonBody.replaceFirst("\\{", "\\{\"serviceTypePolicyName\": \"serviceTypeFieldValue\",");
+						jsonBody = jsonBody.replace("serviceTypeFieldValue", policyData.getServiceType());
+						policyData.setJsonBody(jsonBody);
+					}
+					newPolicy = new CreateClosedLoopPerformanceMetrics(policyData);
+				}else if (policyConfigType.equalsIgnoreCase("Micro Service")) {
+					newPolicy = new MicroServiceConfigPolicy(policyData);
+				}
+			}else if(policyType.equalsIgnoreCase("Action")) {
+				if(policyData.getApiflag() == null){
+					List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
+					List<String> dynamicRuleAlgorithmCombo = new LinkedList<String>();
+					List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
+					List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+
+
+					if(policyData.getRuleAlgorithmschoices().size() > 0){
+						for(Object attribute : policyData.getRuleAlgorithmschoices()){
+							if(attribute instanceof LinkedHashMap<?, ?>){
+								String label = ((LinkedHashMap<?, ?>) attribute).get("id").toString();
+								String key = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField1").toString();
+								String rule = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmCombo").toString();
+								String value = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField2").toString();
+								dynamicRuleAlgorithmLabels.add(label);
+								dynamicRuleAlgorithmField1.add(key);
+								dynamicRuleAlgorithmCombo.add(rule);
+								dynamicRuleAlgorithmField2.add(value);
+							}
+						}
+					}
+
+					String actionDictValue = policyData.getActionAttributeValue();
+					ActionPolicyDict jsonData = ((ActionPolicyDict) commonClassDao.getEntityItem(ActionPolicyDict.class, "attributeName", actionDictValue));
+					String actionBodyString = jsonData.getBody();
+					String actionDictHeader = jsonData.getHeader();
+					String actionDictType = jsonData.getType();
+					String actionDictUrl = jsonData.getUrl();
+					String actionDictMethod = jsonData.getMethod();
+					policyData.setActionDictHeader(actionDictHeader);
+					policyData.setActionDictType(actionDictType);
+					policyData.setActionDictUrl(actionDictUrl);
+					policyData.setActionDictMethod(actionDictMethod);
+					policyData.setActionAttribute(actionDictValue);
+					policyData.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
+					policyData.setDynamicRuleAlgorithmCombo(dynamicRuleAlgorithmCombo);
+					policyData.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
+					policyData.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
+					if (actionBodyString != null) {
+						policyData.setActionBody(actionBodyString);
+					}
+				}
+				newPolicy = new ActionPolicy(policyData);
+			} else if (policyType.equalsIgnoreCase("Decision")) {
+				if(policyData.getApiflag() == null){
+					Map<String, String> settingsMap = new HashMap<String, String>();
+					List<String> dynamicRuleAlgorithmLabels = new LinkedList<String>();
+					List<String> dynamicRuleAlgorithmCombo = new LinkedList<String>();
+					List<String> dynamicRuleAlgorithmField1 = new LinkedList<String>();
+					List<String> dynamicRuleAlgorithmField2 = new LinkedList<String>();
+					List<Object> dynamicVariableList = new LinkedList<Object>();
+					List<String> dataTypeList = new LinkedList<String>();
+
+					if(policyData.getSettings().size() > 0){
+						for(Object settingsData : policyData.getSettings()){
+							if(settingsData instanceof LinkedHashMap<?, ?>){
+								String key = ((LinkedHashMap<?, ?>) settingsData).get("key").toString();
+								String value = ((LinkedHashMap<?, ?>) settingsData).get("value").toString();
+								settingsMap.put(key, value);	
+							}
+						}
+					}
+					if(policyData.getRuleAlgorithmschoices().size() > 0){
+						for(Object attribute : policyData.getRuleAlgorithmschoices()){
+							if(attribute instanceof LinkedHashMap<?, ?>){
+								String label = ((LinkedHashMap<?, ?>) attribute).get("id").toString();
+								String key = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField1").toString();
+								String rule = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmCombo").toString();
+								String value = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField2").toString();
+								dynamicRuleAlgorithmLabels.add(label);
+								dynamicRuleAlgorithmField1.add(key);
+								dynamicRuleAlgorithmCombo.add(rule);
+								dynamicRuleAlgorithmField2.add(value);
+							}
+						}
+					}
+
+					policyData.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
+					policyData.setDynamicRuleAlgorithmCombo(dynamicRuleAlgorithmCombo);
+					policyData.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
+					policyData.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
+					policyData.setDynamicVariableList(dynamicVariableList);
+					policyData.setDynamicSettingsMap(settingsMap);
+					policyData.setDynamicFieldConfigAttributes(attributeMap);
+					policyData.setDataTypeList(dataTypeList);
+				}
+				newPolicy = new DecisionPolicy(policyData);
+			}
+
+			newPolicy.prepareToSave();
+			
+			PolicyDBDaoTransaction policyDBDaoTransaction = null;
+			try{
+				policyDBDao = PolicyDBDao.getPolicyDBDaoInstance(XACMLPapServlet.getEmf());
+				policyDBDaoTransaction = policyDBDao.getNewTransaction();
+				policyDBDaoTransaction.createPolicy(newPolicy, policyData.getUserId());
+				successMap = newPolicy.savePolicies();
+				if(successMap.containsKey("success")){
+					policyDBDaoTransaction.commitTransaction();
+					if(policyData.isEditPolicy){
+						commonClassDao.update(policyVersionDao);
+					}else{
+						commonClassDao.save(policyVersionDao);
+					}
+					try{
+						PolicyElasticSearchController search= new PolicyElasticSearchController();
+						search.updateElk(policyData);
+					}catch(Exception e){
+						LOGGER.error("Error Occured while saving policy to Elastic Database"+e);
+					}
+					body = "success";
+					status = HttpStatus.OK;
+					response.setStatus(HttpServletResponse.SC_OK);								
+					response.addHeader("successMapKey", "success");								
+					response.addHeader("policyName", policyData.getNewFileName());
+					
+                    //get message from the SafetyCheckerResults if present
+                    String safetyCheckerResponse = policyData.getClWarning();
+                    String existingCLName = policyData.getExistingCLName();
+
+                    //if safetyCheckerResponse is not null add a header to send back with response
+                    if(safetyCheckerResponse!=null) {
+                        PolicyLogger.info("SafetyCheckerResponse message: " + safetyCheckerResponse);
+                        response.addHeader("safetyChecker", safetyCheckerResponse);
+                        response.addHeader("newCLName", CLName);
+                        response.addHeader("conflictCLName", existingCLName);
+                    } else {
+                        PolicyLogger.info("SafetyCheckerResponse was empty or null.");
+                    }
+                    
+				}else if (successMap.containsKey("invalidAttribute")) {
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid Action Attribute";
+					LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Could not fine " + policyData.getActionAttribute() + " in the ActionPolicyDict table.");
+					body = "invalidAttribute";
+					status = HttpStatus.BAD_REQUEST;
+					response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
+					response.addHeader("invalidAttribute", policyData.getActionAttribute());
+					response.addHeader("error", message);
+					response.addHeader("policyName", policyData.getPolicyName());
+				}else if (successMap.containsKey("fwdberror")) {
+					policyDBDaoTransaction.rollbackTransaction();
+					body = "fwdberror";
+					status = HttpStatus.BAD_REQUEST;
+					String message = XACMLErrorConstants.ERROR_DATA_ISSUE
+                            + "Error when inserting Firewall ConfigBody data into the database.";
+    				PolicyLogger.error(message);
+					response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+					response.addHeader("error", message);
+					response.addHeader("policyName", policyData.getPolicyName());
+				} else if (successMap.get("error").equals("Validation Failed")) {
+                    policyDBDaoTransaction.rollbackTransaction();
+                    String message = XACMLErrorConstants.ERROR_DATA_ISSUE
+                			+ "Error Validating the Policy on the PAP.";
+                    PolicyLogger.error(message);
+                    body = "Validation";
+					status = HttpStatus.BAD_REQUEST;
+                    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+                    response.addHeader("error", message);
+                    response.addHeader("policyName", policyData.getPolicyName());
+                }else {						
+					policyDBDaoTransaction.rollbackTransaction();
+					body = "error";
+					status = HttpStatus.INTERNAL_SERVER_ERROR;
+					response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);								
+					response.addHeader("error", "error");							
+				}
+			}catch(Exception e){
+				policyDBDaoTransaction.rollbackTransaction();
+			}
+
+		}
+		catch (Exception e){
+			e.printStackTrace();
+		}
+		return new ResponseEntity<String>(body, status);
+	}
+
+	@ExceptionHandler({ HttpMessageNotReadableException.class })
+	public ResponseEntity<String> messageNotReadableExceptionHandler(HttpServletRequest req, HttpMessageNotReadableException exception) {
+		LOGGER.error("Request not readable: {}", exception);
+		StringBuilder message = new StringBuilder();
+		message.append(exception.getMessage());
+		if (exception.getCause() != null) {
+			message.append(" Reason Caused: "
+					+ exception.getCause().getMessage());
+		}
+		return new ResponseEntity<>(message.toString(), HttpStatus.BAD_REQUEST);
+	}
+
+	public PolicyVersion getPolicyVersionData(String dbCheckPolicyName){
+		PolicyVersion entityItem = (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", dbCheckPolicyName);
+		if (entityItem != null) {		
+			if(entityItem.getPolicyName().equals(dbCheckPolicyName)){
+				return entityItem;
+			}
+		}	
+		return entityItem;
+	}
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/package-info.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/package-info.java
new file mode 100644
index 0000000..4eacd4b
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/policycontroller/package-info.java
@@ -0,0 +1,20 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.policycontroller;
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/DictionaryService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/DictionaryService.java
new file mode 100644
index 0000000..6187107
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/DictionaryService.java
@@ -0,0 +1,1005 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.pap.xacml.rest.controller.ActionPolicyDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.BRMSDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.ClosedLoopDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.DecisionPolicyDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.DescriptiveDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.DictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.EnforcerDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.FirewallDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.MicroServiceDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.PolicyScopeDictionaryController;
+import org.openecomp.policy.pap.xacml.rest.controller.SafePolicyController;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.springframework.stereotype.Service;
+import org.springframework.web.servlet.ModelAndView;
+
+
+@Service("DictionaryService")
+public class DictionaryService {
+	
+	private static final Logger LOGGER	= FlexLogger.getLogger(DictionaryService.class);
+
+	/*
+	 * Methods that call the controller method directly to Save and Update dictionary data
+	 */
+	public String saveEcompDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DictionaryController dictionary = new DictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveEcompDictionary(request, response);
+			responseString = result.getViewName();
+			
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+		
+	}
+	
+	public String saveAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DictionaryController dictionary = new DictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveAttributeDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ActionPolicyDictionaryController action = new ActionPolicyDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = action.saveActionPolicyDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		BRMSDictionaryController dictionary = new BRMSDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveBRMSParamDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveVSCLAction(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveVnfType(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePEPOptions(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveVarbind(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveServiceType(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveSiteType(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveSettingsDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveDescriptiveDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		EnforcerDictionaryController dictionary = new EnforcerDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveEnforcerDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveActionListDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveProtocolListDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveZoneDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveSecurityZoneDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePrefixListDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveAddressGroupDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveServiceGroupDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveServiceListDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveTermListDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	
+	
+	
+	public String saveMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveMicroServiceLocationDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveMicroServiceConfigNameDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveDCAEUUIDDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveMicroServiceModelsDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveMicroServiceAttributeDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePSServiceDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePSResourceDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePSTypeDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePSClosedLoopDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String savePSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.savePSGroupScopeDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		SafePolicyController dictionary = new SafePolicyController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveRiskTypeDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	public String saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		SafePolicyController dictionary = new SafePolicyController();
+		String responseString = null;
+		try {
+			ModelAndView result = dictionary.saveSafePolicyWarningDictionary(request, response);
+			responseString = result.getViewName();
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+		return responseString;
+	}
+	
+	
+	/*
+	 * Methods that call the controller get methods directly to get dictionary data
+	 */
+	public void getEcompDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DictionaryController dictionary = new DictionaryController();
+		try {
+			dictionary.getEcompNameDictionaryEntityData(request, response);					
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}		
+	}
+	
+	public void getAttributeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DictionaryController dictionary = new DictionaryController();
+		try {
+			dictionary.getAttributeDictionaryEntityData(request, response);
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getActionPolicyDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ActionPolicyDictionaryController action = new ActionPolicyDictionaryController();
+		try {
+			action.getActionPolicyDictionaryEntityData(request, response);	
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		BRMSDictionaryController dictionary = new BRMSDictionaryController();
+		try {
+			dictionary.getBRMSParamDictionaryEntityData(request, response);
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+	}
+	
+	public void getVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		try {
+			dictionary.getVSCLActionDictionaryEntityData(request, response);
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		try {
+			dictionary.getVNFTypeDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+	}
+	
+	public void getPEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		try {
+			dictionary.getPEPOptionsDictionaryEntityData(request, response);
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		try {
+			dictionary.getVarbindDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+		
+	}
+	
+	public void getServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		try {
+			dictionary.getClosedLoopServiceDictionaryEntityData(request, response);
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		ClosedLoopDictionaryController dictionary = new ClosedLoopDictionaryController();
+		try {
+			dictionary.getClosedLoopSiteDictionaryEntityData(request, response);	
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getSettingsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
+		try {
+			dictionary.getSettingsDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}		
+	}
+	
+	public void getDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
+		try {
+			dictionary.getDescriptiveDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	public void getEnforcerDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		EnforcerDictionaryController dictionary = new EnforcerDictionaryController();
+		try {
+			dictionary.getEnforcerDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getActionListDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getProtocolListDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getZoneDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getSecurityZoneDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getPrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getPrefixListDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getAddressGroupDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getServiceGroupDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getServiceListDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		FirewallDictionaryController dictionary = new FirewallDictionaryController();
+		try {
+			dictionary.getTermListDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	
+	public void getMicroServiceLocationDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		try {
+			dictionary.getMicroServiceLocationDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getMicroServiceConfigNameDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		try {
+			dictionary.getMicroServiceConfigNameDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getDCAEUUIDDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		try {
+			dictionary.getDCAEUUIDDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getMicroServiceModelsDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		try {
+			dictionary.getMicroServiceModelsDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getMicroServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		MicroServiceDictionaryController dictionary = new MicroServiceDictionaryController();
+		try {
+			dictionary.getMicroServiceModelsDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getPSServiceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		try {
+			dictionary.getPSServiceEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getPSResourceDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		try {
+			dictionary.getPSResourceEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getPSTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		try {
+			dictionary.getPSTypeEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getPSClosedLoopDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		try {
+			dictionary.getPSClosedLoopEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getPSGroupScopeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		PolicyScopeDictionaryController dictionary = new PolicyScopeDictionaryController();
+		try {
+			dictionary.getGroupPolicyScopeEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		SafePolicyController dictionary = new SafePolicyController();
+		try {
+			dictionary.getEcompNameDictionaryEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+	
+	public void getSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) throws Exception{
+		
+		SafePolicyController dictionary = new SafePolicyController();
+		try {
+			dictionary.getSafePolicyWarningeEntityData(request, response);
+		
+		} catch (Exception e) {
+			LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+			e.printStackTrace();
+		}
+	}
+}
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
new file mode 100644
index 0000000..39a0485
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/ImportService.java
@@ -0,0 +1,151 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.service;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.components.CreateBRMSRuleTemplate;
+import org.openecomp.policy.pap.xacml.rest.components.CreateNewMicroSerivceModel;
+
+public class ImportService {
+
+	public void doImportMicroServicePut(HttpServletRequest request, HttpServletResponse response) {
+		String importServiceCreation = request.getParameter("importService");;
+		String fileName = request.getParameter("fileName");
+		String version = request.getParameter("version");
+		String serviceName = request.getParameter("serviceName");
+		String description = request.getParameter("description");
+		Map<String, String> successMap = new HashMap<String, String>();
+		switch(importServiceCreation){
+		case "BRMSPARAM":
+			StringBuilder builder = new StringBuilder();
+			int ch;
+			try {
+				while((ch = request.getInputStream().read()) != -1){
+				    builder.append((char)ch);
+				}
+			} catch (IOException e) {
+				PolicyLogger.error("Error in reading in file from API call");
+				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+				response.addHeader("error", "missing");	
+				response.addHeader("operation", "import");
+				response.addHeader("service", serviceName);
+			}
+			CreateBRMSRuleTemplate brmsRuleTemplate = new CreateBRMSRuleTemplate();
+			successMap = brmsRuleTemplate.addRule(builder.toString(), serviceName, description, "API");
+			break;
+		case "MICROSERVICE":
+			CreateNewMicroSerivceModel newMS = null;
+			String randomID = UUID.randomUUID().toString();
+			if ( fileName != null) {
+				File extracDir = new File("ExtractDir");
+				if (!extracDir.exists()){
+					extracDir.mkdirs();
+				}
+				if (fileName.contains(".xmi")){
+					// get the request content into a String
+					String xmi = null;
+					java.util.Scanner scanner;
+					try {
+						scanner = new java.util.Scanner(request.getInputStream());
+						scanner.useDelimiter("\\A");
+						xmi =  scanner.hasNext() ? scanner.next() : "";
+						scanner.close();
+					} catch (IOException e1) {
+						PolicyLogger.error("Error in reading in file from API call");
+						return;
+					}
+					PolicyLogger.info("XML request from API for import new Service"); 
+					try (Writer writer = new BufferedWriter(new OutputStreamWriter(
+							new FileOutputStream("ExtractDir" + File.separator + randomID+".xmi"), "utf-8"))) {
+						writer.write(xmi);
+					} catch (IOException e) {
+						PolicyLogger.error("Error in reading in file from API call");
+						return;
+					}
+				}else{ 
+					try {	
+						InputStream inputStream = request.getInputStream();
+						FileOutputStream outputStream = new FileOutputStream("ExtractDir" + File.separator + randomID+".zip"); 
+						byte[] buffer = new byte[4096];
+						int bytesRead = -1 ; 
+						while ((bytesRead = inputStream.read(buffer)) != -1) { 
+							outputStream.write(buffer, 0, bytesRead) ; 
+						}
+						outputStream.close() ; 
+						inputStream.close() ;
+					} catch (IOException e) {
+						PolicyLogger.error("Error in reading in Zip File from API call");
+						return;
+					}
+				}
+				newMS =  new CreateNewMicroSerivceModel(fileName, serviceName, "API", version, randomID);
+				successMap = newMS.addValuesToNewModel();
+				if (successMap.containsKey("success")) {
+					successMap.clear();
+					successMap = newMS.saveImportService();
+				}
+			}
+			break;
+		}
+		// return a response to the PAP		    
+		if (successMap.containsKey("success")) {							
+			response.setStatus(HttpServletResponse.SC_OK);								
+			response.addHeader("successMapKey", "success");								
+			response.addHeader("operation", "import");
+			response.addHeader("service", serviceName);
+		} else if (successMap.containsKey("DBError")) {
+			if (successMap.get("DBError").contains("EXISTS")){
+				response.setStatus(HttpServletResponse.SC_CONFLICT);
+				response.addHeader("service", serviceName);
+				response.addHeader("error", "modelExistsDB");
+			}else{
+				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+				response.addHeader("error", "importDB");
+			}
+			response.addHeader("operation", "import");
+			response.addHeader("service", serviceName);
+		}else if (successMap.get("error").contains("MISSING")){
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			response.addHeader("error", "missing");	
+			response.addHeader("operation", "import");
+			response.addHeader("service", serviceName);
+		}else if (successMap.get("error").contains("VALIDATION")){
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+			response.addHeader("error", "validation");	
+			response.addHeader("operation", "import");
+			response.addHeader("service", serviceName);
+		}
+	}
+
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
new file mode 100644
index 0000000..21a6301
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/service/MetricService.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
+
+import com.att.research.xacml.api.pap.PDPPolicy;
+
+public class MetricService {
+
+	public static void doGetPolicyMetrics(HttpServletRequest request, HttpServletResponse response) {
+		Set<EcompPDPGroup> groups = new HashSet<EcompPDPGroup>();
+		try {
+			//get the count of policies on the PDP
+			if(XACMLPapServlet.getPAPEngine()!=null){
+				groups = XACMLPapServlet.getPAPEngine().getEcompPDPGroups();
+			}
+			int pdpCount = 0;
+			for (EcompPDPGroup group : groups) {
+				Set<PDPPolicy> policies = group.getPolicies();
+				pdpCount += policies.size();
+			}
+			//get the count of policies on the PAP
+			EntityManager em = null;
+			if(XACMLPapServlet.getEmf()!=null){
+				em = (EntityManager) XACMLPapServlet.getEmf().createEntityManager();
+			}
+			if (em==null){
+				PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Error creating entity manager with persistence unit: " + XACMLPapServlet.getPersistenceUnit());
+				response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
+				response.addHeader("error", "Error creating entity manager with persistence unit");
+				return;
+			}
+			int papCount = ((Number) em.createNamedQuery("PolicyVersion.findAllCount").getSingleResult()).intValue();
+			em.close();
+			int totalCount = pdpCount + papCount;
+			//create json string for API response
+			JSONObject json = new JSONObject();
+			json.put("papCount", papCount);
+			json.put("pdpCount", pdpCount);
+			json.put("totalCount", totalCount);
+			if (pdpCount>0 && papCount>0 && totalCount>0) {
+				PolicyLogger.info("Metrics have been found on the Policy Engine for the number of policies on the PAP and PDP.");
+				response.setStatus(HttpServletResponse.SC_OK);
+				response.addHeader("successMapKey", "success");
+				response.addHeader("operation", "getMetrics");
+				response.addHeader("metrics", json.toString() );
+				return;
+			}else{
+				String message = "The policy count on the PAP and PDP is 0.  Please check the database and file system to correct this error.";
+				response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
+				response.addHeader("error", message);
+				return;
+			}
+		} catch (Exception e) {
+			String message = XACMLErrorConstants.ERROR_DATA_ISSUE + " Error Querying the Database: " + e.getMessage();
+			PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPapServlet", " Error Querying the Database.");
+			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);								
+			response.addHeader("error", message);
+			return;			
+		}
+	}
+
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/AbstractPolicyCreation.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/AbstractPolicyCreation.java
new file mode 100644
index 0000000..5fa681e
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/AbstractPolicyCreation.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.policy.pap.xacml.rest.util;
+
+
+import java.util.UUID;
+
+import org.openecomp.policy.rest.XACMLRestProperties;
+import org.springframework.stereotype.Component;
+
+import com.att.research.xacml.util.XACMLProperties;
+import com.google.common.base.Joiner;
+
+@Component
+public abstract class AbstractPolicyCreation {
+	
+	public static String getDomain() {
+		return XACMLProperties.getProperty(XACMLRestProperties.PROP_ADMIN_DOMAIN, "urn");
+	}
+	
+	public String newPolicyID() {
+		return Joiner.on(':').skipNulls().join((getDomain().startsWith("urn") ? null: "urn"),
+				getDomain().replaceAll("[/\\\\.]", ":"), "xacml", "policy", "id", UUID.randomUUID());
+	}
+	
+	public String convertDate(String dateTTL, boolean portalType) {
+		String formateDate = null;
+		String[] date;
+		String[] parts;
+		
+		if (portalType){
+			parts = dateTTL.split("-");
+			formateDate = parts[2] + "-" + parts[1] + "-" + parts[0];
+		} else {
+			date  = dateTTL.split("T");
+			parts = date[0].split("-");
+			formateDate = parts[2] + "-" + parts[1] + "-" + parts[0];
+		}
+		return formateDate;
+	}
+	
+
+	
+	public void updatePolicyCreationToDatabase(){
+		// Add it into our tree
+/*		Path finalPolicyPath = null;
+		finalPolicyPath = Paths.get(successMap.get("success"));
+		PolicyElasticSearchController controller = new PolicyElasticSearchController();
+		controller.updateElk(finalPolicyPath.toString());
+		File file = finalPolicyPath.toFile();
+		if(file != null){
+			String policyName = file.toString();
+			String removePath = policyName.substring(policyName.indexOf("repository")+11);
+			String removeXml = removePath.replace(".xml", "");
+			String removeExtension = removeXml.substring(0, removeXml.indexOf("."));
+			List<Object> policyVersionList = commonClassDao.getDataById(PolicyVersion.class, "policyName", removeExtension);
+			if (policyVersionList.size() > 0) {		
+				for(int i = 0;  i < policyVersionList.size(); i++) {
+				PolicyVersion entityItem = (PolicyVersion) policyVersionList.get(i);
+					if(entityItem.getPolicyName().equals(removeExtension)){
+						version = entityItem.getHigherVersion() +1;
+						entityItem.setActiveVersion(version);
+						entityItem.setHigherVersion(version);
+						entityItem.setModifiedBy(userId);
+						commonClassDao.update(entityItem);
+						if(policyData.isEditPolicy){
+							PolicyNotificationMail email = new PolicyNotificationMail();
+							String mode = "EditPolicy";
+							String policyNameForEmail = policyData.getDomainDir() + File.separator + policyData.getOldPolicyFileName() + ".xml";
+							email.sendMail(entityItem, policyNameForEmail, mode, commonClassDao);
+						}
+					}
+				}
+			}else{
+				PolicyVersion entityItem = new PolicyVersion();
+				entityItem.setActiveVersion(version);
+				entityItem.setHigherVersion(version);
+				entityItem.setPolicyName(removeExtension);
+				entityItem.setCreatedBy(userId);
+				entityItem.setModifiedBy(userId);
+				commonClassDao.save(entityItem);
+			}	
+		}*/
+	}
+
+
+}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
index 5326cb2..2db7e42 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/util/JPAUtils.java
@@ -43,7 +43,7 @@
 import org.openecomp.policy.common.logging.flexlogger.Logger;
 
 public class JPAUtils {
-	private static Logger logger	= FlexLogger.getLogger(JPAUtils.class);
+	private static Logger LOGGER	= FlexLogger.getLogger(JPAUtils.class);
 	
 	private EntityManagerFactory emf;
 	private static final Object mapAccess = new Object();
@@ -51,7 +51,6 @@
 	private static Map<String, FunctionDefinition> mapID2Function = null;
 	private static JPAUtils currentInstance = null;
 	
-	//private static List<LockdownListener> lockdownListeners = new ArrayList<LockdownListener>();
 	
 	/**
 	 * Get an instance of a JPAUtils. It creates one if it does not exist.
@@ -61,7 +60,7 @@
 	 * @throws IllegalStateException if a JPAUtils has already been constructed. Call getJPAUtilsInstance() to get this.
 	 */
 	public static JPAUtils getJPAUtilsInstance(EntityManagerFactory emf) throws Exception{
-		logger.debug("getJPAUtilsInstance(EntityManagerFactory emf) as getJPAUtilsInstance("+emf+") called");
+		LOGGER.debug("getJPAUtilsInstance(EntityManagerFactory emf) as getJPAUtilsInstance("+emf+") called");
 		if(currentInstance == null){
 			if(emf != null){
 				currentInstance = new JPAUtils(emf);
@@ -73,7 +72,7 @@
 	}
 	
 	private JPAUtils(EntityManagerFactory emf){
-		logger.debug("JPAUtils(EntityManagerFactory emf) as JPAUtils("+emf+") called");
+		LOGGER.debug("JPAUtils(EntityManagerFactory emf) as JPAUtils("+emf+") called");
 		this.emf = emf;	
 	}
 	
@@ -83,7 +82,7 @@
 	 * @throws IllegalStateException if a JPAUtils instance is null. Call getJPAUtilsInstance(EntityManagerFactory emf) to get this.
 	 */
 	public static JPAUtils getJPAUtilsInstance() throws Exception{
-		logger.debug("getJPAUtilsInstance() as getJPAUtilsInstance() called");
+		LOGGER.debug("getJPAUtilsInstance() as getJPAUtilsInstance() called");
 		if(currentInstance != null){
 			return currentInstance;
 		}
@@ -96,12 +95,12 @@
 		if (attribute.getCategoryBean() != null) {
 			designator.setCategory(attribute.getCategoryBean().getXacmlId());
 		} else {
-			logger.warn("No category bean");
+			LOGGER.warn("No category bean");
 		}
 		if (attribute.getDatatypeBean() != null) {
 			designator.setDataType(attribute.getDatatypeBean().getXacmlId());
 		} else {
-			logger.warn("No datatype bean");
+			LOGGER.warn("No datatype bean");
 		}
 		designator.setIssuer(attribute.getIssuer());
 		designator.setMustBePresent(attribute.isMustBePresent());
@@ -115,12 +114,12 @@
 		if (attribute.getCategoryBean() != null) {
 			selector.setCategory(attribute.getCategoryBean().getXacmlId());
 		} else {
-			logger.warn("No category bean");
+			LOGGER.warn("No category bean");
 		}
 		if (attribute.getDatatypeBean() != null) {
 			selector.setDataType(attribute.getDatatypeBean().getXacmlId());
 		} else {
-			logger.warn("No datatype bean");
+			LOGGER.warn("No datatype bean");
 		}
 		selector.setMustBePresent(attribute.isMustBePresent());
 		return selector;
@@ -139,7 +138,6 @@
 				try {
 					buildFunctionMaps();
 				} catch (ServletException e) {
-					// TODO Auto-generated catch block
 					e.printStackTrace();
 				}
 			}
@@ -153,7 +151,6 @@
 				try {
 					buildFunctionMaps();
 				} catch (ServletException e) {
-					// TODO Auto-generated catch block
 					e.printStackTrace();
 				}
 			}
@@ -191,14 +188,14 @@
 	 * @throws ConversionException
 	 */
 	public boolean dbLockdownIgnoreErrors() {
-		if (logger.isTraceEnabled())
-			logger.trace("ENTER");
+		if (LOGGER.isTraceEnabled())
+			LOGGER.trace("ENTER");
 		
 		boolean lockdown = false;
 		try {
 			lockdown = dbLockdown();
 		} catch (Exception e) {
-			logger.warn("Cannot access DB lockdown value", e);
+			LOGGER.warn("Cannot access DB lockdown value", e);
 		}
 		return lockdown;
 	}
@@ -211,8 +208,8 @@
 	 */
 	public boolean dbLockdown() 
 			throws  IllegalAccessException {
-		if (logger.isTraceEnabled())
-			logger.trace("ENTER");
+		if (LOGGER.isTraceEnabled())
+			LOGGER.trace("ENTER");
 		
 		EntityManager em = emf.createEntityManager();
 		Query globalRoleSettingsJPA = em.createNamedQuery("GlobalRoleSettings.findAll");	
@@ -222,15 +219,15 @@
 		if (globalRoleSettings == null) {
 			// this should not happen
 			String msg = "NO GlobalSetttings for " + XacmlAdminAuthorization.Role.ROLE_SUPERADMIN.toString();
-			if (logger.isErrorEnabled())
-				logger.error(msg);
+			if (LOGGER.isErrorEnabled())
+				LOGGER.error(msg);
 			throw new IllegalAccessException(msg);
 		}
 		
 		if (!globalRoleSettings.getRole().equals(XacmlAdminAuthorization.Role.ROLE_SUPERADMIN.toString())) {
 			String msg = "NOT FOUND db data for " + XacmlAdminAuthorization.Role.ROLE_SUPERADMIN.toString();
-			if (logger.isErrorEnabled())
-				logger.error(msg);
+			if (LOGGER.isErrorEnabled())
+				LOGGER.error(msg);
 			throw new IllegalAccessException(msg);
 		}
 		
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/AuthenticationService.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/AuthenticationService.java
index 003585b..78e6528 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/AuthenticationService.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/AuthenticationService.java
@@ -23,22 +23,15 @@
 import java.util.Base64;
 import java.util.StringTokenizer;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.rest.XACMLRestProperties;
-
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
-import com.att.research.xacml.util.XACMLProperties;
-
 import org.openecomp.policy.common.logging.eelf.MessageCodes;
 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
+import org.openecomp.policy.rest.XACMLRestProperties;
+
+import com.att.research.xacml.util.XACMLProperties;
 
 public class AuthenticationService {
 	private String papID = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_USERID);
 	private String papPass = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS);
-	private static final Logger logger = FlexLogger.getLogger(AuthenticationService.class);
 	
 	public boolean authenticate(String authCredentials) {
 
@@ -51,8 +44,6 @@
 			byte[] decodedBytes = Base64.getDecoder().decode(encodedUserPassword);
 			usernameAndPassword = new String(decodedBytes, "UTF-8");
 		} catch (Exception e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "AuthenticationService", "Exception decoding username and password");
 			return false;
 		}
@@ -64,8 +55,6 @@
 			boolean authenticationStatus = papID.equals(username)	&& papPass.equals(password);
 			return authenticationStatus;
 		} catch (Exception e){
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "AuthenticationService", "Exception authenticating user");
 			return false;
 		}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
index ce35a70..7b88569 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/CheckPDP.java
@@ -20,9 +20,6 @@
 
 package org.openecomp.policy.pap.xacml.restAuth;
 
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -39,15 +36,13 @@
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
-
 import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger; 
-
 public class CheckPDP {
 
 	private static Path pdpPath = null;
@@ -62,8 +57,6 @@
 		try {
 			readFile();
 		} catch (Exception e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exception reading file");
 			return false;
 		}
@@ -77,24 +70,18 @@
 	private static void readFile() throws Exception {
 		String pdpFile = XACMLPapServlet.getPDPFile();
 		if (pdpFile == null) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PDP File name not Valid : " + pdpFile);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "PDP File name is undefined");
 			throw new Exception(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"PDP File name not Valid : " + pdpFile);
 		}
 		if (pdpPath == null) {
 			pdpPath = Paths.get(pdpFile);
 			if (Files.notExists(pdpPath)) {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "File doesn't exist in the specified Path : "	+ pdpPath.toString());
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "File doesn't exist in the specified Path");
 				throw new Exception(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"File doesn't exist in the specified Path : "+ pdpPath.toString());
 			} 
 			if (pdpPath.toString().endsWith(".properties")) {
 				readProps();
 			} else {
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Not a .properties file " + pdpFile);
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + "Not a .properties file");
 				throw new Exception(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"Not a .properties file");
 			}
@@ -109,6 +96,7 @@
 		}
 	}
 
+	@SuppressWarnings({ "rawtypes", "unchecked" })
 	private static void readProps() throws Exception {
 		InputStream in;
 		pdpProp = new Properties();
@@ -117,8 +105,6 @@
 			oldModified = pdpPath.toFile().lastModified();
 			pdpProp.load(in);
 		} catch (IOException e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Cannot load the Properties file");
 			throw new Exception("Cannot Load the Properties file", e);
 		}
@@ -164,14 +150,10 @@
 				// 0 - PDPURL
 				pdpMap.put(pdpValues.get(0), encoder.encodeToString((userID+":"+pass).getBytes(StandardCharsets.UTF_8)));
 			}else{
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "No Credentials to send Request: " + pdpValues);
 				PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + "No Credentials to send Request");
 				throw new Exception(XACMLErrorConstants.ERROR_PERMISSIONS + "No enough Credentials to send Request. " + pdpValues);
 			}
 		}else{
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_PERMISSIONS + "No Credentials to send Request: " + pdpVal);
 			PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + "No Credentials to send Request: " + pdpVal);
 			throw new Exception(XACMLErrorConstants.ERROR_PERMISSIONS +"No enough Credentials to send Request.");
 		}
@@ -181,8 +163,6 @@
 		try {
 			readFile();
 		} catch (Exception e) {
-			//TODO:EELF Cleanup - Remove logger
-			//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 			PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exeption reading Properties file");
 		}
 		String encoding = null;
@@ -190,8 +170,6 @@
 			try{
 				encoding = pdpMap.get(pdpID);
 			} catch(Exception e){
-				//TODO:EELF Cleanup - Remove logger
-				//logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e);
 				PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CheckPDP", "Exception encoding");
 			}
 			return encoding;
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/PAPAuthenticationFilter.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/PAPAuthenticationFilter.java
index 8176294..2352beb 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/PAPAuthenticationFilter.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/restAuth/PAPAuthenticationFilter.java
@@ -34,7 +34,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.openecomp.policy.pap.xacml.rest.XACMLPapServlet;
 
 /**
  * Servlet Filter implementation class PAPAuthenticationFilter
@@ -95,8 +94,9 @@
 						logger.info("Request comes from Ecomp Portal");
 						//Spring dispatcher servlet is at the end of the filter chain at /pap/ecomp/ path
 						System.out.println("New Request URI: " + url);
-						//request.getRequestDispatcher(url).forward(request, alteredResponse);
 						filter.doFilter(request, response);
+						/*url = url.substring(url.indexOf("/pap/")+4);
+						request.getRequestDispatcher(url).forward(request, response);*/
 					}
 					
 				}
diff --git a/ECOMP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl b/ECOMP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl
new file mode 100644
index 0000000..e9b58fc
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/resources/META-INF/generatedCreate.ddl
@@ -0,0 +1,119 @@
+CREATE TABLE PolicyEntity (policyId BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, policyData TEXT, policyName VARCHAR(255) NOT NULL, policyVersion INTEGER, scope VARCHAR(255) NOT NULL, version INTEGER, actionBodyId BIGINT, configurationDataId BIGINT, PRIMARY KEY (policyId))
+CREATE TABLE ConfigurationDataEntity (configurationDataId BIGINT NOT NULL, configBody TEXT, configType VARCHAR(255) NOT NULL, configurationName VARCHAR(255) NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, version INTEGER, PRIMARY KEY (configurationDataId))
+CREATE TABLE PolicyDBDaoEntity (policyDBDaoUrl VARCHAR NOT NULL, created_date TIMESTAMP, description VARCHAR(2048) NOT NULL, modified_date TIMESTAMP NOT NULL, password VARCHAR, username VARCHAR, PRIMARY KEY (policyDBDaoUrl))
+CREATE TABLE GroupEntity (groupKey BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, defaultGroup BOOLEAN NOT NULL, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, groupId VARCHAR NOT NULL, groupName VARCHAR(255) NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, version INTEGER, PRIMARY KEY (groupKey))
+CREATE TABLE PdpEntity (pdpKey BIGINT NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, description VARCHAR(2048) NOT NULL, jmxPort INTEGER NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, pdpId VARCHAR(255) NOT NULL, pdpName VARCHAR(255) NOT NULL, groupKey BIGINT, PRIMARY KEY (pdpKey))
+CREATE TABLE ActionBodyEntity (actionBodyId BIGINT NOT NULL, actionBody TEXT, actionBodyName VARCHAR(255) NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP, deleted BOOLEAN NOT NULL, modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, version INTEGER, PRIMARY KEY (actionBodyId))
+CREATE TABLE DatabaseLockEntity (lock_key INTEGER NOT NULL, PRIMARY KEY (lock_key))
+CREATE TABLE PolicyVersion (id INTEGER NOT NULL, ACTIVE_VERSION INTEGER, CREATED_BY VARCHAR(45) NOT NULL, created_date TIMESTAMP NOT NULL, HIGHEST_VERSION INTEGER, modified_by VARCHAR(45) NOT NULL, modified_date TIMESTAMP NOT NULL, POLICY_NAME VARCHAR(255) NOT NULL, PRIMARY KEY (id))
+CREATE TABLE POLICYSCORE (id INTEGER NOT NULL, POLICY_NAME VARCHAR NOT NULL, POLICY_SCORE VARCHAR, VERSIONEXTENSION VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE FunctionDefinition (id INTEGER NOT NULL, arg_lb INTEGER NOT NULL, arg_ub INTEGER NOT NULL, ho_arg_lb INTEGER, ho_arg_ub INTEGER, ho_primitive CHAR, is_bag_return INTEGER NOT NULL, is_higher_order INTEGER NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL, return_datatype INTEGER, PRIMARY KEY (id))
+CREATE TABLE Attribute (id INTEGER NOT NULL, ATTRIBUTE_VALUE VARCHAR, created_date TIMESTAMP, description VARCHAR(2048), is_designator CHAR NOT NULL, modified_date TIMESTAMP NOT NULL, PRIORITY VARCHAR, selector_path VARCHAR(2048), xacml_id VARCHAR NOT NULL UNIQUE, category INTEGER, constraint_type INTEGER, datatype INTEGER, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE Category (id INTEGER NOT NULL, grouping VARCHAR(64) NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
+CREATE TABLE ConstraintType (id INTEGER NOT NULL, constraint_type VARCHAR(64) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY (id))
+CREATE TABLE ConstraintValues (id INTEGER NOT NULL, property VARCHAR, value VARCHAR, attribute_id INTEGER, PRIMARY KEY (id))
+CREATE TABLE Datatype (id INTEGER NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
+CREATE TABLE FunctionArguments (id INTEGER NOT NULL, arg_index INTEGER NOT NULL, is_bag INTEGER NOT NULL, datatype_id INTEGER, function_id INTEGER, PRIMARY KEY (id))
+CREATE TABLE UserInfo (loginid VARCHAR(45) NOT NULL, name VARCHAR NOT NULL UNIQUE, PRIMARY KEY (loginid))
+CREATE TABLE ActionPolicyDict (id INTEGER NOT NULL, ATTRIBUTE_NAME VARCHAR NOT NULL, Body VARCHAR, created_date TIMESTAMP, description VARCHAR(2048), Headers VARCHAR, Method VARCHAR NOT NULL, modified_date TIMESTAMP NOT NULL, Type VARCHAR NOT NULL, URL VARCHAR NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE DecisionSettings (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, PRIORITY VARCHAR, xacml_id VARCHAR NOT NULL UNIQUE, datatype INTEGER, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE MicroServiceModels (id INTEGER NOT NULL, annotation VARCHAR(2000) NOT NULL, attributes VARCHAR(255) NOT NULL, dependency VARCHAR(2048), description VARCHAR(2048), enumValues VARCHAR(2000) NOT NULL, modelName VARCHAR NOT NULL UNIQUE, ref_attributes VARCHAR(255) NOT NULL, sub_attributes VARCHAR(2000) NOT NULL, version VARCHAR(2000) NOT NULL, imported_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE actionlist (id INTEGER NOT NULL, actionname VARCHAR NOT NULL, description VARCHAR, PRIMARY KEY (id))
+CREATE TABLE AddressGroup (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, prefixlist VARCHAR, PRIMARY KEY (id))
+CREATE TABLE AttributeAssignment (id INTEGER NOT NULL, attribute_id INTEGER, expression VARCHAR NOT NULL, OBADVICE_id INTEGER, PRIMARY KEY (id))
+CREATE TABLE BRMSParamTemplate (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), rule LONGVARCHAR NOT NULL, param_template_name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE ClosedLoopD2Services (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, service_Name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE ClosedLoopSite (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, site_Name VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE DCAEUsers (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE DCAEuuid (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE DescriptiveScope (Id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), scopename VARCHAR NOT NULL, modified_date TIMESTAMP NOT NULL, search VARCHAR, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (Id))
+CREATE TABLE EcompName (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), ecomp_Name VARCHAR NOT NULL UNIQUE, modified_date TIMESTAMP NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE EnforcingType (id INTEGER NOT NULL, connectionQuery VARCHAR(255) NOT NULL, enforcingType VARCHAR NOT NULL UNIQUE, script VARCHAR(255) NOT NULL, valueQuery VARCHAR(255) NOT NULL, PRIMARY KEY (id))
+CREATE TABLE GlobalRoleSettings (role VARCHAR(45) NOT NULL, lockdown BOOLEAN, PRIMARY KEY (role))
+CREATE TABLE GroupPolicyScopeList (id INTEGER NOT NULL, description VARCHAR, groupList VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE GroupServiceList (id INTEGER NOT NULL, name VARCHAR NOT NULL, serviceList  VARCHAR, PRIMARY KEY (id))
+CREATE TABLE MicroServiceConfigName (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE MicroServiceLocation (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE Obadvice (id INTEGER NOT NULL, created_by VARCHAR(255) NOT NULL, created_date TIMESTAMP NOT NULL, description VARCHAR(2048), fulfill_on VARCHAR(32), modified_by VARCHAR(255) NOT NULL, modified_date TIMESTAMP NOT NULL, type VARCHAR NOT NULL, xacml_id VARCHAR(255) NOT NULL, PRIMARY KEY (id))
+CREATE TABLE ObadviceExpressions (id INTEGER NOT NULL, type VARCHAR NOT NULL, obadvice_id INTEGER, attribute_id INTEGER, PRIMARY KEY (id))
+CREATE TABLE PEPOptions (Id INTEGER NOT NULL, Actions VARCHAR, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, PEP_NAME VARCHAR NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (Id))
+CREATE TABLE PIPConfigParams (id INTEGER NOT NULL, PARAM_DEFAULT VARCHAR(2048), PARAM_NAME VARCHAR(1024) NOT NULL, PARAM_VALUE VARCHAR(2048) NOT NULL, REQUIRED CHAR NOT NULL, PIP_ID INTEGER, PRIMARY KEY (id))
+CREATE TABLE PIPConfiguration (id INTEGER NOT NULL, CLASSNAME VARCHAR(2048) NOT NULL, CREATED_BY VARCHAR(255) NOT NULL, CREATED_DATE TIMESTAMP NOT NULL, DESCRIPTION VARCHAR(2048), ISSUER VARCHAR(1024), MODIFIED_BY VARCHAR(255) NOT NULL, MODIFIED_DATE TIMESTAMP NOT NULL, NAME VARCHAR(255) NOT NULL, READ_ONLY CHAR NOT NULL, REQUIRES_RESOLVER CHAR NOT NULL, TYPE INTEGER, PRIMARY KEY (id))
+CREATE TABLE PIPResolver (id INTEGER NOT NULL, CLASSNAME VARCHAR(2048) NOT NULL, CREATED_BY VARCHAR(255) NOT NULL, CREATED_DATE TIMESTAMP NOT NULL, DESCRIPTION VARCHAR(2048), ISSUER VARCHAR(1024), MODIFIED_BY VARCHAR(255) NOT NULL, MODIFIED_DATE TIMESTAMP NOT NULL, NAME VARCHAR(255) NOT NULL, READ_ONLY CHAR NOT NULL, PIP_ID INTEGER, PRIMARY KEY (id))
+CREATE TABLE PIPResolverParams (id INTEGER NOT NULL, PARAM_DEFAULT VARCHAR(2048), PARAM_NAME VARCHAR(1024) NOT NULL, PARAM_VALUE VARCHAR(2048) NOT NULL, REQUIRED CHAR NOT NULL, ID_RESOLVER INTEGER, PRIMARY KEY (id))
+CREATE TABLE PIPType (id INTEGER NOT NULL, type VARCHAR(45) NOT NULL, PRIMARY KEY (id))
+CREATE TABLE PolicyAlgorithms (id INTEGER NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
+CREATE TABLE policy_manangement (id INTEGER NOT NULL, CONFIG_NAME VARCHAR(45) NOT NULL, CREATE_DATE_TIME TIMESTAMP NOT NULL, CREATED_BY VARCHAR(45) NOT NULL, ECOMP_NAME VARCHAR(45) NOT NULL, POLICY_NAME VARCHAR(45) NOT NULL, scope VARCHAR(45) NOT NULL, UPDATE_DATE_TIME TIMESTAMP NOT NULL, UPDATED_BY VARCHAR(45) NOT NULL, XML CLOB NOT NULL, PRIMARY KEY (id))
+CREATE TABLE PolicyScopeService (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE PolicyScopeType (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE PolicyScopeResource (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE PolicyScopeClosedLoop (id INTEGER NOT NULL, description  VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE portlist (id INTEGER NOT NULL, description VARCHAR, portname VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE protocollist (id INTEGER NOT NULL, description VARCHAR, protocolname VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE RemoteCatalogValues (id INTEGER NOT NULL, name VARCHAR NOT NULL, value VARCHAR, PRIMARY KEY (id))
+CREATE TABLE roles (id INTEGER NOT NULL, role VARCHAR(45) NOT NULL, scope VARCHAR(45), loginid VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE RuleAlgorithms (id INTEGER NOT NULL, is_standard CHAR NOT NULL, short_name VARCHAR(64) NOT NULL, xacml_id VARCHAR(255) NOT NULL UNIQUE, PRIMARY KEY (id))
+CREATE TABLE securityzone (id INTEGER NOT NULL, name VARCHAR NOT NULL, value VARCHAR, PRIMARY KEY (id))
+CREATE TABLE servicegroup (id INTEGER NOT NULL, appprotocol  VARCHAR, description VARCHAR, name VARCHAR NOT NULL, ports VARCHAR, transportprotocol VARCHAR, type VARCHAR, PRIMARY KEY (id))
+CREATE TABLE SystemLogDB (id INTEGER NOT NULL, date TIMESTAMP NOT NULL, description VARCHAR(2048), logtype VARCHAR(255) NOT NULL, remote VARCHAR(255) NOT NULL, system VARCHAR(255) NOT NULL, type VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE TERM (id INTEGER NOT NULL, action VARCHAR, created_date TIMESTAMP, destIPList VARCHAR, destPortList VARCHAR, fromzone VARCHAR, modified_date TIMESTAMP NOT NULL, portList VARCHAR, protocolList VARCHAR, srcIPList VARCHAR, srcPortList VARCHAR, description VARCHAR, termName VARCHAR NOT NULL, tozone VARCHAR, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE VarbindDictionary (Id INTEGER NOT NULL, created_date TIMESTAMP, modified_date TIMESTAMP NOT NULL, varbind_Description VARCHAR(2048), varbind_Name VARCHAR NOT NULL UNIQUE, varbind_oid VARCHAR NOT NULL, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (Id))
+CREATE TABLE VMType (id INTEGER NOT NULL, description VARCHAR, name VARCHAR NOT NULL, PRIMARY KEY (id))
+CREATE TABLE VNFType (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, vnf_type VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE VSCLAction (id INTEGER NOT NULL, created_date TIMESTAMP, description VARCHAR(2048), modified_date TIMESTAMP NOT NULL, vscl_action VARCHAR NOT NULL UNIQUE, created_by VARCHAR(45), modified_by VARCHAR(45), PRIMARY KEY (id))
+CREATE TABLE zone (id INTEGER NOT NULL, zonename VARCHAR NOT NULL, zonevalue VARCHAR, PRIMARY KEY (id))
+CREATE TABLE BackUpMonitorEntity (id INTEGER NOT NULL, flag VARCHAR NOT NULL, notification_record LONGVARCHAR, resource_name VARCHAR NOT NULL UNIQUE, node_name VARCHAR NOT NULL, last_seen TIMESTAMP, PRIMARY KEY (id))
+CREATE TABLE StateManagementEntity (id BIGINT NOT NULL, adminState VARCHAR(20) NOT NULL, availStatus VARCHAR(20) NOT NULL, created_Date TIMESTAMP, modifiedDate TIMESTAMP NOT NULL, opState VARCHAR(20) NOT NULL, resourceName VARCHAR(100) NOT NULL UNIQUE, standbyStatus VARCHAR(20) NOT NULL, PRIMARY KEY (id))
+CREATE TABLE ForwardProgressEntity (forwardProgressId BIGINT NOT NULL, created_date TIMESTAMP, fpc_count BIGINT NOT NULL, last_updated TIMESTAMP, resourceName VARCHAR(100) NOT NULL UNIQUE, PRIMARY KEY (forwardProgressId))
+CREATE TABLE ResourceRegistrationEntity (ResourceRegistrationId BIGINT NOT NULL, created_date TIMESTAMP, last_updated TIMESTAMP, nodeType VARCHAR(50), resourceName VARCHAR(100) NOT NULL UNIQUE, resourceUrl VARCHAR(255) NOT NULL UNIQUE, site VARCHAR(50), PRIMARY KEY (ResourceRegistrationId))
+CREATE TABLE IntegrityAuditEntity (id BIGINT NOT NULL, createdDate TIMESTAMP, designated BOOLEAN, jdbcDriver VARCHAR NOT NULL, jdbcPassword VARCHAR NOT NULL, jdbcUrl VARCHAR NOT NULL, jdbcUser VARCHAR NOT NULL, lastUpdated TIMESTAMP, nodeType VARCHAR, persistenceUnit VARCHAR NOT NULL, resourceName VARCHAR NOT NULL UNIQUE, site VARCHAR, PRIMARY KEY (id))
+CREATE TABLE PolicyGroupEntity (groupKey BIGINT NOT NULL, policyId BIGINT NOT NULL, PRIMARY KEY (groupKey, policyId))
+ALTER TABLE PolicyEntity ADD CONSTRAINT FK_PolicyEntity_configurationDataId FOREIGN KEY (configurationDataId) REFERENCES ConfigurationDataEntity (configurationDataId)
+ALTER TABLE PolicyEntity ADD CONSTRAINT FK_PolicyEntity_actionBodyId FOREIGN KEY (actionBodyId) REFERENCES ActionBodyEntity (actionBodyId)
+ALTER TABLE PdpEntity ADD CONSTRAINT FK_PdpEntity_groupKey FOREIGN KEY (groupKey) REFERENCES GroupEntity (groupKey)
+ALTER TABLE FunctionDefinition ADD CONSTRAINT FK_FunctionDefinition_return_datatype FOREIGN KEY (return_datatype) REFERENCES Datatype (id)
+ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_category FOREIGN KEY (category) REFERENCES Category (id)
+ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_constraint_type FOREIGN KEY (constraint_type) REFERENCES ConstraintType (id)
+ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE Attribute ADD CONSTRAINT FK_Attribute_datatype FOREIGN KEY (datatype) REFERENCES Datatype (id)
+ALTER TABLE ConstraintValues ADD CONSTRAINT FK_ConstraintValues_attribute_id FOREIGN KEY (attribute_id) REFERENCES Attribute (id)
+ALTER TABLE FunctionArguments ADD CONSTRAINT FK_FunctionArguments_function_id FOREIGN KEY (function_id) REFERENCES FunctionDefinition (id)
+ALTER TABLE FunctionArguments ADD CONSTRAINT FK_FunctionArguments_datatype_id FOREIGN KEY (datatype_id) REFERENCES Datatype (id)
+ALTER TABLE ActionPolicyDict ADD CONSTRAINT FK_ActionPolicyDict_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE ActionPolicyDict ADD CONSTRAINT FK_ActionPolicyDict_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE DecisionSettings ADD CONSTRAINT FK_DecisionSettings_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE DecisionSettings ADD CONSTRAINT FK_DecisionSettings_datatype FOREIGN KEY (datatype) REFERENCES Datatype (id)
+ALTER TABLE DecisionSettings ADD CONSTRAINT FK_DecisionSettings_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE MicroServiceModels ADD CONSTRAINT FK_MicroServiceModels_imported_by FOREIGN KEY (imported_by) REFERENCES UserInfo (loginid)
+ALTER TABLE AttributeAssignment ADD CONSTRAINT FK_AttributeAssignment_OBADVICE_id FOREIGN KEY (OBADVICE_id) REFERENCES Obadvice (id)
+ALTER TABLE BRMSParamTemplate ADD CONSTRAINT FK_BRMSParamTemplate_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE ClosedLoopD2Services ADD CONSTRAINT FK_ClosedLoopD2Services_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE ClosedLoopD2Services ADD CONSTRAINT FK_ClosedLoopD2Services_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE ClosedLoopSite ADD CONSTRAINT FK_ClosedLoopSite_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE ClosedLoopSite ADD CONSTRAINT FK_ClosedLoopSite_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE DescriptiveScope ADD CONSTRAINT FK_DescriptiveScope_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE DescriptiveScope ADD CONSTRAINT FK_DescriptiveScope_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE EcompName ADD CONSTRAINT FK_EcompName_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE EcompName ADD CONSTRAINT FK_EcompName_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE ObadviceExpressions ADD CONSTRAINT FK_ObadviceExpressions_obadvice_id FOREIGN KEY (obadvice_id) REFERENCES Obadvice (id)
+ALTER TABLE ObadviceExpressions ADD CONSTRAINT FK_ObadviceExpressions_attribute_id FOREIGN KEY (attribute_id) REFERENCES Attribute (id)
+ALTER TABLE PEPOptions ADD CONSTRAINT FK_PEPOptions_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE PEPOptions ADD CONSTRAINT FK_PEPOptions_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE PIPConfigParams ADD CONSTRAINT FK_PIPConfigParams_PIP_ID FOREIGN KEY (PIP_ID) REFERENCES PIPConfiguration (id)
+ALTER TABLE PIPConfiguration ADD CONSTRAINT FK_PIPConfiguration_TYPE FOREIGN KEY (TYPE) REFERENCES PIPType (id)
+ALTER TABLE PIPResolver ADD CONSTRAINT FK_PIPResolver_PIP_ID FOREIGN KEY (PIP_ID) REFERENCES PIPConfiguration (id)
+ALTER TABLE PIPResolverParams ADD CONSTRAINT FK_PIPResolverParams_ID_RESOLVER FOREIGN KEY (ID_RESOLVER) REFERENCES PIPResolver (id)
+ALTER TABLE roles ADD CONSTRAINT FK_roles_loginid FOREIGN KEY (loginid) REFERENCES UserInfo (loginid)
+ALTER TABLE TERM ADD CONSTRAINT FK_TERM_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE TERM ADD CONSTRAINT FK_TERM_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE VarbindDictionary ADD CONSTRAINT FK_VarbindDictionary_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE VarbindDictionary ADD CONSTRAINT FK_VarbindDictionary_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE VNFType ADD CONSTRAINT FK_VNFType_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE VNFType ADD CONSTRAINT FK_VNFType_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE VSCLAction ADD CONSTRAINT FK_VSCLAction_modified_by FOREIGN KEY (modified_by) REFERENCES UserInfo (loginid)
+ALTER TABLE VSCLAction ADD CONSTRAINT FK_VSCLAction_created_by FOREIGN KEY (created_by) REFERENCES UserInfo (loginid)
+ALTER TABLE PolicyGroupEntity ADD CONSTRAINT FK_PolicyGroupEntity_policyId FOREIGN KEY (policyId) REFERENCES PolicyEntity (policyId)
+ALTER TABLE PolicyGroupEntity ADD CONSTRAINT FK_PolicyGroupEntity_groupKey FOREIGN KEY (groupKey) REFERENCES GroupEntity (groupKey)
+CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT NUMERIC(38), PRIMARY KEY (SEQ_NAME))
+INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)
diff --git a/ECOMP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl b/ECOMP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl
new file mode 100644
index 0000000..70ef3cb
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/resources/META-INF/generatedDrop.ddl
@@ -0,0 +1,118 @@
+ALTER TABLE PolicyEntity DROP CONSTRAINT FK_PolicyEntity_configurationDataId
+ALTER TABLE PolicyEntity DROP CONSTRAINT FK_PolicyEntity_actionBodyId
+ALTER TABLE PdpEntity DROP CONSTRAINT FK_PdpEntity_groupKey
+ALTER TABLE FunctionDefinition DROP CONSTRAINT FK_FunctionDefinition_return_datatype
+ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_category
+ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_constraint_type
+ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_created_by
+ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_modified_by
+ALTER TABLE Attribute DROP CONSTRAINT FK_Attribute_datatype
+ALTER TABLE ConstraintValues DROP CONSTRAINT FK_ConstraintValues_attribute_id
+ALTER TABLE FunctionArguments DROP CONSTRAINT FK_FunctionArguments_function_id
+ALTER TABLE FunctionArguments DROP CONSTRAINT FK_FunctionArguments_datatype_id
+ALTER TABLE ActionPolicyDict DROP CONSTRAINT FK_ActionPolicyDict_modified_by
+ALTER TABLE ActionPolicyDict DROP CONSTRAINT FK_ActionPolicyDict_created_by
+ALTER TABLE DecisionSettings DROP CONSTRAINT FK_DecisionSettings_created_by
+ALTER TABLE DecisionSettings DROP CONSTRAINT FK_DecisionSettings_datatype
+ALTER TABLE DecisionSettings DROP CONSTRAINT FK_DecisionSettings_modified_by
+ALTER TABLE MicroServiceModels DROP CONSTRAINT FK_MicroServiceModels_imported_by
+ALTER TABLE AttributeAssignment DROP CONSTRAINT FK_AttributeAssignment_OBADVICE_id
+ALTER TABLE BRMSParamTemplate DROP CONSTRAINT FK_BRMSParamTemplate_created_by
+ALTER TABLE ClosedLoopD2Services DROP CONSTRAINT FK_ClosedLoopD2Services_modified_by
+ALTER TABLE ClosedLoopD2Services DROP CONSTRAINT FK_ClosedLoopD2Services_created_by
+ALTER TABLE ClosedLoopSite DROP CONSTRAINT FK_ClosedLoopSite_modified_by
+ALTER TABLE ClosedLoopSite DROP CONSTRAINT FK_ClosedLoopSite_created_by
+ALTER TABLE DescriptiveScope DROP CONSTRAINT FK_DescriptiveScope_created_by
+ALTER TABLE DescriptiveScope DROP CONSTRAINT FK_DescriptiveScope_modified_by
+ALTER TABLE EcompName DROP CONSTRAINT FK_EcompName_created_by
+ALTER TABLE EcompName DROP CONSTRAINT FK_EcompName_modified_by
+ALTER TABLE ObadviceExpressions DROP CONSTRAINT FK_ObadviceExpressions_obadvice_id
+ALTER TABLE ObadviceExpressions DROP CONSTRAINT FK_ObadviceExpressions_attribute_id
+ALTER TABLE PEPOptions DROP CONSTRAINT FK_PEPOptions_modified_by
+ALTER TABLE PEPOptions DROP CONSTRAINT FK_PEPOptions_created_by
+ALTER TABLE PIPConfigParams DROP CONSTRAINT FK_PIPConfigParams_PIP_ID
+ALTER TABLE PIPConfiguration DROP CONSTRAINT FK_PIPConfiguration_TYPE
+ALTER TABLE PIPResolver DROP CONSTRAINT FK_PIPResolver_PIP_ID
+ALTER TABLE PIPResolverParams DROP CONSTRAINT FK_PIPResolverParams_ID_RESOLVER
+ALTER TABLE roles DROP CONSTRAINT FK_roles_loginid
+ALTER TABLE TERM DROP CONSTRAINT FK_TERM_modified_by
+ALTER TABLE TERM DROP CONSTRAINT FK_TERM_created_by
+ALTER TABLE VarbindDictionary DROP CONSTRAINT FK_VarbindDictionary_modified_by
+ALTER TABLE VarbindDictionary DROP CONSTRAINT FK_VarbindDictionary_created_by
+ALTER TABLE VNFType DROP CONSTRAINT FK_VNFType_modified_by
+ALTER TABLE VNFType DROP CONSTRAINT FK_VNFType_created_by
+ALTER TABLE VSCLAction DROP CONSTRAINT FK_VSCLAction_modified_by
+ALTER TABLE VSCLAction DROP CONSTRAINT FK_VSCLAction_created_by
+ALTER TABLE PolicyGroupEntity DROP CONSTRAINT FK_PolicyGroupEntity_policyId
+ALTER TABLE PolicyGroupEntity DROP CONSTRAINT FK_PolicyGroupEntity_groupKey
+DROP TABLE PolicyEntity
+DROP TABLE ConfigurationDataEntity
+DROP TABLE PolicyDBDaoEntity
+DROP TABLE GroupEntity
+DROP TABLE PdpEntity
+DROP TABLE ActionBodyEntity
+DROP TABLE DatabaseLockEntity
+DROP TABLE PolicyVersion
+DROP TABLE POLICYSCORE
+DROP TABLE FunctionDefinition
+DROP TABLE Attribute
+DROP TABLE Category
+DROP TABLE ConstraintType
+DROP TABLE ConstraintValues
+DROP TABLE Datatype
+DROP TABLE FunctionArguments
+DROP TABLE UserInfo
+DROP TABLE ActionPolicyDict
+DROP TABLE DecisionSettings
+DROP TABLE MicroServiceModels
+DROP TABLE actionlist
+DROP TABLE AddressGroup
+DROP TABLE AttributeAssignment
+DROP TABLE BRMSParamTemplate
+DROP TABLE ClosedLoopD2Services
+DROP TABLE ClosedLoopSite
+DROP TABLE DCAEUsers
+DROP TABLE DCAEuuid
+DROP TABLE DescriptiveScope
+DROP TABLE EcompName
+DROP TABLE EnforcingType
+DROP TABLE GlobalRoleSettings
+DROP TABLE GroupPolicyScopeList
+DROP TABLE GroupServiceList
+DROP TABLE MicroServiceConfigName
+DROP TABLE MicroServiceLocation
+DROP TABLE Obadvice
+DROP TABLE ObadviceExpressions
+DROP TABLE PEPOptions
+DROP TABLE PIPConfigParams
+DROP TABLE PIPConfiguration
+DROP TABLE PIPResolver
+DROP TABLE PIPResolverParams
+DROP TABLE PIPType
+DROP TABLE PolicyAlgorithms
+DROP TABLE policy_manangement
+DROP TABLE PolicyScopeService
+DROP TABLE PolicyScopeType
+DROP TABLE PolicyScopeResource
+DROP TABLE PolicyScopeClosedLoop
+DROP TABLE portlist
+DROP TABLE protocollist
+DROP TABLE RemoteCatalogValues
+DROP TABLE roles
+DROP TABLE RuleAlgorithms
+DROP TABLE securityzone
+DROP TABLE servicegroup
+DROP TABLE SystemLogDB
+DROP TABLE TERM
+DROP TABLE VarbindDictionary
+DROP TABLE VMType
+DROP TABLE VNFType
+DROP TABLE VSCLAction
+DROP TABLE zone
+DROP TABLE BackUpMonitorEntity
+DROP TABLE StateManagementEntity
+DROP TABLE ForwardProgressEntity
+DROP TABLE ResourceRegistrationEntity
+DROP TABLE IntegrityAuditEntity
+DROP TABLE PolicyGroupEntity
+DELETE FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'
diff --git a/ECOMP-PAP-REST/src/main/resources/logback.xml b/ECOMP-PAP-REST/src/main/resources/logback.xml
index 7c328c5..b119a4e 100644
--- a/ECOMP-PAP-REST/src/main/resources/logback.xml
+++ b/ECOMP-PAP-REST/src/main/resources/logback.xml
@@ -44,14 +44,15 @@
            <property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
            <property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{ElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
    -->
-   <property name="defaultAuditPattern" value="%X{TransactionBeginTimestamp}|%X{TransactionEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{TransactionElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+   <property name="defaultAuditPattern" value="%X{TransactionBeginTimestamp}|%X{TransactionEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{TransactionElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
   
   
   
    <!--    M E T R I C 
           <property name="defaultMetricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
    -->
-   <property name="defaultMetricPattern" value="%X{MetricBeginTimestamp}|%X{MetricEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%p|%X{severity}|%X{serverIpAddress}|%X{MetricElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+   <property name="defaultMetricPattern" value="%X{MetricBeginTimestamp}|%X{MetricEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%p|%X{severity}|%X{serverIpAddress}|%X{MetricElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+  
   
      
    
diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
index c5fa379..6ab3d35 100644
--- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
+++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/ia/DbAuditCompareEntriesTest.java
@@ -20,7 +20,8 @@
 
 package org.openecomp.policy.pap.ia;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -32,79 +33,13 @@
 import javax.persistence.EntityTransaction;
 import javax.persistence.Persistence;
 
+import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.openecomp.policy.jpa.BackUpMonitorEntity;
-import org.openecomp.policy.rest.jpa.ActionBodyEntity;
-import org.openecomp.policy.rest.jpa.ActionList;
-import org.openecomp.policy.rest.jpa.ActionPolicyDict;
-import org.openecomp.policy.rest.jpa.AddressGroup;
-import org.openecomp.policy.rest.jpa.Attribute;
-import org.openecomp.policy.rest.jpa.AttributeAssignment;
-import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
-import org.openecomp.policy.rest.jpa.Category;
-import org.openecomp.policy.rest.jpa.ClosedLoopD2Services;
-import org.openecomp.policy.rest.jpa.ClosedLoopSite;
-import org.openecomp.policy.rest.jpa.ConfigurationDataEntity;
-import org.openecomp.policy.rest.jpa.ConstraintType;
-import org.openecomp.policy.rest.jpa.ConstraintValue;
-import org.openecomp.policy.rest.jpa.DCAEUsers;
-import org.openecomp.policy.rest.jpa.DCAEuuid;
-import org.openecomp.policy.rest.jpa.DatabaseLockEntity;
-import org.openecomp.policy.rest.jpa.Datatype;
-import org.openecomp.policy.rest.jpa.DecisionSettings;
-import org.openecomp.policy.rest.jpa.DescriptiveScope;
-import org.openecomp.policy.rest.jpa.EcompName;
-import org.openecomp.policy.rest.jpa.EnforcingType;
-import org.openecomp.policy.rest.jpa.FunctionArgument;
-import org.openecomp.policy.rest.jpa.FunctionDefinition;
-import org.openecomp.policy.rest.jpa.GlobalRoleSettings;
-import org.openecomp.policy.rest.jpa.GroupEntity;
-import org.openecomp.policy.rest.jpa.GroupPolicyScopeList;
-import org.openecomp.policy.rest.jpa.GroupServiceList;
-import org.openecomp.policy.rest.jpa.MicroServiceConfigName;
-import org.openecomp.policy.rest.jpa.MicroServiceLocation;
-import org.openecomp.policy.rest.jpa.MicroServiceModels;
-import org.openecomp.policy.rest.jpa.Obadvice;
-import org.openecomp.policy.rest.jpa.ObadviceExpression;
-import org.openecomp.policy.rest.jpa.PEPOptions;
-import org.openecomp.policy.rest.jpa.PIPConfigParam;
-import org.openecomp.policy.rest.jpa.PIPConfiguration;
-import org.openecomp.policy.rest.jpa.PIPResolver;
-import org.openecomp.policy.rest.jpa.PIPResolverParam;
-import org.openecomp.policy.rest.jpa.PIPType;
-import org.openecomp.policy.rest.jpa.PREFIXLIST;
-import org.openecomp.policy.rest.jpa.PdpEntity;
-import org.openecomp.policy.rest.jpa.PolicyAlgorithms;
-import org.openecomp.policy.rest.jpa.PolicyDBDaoEntity;
-import org.openecomp.policy.rest.jpa.PolicyEntity;
-import org.openecomp.policy.rest.jpa.PolicyManagement;
-import org.openecomp.policy.rest.jpa.PolicyRoles;
-import org.openecomp.policy.rest.jpa.PolicyScopeClosedLoop;
-import org.openecomp.policy.rest.jpa.PolicyScopeResource;
-import org.openecomp.policy.rest.jpa.PolicyScopeService;
-import org.openecomp.policy.rest.jpa.PolicyScopeType;
-import org.openecomp.policy.rest.jpa.PolicyScore;
-import org.openecomp.policy.rest.jpa.PolicyVersion;
-import org.openecomp.policy.rest.jpa.PortList;
-import org.openecomp.policy.rest.jpa.ProtocolList;
-import org.openecomp.policy.rest.jpa.RemoteCatalogValues;
-import org.openecomp.policy.rest.jpa.RuleAlgorithms;
-import org.openecomp.policy.rest.jpa.SecurityZone;
-import org.openecomp.policy.rest.jpa.ServiceList;
-import org.openecomp.policy.rest.jpa.SystemLogDB;
-import org.openecomp.policy.rest.jpa.TermList;
-import org.openecomp.policy.rest.jpa.UserInfo;
-import org.openecomp.policy.rest.jpa.VMType;
-import org.openecomp.policy.rest.jpa.VNFType;
-import org.openecomp.policy.rest.jpa.VSCLAction;
-import org.openecomp.policy.rest.jpa.VarbindDictionary;
-import org.openecomp.policy.rest.jpa.Zone;
-
 import org.openecomp.policy.common.ia.DbAudit;
 import org.openecomp.policy.common.ia.DbDAO;
 import org.openecomp.policy.common.ia.IntegrityAuditProperties;
@@ -112,8 +47,7 @@
 import org.openecomp.policy.common.im.jpa.ForwardProgressEntity;
 import org.openecomp.policy.common.im.jpa.ResourceRegistrationEntity;
 import org.openecomp.policy.common.im.jpa.StateManagementEntity;
-
-import org.apache.commons.lang3.SerializationUtils;
+import org.openecomp.policy.jpa.BackUpMonitorEntity;
 
 @Ignore
 public class DbAuditCompareEntriesTest {
diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServletTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServletTest.java
index da11d72..b87d990 100644
--- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServletTest.java
+++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/XACMLPapServletTest.java
@@ -20,7 +20,7 @@
 
 package org.openecomp.policy.pap.xacml.rest;
 
-import static org.junit.Assert.assertTrue;
+/*import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
@@ -95,7 +95,7 @@
     	
     	Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pap.test.properties");
     	
-		System.setProperty("xacml.PAP.papEngineFactory", "org.openecomp.policy.xacml.std.pap.StdEngineFactory");
+		System.setProperty("xacml.PAP.papEngineFactory", "com.att.research.xacml.std.pap.StdEngineFactory");
 		System.setProperty("xacml.pap.pdps", "pdps");
 		System.setProperty("xacml.rest.pap.url", "http://localhost:8070/pap/");
 		System.setProperty("xacml.rest.pap.initiate.pdp", "false");
@@ -117,10 +117,10 @@
 		System.setProperty("node_type", "pap"); 
     }
 	
-    /*
+    
      * This method initializes and cleans the DB so the XACMLPapServlet will be able to instantiate an
      * IntegrityAudit object which will use the DB.
-     */
+     
 	public void initializeDb(){
 		logger.debug("initializeDb: enter");
     	Properties cleanProperties = new Properties();
@@ -171,7 +171,7 @@
 		}
 	}
 	
-/*	public void testDoGetPapTest(){
+	public void testDoGetPapTest(){
 		try{
 			Mockito.when(httpServletRequest.getRequestURI()).thenReturn("/pap/test");
 			papServlet.init(servletConfig);
@@ -186,9 +186,9 @@
 			fail();
 		}
 		assertTrue(true);
-	}*/
+	}
 
-/*	
+	
  * Need to figure a way to get it to match any message string
  * public void testDoGetPapTestFpcFailure(){
 		try{
@@ -204,7 +204,7 @@
 			fail();
 		}
 		assertTrue(true);
-	}*/
+	}
 	
 	public void testDoGetLocal(){
 		try{
@@ -268,7 +268,7 @@
 		}
 	}
 	//why is this test trying to send no pdp id and expecting a 200 response?
-	/*
+	
 	public void testDoPost(){
 		final ByteArrayOutputStream os = new ByteArrayOutputStream ();
 		ByteArrayOutputStream multiPartResponse = new ByteArrayOutputStream();
@@ -293,7 +293,7 @@
 			fail();
 		}
 	}	
-	*/
+	
 		
 	public void testDoPostPDPId(){
 		String groupId = "newPDP";
@@ -366,3 +366,4 @@
 		}
 	}
 }
+*/
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
index 81f33c9..1009e03 100644
--- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
+++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
@@ -36,41 +36,34 @@
 import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.Assert;
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
-import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
-import org.openecomp.policy.pap.xacml.rest.components.ConfigPolicy;
-import org.openecomp.policy.pap.xacml.rest.components.Policy;
-import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao;
-import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.pap.xacml.rest.components.PolicyDBDao.PolicyDBDaoTestClass;
 import org.openecomp.policy.rest.XACMLRestProperties;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
 import org.openecomp.policy.rest.jpa.ActionBodyEntity;
 import org.openecomp.policy.rest.jpa.GroupEntity;
 import org.openecomp.policy.rest.jpa.PdpEntity;
 import org.openecomp.policy.rest.jpa.PolicyEntity;
 import org.openecomp.policy.rest.util.Webapps;
-
-import com.att.research.xacml.api.pap.PAPException;
-
 import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
 import org.openecomp.policy.xacml.std.pap.StdPDPGroup;
 import org.openecomp.policy.xacml.util.XACMLPolicyWriter;
+
+import com.att.research.xacml.api.pap.PAPException;
 import com.att.research.xacml.util.XACMLProperties;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-//import org.apache.commons.logging.Log;
-//import org.apache.commons.logging.LogFactory;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.Ignore;
-
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 
-import org.junit.Assert;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger; 
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-
 @Ignore //only run locally as timing sometimes causes failures on Jenkins
 public class PolicyDBDaoTest {
 
@@ -180,14 +173,14 @@
 //			Assert.fail();
 //		}
 		String filePath = null;
-		String xmlFile = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:eaa4bb64-59cf-4517-bb44-b2eeabd50b11\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n    <Description></Description>\n    <Target>\n        <AnyOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#integer\">99</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"cpu\" DataType=\"http://www.w3.org/2001/XMLSchema#integer\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n        </AnyOf>\n    </Target>\n    <Rule RuleId=\"urn:com:xacml:rule:id:3350bf37-43d0-4a94-a317-febec81150d8\" Effect=\"Permit\">\n        <Target/>\n        <ObligationExpressions>\n            <ObligationExpression ObligationId=\"test\" FulfillOn=\"Permit\">\n                <AttributeAssignmentExpression AttributeId=\"performer\" Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">PDPAction</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">REST</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"url\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">http://localhost:8056/pcd</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"method\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">GET</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"body\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URLaction/com.Action_patbaction7.json</AttributeValue>\n                </AttributeAssignmentExpression>\n            </ObligationExpression>\n        </ObligationExpressions>\n    </Rule>\n</Policy>\n";
+		String xmlFile = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:eaa4bb64-59cf-4517-bb44-b2eeabd50b11\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n    <Description></Description>\n    <Target>\n        <AnyOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.labs.ecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#integer\">99</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"cpu\" DataType=\"http://www.w3.org/2001/XMLSchema#integer\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n        </AnyOf>\n    </Target>\n    <Rule RuleId=\"urn:com:xacml:rule:id:3350bf37-43d0-4a94-a317-febec81150d8\" Effect=\"Permit\">\n        <Target/>\n        <ObligationExpressions>\n            <ObligationExpression ObligationId=\"test\" FulfillOn=\"Permit\">\n                <AttributeAssignmentExpression AttributeId=\"performer\" Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">PDPAction</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">REST</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"url\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">http://localhost:8056/pcd</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"method\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">GET</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"body\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URLaction/com.Action_patbaction7.json</AttributeValue>\n                </AttributeAssignmentExpression>\n            </ObligationExpression>\n        </ObligationExpressions>\n    </Rule>\n</Policy>\n";
 		String jsonFile = "{\"actionAttribute\":\"Memory\"}";
 		
 		try{
 			//policy file
 			InputStream in = new ByteArrayInputStream(xmlFile.getBytes());
 			String workspaceDir = "src/test/resources/junitTestCreatedDirectory/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE)+"/admin/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY);
-			FileUtils.forceMkdir(new File(workspaceDir+"/org/openecomp"));
+			FileUtils.forceMkdir(new File(workspaceDir+"/com/att"));
 			File outFile = new File(workspaceDir+"/org/openecomp/Action_mypol.xml");
 			OutputStream out = new FileOutputStream(outFile);
 			IOUtils.copy(in, out);
@@ -283,7 +276,7 @@
 			}
 			willFail.close();
 			
-			fakeFile = new File("directorythatdoesnotexist/"+workspaceDir+"org/openecomp/Action_mypol2.xml");
+			fakeFile = new File("directorythatdoesnotexist/"+workspaceDir+"com/att/Action_mypol2.xml");
 			willFail = dbd.getNewTransaction();
 			try{
 			willFail.createPolicy(fakeFile.getAbsolutePath(), "user1");
@@ -319,7 +312,7 @@
 	@Test
 	public void createFromPolicyObject(){
 		String workspaceDir = "src/test/resources/junitTestCreatedDirectory/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE)+"/admin/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY);
-		File parentPath = new File(workspaceDir+"/org/openecomp");
+		File parentPath = new File(workspaceDir+"/com/att");
 		File scope = new File(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WORKSPACE)+"/admin/"+XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_REPOSITORY));
 		Policy policyObject = new ConfigPolicy();
 		policyObject.policyAdapter = new PolicyRestAdapter();
@@ -635,7 +628,6 @@
 			System.out.println("Decrypted password: "+decr);
 			Assert.assertEquals("testpassword", decr);
 		} catch (Exception e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 			Assert.fail();
 		}
@@ -670,7 +662,6 @@
 			}
 			Thread.sleep(sleepTime);
 		} catch (InterruptedException e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 		if(logger.isDebugEnabled()){
@@ -712,7 +703,6 @@
 			}
 			Thread.sleep(sleepTime);
 		} catch (InterruptedException e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 		if(logger.isDebugEnabled()){
diff --git a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/jpa/PolicyEntityTest.java b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/jpa/PolicyEntityTest.java
index f71026c..0461640 100644
--- a/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/jpa/PolicyEntityTest.java
+++ b/ECOMP-PAP-REST/src/test/java/org/openecomp/policy/pap/xacml/rest/jpa/PolicyEntityTest.java
@@ -48,7 +48,6 @@
 	
 	private static Logger logger = FlexLogger.getLogger(PolicyEntityTest.class);
 	
-//    @Ignore
     @Test
     public void testAllOps(){
     	Properties properties = new Properties();
@@ -125,18 +124,18 @@
         //We will NOT set the ConfigurationDataEntity or ActionBodyEntity object just to test that it is optional
         
         //set createdBy
-        p1.setCreatedBy("super-admin");
+        p1.setCreatedBy("kevin");
         
         //createdDate will be set when it is persisted
         
         //set scope
-        p1.setScope("com.test");
+        p1.setScope("mckiou.kevin");
         
         //set description
         p1.setDescription("PolicyEntity Description");
         
         //set modifiedBy
-        p1.setModifiedBy("super-admin");
+        p1.setModifiedBy("kevin");
         
         //modifiedDate will be set when it is persisted
       
@@ -202,7 +201,9 @@
         
         c1.setDescription("ConfigurationDataEntity Description");
         
-        c1.setCreatedBy("super-admin");
+        c1.setCreatedBy("kevin");
+        
+        //c1.setModifiedBy("kevin");
         
         c1.setDeleted(true);
         
@@ -214,9 +215,9 @@
         
         a1.setActionBodyName("myActionBodyName");
         
-        a1.setCreatedBy("super-admin");
+        a1.setCreatedBy("kevin");
         
-        a1.setModifiedBy("super-admin");
+        a1.setModifiedBy("kevin");
         
         a1.setDeleted(false);
         
@@ -274,7 +275,7 @@
         Query queryscope = em.createQuery("Select p from PolicyEntity p where p.scope=:s");
         
         query.setParameter("pid", p1.getPolicyId());
-        queryscope.setParameter("s", "com.user");
+        queryscope.setParameter("s", "mckiou.kevin.kim");
         
         //Just test that we are retrieving the right object
         @SuppressWarnings("rawtypes")
@@ -669,7 +670,7 @@
         
         pe1.setDescription("This is pe1");
         
-        pe1.setPolicyDBDaoUrl("http://10.11.12.13:2345");
+        pe1.setPolicyDBDaoUrl("http://123.45.2.456:2345");
         
         //push it to the DB
         em.flush();
@@ -680,7 +681,7 @@
         
         pe2.setDescription("This is pe2");
         
-        pe2.setPolicyDBDaoUrl("http://10.11.12.13:2345");
+        pe2.setPolicyDBDaoUrl("http://789.01.2.345:2345");
         
         //Print them to the log before flushing
         logger.debug("\n\n***********PolicyEntityTest: PolicyDBDaoEntity objects before flush********"
@@ -711,9 +712,9 @@
         	}
         	for(Object policyDBDaoEntity: resultList){
         		PolicyDBDaoEntity pdbdao = (PolicyDBDaoEntity)policyDBDaoEntity;
-        		if(pdbdao.getPolicyDBDaoUrl().equals("http://10.11.12.13:2345")){
+        		if(pdbdao.getPolicyDBDaoUrl().equals("http://123.45.2.456:2345")){
         			pex = pdbdao;
-        		}else if(pdbdao.getPolicyDBDaoUrl().equals("http://10.11.12.13:2345")){
+        		}else if(pdbdao.getPolicyDBDaoUrl().equals("http://789.01.2.345:2345")){
         			pey = pdbdao;
         		}
         	}
@@ -731,7 +732,7 @@
         			+ "\n   modifiedDate-y " + pey.getModifiedDate()
             		);
         	//Verify the retrieved objects are the same as the ones we stored in the DB
-        	if(pex.getPolicyDBDaoUrl().equals("http://10.11.12.13:2345")){
+        	if(pex.getPolicyDBDaoUrl().equals("http://123.45.2.456:2345")){
         		assertSame(pe1,pex);
         		assertSame(pe2,pey);
         	}else{
