diff --git a/ECOMP-PAP-REST/pip.properties b/ECOMP-PAP-REST/pip.properties
new file mode 100644
index 0000000..61aa1eb
--- /dev/null
+++ b/ECOMP-PAP-REST/pip.properties
@@ -0,0 +1,226 @@
+#
+# Default PIP Configuration from Policy. 
+# 
+xacml.pip.engines=AAF,sql1
+
+### AAF PIP Configuration. 
+AAF.description=AAFEngine to communicate with AAF to take decisions
+AAF.classname=org.openecomp.policy.xacml.std.pip.engines.aaf.AAFEngine
+AAF.name=AAFEngine
+
+### sql1 PIP Configuration. 
+# Class from XACML resource. 
+sql1.classname=com.att.research.xacml.std.pip.engines.jdbc.JDBCEngine
+sql1.name=OperationsHistory
+sql1.description=Database of operations performed via closed loop.
+sql1.issuer=org:openecomp:xacml:sql123
+sql1.type=jdbc
+sql1.jdbc.driver=com.mysql.jdbc.Driver
+sql1.jdbc.url=jdbc:mysql://localhost:3306/policy
+sql1.jdbc.conn.user=root
+sql1.jdbc.conn.password=password
+
+#Each of the following resolvers corresponds to a specific time window. The only difference between them is the "interval" in the "select" SQL query and the "issuer".
+sql1.resolvers=tw5min,tw10min,tw30min,tw1h,tw12h,tw1d,tw5d,tw1w,tw1mon
+
+##############################################
+sql1.resolver.tw5min.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 5 minute) and now()
+sql1.resolver.tw5min.field.count.issuer=org:openecomp:xacml:sql:tw5min
+
+sql1.resolver.tw5min.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw5min.name=OperationsCount
+sql1.resolver.tw5min.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw5min.fields=count
+sql1.resolver.tw5min.field.count.id=count
+sql1.resolver.tw5min.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw5min.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw5min.parameters=actor,operation,target
+sql1.resolver.tw5min.parameter.actor.id=actor
+sql1.resolver.tw5min.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw5min.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw5min.parameter.operation.id=recipe
+sql1.resolver.tw5min.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw5min.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw5min.parameter.target.id=target
+sql1.resolver.tw5min.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw5min.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+##############################################
+sql1.resolver.tw10min.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 10 minute) and now()
+sql1.resolver.tw10min.field.count.issuer=org:openecomp:xacml:sql:tw10min
+
+sql1.resolver.tw10min.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw10min.name=OperationsCount
+sql1.resolver.tw10min.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw10min.fields=count
+sql1.resolver.tw10min.field.count.id=count
+sql1.resolver.tw10min.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw10min.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw10min.parameters=actor,operation,target
+sql1.resolver.tw10min.parameter.actor.id=actor
+sql1.resolver.tw10min.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw10min.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw10min.parameter.operation.id=recipe
+sql1.resolver.tw10min.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw10min.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw10min.parameter.target.id=target
+sql1.resolver.tw10min.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw10min.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+##############################################
+sql1.resolver.tw30min.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 30 minute) and now()
+sql1.resolver.tw30min.field.count.issuer=org:openecomp:xacml:sql:tw30min
+
+sql1.resolver.tw30min.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw30min.name=OperationsCount
+sql1.resolver.tw30min.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw30min.fields=count
+sql1.resolver.tw30min.field.count.id=count
+sql1.resolver.tw30min.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw30min.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw30min.parameters=actor,operation,target
+sql1.resolver.tw30min.parameter.actor.id=actor
+sql1.resolver.tw30min.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw30min.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw30min.parameter.operation.id=recipe
+sql1.resolver.tw30min.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw30min.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw30min.parameter.target.id=target
+sql1.resolver.tw30min.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw30min.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+##############################################
+sql1.resolver.tw1h.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 1 hour) and now()
+sql1.resolver.tw1h.field.count.issuer=org:openecomp:xacml:sql:tw1h
+
+sql1.resolver.tw1h.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw1h.name=OperationsCount
+sql1.resolver.tw1h.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw1h.fields=count
+sql1.resolver.tw1h.field.count.id=count
+sql1.resolver.tw1h.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw1h.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1h.parameters=actor,operation,target
+sql1.resolver.tw1h.parameter.actor.id=actor
+sql1.resolver.tw1h.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1h.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1h.parameter.operation.id=recipe
+sql1.resolver.tw1h.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1h.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1h.parameter.target.id=target
+sql1.resolver.tw1h.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1h.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+
+##############################################
+sql1.resolver.tw12h.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 12 hour) and now()
+sql1.resolver.tw12h.field.count.issuer=org:openecomp:xacml:sql:tw12h
+
+sql1.resolver.tw12h.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw12h.name=OperationsCount
+sql1.resolver.tw12h.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw12h.fields=count
+sql1.resolver.tw12h.field.count.id=count
+sql1.resolver.tw12h.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw12h.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw12h.parameters=actor,operation,target
+sql1.resolver.tw12h.parameter.actor.id=actor
+sql1.resolver.tw12h.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw12h.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw12h.parameter.operation.id=recipe
+sql1.resolver.tw12h.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw12h.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw12h.parameter.target.id=target
+sql1.resolver.tw12h.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw12h.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+
+#############################
+sql1.resolver.tw1d.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 1 day) and now()
+sql1.resolver.tw1d.field.count.issuer=org:openecomp:xacml:sql:tw1d
+
+sql1.resolver.tw1d.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw1d.name=OperationsCount
+sql1.resolver.tw1d.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw1d.fields=count
+sql1.resolver.tw1d.field.count.id=count
+sql1.resolver.tw1d.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw1d.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1d.parameters=actor,operation,target
+sql1.resolver.tw1d.parameter.actor.id=actor
+sql1.resolver.tw1d.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1d.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1d.parameter.operation.id=recipe
+sql1.resolver.tw1d.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1d.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1d.parameter.target.id=target
+sql1.resolver.tw1d.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1d.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+
+#############################
+sql1.resolver.tw5d.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 5 day) and now()
+sql1.resolver.tw5d.field.count.issuer=org:openecomp:xacml:sql:tw5d
+
+sql1.resolver.tw5d.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw5d.name=OperationsCount
+sql1.resolver.tw5d.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw5d.fields=count
+sql1.resolver.tw5d.field.count.id=count
+sql1.resolver.tw5d.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw5d.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw5d.parameters=actor,operation,target
+sql1.resolver.tw5d.parameter.actor.id=actor
+sql1.resolver.tw5d.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw5d.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw5d.parameter.operation.id=recipe
+sql1.resolver.tw5d.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw5d.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw5d.parameter.target.id=target
+sql1.resolver.tw5d.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw5d.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+
+#############################
+sql1.resolver.tw1w.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 1 week) and now()
+sql1.resolver.tw1w.field.count.issuer=org:openecomp:xacml:sql:tw1w
+
+sql1.resolver.tw1w.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw1w.name=OperationsCount
+sql1.resolver.tw1w.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw1w.fields=count
+sql1.resolver.tw1w.field.count.id=count
+sql1.resolver.tw1w.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw1w.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1w.parameters=actor,operation,target
+sql1.resolver.tw1w.parameter.actor.id=actor
+sql1.resolver.tw1w.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1w.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1w.parameter.operation.id=recipe
+sql1.resolver.tw1w.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1w.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1w.parameter.target.id=target
+sql1.resolver.tw1w.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1w.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+
+#############################
+sql1.resolver.tw1mon.select=select count(*) as count from operationshistory10 where outcome<>'Failure_Guard' and actor=? and operation=? and target=? and endtime between date_sub(now(),interval 1 month) and now()
+sql1.resolver.tw1mon.field.count.issuer=org:openecomp:xacml:sql:tw1mon
+
+sql1.resolver.tw1mon.classname=com.att.research.xacml.std.pip.engines.jdbc.ConfigurableJDBCResolver
+sql1.resolver.tw1mon.name=OperationsCount
+sql1.resolver.tw1mon.description=This returns the number of previous operations within the given time window
+sql1.resolver.tw1mon.fields=count
+sql1.resolver.tw1mon.field.count.id=count
+sql1.resolver.tw1mon.field.count.datatype=http://www.w3.org/2001/XMLSchema#integer
+sql1.resolver.tw1mon.field.count.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1mon.parameters=actor,operation,target
+sql1.resolver.tw1mon.parameter.actor.id=actor
+sql1.resolver.tw1mon.parameter.actor.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1mon.parameter.actor.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1mon.parameter.operation.id=recipe
+sql1.resolver.tw1mon.parameter.operation.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1mon.parameter.operation.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
+sql1.resolver.tw1mon.parameter.target.id=target
+sql1.resolver.tw1mon.parameter.target.datatype=http://www.w3.org/2001/XMLSchema#string
+sql1.resolver.tw1mon.parameter.target.category=urn:oasis:names:tc:xacml:3.0:attribute-category:resource
diff --git a/ECOMP-PAP-REST/pom.xml b/ECOMP-PAP-REST/pom.xml
index 94fd4b3..5d35eda 100644
--- a/ECOMP-PAP-REST/pom.xml
+++ b/ECOMP-PAP-REST/pom.xml
@@ -19,12 +19,10 @@
   ============LICENSE_END=========================================================
   -->
 
-
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
 	<modelVersion>4.0.0</modelVersion>
-
 	<artifactId>ECOMP-PAP-REST</artifactId>
 	<description>ECOMP-PAP-REST</description>
 	<packaging>war</packaging>
@@ -35,32 +33,32 @@
 	</parent>
 	<build>
 		<plugins>
-	 		<plugin>
-	      		<artifactId>maven-war-plugin</artifactId>
-	      		<version>2.1</version>
-	      		<configuration>
-	        		<attachClasses>true</attachClasses>
-	        		<webResources>
-	        			<webResource>
-	        				<directory>src/main/java/</directory>
-	        				<targetPath>WEB-INF/classes/</targetPath>
-	        				<includes>
-	        					<include>hibernate.cfg.xml</include>
-	        				</includes>
-	        			</webResource>
-	        		</webResources>
-	      		</configuration>
-   			</plugin>
-   			<plugin>
-   				<groupId>org.apache.maven.plugins</groupId>
-   				<artifactId>maven-compiler-plugin</artifactId>
-   				<version>3.2</version>
-   				<configuration>
-   					<source>1.8</source>
-   					<target>1.8</target>
-   				</configuration>
-   			</plugin>
-    	</plugins>
+			<plugin>
+				<artifactId>maven-war-plugin</artifactId>
+				<version>2.1</version>
+				<configuration>
+					<attachClasses>true</attachClasses>
+					<webResources>
+						<webResource>
+							<directory>src/main/java/</directory>
+							<targetPath>WEB-INF/classes/</targetPath>
+							<includes>
+								<include>hibernate.cfg.xml</include>
+							</includes>
+						</webResource>
+					</webResources>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>3.2</version>
+				<configuration>
+					<source>1.8</source>
+					<target>1.8</target>
+				</configuration>
+			</plugin>
+		</plugins>
 	</build>
 	<dependencies>
 		<dependency>
@@ -68,16 +66,32 @@
 			<groupId>org.openecomp.policy.engine</groupId>
 			<artifactId>PolicyEngineUtils</artifactId>
 			<version>${project.version}</version>
-		</dependency>		
+			<exclusions>
+				<exclusion>
+					<groupId>com.att.aft</groupId>
+					<artifactId>dme2</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.json</groupId>
+					<artifactId>json</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
 		<dependency>
-			 <groupId>org.apache.commons</groupId>
-			 <artifactId>commons-lang3</artifactId>
-			 <version>3.4</version>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-lang3</artifactId>
+			<version>3.4</version>
 		</dependency>
 		<dependency>
 			<groupId>org.openecomp.policy.engine</groupId>
 			<artifactId>ECOMP-PDP</artifactId>
 			<version>${project.version}</version>
+			<exclusions>
+				<exclusion>
+					<groupId>org.json</groupId>
+					<artifactId>json</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.openecomp.policy.common</groupId>
@@ -131,16 +145,6 @@
 			<version>14.0.1</version>
 		</dependency>
 		<dependency>
-			<groupId>com.fasterxml.jackson.core</groupId>
-			<artifactId>jackson-databind</artifactId>
-			<version>2.3.0-rc1</version>
-		</dependency>
-		<dependency>
-			<groupId>org.json</groupId>
-			<artifactId>json</artifactId>
-			<version>[20090211,)</version>
-		</dependency>
-		<dependency>
 			<groupId>org.eclipse.jgit</groupId>
 			<artifactId>org.eclipse.jgit</artifactId>
 			<version>3.2.0.201312181205-r</version>
@@ -183,22 +187,6 @@
 			<version>5.1.30</version>
 		</dependency>
 		<dependency>
-			<groupId>org.mariadb.jdbc</groupId>
-			<artifactId>mariadb-java-client</artifactId>
-			<version>1.2.3</version>
-		</dependency>		
-		<dependency>
-			<groupId>org.mockito</groupId>
-			<artifactId>mockito-core</artifactId>
-			<version>1.9.5</version>
-		</dependency>     
-		<!--  PLD WHICH VERSION?>dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>javax.servlet-api</artifactId>
-			<version>3.0.1</version>
-			<scope>provided</scope>
-		</dependency -->
-		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-mock</artifactId>
 			<version>2.0.8</version>
@@ -208,7 +196,7 @@
 			<artifactId>mockrunner</artifactId>
 			<version>0.3.1</version>
 		</dependency>
-				<!-- Spring -->
+		<!-- Spring -->
 		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-core</artifactId>
@@ -250,10 +238,75 @@
 			<artifactId>hibernate-validator</artifactId>
 			<version>5.1.3.Final</version>
 		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.json/json -->
+		<dependency>
+			<groupId>org.json</groupId>
+			<artifactId>json</artifactId>
+			<version>20160810</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-annotations</artifactId>
+			<version>2.6.3</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-core</artifactId>
+			<version>2.6.3</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>2.6.3</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.module</groupId>
+			<artifactId>jackson-module-jaxb-annotations</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.module</groupId>
+			<artifactId>jackson-module-jsonSchema</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.dataformat</groupId>
+			<artifactId>jackson-dataformat-xml</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+		<dependency>
+    		<groupId>org.elasticsearch</groupId>
+    		<artifactId>elasticsearch</artifactId>
+    		<version>5.1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>io.searchbox</groupId>
+			<artifactId>jest</artifactId>
+			<version>2.0.4</version>
+			<exclusions>
+				<exclusion>
+					<groupId>commons-logging</groupId>
+					<artifactId>commons-logging</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>args4j</groupId>
+			<artifactId>args4j</artifactId>
+			<version>2.32</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-dbcp -->
+		<dependency>
+			<groupId>org.apache.tomcat</groupId>
+			<artifactId>tomcat-dbcp</artifactId>
+			<version>8.5.9</version>
+		</dependency>
+
 	</dependencies>
 	<properties>
 		<springframework.version>4.2.0.RELEASE</springframework.version>
-		<hibernate.version>4.3.11.Final</hibernate.version>
+		<hibernate.version>4.3.10.Final</hibernate.version>
 		<projectversion>2.0.2</projectversion>
+		<jackson.version>2.6.0</jackson.version>
 	</properties>
 </project>
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{
diff --git a/ECOMP-PAP-REST/test.properties b/ECOMP-PAP-REST/test.properties
index a459f3e..251a69e 100644
--- a/ECOMP-PAP-REST/test.properties
+++ b/ECOMP-PAP-REST/test.properties
@@ -18,5 +18,5 @@
 # ============LICENSE_END=========================================================
 ###
 
-PDP_URL=http://localhost:9091/pdp/, testpdp, alpha456
+PDP_URL=http://localhost:8082/pdp/, testpdp, alpha456
 #PAP_URL=http://localhost:8070/pap/, testpap, alpha123
diff --git a/ECOMP-PAP-REST/xacml.pap.properties b/ECOMP-PAP-REST/xacml.pap.properties
index 91e393d..7ec9447 100644
--- a/ECOMP-PAP-REST/xacml.pap.properties
+++ b/ECOMP-PAP-REST/xacml.pap.properties
@@ -17,12 +17,23 @@
 # limitations under the License.
 # ============LICENSE_END=========================================================
 ###
-
+#=====================================================================================#
+#================The Below Properties are default, shouldn't change them==============#
+#=====================================================================================#
 #
 # This is our factory that will create our engine
 #
 xacml.PAP.papEngineFactory=org.openecomp.policy.xacml.std.pap.StdEngineFactory
-
+# Dictionary and Policy Implementation Classes Properties
+dictionary.impl.className=org.openecomp.policy.pap.xacml.rest.handler.DictionaryHandlerImpl
+savePolicy.impl.className=org.openecomp.policy.pap.xacml.rest.handler.SavePolicyHandler
+pushPolicy.impl.className=org.openecomp.policy.pap.xacml.rest.handler.PushPolicyHander
+deletePolicy.impl.className=org.openecomp.policy.pap.xacml.rest.handler.DeleteHandler
+#AutoPush Policy 
+xacml.rest.pap.autopush.file=autopush.properties
+#=====================================================================================#
+#===============The Below Properties will be changed based on Environment=============#
+#=====================================================================================#
 #
 # Where we store our PAP PDP Group/Node information
 #
@@ -35,7 +46,6 @@
 # but for startup there is no other way to get it.)
 #
 #
-
 xacml.rest.pap.url=http://localhost:8070/pap/
 
 #
@@ -55,28 +65,14 @@
 #
 xacml.rest.pap.heartbeat.timeout=100000
 
-################################################################################################
-# Adding properties for getting properties previously used by PAP-ADMIN for creating Policies
-# THis is part of the Policy Creation API project
-################################################################################################
-
-# Set your domain here:
-xacml.rest.pap.domain=com
-
-# Location where all the user workspaces are located.
-xacml.rest.pap.workspace=workspace
-
-# Location where the GIT repository is located
-xacml.rest.pap.repository=repository
-
 # new Property Please mention your PAP-REST webapps Location here. 
-xacml.rest.config.webapps=C:\\Second Tomcat\\apache-tomcat-8.0.23\\webapps\\ConfigPAP\\
+xacml.rest.config.webapps=/home/users/PolicyEngine/webapps/ConfigPAP/
 
 #Turn the audit on to synchronize the DB/file system
 #xacml.rest.pap.run.audit.flag=true
 #Turn the audit off to not synchronize the DB/file system
 #xacml.rest.pap.run.audit.flag=false
-xacml.rest.pap.run.audit.flag=false
+xacml.rest.pap.run.audit.flag=true
 
 #Audit will synchronize the file system to match the contents of the DB
 #xacml.rest.pap.filesystem.audit=true
@@ -91,12 +87,12 @@
 # pdps file
 xacml.rest.pdp.idfile=test.properties
 
-
+#Properties for db access
 #properties for MySql xacml database:  PLEASE DO NOT REMOVE... NEEDED FOR APIs
 javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/ecomp_sdk
-javax.persistence.jdbc.user=root
-javax.persistence.jdbc.password=
+javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/ecomp_sdk?failOverReadOnly=false&autoReconnect=true
+javax.persistence.jdbc.user=policy_user
+javax.persistence.jdbc.password=policy_user
 
 #Time in ms which a Policy DB transaction will wait to get the transaction lock object
 xacml.rest.pap.transaction.waitms=500000
@@ -110,10 +106,11 @@
 #controls how long the pap will wait before giving up when sending notifications to other paps
 xacml.rest.pap.notify.timeoutms=10000
 
+#the number of times an incoming policy update notification will be tried to be processed (or until it succeeds)
+xacml.rest.pap.incomingnotification.tries=4
+
 #AutoPush Policy Flag
 xacml.rest.pap.autopush.flag=false
-#AutoPush Policy 
-xacml.rest.pap.autopush.file=autopush.properties
 
 #***Properties for IntegrityMonitor integration defined in XACMLRestProperties.java***
 
@@ -153,3 +150,16 @@
 integrity_audit_period_seconds=-1
 
 ENVIRONMENT=DEVL
+
+#
+#PolicySafetyChecker properties
+#
+#Turn safetyChecker on/off
+xacml.rest.pap.safetychecker=on
+PDP_URL1 = http://localhost:8082/pdp/, testpdp, alpha456
+CLIENT_ID=
+CLIENT_KEY=
+
+#Micro Service Model Properties
+xacml.policy.msEcompName=http://ecomp.com
+xacml.policy.msPolicyName=http://ecomp.com/policy
\ No newline at end of file
diff --git a/ECOMP-PAP-REST/xacml.pap.test.properties b/ECOMP-PAP-REST/xacml.pap.test.properties
index 78a2c40..0f6f253 100644
--- a/ECOMP-PAP-REST/xacml.pap.test.properties
+++ b/ECOMP-PAP-REST/xacml.pap.test.properties
@@ -17,12 +17,21 @@
 # limitations under the License.
 # ============LICENSE_END=========================================================
 ###
-
+#=====================================================================================#
+#================The Below Properties are default, shouldn't change them==============#
+#=====================================================================================#
 #
 # This is our factory that will create our engine
 #
 xacml.PAP.papEngineFactory=org.openecomp.policy.xacml.std.pap.StdEngineFactory
-
+# Dictionary and Policy Implementation Classes Properties
+dictionary.impl.className=org.openecomp.policy.pap.xacml.rest.handler.DictionaryHandlerImpl
+savePolicy.impl.className=org.openecomp.policy.pap.xacml.rest.handler.SavePolicyHandler
+#AutoPush Policy 
+xacml.rest.pap.autopush.file=autopush.properties
+#=====================================================================================#
+#===============The Below Properties will be changed based on Environment=============#
+#=====================================================================================#
 #
 # Where we store our PAP PDP Group/Node information
 #
@@ -35,9 +44,7 @@
 # but for startup there is no other way to get it.)
 #
 #
-
 xacml.rest.pap.url=http://localhost:8070/pap/
-
 #
 # Upon startup, have the PAP servlet send latest configuration information to all
 # the PDP nodes it knows about.
@@ -55,22 +62,8 @@
 #
 xacml.rest.pap.heartbeat.timeout=10000
 
-################################################################################################
-# Adding properties for getting properties previously used by PAP-ADMIN for creating Policies
-# THis is part of the Policy Creation API project
-################################################################################################
-
-# Set your domain here:
-xacml.rest.pap.domain=com
-
-# Location where all the user workspaces are located.
-xacml.rest.pap.workspace=workspace
-
-# Location where the GIT repository is located
-xacml.rest.pap.repository=repository
-
 # new Property Please mention your PAP-REST webapps Location here. 
-xacml.rest.config.webapps=C:\\Second Tomcat\\apache-tomcat-8.0.23\\webapps\\ConfigPAP\\
+xacml.rest.config.webapps=/home/users/PolicyEngine/webapps/ConfigPAP/
 
 #Turn the audit on to synchronize the DB/file system
 #xacml.rest.pap.run.audit.flag=true
@@ -93,7 +86,6 @@
 
 #Properties for db access
 javax.persistence.jdbc.driver=org.h2.Driver
-#javax.persistence.jdbc.url=jdbc:h2:tcp://localhost/xacmlpolicy
 javax.persistence.jdbc.url=jdbc:h2:file:./sql/xacmlTest
 javax.persistence.jdbc.user=sa
 javax.persistence.jdbc.password=
