aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl
diff options
context:
space:
mode:
Diffstat (limited to 'ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl')
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionListDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionPolicyDictDaoImpl.java185
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AddressGroupDaoImpl.java157
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AttributeDaoImpl.java157
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/BRMSParamTemplateDaoImpl.java157
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CategoryDaoImpl.java76
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DCAEUUIDDaoImpl.java157
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DecisionPolicyDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DescriptiveScopeDaoImpl.java182
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EcompNameDaoImpl.java167
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EnforcerPolicyDaoImpl.java132
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/FirewallDictionaryListDaoImpl.java202
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/GroupPolicyScopeListDaoImpl.java182
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceConfigNameDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceLocationDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceModelsDaoImpl.java161
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PEPOptionsDaoImpl.java159
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeClosedLoopDaoImpl.java181
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeResourceDaoImpl.java181
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeServiceDaoImpl.java182
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeTypeDaoImpl.java182
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PortListDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PrefixListDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ProtocolListDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/RiskTypeDaoImpl.java167
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SafePolicyWarningDaoImpl.java181
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SecurityZoneDaoImpl.java157
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceDictionaryDaoImpl.java157
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceGroupDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceListDaoImpl.java159
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SiteDictionaryDaoImpl.java159
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/TermListDaoImpl.java181
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/UserInfoDaoImpl.java138
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VNFTypeDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VSCLActionDaoImpl.java158
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VarbindDictionaryDaoImpl.java181
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ZoneDaoImpl.java159
37 files changed, 6019 insertions, 0 deletions
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
new file mode 100644
index 000000000..ba6c2c41e
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionListDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..50d41fd02
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ActionPolicyDictDaoImpl.java
@@ -0,0 +1,185 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..951a38a28
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AddressGroupDaoImpl.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.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
new file mode 100644
index 000000000..7eb51d3f4
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/AttributeDaoImpl.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.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
new file mode 100644
index 000000000..4f8478da6
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/BRMSParamTemplateDaoImpl.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.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
new file mode 100644
index 000000000..f3fcbf152
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/CategoryDaoImpl.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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/DCAEUUIDDaoImpl.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DCAEUUIDDaoImpl.java
new file mode 100644
index 000000000..ddd4606f9
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DCAEUUIDDaoImpl.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.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
new file mode 100644
index 000000000..9762e1d34
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DecisionPolicyDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..8d286859c
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/DescriptiveScopeDaoImpl.java
@@ -0,0 +1,182 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..9bafc3a5c
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EcompNameDaoImpl.java
@@ -0,0 +1,167 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..ba621ab17
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/EnforcerPolicyDaoImpl.java
@@ -0,0 +1,132 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..b19a58b93
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/FirewallDictionaryListDaoImpl.java
@@ -0,0 +1,202 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..edc147fc2
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/GroupPolicyScopeListDaoImpl.java
@@ -0,0 +1,182 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..fdee32cc9
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceConfigNameDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..91a2f42cf
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceLocationDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..c4e66b5a3
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/MicroServiceModelsDaoImpl.java
@@ -0,0 +1,161 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..92b89e9e3
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PEPOptionsDaoImpl.java
@@ -0,0 +1,159 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..6ac3e5bc9
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeClosedLoopDaoImpl.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..6fe91b112
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeResourceDaoImpl.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..d90d5a014
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeServiceDaoImpl.java
@@ -0,0 +1,182 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..66317a4d0
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PolicyScopeTypeDaoImpl.java
@@ -0,0 +1,182 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..a3139b2c6
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PortListDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..2fecc7d88
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/PrefixListDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..7d78d387a
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ProtocolListDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..1318f82fa
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/RiskTypeDaoImpl.java
@@ -0,0 +1,167 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..37a77f9b5
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SafePolicyWarningDaoImpl.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..9c79773dd
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SecurityZoneDaoImpl.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.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
new file mode 100644
index 000000000..226c50060
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceDictionaryDaoImpl.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.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
new file mode 100644
index 000000000..725631306
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceGroupDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..01ff3e4fc
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ServiceListDaoImpl.java
@@ -0,0 +1,159 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..3b2a75176
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/SiteDictionaryDaoImpl.java
@@ -0,0 +1,159 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..7568d60b0
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/TermListDaoImpl.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..04ad69c1a
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/UserInfoDaoImpl.java
@@ -0,0 +1,138 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..4d424fa9f
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VNFTypeDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..8ab6bfd19
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VSCLActionDaoImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..dba3a0d57
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/VarbindDictionaryDaoImpl.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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
new file mode 100644
index 000000000..865a08516
--- /dev/null
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/daoimpl/ZoneDaoImpl.java
@@ -0,0 +1,159 @@
+/*-
+ * ============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;
+ }
+
+}