aboutsummaryrefslogtreecommitdiffstats
path: root/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp')
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ActionPolicyDictDaoImpl.java178
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/AddressGroupDaoImpl.java152
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/BRMSParamTemplateDaoImpl.java152
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/DescriptiveScopeDaoImpl.java177
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/FirewallDictionaryListDaoImpl.java196
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/FunctionDefinitionDaoImpl.java94
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GlobalRoleSettingsDaoImpl.java91
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupEntityDaoImpl.java124
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupPolicyScopeListDaoImpl.java177
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/MicroServiceModelsDaoImpl.java156
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PDPEntityDaoImpl.java68
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyEditorScopesDaoImpl.java193
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyRolesDaoImpl.java159
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyVersionDaoImpl.java216
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PrefixListDaoImpl.java153
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RemoteCatalogValuesDaoImpl.java150
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RolesDaoImpl.java109
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RuleAlgorithmsDaoImpl.java68
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SafePolicyWarningDaoImpl.java181
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SecurityZoneDaoImpl.java152
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceGroupDaoImpl.java153
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceListDaoImpl.java154
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SystemLogDbDaoImpl.java93
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/TermListDaoImpl.java176
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/UserInfoDaoImpl.java123
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/VarbindDictionaryDaoImpl.java177
-rw-r--r--ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/WatchPolicyNotificationDaoImpl.java173
27 files changed, 3995 insertions, 0 deletions
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ActionPolicyDictDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ActionPolicyDictDaoImpl.java
new file mode 100644
index 000000000..b29aafec2
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ActionPolicyDictDaoImpl.java
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("ActionPolicyDictDao")
+public class ActionPolicyDictDaoImpl implements ActionPolicyDictDao {
+ private static final Logger logger = FlexLogger.getLogger(ActionPolicyDictDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ActionPolicyDict> getActionDictData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/AddressGroupDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/AddressGroupDaoImpl.java
new file mode 100644
index 000000000..132220f5f
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/AddressGroupDaoImpl.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("AddressGroupDao")
+public class AddressGroupDaoImpl implements AddressGroupDao{
+ private static final Logger logger = FlexLogger.getLogger(AddressGroupDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<AddressGroup> getAddressGroupData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/BRMSParamTemplateDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/BRMSParamTemplateDaoImpl.java
new file mode 100644
index 000000000..0b634ff73
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/BRMSParamTemplateDaoImpl.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("BRMSParamTemplateDao")
+public class BRMSParamTemplateDaoImpl implements BRMSParamTemplateDao{
+ private static final Logger logger = FlexLogger.getLogger(BRMSParamTemplateDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<BRMSParamTemplate> getBRMSParamTemplateData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/DescriptiveScopeDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/DescriptiveScopeDaoImpl.java
new file mode 100644
index 000000000..600b42ce7
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/DescriptiveScopeDaoImpl.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("DescriptiveScopeDao")
+public class DescriptiveScopeDaoImpl implements DescriptiveScopeDao{
+ private static final Logger logger = FlexLogger.getLogger(DescriptiveScopeDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<DescriptiveScope> getDescriptiveScope() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ DescriptiveScope data = null;
+ try {
+ Criteria cr = session.createCriteria(PolicyVersion.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-sdk-app/src/main/java/org/openecomp/policy/daoImp/FirewallDictionaryListDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/FirewallDictionaryListDaoImpl.java
new file mode 100644
index 000000000..e002aa962
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/FirewallDictionaryListDaoImpl.java
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("FirewallDictionaryListDao")
+public class FirewallDictionaryListDaoImpl implements FirewallDictionaryListDao {
+ private static final Logger logger = FlexLogger.getLogger(FirewallDictionaryListDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<FirewallDictionaryList> getFWDictionaryListData() {
+ Session session = sessionfactory.openSession();
+ 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;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> getFWDictionaryListDataByName() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/FunctionDefinitionDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/FunctionDefinitionDaoImpl.java
new file mode 100644
index 000000000..ebb833585
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/FunctionDefinitionDaoImpl.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.FunctionDefinitionDao;
+import org.openecomp.policy.rest.jpa.FunctionDefinition;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("FunctionDefinitionDao")
+public class FunctionDefinitionDaoImpl implements FunctionDefinitionDao{
+ private static final Logger logger = FlexLogger.getLogger(FunctionDefinitionDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> getFunctionDefinitionByName() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<String> data = new ArrayList<String>();
+ try {
+ Criteria cr = session.createCriteria(FunctionDefinition.class);
+ List<FunctionDefinition> functionDefinitionData = cr.list();
+ for(int i = 0; i < functionDefinitionData.size(); i++){
+ data.add(functionDefinitionData.get(i).getShortname());
+ }
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying FunctionDefinition Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return data;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<FunctionDefinition> getFunctionDefinition() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<FunctionDefinition> functionDefinitionData = null;
+ try {
+ Criteria cr = session.createCriteria(FunctionDefinition.class);
+ functionDefinitionData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying FunctionDefinition Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return functionDefinitionData;
+ }
+
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GlobalRoleSettingsDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GlobalRoleSettingsDaoImpl.java
new file mode 100644
index 000000000..718b8e98f
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GlobalRoleSettingsDaoImpl.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.GlobalRoleSettingsDao;
+import org.openecomp.policy.rest.jpa.GlobalRoleSettings;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+
+@Service("GlobalRoleSettingsDao")
+public class GlobalRoleSettingsDaoImpl implements GlobalRoleSettingsDao{
+ private static final Logger logger = FlexLogger.getLogger(GlobalRoleSettingsDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<GlobalRoleSettings> getGlobalRoleSettings() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<GlobalRoleSettings> lockdownData = null;
+ try {
+ Criteria cr = session.createCriteria(GlobalRoleSettings.class);
+ lockdownData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GlobalRoleSettings Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return lockdownData;
+ }
+
+
+
+ @Override
+ public void update(GlobalRoleSettings globalRoleSettings) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.update(globalRoleSettings);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating GlobalRoleSettings 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupEntityDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupEntityDaoImpl.java
new file mode 100644
index 000000000..1a468253c
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupEntityDaoImpl.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.GroupEntityDao;
+import org.openecomp.policy.rest.jpa.GroupEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("PDPGroupDataDao")
+public class GroupEntityDaoImpl implements GroupEntityDao{
+ private static final Logger logger = FlexLogger.getLogger(GroupEntityDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<GroupEntity> getGroupEntityData() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ Criteria cr = session.createCriteria(GroupEntity.class);
+ List<GroupEntity> groupData = null;
+ try {
+ groupData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupEntity Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return groupData;
+ }
+
+ @Override
+ public GroupEntity getPDPGroupEntity(String getgroupName) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ GroupEntity entity = null;
+ try {
+ entity = (GroupEntity) session.get(GroupEntity.class, getgroupName);
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying GroupEntity Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return entity;
+ }
+
+ @Override
+ public void savePDPGroupEntity(GroupEntity pdpGroupDataFunction) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(pdpGroupDataFunction);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving GroupEntity Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ }
+
+ @Override
+ public void deletePDPGroupEntity(GroupEntity pdpGroupDataFunction) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.delete(pdpGroupDataFunction);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting GroupEntity 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupPolicyScopeListDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupPolicyScopeListDaoImpl.java
new file mode 100644
index 000000000..a51eef102
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/GroupPolicyScopeListDaoImpl.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("GroupPolicyScopeListDao")
+public class GroupPolicyScopeListDaoImpl implements GroupPolicyScopeListDao {
+ private static final Logger logger = FlexLogger.getLogger(GroupPolicyScopeListDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<GroupPolicyScopeList> getGroupPolicyScopeListData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/MicroServiceModelsDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/MicroServiceModelsDaoImpl.java
new file mode 100644
index 000000000..6c198aa11
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/MicroServiceModelsDaoImpl.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("MicroServiceModelsDao")
+public class MicroServiceModelsDaoImpl implements MicroServiceModelsDao{
+ private static final Logger logger = FlexLogger.getLogger(MicroServiceModelsDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<MicroServiceModels> getMicroServiceModelsData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/PDPEntityDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PDPEntityDaoImpl.java
new file mode 100644
index 000000000..2a2250e87
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PDPEntityDaoImpl.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.PDPEntityDao;
+import org.openecomp.policy.rest.jpa.PdpEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("PDPEntityDataDao")
+public class PDPEntityDaoImpl implements PDPEntityDao {
+ private static final Logger logger = FlexLogger.getLogger(PDPEntityDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<PdpEntity> getPDPEntityData() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PdpEntity> pdpData = null;
+ try {
+ Criteria cr = session.createCriteria(PdpEntity.class);
+ pdpData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PdpEntity Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return pdpData;
+ }
+
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyEditorScopesDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyEditorScopesDaoImpl.java
new file mode 100644
index 000000000..4aad7efbd
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyEditorScopesDaoImpl.java
@@ -0,0 +1,193 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.PolicyEditorScopesDao;
+import org.openecomp.policy.rest.jpa.PolicyEditorScopes;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+@Service("PolicyEditorScopesDao")
+public class PolicyEditorScopesDaoImpl implements PolicyEditorScopesDao {
+ private static final Log logger = LogFactory.getLog(PolicyEditorScopesDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<PolicyEditorScopes> getPolicyEditorScopesData() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyEditorScopes> scopeNameData = null;
+ try {
+ Criteria cr = session.createCriteria(PolicyEditorScopes.class);
+ scopeNameData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyEditorScopes Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return scopeNameData;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> getPolicyEditorScopesDataByName() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<String> data = new ArrayList<String>();
+ try {
+ Criteria cr = session.createCriteria(PolicyEditorScopes.class);
+ List<PolicyEditorScopes> scopeNameData = cr.list();
+ for(int i = 0; i < scopeNameData.size(); i++){
+ data.add(scopeNameData.get(i).getScopeName());
+ }
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyEditorScopes 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(PolicyEditorScopes policyEditorScopes) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(policyEditorScopes);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyEditorScopes 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(PolicyEditorScopes policyEditorScopes) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.delete(policyEditorScopes);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyEditorScopes 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(PolicyEditorScopes policyEditorScopes) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.update(policyEditorScopes);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyEditorScopes 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<PolicyEditorScopes> getListOfPolicyScopes(String query) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyEditorScopes> data = null;
+ try {
+ Query hbquery = session.createQuery(query);
+ data = hbquery.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyEditorScopes Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return data;
+ }
+
+ @Override
+ public void updateQuery(String policyScopeQuery) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ Query hbquery = session.createQuery(policyScopeQuery);
+ hbquery.executeUpdate();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyEditorScopes 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyRolesDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyRolesDaoImpl.java
new file mode 100644
index 000000000..f10a94229
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyRolesDaoImpl.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.criterion.Conjunction;
+import org.hibernate.criterion.Disjunction;
+import org.hibernate.criterion.Restrictions;
+import org.openecomp.policy.dao.PolicyRolesDao;
+import org.openecomp.policy.rest.jpa.PolicyRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("PolicyRolesDao")
+public class PolicyRolesDaoImpl implements PolicyRolesDao{
+ private static final Logger logger = FlexLogger.getLogger(PolicyRolesDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<PolicyRoles> getUserRoles() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyRoles> rolesData = null;
+ try {
+ Criteria cr = session.createCriteria(PolicyRoles.class);
+ Disjunction disjunction = Restrictions.disjunction();
+ Conjunction conjunction1 = Restrictions.conjunction();
+ conjunction1.add(Restrictions.eq("role", "admin"));
+ Conjunction conjunction2 = Restrictions.conjunction();
+ conjunction2.add(Restrictions.eq("role", "editor"));
+ Conjunction conjunction3 = Restrictions.conjunction();
+ conjunction3.add(Restrictions.eq("role", "guest"));
+ disjunction.add(conjunction1);
+ disjunction.add(conjunction2);
+ disjunction.add(conjunction3);
+ rolesData = cr.add(disjunction).list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyRoles Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return rolesData;
+ }
+
+ @Override
+ public void save(PolicyRoles role) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(role);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyRoles 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(PolicyRoles role) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.delete(role);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyRoles 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(PolicyRoles role) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.update(role);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyRoles 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<PolicyRoles> getRoles() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyRoles> rolesData = null;
+ try {
+ Criteria cr = session.createCriteria(PolicyRoles.class);
+ rolesData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyRoles Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return rolesData;
+ }
+
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyVersionDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyVersionDaoImpl.java
new file mode 100644
index 000000000..02188ec47
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PolicyVersionDaoImpl.java
@@ -0,0 +1,216 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.dao.PolicyVersionDao;
+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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("PolicyVersionDao")
+public class PolicyVersionDaoImpl implements PolicyVersionDao {
+ private static final Logger logger = FlexLogger.getLogger(PolicyVersionDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<PolicyVersion> getPolicyVersionData() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyVersion> versionData = null;
+ try {
+ Criteria cr = session.createCriteria(PolicyVersion.class);
+ versionData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyVersion Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return versionData;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<String> getPolicyVersionDataByName() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<String> data = new ArrayList<String>();
+ try {
+ Criteria cr = session.createCriteria(PolicyVersion.class);
+ List<PolicyVersion> attributeData = cr.list();
+ for(int i = 0; i < attributeData.size(); i++){
+ data.add(attributeData.get(i).getPolicyName());
+ }
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyVersion 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(PolicyVersion policyVersion) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(policyVersion);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving PolicyVersion 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(PolicyVersion policyVersion) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.delete(policyVersion);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting PolicyVersion 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(PolicyVersion policyVersion) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.update(policyVersion);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyVersion 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<PolicyVersion> getPolicyVersionEntityByName(String policyVersion) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyVersion> data = null;
+ try {
+ Criteria cr = session.createCriteria(PolicyVersion.class);
+ cr.add(Restrictions.eq("policyName",policyVersion));
+ data = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyVersion Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return data;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<PolicyVersion> getActiveVersionPolicy(String query) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<PolicyVersion> data = null;
+ try {
+ Query hbquery = session.createQuery(query);
+ data = hbquery.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying PolicyVersion Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return data;
+ }
+
+ @Override
+ public void updateQuery(String policyVersion) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ Query hbquery = session.createQuery(policyVersion);
+ hbquery.executeUpdate();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating PolicyVersion 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/PrefixListDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PrefixListDaoImpl.java
new file mode 100644
index 000000000..cc8701361
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/PrefixListDaoImpl.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("PrefixListDao")
+public class PrefixListDaoImpl implements PrefixListDao{
+ private static final Logger logger = FlexLogger.getLogger(PrefixListDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<PREFIXLIST> getPREFIXLISTData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/RemoteCatalogValuesDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RemoteCatalogValuesDaoImpl.java
new file mode 100644
index 000000000..5f42ba73e
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RemoteCatalogValuesDaoImpl.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.RemoteCatalogValuesDao;
+import org.openecomp.policy.rest.jpa.RemoteCatalogValues;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("RemoteCatalogValuesDao")
+public class RemoteCatalogValuesDaoImpl implements RemoteCatalogValuesDao {
+ private static final Logger logger = FlexLogger.getLogger(RemoteCatalogValuesDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<RemoteCatalogValues> getRemoteCatalogValuesData() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<RemoteCatalogValues> attributeData = null;
+ try {
+ Criteria cr = session.createCriteria(RemoteCatalogValues.class);
+ attributeData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying RemoteCatalogValues 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> getRemoteCatalogValuesDataByName() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<String> data = new ArrayList<String>();
+ try {
+ Criteria cr = session.createCriteria(RemoteCatalogValues.class);
+ List<RemoteCatalogValues> 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 RemoteCatalogValues 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(RemoteCatalogValues attribute) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(attribute);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving RemoteCatalogValues 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(RemoteCatalogValues attribute) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.delete(attribute);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting RemoteCatalogValues 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(RemoteCatalogValues attribute) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.update(attribute);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating RemoteCatalogValues 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/RolesDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RolesDaoImpl.java
new file mode 100644
index 000000000..7e5c860de
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RolesDaoImpl.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.dao.RolesDao;
+import org.openecomp.policy.model.Roles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("RolesDao")
+public class RolesDaoImpl implements RolesDao{
+ private static final Logger logger = FlexLogger.getLogger(RolesDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @Override
+ public void save(Roles role) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(role);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving Roles 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(Roles role) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ System.out.println("delete from Roles where loginid = '"+role.getLoginId()+"'");
+ Query q = session.createQuery(" delete from Roles where loginid = '"+role.getLoginId()+"'");
+ q.executeUpdate();
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting Roles 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<Roles> getUserRoles(String userId) {
+ System.out.println("User Id:"+userId);
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<Roles> rolesData = null;
+ try {
+ Criteria cr = session.createCriteria(Roles.class);
+ cr = cr.add(Restrictions.eq("loginId",userId));
+ rolesData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying Roles Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return rolesData;
+ }
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RuleAlgorithmsDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RuleAlgorithmsDaoImpl.java
new file mode 100644
index 000000000..149038501
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/RuleAlgorithmsDaoImpl.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.openecomp.policy.dao.RuleAlgorithmsDao;
+import org.openecomp.policy.rest.jpa.RuleAlgorithms;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("RuleAlgorithmsDao")
+public class RuleAlgorithmsDaoImpl implements RuleAlgorithmsDao{
+ private static final Logger logger = FlexLogger.getLogger(RuleAlgorithmsDaoImpl.class);
+ @Autowired
+ SessionFactory sessionFactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<RuleAlgorithms> getRuleAlgorithms() {
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<RuleAlgorithms> ruleAlgorithmsData = null;
+ try {
+ Criteria cr = session.createCriteria(RuleAlgorithms.class);
+ ruleAlgorithmsData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying RuleAlgorithms Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return ruleAlgorithmsData;
+ }
+
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SafePolicyWarningDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SafePolicyWarningDaoImpl.java
new file mode 100644
index 000000000..209d60b2d
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SafePolicyWarningDaoImpl.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ SafePolicyWarning data = null;
+ try {
+ Criteria cr = session.createCriteria(SafePolicyWarning.class);
+ cr.add(Restrictions.eq("riskType",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-sdk-app/src/main/java/org/openecomp/policy/daoImp/SecurityZoneDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SecurityZoneDaoImpl.java
new file mode 100644
index 000000000..e3661ceb9
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SecurityZoneDaoImpl.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("SecurityZoneDao")
+public class SecurityZoneDaoImpl implements SecurityZoneDao{
+ private static final Logger logger = FlexLogger.getLogger(SecurityZoneDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<SecurityZone> getSecurityZoneData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceGroupDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceGroupDaoImpl.java
new file mode 100644
index 000000000..f2e9c5be8
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceGroupDaoImpl.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("ServiceGroupDao")
+public class ServiceGroupDaoImpl implements ServiceGroupDao{
+ private static final Logger logger = FlexLogger.getLogger(ServiceGroupDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<GroupServiceList> getGroupServiceListData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceListDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceListDaoImpl.java
new file mode 100644
index 000000000..0f80a16d3
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/ServiceListDaoImpl.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("ServiceListDao")
+public class ServiceListDaoImpl implements ServiceListDao {
+ private static final Logger logger = FlexLogger.getLogger(ServiceListDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ServiceList> getServiceListData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/SystemLogDbDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SystemLogDbDaoImpl.java
new file mode 100644
index 000000000..927d20f2f
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/SystemLogDbDaoImpl.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+import java.util.List;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.hibernate.Transaction;
+import org.hibernate.criterion.Restrictions;
+import org.openecomp.policy.conf.HibernateSession;
+import org.openecomp.policy.controller.PolicyController;
+import org.openecomp.policy.dao.SystemLogDbDao;
+import org.openecomp.policy.rest.jpa.SystemLogDB;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+
+@Service("SystemLogDbDao")
+public class SystemLogDbDaoImpl implements SystemLogDbDao {
+ private static final Logger logger = FlexLogger.getLogger(SystemLogDbDaoImpl.class);
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<SystemLogDB> getLoggingData() {
+ Session session = HibernateSession.getSession();
+ Transaction tx = session.beginTransaction();
+ List<SystemLogDB> system = null;
+ try {
+ String sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit "+PolicyController.logTableLimit+"";
+ Criteria cr = session.createCriteria(SystemLogDB.class);
+ cr.add(Restrictions.sqlRestriction(sqlWhere));
+ system = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDB Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return system;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<SystemLogDB> getSystemAlertData() {
+ Session session = HibernateSession.getSession();;
+ Transaction tx = session.beginTransaction();
+ List<SystemLogDB> system = null;
+ try {
+ String sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit "+PolicyController.systemAlertTableLimit+"";
+ Criteria cr = session.createCriteria(SystemLogDB.class);
+ cr.add(Restrictions.sqlRestriction(sqlWhere));
+ system = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDB Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return system;
+ }
+
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/TermListDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/TermListDaoImpl.java
new file mode 100644
index 000000000..ff8f1f26d
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/TermListDaoImpl.java
@@ -0,0 +1,176 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("TermListDao")
+public class TermListDaoImpl implements TermListDao{
+ private static final Logger logger = FlexLogger.getLogger(TermListDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<TermList> getTermListData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/UserInfoDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/UserInfoDaoImpl.java
new file mode 100644
index 000000000..ad13b5940
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/UserInfoDaoImpl.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+
+@Service("UserInfoDao")
+public class UserInfoDaoImpl implements UserInfoDao{
+ private static final Logger logger = FlexLogger.getLogger(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 = sessionfactory.openSession();
+ 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() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/VarbindDictionaryDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/VarbindDictionaryDaoImpl.java
new file mode 100644
index 000000000..a24c0e7ad
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/VarbindDictionaryDaoImpl.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.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;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("VarbindDictionaryDao")
+public class VarbindDictionaryDaoImpl implements VarbindDictionaryDao {
+ private static final Logger logger = FlexLogger.getLogger(VarbindDictionaryDaoImpl.class);
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<VarbindDictionary> getVarbindDictionaryData() {
+ Session session = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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 = sessionfactory.openSession();
+ 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;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<VarbindDictionary> getVarbindEntityByName(String value) {
+ Session session = sessionfactory.openSession();
+ 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-sdk-app/src/main/java/org/openecomp/policy/daoImp/WatchPolicyNotificationDaoImpl.java b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/WatchPolicyNotificationDaoImpl.java
new file mode 100644
index 000000000..b4b807fbd
--- /dev/null
+++ b/ecomp-sdk-app/src/main/java/org/openecomp/policy/daoImp/WatchPolicyNotificationDaoImpl.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ECOMP Policy Engine
+ * ================================================================================
+ * 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.daoImp;
+
+
+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.dao.WatchPolicyNotificationDao;
+import org.openecomp.policy.rest.jpa.WatchPolicyNotificationTable;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
+
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+
+@Service("WatchPolicyNotificationDao")
+public class WatchPolicyNotificationDaoImpl implements WatchPolicyNotificationDao{
+
+ private static final Logger logger = FlexLogger.getLogger(WatchPolicyNotificationDaoImpl.class);
+
+ @Autowired
+ SessionFactory sessionfactory;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<WatchPolicyNotificationTable> getListData() {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<WatchPolicyNotificationTable> attributeData =null;
+ try {
+ Criteria cr = session.createCriteria(WatchPolicyNotificationTable.class);
+ attributeData = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying WatchPolicyNotificationTable 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(WatchPolicyNotificationTable attribute) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.persist(attribute);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Saving WatchPolicyNotificationTable 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(WatchPolicyNotificationTable attribute) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.delete(attribute);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Deleting WatchPolicyNotificationTable 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(WatchPolicyNotificationTable attribute) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try {
+ session.update(attribute);
+ tx.commit();
+ }catch(Exception e){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Updating WatchPolicyNotificationTable 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<WatchPolicyNotificationTable> getListDataByPolicyName(String policyName) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<WatchPolicyNotificationTable> data = null;
+ try {
+ Criteria cr = session.createCriteria(WatchPolicyNotificationTable.class);
+ cr.add(Restrictions.eq("policyName",policyName));
+ data = cr.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying WatchPolicyNotificationTable Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return data;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<WatchPolicyNotificationTable> watchListQuery(String query) {
+ Session session = sessionfactory.openSession();
+ Transaction tx = session.beginTransaction();
+ List<WatchPolicyNotificationTable> data = null;
+ try {
+ Query hbquery = session.createQuery(query);
+ data = hbquery.list();
+ tx.commit();
+ } catch (Exception e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying WatchPolicyNotificationTable Table"+e);
+ }finally{
+ try{
+ session.close();
+ }catch(Exception e1){
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Closing Connection/Statement"+e1);
+ }
+ }
+ return data;
+ }
+
+}