diff options
author | 2017-05-03 21:31:58 +0000 | |
---|---|---|
committer | 2017-05-03 21:31:58 +0000 | |
commit | a330af579866dacbe595e2e4ad1dd29cd3c96945 (patch) | |
tree | b9455591600034dfd4f33a9c1f733336280f2208 /ECOMP-REST/src/main/java/org | |
parent | 5444e748b8651d8346dcb78c5ab8b0637dea197b (diff) | |
parent | e0addf5b588a1244f9679becd90999dfcb4c3a94 (diff) |
Merge "Policy 1707 commit to LF"
Diffstat (limited to 'ECOMP-REST/src/main/java/org')
118 files changed, 4180 insertions, 1856 deletions
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRest.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRest.java index 7e535cbcf..2a6654815 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRest.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRest.java @@ -34,7 +34,6 @@ import org.apache.commons.logging.LogFactory; import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; -import org.openecomp.policy.xacml.api.XACMLErrorConstants; import com.att.research.xacml.util.XACMLProperties; @@ -76,6 +75,7 @@ public class XACMLRest { // Look for system override // String xacmlPropertiesName = System.getProperty(XACMLProperties.XACML_PROPERTIES_NAME); + logger.info("\n\n" + xacmlPropertiesName + "\n" + XACMLProperties.XACML_PROPERTIES_NAME); if (xacmlPropertiesName == null) { // // Set it to our servlet default @@ -139,8 +139,6 @@ public class XACMLRest { XACMLProperties.getProperties().putAll(pipProperties); } } catch (IOException e) { - //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to put init properties into Xacml properties", e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Failed to put init properties into Xacml properties"); } // @@ -150,8 +148,6 @@ public class XACMLRest { try { logger.debug(XACMLProperties.getProperties().toString()); } catch (IOException e) { - //logger.error( XACMLErrorConstants.ERROR_PROCESS_FLOW + "Cannot dump properties", e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Cannot dump properties"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRestProperties.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRestProperties.java index bc991aafb..04472f8fe 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRestProperties.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XACMLRestProperties.java @@ -310,16 +310,27 @@ public class XACMLRestProperties extends XACMLProperties { /* * Value for Notification Option */ - public static final String PROP_NOTIFICATION_TYPE = "xacml.notification.type"; - + public static final String PROP_NOTIFICATION_TYPE = "NOTIFICATION_TYPE"; /* - * Value for Notification Servers + * Value for Notification DMaaP servers */ - public static final String PROP_NOTIFICATION_UEB_CLUSTER = "xacml.ueb.cluster"; + public static final String PROP_NOTIFICATION_SERVERS = "NOTIFICATION_SERVERS"; /* * Value for Notification Delay */ - public static final String PROP_NOTIFICATION_DELAY= "xacml.rest.notification.delay"; + public static final String PROP_NOTIFICATION_DELAY= "NOTIFICATION_DELAY"; + /* + * Value for Notification Topic + */ + public static final String PROP_NOTIFICATION_TOPIC= "NOTIFICATION_TOPIC"; + /* + * Value for Notification Topic + */ + public static final String PROP_UEB_API_KEY= "UEB_API_KEY"; + /* + * Value for Notification Topic + */ + public static final String PROP_UEB_API_SECRET= "UEB_API_SECRET"; /* * Closedloop Fault Policy Template Version */ @@ -337,10 +348,6 @@ public class XACMLRestProperties extends XACMLProperties { */ public static final String TemplateVersion_MS= "xacml.rest.microServices"; /* - * GOC Policy Template Version - */ - public static final String TemplateVersion_GOC= "xacml.rest.gocPolicy"; - /* * Firewall Policy Template Version */ public static final String TemplateVersion_FW= "xacml.rest.firewallPolicy"; @@ -440,4 +447,10 @@ public class XACMLRestProperties extends XACMLProperties { */ public static final String PROP_MODEL_LEVEL = "xacml.model.level"; + /* + * Value for Incoming Notification tries + * + * */ + public static final String PROP_PAP_INCOMINGNOTIFICATION_TRIES = "xacml.rest.pap.incomingnotification.tries"; + } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XacmlAdminAuthorization.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XacmlAdminAuthorization.java index f611cf944..ae72db267 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XacmlAdminAuthorization.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/XacmlAdminAuthorization.java @@ -22,14 +22,16 @@ package org.openecomp.policy.rest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.openecomp.policy.common.logging.eelf.MessageCodes; +import org.openecomp.policy.common.logging.eelf.PolicyLogger; import org.openecomp.policy.rest.jpa.UserInfo; +import org.openecomp.policy.xacml.api.XACMLErrorConstants; import com.att.research.xacml.api.DataTypeException; import com.att.research.xacml.api.Decision; import com.att.research.xacml.api.Request; import com.att.research.xacml.api.Response; import com.att.research.xacml.api.Result; -import org.openecomp.policy.xacml.api.XACMLErrorConstants; import com.att.research.xacml.api.pdp.PDPEngine; import com.att.research.xacml.api.pdp.PDPEngineFactory; import com.att.research.xacml.api.pdp.PDPException; @@ -40,8 +42,7 @@ import com.att.research.xacml.std.annotations.XACMLResource; import com.att.research.xacml.std.annotations.XACMLSubject; import com.att.research.xacml.util.FactoryException; -import org.openecomp.policy.common.logging.eelf.MessageCodes; -import org.openecomp.policy.common.logging.eelf.PolicyLogger; + public class XacmlAdminAuthorization { private static Log logger = LogFactory.getLog(XacmlAdminAuthorization.class); @@ -160,13 +161,11 @@ public class XacmlAdminAuthorization { pdpEngineFactory = PDPEngineFactory.newInstance(); if (pdpEngineFactory == null) { logger.error("Failed to create PDP Engine Factory"); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error("Failed to create PDP Engine Factory"); } this.pdpEngine = pdpEngineFactory.newEngine(); } catch (FactoryException e) { logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception create PDP Engine: " + e.getLocalizedMessage()); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "Exception create PDP Engine"); } } @@ -182,13 +181,11 @@ public class XacmlAdminAuthorization { request = RequestParser.parseRequest(new AuthorizationRequest(userid, action.toString(), resource.toString())); } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) { logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create request: " + e.getLocalizedMessage()); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "Failed to create request"); return false; } if (request == null) { logger.error("Failed to parse request."); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error("Failed to parse request"); return false; } @@ -200,7 +197,6 @@ public class XacmlAdminAuthorization { Response response = this.pdpEngine.decide(request); if (response == null) { logger.error("Null response from PDP decide"); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error("Null response from PDP decide"); } // @@ -215,7 +211,6 @@ public class XacmlAdminAuthorization { } } catch (PDPException e) { logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PDP Decide failed: " + e.getLocalizedMessage()); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "PDP Decide failed"); } return false; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java new file mode 100644 index 000000000..ad6b503a2 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressGroupJson.java @@ -0,0 +1,79 @@ +/*- + * ============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.rest.adapter; + + +import java.util.ArrayList; +import java.util.List; + +public class AddressGroupJson { + + protected String name; + protected String description; + protected List<AddressMembers> members; + + // name + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } + + public boolean equals(Object obj) + { + AddressGroupJson servGroupobj=(AddressGroupJson) obj; + if(this.getName().equals(servGroupobj.getName())) + { + return true; + } + return false; + } + + public int hashCode() { + return Integer.valueOf(name.charAt(0)+(name.charAt(1))); + } + + // description + public String getDescription() { + return description; + } + + public void setDescription(String value) { + this.description = value; + } + + public List<AddressMembers> getMembers() + { + if(members==null) + { + members= new ArrayList<AddressMembers>(); + } + return this.members; + } + + public void setMembers(List<AddressMembers> members) + { + this.members = members; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressJson.java new file mode 100644 index 000000000..d2361d807 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressJson.java @@ -0,0 +1,52 @@ +/*- + * ============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.rest.adapter; + + +public class AddressJson { + + protected String type; + protected String name; + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + // type + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /*public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + }*/ +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressMembers.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressMembers.java new file mode 100644 index 000000000..f53f61c32 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AddressMembers.java @@ -0,0 +1,46 @@ +/*- + * ============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.rest.adapter; + + + +public class AddressMembers { + + protected String type; + protected String value; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DescriptiveScopeDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AutoPushTabAdapter.java index b0001390e..7180f9a46 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DescriptiveScopeDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/AutoPushTabAdapter.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,18 +18,25 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.DescriptiveScope; +import java.util.ArrayList; -public interface DescriptiveScopeDao { +public class AutoPushTabAdapter { - List<DescriptiveScope> getDescriptiveScope(); - List<String> getDescriptiveScopeDataByName(); - void Save(DescriptiveScope descriptiveScope); - void delete(DescriptiveScope descriptiveScope); - void update(DescriptiveScope descriptiveScope); - DescriptiveScope getDescriptiveScopeById(String name); + private ArrayList<Object> pdpDatas; + private ArrayList<Object> policyDatas; + public ArrayList<Object> getPdpDatas() { + return pdpDatas; + } + public void setPdpDatas(ArrayList<Object> pdpDatas) { + this.pdpDatas = pdpDatas; + } + public ArrayList<Object> getPolicyDatas() { + return policyDatas; + } + public void setPolicyDatas(ArrayList<Object> policyDatas) { + this.policyDatas = policyDatas; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopFaultBody.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopFaultBody.java new file mode 100644 index 000000000..469b1075c --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopFaultBody.java @@ -0,0 +1,280 @@ +/*- + * ============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.rest.adapter; + + + +public class ClosedLoopFaultBody { + + private boolean trinity; + private boolean vUSP; + private boolean mcr; + private boolean gama; + private boolean vDNS; + + private String vnfType; + private String vServices; + private String ECOMPname; + + private String closedLoopPolicyStatus; + private ClosedLoopSignatures triggerSignatures; + private String actions; + private int timeInterval; + private int timeOutvPRO; + private int timeOutRuby; + private int retrys; + private int agingWindow; + private String geoLink; + private String emailAddress; + private ClosedLoopSignatures verificationSignatures; + private ClosedLoopPolicyConditions conditions; + private ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI; + private ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI; + private int triggerTimeWindowUsedForUI; + private int verfificationTimeWindowUsedForUI; + private String pepName; + private String pepAction; + private String templateVersion; + private int trapMaxAgeUsedForUI; + + + public Integer getTrapMaxAgeUsedForUI() { + return trapMaxAgeUsedForUI; + } + + public void setTrapMaxAgeUsedForUI(int trapMaxAgeUsedForUI) { + this.trapMaxAgeUsedForUI = trapMaxAgeUsedForUI; + } + + public String getTemplateVersion() { + return templateVersion; + } + + public void setTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + } + + public Integer getTimeOutvPRO() { + return timeOutvPRO; + } + + public void setTimeOutvPRO(int timeOutvPRO) { + this.timeOutvPRO = timeOutvPRO; + } + + + public Integer getTriggerTimeWindowUsedForUI() { + return triggerTimeWindowUsedForUI; + } + + public String getPepName() { + return pepName; + } + + public void setPepName(String pepName) { + this.pepName = pepName; + } + + public String getPepAction() { + return pepAction; + } + + public void setPepAction(String pepAction) { + this.pepAction = pepAction; + } + + public void setTriggerTimeWindowUsedForUI(int triggerTimeWindowUsedForUI) { + this.triggerTimeWindowUsedForUI = triggerTimeWindowUsedForUI; + } + + public Integer getVerfificationTimeWindowUsedForUI() { + return verfificationTimeWindowUsedForUI; + } + + public void setVerfificationTimeWindowUsedForUI( + int verfificationTimeWindowUsedForUI) { + this.verfificationTimeWindowUsedForUI = verfificationTimeWindowUsedForUI; + } + + public String getECOMPname(){ + return ECOMPname; + } + + public void setECOMPname(String ECOMPname){ + this.ECOMPname = ECOMPname; + } + + public String getvServices() { + return vServices; + } + public void setvServices(String vServices) { + this.vServices = vServices; + } + + public ClosedLoopFaultTriggerUISignatures getVerificationSignaturesUsedForUI() { + return verificationSignaturesUsedForUI; + } + public void setVerificationSignaturesUsedForUI( + ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI) { + this.verificationSignaturesUsedForUI = verificationSignaturesUsedForUI; + } + public ClosedLoopFaultTriggerUISignatures getTriggerSignaturesUsedForUI() { + return triggerSignaturesUsedForUI; + } + public void setTriggerSignaturesUsedForUI( + ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI) { + this.triggerSignaturesUsedForUI = triggerSignaturesUsedForUI; + } + public ClosedLoopPolicyConditions getConditions() { + return conditions; + } + public void setConditions(ClosedLoopPolicyConditions conditions) { + this.conditions = conditions; + } + + public String getVnfType() { + return vnfType; + } + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public Integer getAgingWindow() { + return agingWindow; + } + public void setAgingWindow(int agingWindow) { + this.agingWindow = agingWindow; + } + + public String getClosedLoopPolicyStatus() { + return closedLoopPolicyStatus; + } + public void setClosedLoopPolicyStatus( + String closedLoopPolicyStatus) { + this.closedLoopPolicyStatus = closedLoopPolicyStatus; + } + public ClosedLoopSignatures getTriggerSignatures() { + return triggerSignatures; + } + public void setTriggerSignatures(ClosedLoopSignatures triggerSignatures) { + this.triggerSignatures = triggerSignatures; + } + public String getActions() { + return actions; + } + public void setActions(String actions) { + this.actions = actions; + } + public Integer getTimeInterval() { + return timeInterval; + } + public void setTimeInterval(int timeInterval) { + this.timeInterval = timeInterval; + } + public Integer getTimeOutRuby() { + return timeOutRuby; + } + public void setTimeOutRuby(int timeOutRuby) { + this.timeOutRuby = timeOutRuby; + } + public Integer getRetrys() { + return retrys; + } + public void setRetrys(int retrys) { + this.retrys = retrys; + } + public String getGeoLink() { + return geoLink; + } + public void setGeoLink(String geoLink) { + this.geoLink = geoLink; + } + public String getEmailAddress() { + return emailAddress; + } + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + public ClosedLoopSignatures getVerificationSignatures() { + return verificationSignatures; + } + public void setVerificationSignatures( + ClosedLoopSignatures verificationSignatures) { + this.verificationSignatures = verificationSignatures; + } + + /*public ArrayList<String> getD2Services() { + return d2Services; + } + + public void setD2Services(ArrayList<String> d2Services) { + this.d2Services = d2Services; + } + + public ArrayList<String> getSiteNames() { + return siteNames; + } + + public void setSiteNames(ArrayList<String> siteNames) { + this.siteNames = siteNames; + }*/ + + public boolean isvDNS() { + return vDNS; + } + + public void setvDNS(boolean vDNS) { + this.vDNS = vDNS; + } + + public boolean isTrinity() { + return trinity; + } + + public void setTrinity(boolean trinity) { + this.trinity = trinity; + } + + public boolean isvUSP() { + return vUSP; + } + + public void setvUSP(boolean vUSP) { + this.vUSP = vUSP; + } + + public boolean isMcr() { + return mcr; + } + + public void setMcr(boolean mcr) { + this.mcr = mcr; + } + + public boolean isGama() { + return gama; + } + + public void setGama(boolean gama) { + this.gama = gama; + } +} + diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ActionPolicyDictDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java index c4914eb47..1c1702e89 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ActionPolicyDictDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,17 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.ActionPolicyDict; -public interface ActionPolicyDictDao { - List<ActionPolicyDict> getActionDictData(); - List<String> getActionDictDataByName(); - ActionPolicyDict getActionEntityDatabyId(String action); - void Save(ActionPolicyDict action); - void delete(ActionPolicyDict action); - void update(ActionPolicyDict action); +public class ClosedLoopFaultTriggerUISignatures { + + private String signatures; + + private String connectSignatures; + + public String getConnectSignatures() { + return connectSignatures; + } + public void setConnectSignatures(String connectSignatures) { + this.connectSignatures = connectSignatures; + } + public String getSignatures() { + return signatures; + } + public void setSignatures(String signatures) { + this.signatures = signatures; + } + } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPMBody.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPMBody.java new file mode 100644 index 000000000..419c7d7ea --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPMBody.java @@ -0,0 +1,133 @@ +/*- + * ============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.rest.adapter; + + +import java.util.Map; + +public class ClosedLoopPMBody { + + private boolean trinity; + private boolean vUSP; + private boolean mcr; + private boolean gama; + private boolean vDNS; + private String geoLink; + private String vServices; + private String ECOMPname; + + private String emailAddress; + + private String serviceTypePolicyName; + + private Map<String, String> attributes; + private String templateVersion; + + public String getTemplateVersion() { + return templateVersion; + } + + public void setTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + } + + public String getECOMPname(){ + return ECOMPname; + } + + public void setECOMPname(String ECOMPname){ + this.ECOMPname = ECOMPname; + } + + public String getvServices() { + return vServices; + } + + public void setvServices(String vServices) { + this.vServices = vServices; + } + + public Map<String, String> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, String> map) { + this.attributes = map; + } + + public String getGeoLink() { + return geoLink; + } + + public void setGeoLink(String geoLink) { + this.geoLink = geoLink; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getServiceTypePolicyName() { + return serviceTypePolicyName; + } + + public void setServiceTypePolicyName(String serviceTypePolicyName) { + this.serviceTypePolicyName = serviceTypePolicyName; + } + + public boolean isGama() { + return gama; + } + public void setGama(boolean gama) { + this.gama = gama; + } + public boolean isvDNS() { + return vDNS; + } + public void setvDNS(boolean vDNS) { + this.vDNS = vDNS; + } + + public boolean isTrinity() { + return trinity; + } + public void setTrinity(boolean trinity) { + this.trinity = trinity; + } + public boolean isvUSP() { + return vUSP; + } + public void setvUSP(boolean vUSP) { + this.vUSP = vUSP; + } + public boolean isMcr() { + return mcr; + } + public void setMcr(boolean mcr) { + this.mcr = mcr; + } + +} + diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/AddressGroupDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPerformanceMetrics.java index c4c7002b3..ad858a6af 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/AddressGroupDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPerformanceMetrics.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,16 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.AddressGroup; - -public interface AddressGroupDao { - List<AddressGroup> getAddressGroupData(); - List<String> getAddressGroupDataByName(); - void Save(AddressGroup addressGroup); - void delete(AddressGroup addressGroup); - void update(AddressGroup addressGroup); +public class ClosedLoopPerformanceMetrics { + public static final String CLPM_UIFIELD_ONSET_MESSAGE = "Onset Message"; + public static final String CLPM_UIJSON_ONSET_MESSAGE = "attributes.OnsetMessage"; + + public static final String CLPM_UIFIELD_POLICY_NAME = "PolicyName"; + public static final String CLPM_UIJSON_POLICY_NAME = "attributes.PolicyName"; + + public static final String CLPM_UIFIELD_ABATEMENT_MESSAGE = "Abatement Message"; + public static final String CLPM_UIJSON_ABATEMENT_MESSAGE = "attributes.AbatementMessage"; + + public static final String CLPM_UIFIELD_GEOLINK = "Geo Link"; + public static final String CLPM_UIJSON_GEOLINK = "geoLink"; } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicy.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicy.java new file mode 100644 index 000000000..16db3c2b4 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicy.java @@ -0,0 +1,61 @@ +/*- + * ============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.rest.adapter; + + +public class ClosedLoopPolicy { + public static final String CLFAULT_UIFIELD_D2_SERVICES_TRINITY = "Hosted Voice (Trinity)"; + public static final String CLFAULT_UIJSON_D2_SERVICES_TRINITY = "trinity"; + + public static final String CLFAULT_UIFIELD_D2_SERVICES_VUSP = "vUSP"; + public static final String CLFAULT_UIJSON_D2_SERVICES_VUSP = "vUSP"; + + public static final String CLFAULT_UIFIELD_D2_SERVICES_MCR = "MCR"; + public static final String CLFAULT_UIJSON_D2_SERVICES_MCR = "mcr"; + + public static final String CLFAULT_UIFIELD_D2_SERVICES_GAMMA = "Gamma"; + public static final String CLFAULT_UIJSON_D2_SERVICES_GAMMA = "gama"; + + public static final String CLFAULT_UIFIELD_D2_SERVICES_VDNS = "vDNS"; + public static final String CLFAULT_UIJSON_D2_SERVICES_VDNS = "vDNS"; + + public static final String CLFAULT_UIFIELD_EMAIL_ADDRESS = "Email Address"; + public static final String CLFAULT_UIJSON_EMAIL_ADDRESS = "emailAddress"; + + public static final String CLFAULT_UIFIELD_TRIGGER_SIGNATURE = "Trigger Signature"; + public static final String CLFAULT_UIJSON_TRIGGER_SIGNATURE = "triggerSignaturesUsedForUI.signatures"; + + public static final String CLFAULT_UIFIELD_VERIFICATION_SIGNATURE = "Verification Signature"; + public static final String CLFAULT_UIJSON_VERIFICATION_SIGNATURE = "verificationSignaturesUsedForUI.signatures"; + + public static final String CLFAULT_UIFIELD_CONNECT_ALL_TRAPS = "Connect All Traps"; + public static final String CLFAULT_UIJSON_CONNECT_ALL_TRAPS = "triggerSignaturesUsedForUI.connectSignatures"; + + public static final String CLFAULT_UIFIELD_CONNECT_ALL_FAULTS = "Connect All Faults"; + public static final String CLFAULT_UIJSON_CONNECT_ALL_FAULTS = "verificationSignaturesUsedForUI.connectSignatures"; + + public static final String CLFAULT_UIFIELD_POLICY_STATUS_ACTIVE = "Active"; + public static final String CLFAULT_UIJSON_POLICY_STATUS_ACTIVE = "ACTIVE"; + + public static final String CLFAULT_UIFIELD_POLICY_STATUS_INACTIVE = "InActive"; + public static final String CLFAULT_UIJSON_POLICY_STATUS_INACTIVE = "INACTIVE"; + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PEPOptionsDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicyConditions.java index d1bbf2a1a..ff7efdfbc 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PEPOptionsDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicyConditions.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,18 +18,22 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.PEPOptions; +public enum ClosedLoopPolicyConditions { + SEND("DCAE should send event notification"), + NOTSEND("DCAE should not send event notification"); + private String name; + private ClosedLoopPolicyConditions(String name){ + this.name = name; + } -public interface PEPOptionsDao { - List<PEPOptions> getPEPOptionsData(); - List<String> getPEPOptionsDataByName(); - void Save(PEPOptions pepOptions); - void delete(PEPOptions pepOptions); - void update(PEPOptions pepOptions); + @Override + public String toString(){ + return this.name; + } } + diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/UserInfoDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicyStatus.java index a144a463f..74138f448 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/UserInfoDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopPolicyStatus.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,15 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.UserInfo; +public enum ClosedLoopPolicyStatus { + ACTIVE("active"), + + INACTIVE("inactive") + ; + + private String name; + + private ClosedLoopPolicyStatus(String name){ + this.name = name; + } -public interface UserInfoDao { - void save(UserInfo userInfo); - List<UserInfo> getUserInfo(); - UserInfo getUserInfoByLoginId(String loginid); - String getUserName(String loginid); + @Override + public String toString(){ + return this.name; + } } + diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopSignatures.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopSignatures.java new file mode 100644 index 000000000..793e93ed8 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ClosedLoopSignatures.java @@ -0,0 +1,52 @@ +/*- + * ============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.rest.adapter; + + +public class ClosedLoopSignatures { + + private String signatures; + + private int timeWindow; + + private Integer trapMaxAge; + + public String getSignatures() { + return signatures; + } + public void setSignatures(String signatures) { + this.signatures = signatures; + } + + public Integer getTimeWindow() { + return timeWindow; + } + public void setTimeWindow(Integer timeWindow) { + this.timeWindow = timeWindow; + } + + public Integer getTrapMaxAge() { + return trapMaxAge; + } + public void setTrapMaxAge(Integer trapMaxAge) { + this.trapMaxAge = trapMaxAge; + } +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/DeletePolicyCondition.java index 116f9cb17..f34bc1d3e 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceListDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/DeletePolicyCondition.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,17 +18,21 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.ServiceList; +public enum DeletePolicyCondition { + ONE("Are you sure you want to delete Current Version of policy"), + ALL("Are you sure you want to delete All Versions of policy"); + private String name; -public interface ServiceListDao { - List<ServiceList> getServiceListData(); - List<String> getServiceListDataByName(); - void Save(ServiceList serviceList); - void delete(ServiceList serviceList); - void update(ServiceList serviceList); + private DeletePolicyCondition(String name){ + this.name = name; + } + + @Override + public String toString(){ + return this.name; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ZoneDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/DeployNowJson.java index df318e167..6344fbfcb 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ZoneDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/DeployNowJson.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,16 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.Zone; +public class DeployNowJson { -public interface ZoneDao { - List<Zone> getZoneData(); - List<String> getZoneDataByName(); - void Save(Zone zone); - void delete(Zone zone); - void update(Zone zone); + protected boolean deployNow; + + // deployNow + public boolean getDeployNow() { + return deployNow; + } + + public void setDeployNow(boolean value) { + this.deployNow = value; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/GridData.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/GridData.java new file mode 100644 index 000000000..f39156cf1 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/GridData.java @@ -0,0 +1,54 @@ +/*- + * ============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.rest.adapter; + + +import java.util.ArrayList; + +public class GridData { + private ArrayList<Object> attributes; + private ArrayList<Object> transportProtocols; + private ArrayList<Object> appProtocols; + + public ArrayList<Object> getAttributes() { + return attributes; + } + + public void setAttributes(ArrayList<Object> attributes) { + this.attributes = attributes; + } + + public ArrayList<Object> getAppProtocols() { + return appProtocols; + } + + public void setAppProtocols(ArrayList<Object> appProtocols) { + this.appProtocols = appProtocols; + } + + public ArrayList<Object> getTransportProtocols() { + return transportProtocols; + } + + public void setTransportProtocols(ArrayList<Object> transportProtocols) { + this.transportProtocols = transportProtocols; + } +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/AttributeDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyExportAdapter.java index 796157f62..ce2d21083 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/AttributeDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyExportAdapter.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,18 +18,19 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.Attribute; +import java.util.ArrayList; -public interface AttributeDao { - - List<Attribute> getData(); - List<String> getAttributeData(); - void Save(Attribute attribute); - void delete(Attribute attribute); - void update(Attribute attribute); +public class PolicyExportAdapter { + + private ArrayList<Object> policyDatas; + public ArrayList<Object> getPolicyDatas() { + return policyDatas; + } + public void setPolicyDatas(ArrayList<Object> policyDatas) { + this.policyDatas = policyDatas; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java new file mode 100644 index 000000000..c823ec6ab --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java @@ -0,0 +1,827 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-PAP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.adapter; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManagerFactory; + +import org.openecomp.policy.rest.jpa.EcompName; + +public class PolicyRestAdapter { + + //Common + private Object data; + private String policyName = null; + private String configBodyData = null; + private String configType = null; + private String policyID = null; + private String policyType = null; + private String comboPolicyType; + private String configPolicyType = null; + private String policyDescription = null; + private String ecompName = null; + private String configName = null; + private String ruleID = null; + private String parentPath; + private boolean isValidData = false; + private String adminNotification = null; + public boolean isEditPolicy = false; + public boolean isViewPolicy = false; + private boolean isDraft = false; + private Object policyData = null; + private String gitPath; + private boolean readOnly; + private String configHome; + private String configUrl; + private String finalPolicyPath; + private String version; + private String jsonBody; + private String apiflag; + private String prevJsonBody; + private Integer highestVersion; + private EntityManagerFactory entityManagerFactory = null; + private Boolean policyExists = false; + private String oldPolicyFileName = null; + private String domain = null; + private String userId; + private String newFileName; + private String clWarning = null; + private String newCLName = null; + private String existingCLName = null; + //Used by GUI + private EcompName ecompNameField; + private Object jsonBodyData; + private String dirPath; + private String configBodyPath; + private ArrayList<Object> attributes; + private ArrayList<Object> settings; + private ArrayList<Object> ruleAlgorithmschoices; + + private LinkedHashMap<?, ?> serviceTypePolicyName; + + private LinkedHashMap<?, ?> verticaMetrics; + private LinkedHashMap<?, ?> description; + private LinkedHashMap<?, ?> attributeFields; + + //ClosedLoop + private String clearTimeOut; + private String trapMaxAge; + private String verificationclearTimeOut; + public Map<String , String> dynamicLayoutMap; + + //FireWall + private String fwPolicyType; + private ArrayList<Object> fwattributes; + private String parentForChild; + private String securityZone; + + //Action & Decision + private String ruleCombiningAlgId = null; + private Map<String,String> dynamicFieldConfigAttributes; + private Map<String,String> dynamicSettingsMap; + private Map<String,String> dropDownMap; + private String actionPerformer = null; + private String actionAttribute = null; + private List<String> dynamicRuleAlgorithmLabels; + private List<String> dynamicRuleAlgorithmCombo; + private List<String> dynamicRuleAlgorithmField1; + private List<String> dynamicRuleAlgorithmField2; + private List<Object> dynamicVariableList; + private List<String> dataTypeList; + private String actionAttributeValue; + private String ruleProvider; + private String actionBody = null; + private String actionDictHeader = null; + private String actionDictType = null; + private String actionDictUrl = null; + private String actionDictMethod = null; + + //MicroSerice + private String serviceType = null; + private String uuid = null; + private String location = null; + private String priority = null; + private String msLocation = null; + + //BRMS Policies + private String ruleName; + private Map<String,String> brmsParamBody=null; + private String brmsController = null; + private ArrayList<String> brmsDependency = null; + private LinkedHashMap<?, ?> ruleData; + private LinkedHashMap<?,?> ruleListData; + private Map<String,String> drlRuleAndUIParams=null; + + //Safe Policy + private String policyScope; + private String providerComboBox = null; + private String riskType; + private String riskLevel; + private String guard = null; + private String ttlDate; + private Map<String,String> matching; + + private ArrayList<Object> triggerSignatures; + private ArrayList<Object> symptomSignatures; + private String logicalConnector; + private String policyStatus; + public String gocServerScope; + private String supressionType; + + + public ArrayList<Object> getTriggerSignatures() { + return triggerSignatures; + } + public void setTriggerSignatures(ArrayList<Object> triggerSignatures) { + this.triggerSignatures = triggerSignatures; + } + public ArrayList<Object> getSymptomSignatures() { + return symptomSignatures; + } + public void setSymptomSignatures(ArrayList<Object> symptomSignatures) { + this.symptomSignatures = symptomSignatures; + } + public String getLogicalConnector() { + return logicalConnector; + } + public void setLogicalConnector(String logicalConnector) { + this.logicalConnector = logicalConnector; + } + public String getPolicyStatus() { + return policyStatus; + } + public void setPolicyStatus(String policyStatus) { + this.policyStatus = policyStatus; + } + public String getGocServerScope() { + return gocServerScope; + } + public void setGocServerScope(String gocServerScope) { + this.gocServerScope = gocServerScope; + } + + public String getSupressionType() { + return supressionType; + } + public void setSupressionType(String supressionType) { + this.supressionType = supressionType; + } + + /********************************************************************************/ + + + + public String getComboPolicyType() { + return comboPolicyType; + } + public void setComboPolicyType(String comboPolicyType) { + this.comboPolicyType = comboPolicyType; + } + public String getGitPath() { + return gitPath; + } + public void setGitPath(String gitPath) { + this.gitPath = gitPath; + } + public String getOldPolicyFileName() { + return oldPolicyFileName; + } + public void setOldPolicyFileName(String oldPolicyFileName) { + this.oldPolicyFileName = oldPolicyFileName; + } + public String getDomainDir() { + return domain; + } + public void setDomainDir(String domain) { + this.domain = domain; + } + public Integer getHighestVersion() { + return highestVersion; + } + public void setHighestVersion(Integer highestVersion) { + this.highestVersion = highestVersion; + } + public Object getData() { + return data; + } + public void setData(Object data) { + this.data = data; + } + public String getPolicyName() { + return policyName; + } + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + public String getConfigBodyData() { + return configBodyData; + } + public void setConfigBodyData(String configBodyData) { + this.configBodyData = configBodyData; + } + public String getConfigType() { + return configType; + } + public void setConfigType(String configType) { + this.configType = configType; + } + public String getPolicyID() { + return policyID; + } + public void setPolicyID(String policyID) { + this.policyID = policyID; + } + public String getPolicyType() { + return policyType; + } + public void setPolicyType(String policyType) { + this.policyType = policyType; + } + public String getPolicyDescription() { + return policyDescription; + } + public void setPolicyDescription(String policyDescription) { + this.policyDescription = policyDescription; + } + public String getEcompName() { + return ecompName; + } + public void setEcompName(String ecompName) { + this.ecompName = ecompName; + } + public String getConfigName() { + return configName; + } + public void setConfigName(String configName) { + this.configName = configName; + } + public String getRuleID() { + return ruleID; + } + public void setRuleID(String ruleID) { + this.ruleID = ruleID; + } + public String getRuleCombiningAlgId() { + return ruleCombiningAlgId; + } + public void setRuleCombiningAlgId(String ruleCombiningAlgId) { + this.ruleCombiningAlgId = ruleCombiningAlgId; + } + public Map<String,String> getDynamicFieldConfigAttributes() { + return dynamicFieldConfigAttributes; + } + public void setDynamicFieldConfigAttributes( + Map<String,String> dynamicFieldConfigAttributes) { + this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes; + } + public String getParentPath() { + return parentPath; + } + public void setParentPath(String parentPath) { + this.parentPath = parentPath; + } + public boolean isEditPolicy() { + return isEditPolicy; + } + public void setEditPolicy(boolean isEditPolicy) { + this.isEditPolicy = isEditPolicy; + } + public boolean isViewPolicy() { + return isViewPolicy; + } + public void setViewPolicy(boolean isViewPolicy) { + this.isViewPolicy = isViewPolicy; + } + public Object getPolicyData() { + return policyData; + } + public void setPolicyData(Object policyData) { + this.policyData = policyData; + } + public boolean isReadOnly() { + return readOnly; + } + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + public String getUserGitPath() { + return gitPath; + } + public void setUserGitPath(String gitPath) { + this.gitPath = gitPath; + } + public boolean isValidData() { + return isValidData; + } + public void setValidData(boolean isValidData) { + this.isValidData = isValidData; + } + public String getAdminNotification() { + return adminNotification; + } + public void setAdminNotification(String adminNotification) { + this.adminNotification = adminNotification; + } + public String getConfigHome() { + return configHome; + } + public void setConfigHome(String configHome) { + this.configHome = configHome; + } + public String getConfigUrl() { + return configUrl; + } + public void setConfigUrl(String configUrl) { + this.configUrl = configUrl; + } + public String getFinalPolicyPath() { + return finalPolicyPath; + } + public void setFinalPolicyPath(String finalPolicyPath) { + this.finalPolicyPath = finalPolicyPath; + } + public String getVersion() { + return version; + } + public void setVersion(String version) { + this.version = version; + } + public String getJsonBody() { + return jsonBody; + } + public void setJsonBody(String jsonBody) { + this.jsonBody = jsonBody; + } + public String getPrevJsonBody() { + return prevJsonBody; + } + public void setPrevJsonBody(String prevJsonBody) { + this.prevJsonBody = prevJsonBody; + } + public String getApiflag() { + return apiflag; + } + public void setApiflag(String apiflag) { + this.apiflag = apiflag; + } + /** + * @return the actionPerformer + */ + public String getActionPerformer() { + return actionPerformer; + } + /** + * @param actionPerformer the actionPerformer to set + */ + public void setActionPerformer(String actionPerformer) { + this.actionPerformer = actionPerformer; + } + /** + * @return the actionAttribute + */ + public String getActionAttribute() { + return actionAttribute; + } + /** + * @param actionAttribute the actionAttribute to set + */ + public void setActionAttribute(String actionAttribute) { + this.actionAttribute = actionAttribute; + } + /** + * @return the dynamicRuleAlgorithmLabels + */ + public List<String> getDynamicRuleAlgorithmLabels() { + return dynamicRuleAlgorithmLabels; + } + /** + * @param dynamicRuleAlgorithmLabels the dynamicRuleAlgorithmLabels to set + */ + public void setDynamicRuleAlgorithmLabels( + List<String> dynamicRuleAlgorithmLabels) { + this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels; + } + /** + * @return the dynamicRuleAlgorithmCombo + */ + public List<String> getDynamicRuleAlgorithmCombo() { + return dynamicRuleAlgorithmCombo; + } + /** + * @param dynamicRuleAlgorithmCombo the dynamicRuleAlgorithmCombo to set + */ + public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) { + this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo; + } + /** + * @return the dynamicRuleAlgorithmField1 + */ + public List<String> getDynamicRuleAlgorithmField1() { + return dynamicRuleAlgorithmField1; + } + /** + * @param dynamicRuleAlgorithmField1 the dynamicRuleAlgorithmField1 to set + */ + public void setDynamicRuleAlgorithmField1( + List<String> dynamicRuleAlgorithmField1) { + this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1; + } + /** + * @return the dynamicRuleAlgorithmField2 + */ + public List<String> getDynamicRuleAlgorithmField2() { + return dynamicRuleAlgorithmField2; + } + /** + * @param dynamicRuleAlgorithmField2 the dynamicRuleAlgorithmField2 to set + */ + public void setDynamicRuleAlgorithmField2( + List<String> dynamicRuleAlgorithmField2) { + this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2; + } + public Map<String,String> getDropDownMap() { + return dropDownMap; + } + public void setDropDownMap(Map<String,String> dropDownMap) { + this.dropDownMap = dropDownMap; + } + + public Map<String,String> getDynamicSettingsMap() { + return dynamicSettingsMap; + } + public void setDynamicSettingsMap(Map<String,String> dynamicSettingsMap) { + this.dynamicSettingsMap = dynamicSettingsMap; + } + public List<Object> getDynamicVariableList() { + return dynamicVariableList; + } + public void setDynamicVariableList(List<Object> dynamicVariableList) { + this.dynamicVariableList = dynamicVariableList; + } + public List<String> getDataTypeList() { + return dataTypeList; + } + public void setDataTypeList(List<String> dataTypeList) { + this.dataTypeList = dataTypeList; + } + public boolean isDraft() { + return isDraft; + } + public void setDraft(boolean isDraft) { + this.isDraft = isDraft; + } + public String getConfigPolicyType() { + return configPolicyType; + } + public void setConfigPolicyType(String configPolicyType) { + this.configPolicyType = configPolicyType; + } + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getLocation() { + return location; + } + public void setLocation(String location) { + this.location = location; + } + public String getPriority() { + return priority; + } + public void setPriority(String priority) { + this.priority = priority; + } + public Map<String, String> getBrmsParamBody() { + return brmsParamBody; + } + public void setBrmsParamBody(Map<String, String> brmsParamBody) { + this.brmsParamBody = brmsParamBody; + } + public EntityManagerFactory getEntityManagerFactory() { + return entityManagerFactory; + } + public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) { + this.entityManagerFactory = entityManagerFactory; + } + /** + * @return the policyExists + */ + public Boolean getPolicyExists() { + return policyExists; + } + /** + * @param policyExists the policyExists to set + */ + public void setPolicyExists(Boolean policyExists) { + this.policyExists = policyExists; + } + public String getPolicyScope() { + return policyScope; + } + + public void setPolicyScope(String domainDir) { + this. policyScope=domainDir; + } + public String getProviderComboBox() { + return providerComboBox; + } + public void setProviderComboBox(String providerComboBox) { + this.providerComboBox = providerComboBox; + } + public String getRiskType() { + return riskType; + } + public void setRiskType(String riskType) { + this.riskType = riskType; + } + public String getGuard() { + return guard; + } + public void setGuard(String guard) { + this.guard = guard; + } + public String getRiskLevel() { + return riskLevel; + } + public void setRiskLevel(String riskLevel) { + this.riskLevel = riskLevel; + } + public String getTtlDate() { + return ttlDate; + } + public void setTtlDate(String ttlDate) { + this.ttlDate = ttlDate; + } + public String getBrmsController() { + return brmsController; + } + public void setBrmsController(String brmsController) { + this.brmsController = brmsController; + } + public ArrayList<String> getBrmsDependency() { + return brmsDependency; + } + public void setBrmsDependency(ArrayList<String> brmsDependency) { + this.brmsDependency = brmsDependency; + } + public Map<String, String> getMatching() { + return matching; + } + public void setMatching(Map<String, String> matching) { + this.matching = matching; + } + public String getUserId() { + return userId; + } + public void setUserId(String userId) { + this.userId = userId; + } + public String getNewFileName() { + return newFileName; + } + public void setNewFileName(String newFileName) { + this.newFileName = newFileName; + } + + public String getDomain() { + return domain; + } + public void setDomain(String domain) { + this.domain = domain; + } + public EcompName getEcompNameField() { + return ecompNameField; + } + public void setEcompNameField(EcompName ecompNameField) { + this.ecompNameField = ecompNameField; + } + public Object getJsonBodyData() { + return jsonBodyData; + } + public void setJsonBodyData(Object jsonBodyData) { + this.jsonBodyData = jsonBodyData; + } + public String getDirPath() { + return dirPath; + } + public void setDirPath(String dirPath) { + this.dirPath = dirPath; + } + public String getConfigBodyPath() { + return configBodyPath; + } + public void setConfigBodyPath(String configBodyPath) { + this.configBodyPath = configBodyPath; + } + public ArrayList<Object> getAttributes() { + return attributes; + } + public void setAttributes(ArrayList<Object> attributes) { + this.attributes = attributes; + } + public ArrayList<Object> getSettings() { + return settings; + } + public void setSettings(ArrayList<Object> settings) { + this.settings = settings; + } + public ArrayList<Object> getRuleAlgorithmschoices() { + return ruleAlgorithmschoices; + } + public void setRuleAlgorithmschoices(ArrayList<Object> ruleAlgorithmschoices) { + this.ruleAlgorithmschoices = ruleAlgorithmschoices; + } + public LinkedHashMap<?, ?> getServiceTypePolicyName() { + return serviceTypePolicyName; + } + public void setServiceTypePolicyName(LinkedHashMap<?, ?> serviceTypePolicyName) { + this.serviceTypePolicyName = serviceTypePolicyName; + } + public LinkedHashMap<?, ?> getVerticaMetrics() { + return verticaMetrics; + } + public void setVerticaMetrics(LinkedHashMap<?, ?> verticaMetrics) { + this.verticaMetrics = verticaMetrics; + } + public LinkedHashMap<?, ?> getDescription() { + return description; + } + public void setDescription(LinkedHashMap<?, ?> description) { + this.description = description; + } + public LinkedHashMap<?, ?> getAttributeFields() { + return attributeFields; + } + public void setAttributeFields(LinkedHashMap<?, ?> attributeFields) { + this.attributeFields = attributeFields; + } + public String getClearTimeOut() { + return clearTimeOut; + } + public void setClearTimeOut(String clearTimeOut) { + this.clearTimeOut = clearTimeOut; + } + public String getTrapMaxAge() { + return trapMaxAge; + } + public void setTrapMaxAge(String trapMaxAge) { + this.trapMaxAge = trapMaxAge; + } + public String getVerificationclearTimeOut() { + return verificationclearTimeOut; + } + public void setVerificationclearTimeOut(String verificationclearTimeOut) { + this.verificationclearTimeOut = verificationclearTimeOut; + } + public Map<String, String> getDynamicLayoutMap() { + return dynamicLayoutMap; + } + public void setDynamicLayoutMap(Map<String, String> dynamicLayoutMap) { + this.dynamicLayoutMap = dynamicLayoutMap; + } + public String getFwPolicyType() { + return fwPolicyType; + } + public void setFwPolicyType(String fwPolicyType) { + this.fwPolicyType = fwPolicyType; + } + public ArrayList<Object> getFwattributes() { + return fwattributes; + } + public void setFwattributes(ArrayList<Object> fwattributes) { + this.fwattributes = fwattributes; + } + public String getParentForChild() { + return parentForChild; + } + public void setParentForChild(String parentForChild) { + this.parentForChild = parentForChild; + } + public String getRuleName() { + return ruleName; + } + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + public LinkedHashMap<?, ?> getRuleData() { + return ruleData; + } + public void setRuleData(LinkedHashMap<?, ?> ruleData) { + this.ruleData = ruleData; + } + public LinkedHashMap<?, ?> getRuleListData() { + return ruleListData; + } + public void setRuleListData(LinkedHashMap<?, ?> ruleListData) { + this.ruleListData = ruleListData; + } + public String getSecurityZone() { + return securityZone; + } + public void setSecurityZone(String securityZone) { + this.securityZone = securityZone; + } + public String getActionAttributeValue() { + return actionAttributeValue; + } + public void setActionAttributeValue(String actionAttributeValue) { + this.actionAttributeValue = actionAttributeValue; + } + public String getRuleProvider() { + return ruleProvider; + } + public void setRuleProvider(String ruleProvider) { + this.ruleProvider = ruleProvider; + } + public String getMsLocation() { + return msLocation; + } + public void setMsLocation(String msLocation) { + this.msLocation = msLocation; + } + public Map<String,String> getDrlRuleAndUIParams() { + return drlRuleAndUIParams; + } + public void setDrlRuleAndUIParams(Map<String,String> drlRuleAndUIParams) { + this.drlRuleAndUIParams = drlRuleAndUIParams; + } + public String getActionBody() { + return actionBody; + } + public void setActionBody(String actionBody) { + this.actionBody = actionBody; + } + public String getActionDictHeader() { + return actionDictHeader; + } + public void setActionDictHeader(String actionDictHeader) { + this.actionDictHeader = actionDictHeader; + } + public String getActionDictType() { + return actionDictType; + } + public void setActionDictType(String actionDictType) { + this.actionDictType = actionDictType; + } + public String getActionDictUrl() { + return actionDictUrl; + } + public void setActionDictUrl(String actionDictUrl) { + this.actionDictUrl = actionDictUrl; + } + public String getActionDictMethod() { + return actionDictMethod; + } + public void setActionDictMethod(String actionDictMethod) { + this.actionDictMethod = actionDictMethod; + } + public String getClWarning() { + return clWarning; + } + public void setClWarning(String clWarning) { + this.clWarning = clWarning; + } + public String getNewCLName() { + return newCLName; + } + public void setNewCLName(String newCLName) { + this.newCLName = newCLName; + } + public String getExistingCLName() { + return existingCLName; + } + public void setExistingCLName(String existingCLName) { + this.existingCLName = existingCLName; + } +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PrefixIPList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PrefixIPList.java new file mode 100644 index 000000000..3de72ee68 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PrefixIPList.java @@ -0,0 +1,72 @@ +/*- + * ============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.rest.adapter; + + + +import java.util.ArrayList; +import java.util.List; + + +public class PrefixIPList { + protected String name; + protected String description; + protected List<AddressMembers> members; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public List<AddressMembers> getMembers() + { + if(members==null) + { + members= new ArrayList<AddressMembers>(); + } + return this.members; + } + + public void setMembers(List<AddressMembers> members) + { + this.members = members; + } + /*public String getValue() { + return value; + } + + + public void setValue(String value) { + this.value = value; + }*/ + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java new file mode 100644 index 000000000..6b368d331 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceGroupJson.java @@ -0,0 +1,79 @@ +/*- + * ============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.rest.adapter; + + +import java.util.ArrayList; +import java.util.List; + +public class ServiceGroupJson { + + protected String name; + protected String description; + protected List<ServiceMembers> members; + + // name + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } + + public boolean equals(Object obj) + { + ServiceGroupJson servGroupobj=(ServiceGroupJson) obj; + if(this.getName().equals(servGroupobj.getName())) + { + return true; + } + return false; + } + + public int hashCode() { + return Integer.valueOf(name.charAt(0)+(name.charAt(1))); + } + + // description + public String getDescription() { + return description; + } + + public void setDescription(String value) { + this.description = value; + } + + public List<ServiceMembers> getMembers() + { + if(members==null) + { + members= new ArrayList<ServiceMembers>(); + } + return this.members; + } + + public void setMembers(List<ServiceMembers> members) + { + this.members = members; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java new file mode 100644 index 000000000..81cfc03c6 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceListJson.java @@ -0,0 +1,107 @@ +/*- + * ============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.rest.adapter; + + + +public class ServiceListJson { + + protected String name; + protected String description; + protected String type; + protected String transportProtocol; + protected String appProtocol; + protected String ports; + // name + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } + + public boolean equals(Object obj) + { + ServiceListJson servobj=(ServiceListJson) obj; + if(this.getName().equals(servobj.getName())) + { + return true; + } + return false; + } + + public int hashCode() { + if(name!=null){ + return Integer.valueOf(name.charAt(0)+(name.charAt(1))); + }else{ + return 0; + } + } + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + // type + public String getType() { + return type; + } + + public void setType(String value) { + this.type = value; + } + + // transportProtocol + public String getTransportProtocol() { + return transportProtocol; + } + + public void setTransportProtocol(String value) { + this.transportProtocol = value; + } + + // appProtocol + public String getAppProtocol() { + return appProtocol; + } + + public void setAppProtocol(String value) { + this.appProtocol = value; + } + + // ports + public String getPorts() { + return ports; + } + + public void setPorts(String value) { + this.ports = value; + } + + + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceMembers.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceMembers.java new file mode 100644 index 000000000..a88df5174 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServiceMembers.java @@ -0,0 +1,48 @@ +/*- + * ============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.rest.adapter; + + + +public class ServiceMembers { + + protected String type; + protected String name; + + // type + public String getType() { + return type; + } + + public void setType(String value) { + this.type = value; + } + + // transportProtocol + public String getName() { + return name; + } + + public void setName(String value) { + this.name = value; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VSCLActionDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServicesJson.java index 3d0245555..c64af9a3c 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VSCLActionDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/ServicesJson.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * ECOMP-REST + * ECOMP Policy Engine * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -18,18 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; -import org.openecomp.policy.rest.jpa.VSCLAction; +public class ServicesJson { + protected String type; + protected String name; + // type + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } -public interface VSCLActionDao { - List<VSCLAction> getVSCLActionData(); - List<String> getVsclActionDataByName(); - void Save(VSCLAction vSCLAction); - void delete(VSCLAction vSCLAction); - void update(VSCLAction vSCLAction); + public void setName(String value) { + this.name = value; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VNFTypeDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TagDefines.java index ff68a4065..0af88912a 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VNFTypeDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TagDefines.java @@ -18,17 +18,24 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; -import java.util.List; - -import org.openecomp.policy.rest.jpa.VNFType; - -public interface VNFTypeDao { - List<VNFType> getVNFTypeData(); - List<String> getVNFTypeDataByName(); - void Save(VNFType vnfType); - void delete(VNFType vnfType); - void update(VNFType vnfType); +public class TagDefines { + String key; + String value; + + public String getKey() { + return key; + } + public void setKey(String key) { + this.key = key; + } + public String getValue() { + return value; + } + public void setValue(String value) { + this.value = value; + } + } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/FirewallDictionaryListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Tags.java index 76cb1bc1f..8fec46482 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/FirewallDictionaryListDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Tags.java @@ -18,20 +18,35 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.policy.rest.dao; +package org.openecomp.policy.rest.adapter; + import java.util.List; -import org.openecomp.policy.rest.jpa.FirewallDictionaryList; +public class Tags { + String ruleName; + List<TagDefines> tags; + String tagPickerName; + + public String getRuleName() { + return ruleName; + } + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + public List<TagDefines> getTags() { + return tags; + } + public void setTags(List<TagDefines> tags) { + this.tags = tags; + } + public String getTagPickerName() { + return tagPickerName; + } -public interface FirewallDictionaryListDao { - List<FirewallDictionaryList> getFWDictionaryListData(); - List<String> getFWDictionaryListDataByName(); - void Save(FirewallDictionaryList firewallDictionaryList); - void delete(FirewallDictionaryList firewallDictionaryList); - void update(FirewallDictionaryList firewallDictionaryList); - void updateQuery(String query); - FirewallDictionaryList getFWDictionaryDataById(String value); + public void setTagPickerName(String tagPickerName) { + this.tagPickerName = tagPickerName; + } + } - diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Term.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Term.java new file mode 100644 index 000000000..e5e0a7b00 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Term.java @@ -0,0 +1,201 @@ +/*- + * ============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.rest.adapter; + + + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + + +public class Term { + + String position; + protected String ruleName; + protected List<String> fromZones; + protected List<String> toZones; + protected boolean negateSource; //hardcoded + protected boolean negateDestination; //hardcoded + protected List<AddressJson> sourceList; + protected List<AddressJson> destinationList; + protected List<ServicesJson> sourceServices; + protected Set<ServicesJson> destServices; + protected String action; + protected String description; + boolean enabled; //hardcoded + boolean log; //hardcoded + + //position + public String getPosition() { + return position; + } + + public void setPosition(String value) { + this.position = value; + } + + //RuleName + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String value) { + this.ruleName = value; + } + + //From Zone + public List<String> getFromZones() { + if (fromZones==null) + { + fromZones= new ArrayList<String>(); + } + return fromZones; + } + + public void setFromZones(List<String> fromZones) { + this.fromZones = fromZones; + } + + //To Zone + public List<String> getToZones() { + if (toZones==null) + { + toZones= new ArrayList<String>(); + } + return toZones; + } + + public void setToZones(List<String> toZones) { + this.toZones = toZones; + } + + + //Negate Source + public boolean getNegateSource() { + return negateSource; + } + + public void setNegateSource(boolean negateSource) { + this.negateSource = negateSource; + } + + //Negate Destination + public boolean getNegateDestination() { + return negateDestination; + } + + public void setNegateDestination(boolean negateDestination) { + this.negateDestination = negateDestination; + } + + //SourceList + public List<AddressJson> getSourceList() + { + if(sourceList==null) + { + sourceList= new ArrayList<AddressJson>(); + } + return this.sourceList; + } + + public void setSourceList(List<AddressJson> srcList) { + this.sourceList = srcList; + } + + //Destination List + public List<AddressJson> getDestinationList() + { + if(destinationList==null) + { + destinationList= new ArrayList<AddressJson>(); + } + return this.destinationList; + } + + public void setDestinationList(List<AddressJson> destList) { + this.destinationList = destList; + } + + //Source Services + public List<ServicesJson> getSourceServices() { + if(sourceServices==null) + { + sourceServices= new ArrayList<ServicesJson>(); + } + return this.sourceServices; + } + + public void setSourceServices(List<ServicesJson> sourceServices) { + this.sourceServices = sourceServices; + } + + //Destination services. + public Set<ServicesJson> getDestServices() { + if(destServices==null) + { + destServices= new HashSet<ServicesJson>(); + } + return this.destServices; + } + + public void setDestServices(Set<ServicesJson> destServices) { + this.destServices = destServices; + } + + //Action + public String getAction() { + return action; + } + + public void setAction(String value) { + this.action = value; + } + + //description + public String getDescription() { + return description; + } + + public void setDescription(String desc) { + this.description = desc; + } + + //enabled + public boolean getEnabled() { + return enabled; + } + + public void setEnabled(boolean value) { + this.enabled = value; + } + + //Log + public boolean getLog() { + return log; + } + + public void setLog(boolean value) { + this.log = value; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java new file mode 100644 index 000000000..26853d360 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/TermCollector.java @@ -0,0 +1,141 @@ +/*- + * ============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.rest.adapter; + + + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + + +public class TermCollector { + String serviceTypeId; + String configName; + DeployNowJson deploymentOption; + String securityZoneId; + + protected Set<Object> serviceGroups; + protected Set<Object> addressGroups; + protected List<Term> firewallRuleList; + + private String primaryParentZoneId; + + protected List<Tags> ruleToTag; + + public List<Tags> getRuleToTag() { + return ruleToTag; + } + + public void setRuleToTag(List<Tags> ruleToTag) { + this.ruleToTag = ruleToTag; + } + + //SecurityTypeId + public String getServiceTypeId() { + return serviceTypeId; + } + + public void setServiceTypeId(String serviceTypeId) { + this.serviceTypeId = serviceTypeId; + } + + //ConfigName + public String getConfigName() { + return configName; + } + + public void setConfigName(String configName) { + this.configName = configName; + } + + //DeploymentControl + public DeployNowJson getDeploymentOption() { + return deploymentOption; + } + + public void setDeploymentOption(DeployNowJson deploymentOption) { + this.deploymentOption = deploymentOption; + } + + //SecurityZoneId + public String getSecurityZoneId() { + return securityZoneId; + } + public void setSecurityZoneId(String securityZoneId) { + this.securityZoneId = securityZoneId; + } + + + //ServiceGroup + public Set<Object> getServiceGroups() { + if(serviceGroups==null) + { + serviceGroups= new HashSet<Object>(); + } + return this.serviceGroups; + } + + public void setServiceGroups(Set<Object> servListArray) { + this.serviceGroups = servListArray; + } + + //AddressGroup + public Set<Object> getAddressGroups() { + if(addressGroups==null) + { + addressGroups= new HashSet<Object>(); + } + return this.addressGroups; + } + + public void setAddressGroups(Set<Object> addressGroups) { + this.addressGroups = addressGroups; + } + + //FirewallRuleList + public List<Term> getFirewallRuleList() { + + if(firewallRuleList==null) + { + firewallRuleList= new ArrayList<Term>(); + } + return this.firewallRuleList; + } + + public void setFirewallRuleList(List<Term> firewallRuleList) { + this.firewallRuleList = firewallRuleList; + } + + + //primaryParentZoneId + public String getPrimaryParentZoneId() { + return primaryParentZoneId; + } + + public void setPrimaryParentZoneId(String primaryParentZoneId) { + this.primaryParentZoneId = primaryParentZoneId; + } + + + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/CategoryDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/package-info.java index e90aa1d8b..a78bbf203 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/CategoryDao.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/package-info.java @@ -17,13 +17,4 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.Category; - -public interface CategoryDao { - List<Category> getCategoryListData(); -} +package org.openecomp.policy.rest.adapter;
\ No newline at end of file diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ActionListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ActionListDao.java deleted file mode 100644 index b8aa2948a..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ActionListDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.ActionList; - -public interface ActionListDao { - List<ActionList> getActionListData(); - List<String> getActionListDataByName(); - void Save(ActionList actionList); - void delete(ActionList actionList); - void update(ActionList actionList); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/BRMSParamTemplateDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/BRMSParamTemplateDao.java deleted file mode 100644 index 2c03192c0..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/BRMSParamTemplateDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.BRMSParamTemplate; - -public interface BRMSParamTemplateDao { - List<BRMSParamTemplate> getBRMSParamTemplateData(); - List<String> getBRMSParamDataByName(); - void Save(BRMSParamTemplate brmsParam); - void delete(BRMSParamTemplate brmsParam); - void update(BRMSParamTemplate brmsParam); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/CommonClassDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/CommonClassDao.java new file mode 100644 index 000000000..3d0da0e6b --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/CommonClassDao.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.dao; + +import java.util.List; + +import org.openecomp.policy.rest.jpa.PolicyRoles; + +public interface CommonClassDao { + + //Common methods + List<Object> getData(@SuppressWarnings("rawtypes") Class className); + List<Object> getDataById(@SuppressWarnings("rawtypes") Class className, String columnName, String key); + List<String> getDataByColumn(@SuppressWarnings("rawtypes") Class className, String columnName); + List<Object> checkDuplicateEntry(String value, String columnName, @SuppressWarnings("rawtypes") Class className); + Object getEntityItem(@SuppressWarnings("rawtypes") Class className, String columnName, String key); + List<Object> getDataByQuery(String query); + List<Object> getMultipleDataOnAddingConjunction(@SuppressWarnings("rawtypes") Class className, String columnName, List<String> data); + void save(Object entity); + void delete(Object entity); + void update(Object entity); + void updateQuery(String query); + + //Group Policy Scope + List<Object> checkExistingGroupListforUpdate(String groupListValue, String groupNameValue); + + + //Roles + List<PolicyRoles> getUserRoles(); + + + //ClosedLoops + void updateClAlarms(String clName, String alarms); + void updateClYaml(String clName, String yaml); + void deleteAll(); + + + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DCAEUUIDDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DCAEUUIDDao.java deleted file mode 100644 index 418d77629..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DCAEUUIDDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.DCAEuuid; - -public interface DCAEUUIDDao { - List<DCAEuuid> getDCAEuuidData(); - List<String> getDCAEuuidDataByName(); - void Save(DCAEuuid dcaeUUID); - void delete(DCAEuuid dcaeUUID); - void update(DCAEuuid dcaeUUID); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DecisionPolicyDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DecisionPolicyDao.java deleted file mode 100644 index 372a1fb7c..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/DecisionPolicyDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.DecisionSettings; - -public interface DecisionPolicyDao { - List<DecisionSettings> getDecisionSettingsData(); - List<String> getDecisionDataByName(); - void Save(DecisionSettings decisionSettings); - void delete(DecisionSettings decisionSettings); - void update(DecisionSettings decisionSettings); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/EcompNameDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/EcompNameDao.java deleted file mode 100644 index 420121883..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/EcompNameDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.EcompName; - -public interface EcompNameDao { - List<EcompName> getEcompName(); - List<String> getEcompNameDataByName(); - void Save(EcompName ecompName); - void delete(EcompName ecompName); - void update(EcompName ecompName); - -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/EnforcerPolicyDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/EnforcerPolicyDao.java deleted file mode 100644 index 55f4bf599..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/EnforcerPolicyDao.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.EnforcingType; - -public interface EnforcerPolicyDao { - List<EnforcingType> getEnforcingTypeData(); - void Save(EnforcingType enforcingType); - void delete(EnforcingType enforcingType); - void update(EnforcingType enforcingType); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/GroupPolicyScopeListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/GroupPolicyScopeListDao.java deleted file mode 100644 index fdab28a0f..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/GroupPolicyScopeListDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.GroupPolicyScopeList; - -public interface GroupPolicyScopeListDao{ - List<GroupPolicyScopeList> getGroupPolicyScopeListData(); - List<String> getGroupPolicyScopeListDataByName(); - void Save(GroupPolicyScopeList attribute); - void delete(GroupPolicyScopeList attribute); - void update(GroupPolicyScopeList attribute); - List<GroupPolicyScopeList> CheckDuplicateEntry(String value); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceConfigNameDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceConfigNameDao.java deleted file mode 100644 index f0321031c..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceConfigNameDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.MicroServiceConfigName; - -public interface MicroServiceConfigNameDao { - List<MicroServiceConfigName> getMicroServiceConfigNameData(); - List<String> getMSConfigDataByName(); - void Save(MicroServiceConfigName microServiceConfigName); - void delete(MicroServiceConfigName microServiceConfigName); - void update(MicroServiceConfigName microServiceConfigName); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceLocationDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceLocationDao.java deleted file mode 100644 index fdb9c559e..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceLocationDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.MicroServiceLocation; - -public interface MicroServiceLocationDao { - List<MicroServiceLocation> getMicroServiceLocationData(); - List<String> getMSLocationDataByName(); - void Save(MicroServiceLocation microServiceLocation); - void delete(MicroServiceLocation microServiceLocation); - void update(MicroServiceLocation microServiceLocation); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceModelsDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceModelsDao.java deleted file mode 100644 index 0a56edd2c..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/MicroServiceModelsDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.MicroServiceModels; - -public interface MicroServiceModelsDao { - List<MicroServiceModels> getMicroServiceModelsData(); - List<String> getMSModelsDataByName(); - void Save(MicroServiceModels microServiceModels); - void delete(MicroServiceModels microServiceModels); - void update(MicroServiceModels microServiceModels); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeClosedLoopDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeClosedLoopDao.java deleted file mode 100644 index 7730adacb..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeClosedLoopDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.PolicyScopeClosedLoop; - -public interface PolicyScopeClosedLoopDao { - List<PolicyScopeClosedLoop> getPolicyScopeClosedLoopData(); - List<String> getPolicyScopeClosedLoopDataByName(); - void Save(PolicyScopeClosedLoop attribute); - void delete(PolicyScopeClosedLoop attribute); - void update(PolicyScopeClosedLoop attribute); - List<PolicyScopeClosedLoop> CheckDuplicateEntry(String value); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeResourceDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeResourceDao.java deleted file mode 100644 index 4ff88fed8..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeResourceDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.PolicyScopeResource; - -public interface PolicyScopeResourceDao { - List<PolicyScopeResource> getPolicyScopeResourceData(); - List<String> getPolicyScopeResourceDataByName(); - void Save(PolicyScopeResource attribute); - void delete(PolicyScopeResource attribute); - void update(PolicyScopeResource attribute); - List<PolicyScopeResource> CheckDuplicateEntry(String value); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeServiceDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeServiceDao.java deleted file mode 100644 index 2a5c8c565..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeServiceDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.PolicyScopeService; - -public interface PolicyScopeServiceDao { - List<PolicyScopeService> getPolicyScopeServiceData(); - List<String> getPolicyScopeServiceDataByName(); - void Save(PolicyScopeService attribute); - void delete(PolicyScopeService attribute); - void update(PolicyScopeService attribute); - List<PolicyScopeService> CheckDuplicateEntry(String value); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeTypeDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeTypeDao.java deleted file mode 100644 index e49f84cec..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PolicyScopeTypeDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.PolicyScopeType; - -public interface PolicyScopeTypeDao { - List<PolicyScopeType> getPolicyScopeTypeData(); - List<String> getPolicyScopeTypeDataByName(); - void Save(PolicyScopeType attribute); - void delete(PolicyScopeType attribute); - void update(PolicyScopeType attribute); - List<PolicyScopeType> CheckDuplicateEntry(String value); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PortListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PortListDao.java deleted file mode 100644 index 461387f4a..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PortListDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.PortList; - -public interface PortListDao { - List<PortList> getPortListData(); - List<String> getPortListDataByName(); - void Save(PortList portList); - void delete(PortList portList); - void update(PortList portList); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PrefixListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PrefixListDao.java deleted file mode 100644 index 29571dddb..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/PrefixListDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.PREFIXLIST; - -public interface PrefixListDao { - List<PREFIXLIST> getPREFIXLISTData(); - List<String> getPrefixListDataByName(); - void Save(PREFIXLIST prefixList); - void delete(PREFIXLIST prefixList); - void update(PREFIXLIST prefixList); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ProtocolListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ProtocolListDao.java deleted file mode 100644 index 11956ee94..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ProtocolListDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.ProtocolList; - -public interface ProtocolListDao { - List<ProtocolList> getProtocolListData(); - List<String> getProtocolListDataByName(); - void Save(ProtocolList protocolList); - void delete(ProtocolList protocolList); - void update(ProtocolList protocolList); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/RiskTypeDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/RiskTypeDao.java deleted file mode 100644 index 6c14928d8..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/RiskTypeDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.RiskType; - -public interface RiskTypeDao { - List<RiskType> getRiskName(); - List<String> getRiskTypeDataByName(); - void Save(RiskType riskName); - void delete(RiskType riskName); - void update(RiskType riskName); - -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SafePolicyWarningDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SafePolicyWarningDao.java deleted file mode 100644 index 3812f9470..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SafePolicyWarningDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.SafePolicyWarning; - -public interface SafePolicyWarningDao{ - List<SafePolicyWarning> getSafePolicyWarningData(); - List<String> getSafePolicyWarningDataByName(); - void Save(SafePolicyWarning attribute); - void delete(SafePolicyWarning attribute); - void update(SafePolicyWarning attribute); - SafePolicyWarning getSafePolicyWarningDataById(String riskType); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SecurityZoneDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SecurityZoneDao.java deleted file mode 100644 index 4367023b5..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SecurityZoneDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.SecurityZone; - -public interface SecurityZoneDao { - List<SecurityZone> getSecurityZoneData(); - List<String> getSecurityZoneDataByName(); - void Save(SecurityZone securityZone); - void delete(SecurityZone securityZone); - void update(SecurityZone securityZone); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceDictionaryDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceDictionaryDao.java deleted file mode 100644 index a756f3234..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceDictionaryDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.ClosedLoopD2Services; - -public interface ServiceDictionaryDao { - List<ClosedLoopD2Services> getClosedLoopD2ServicesData(); - List<String> getCLServiceDictDataByName(); - void Save(ClosedLoopD2Services closedLoopD2Services); - void delete(ClosedLoopD2Services closedLoopD2Services); - void update(ClosedLoopD2Services closedLoopD2Services); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceGroupDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceGroupDao.java deleted file mode 100644 index 678c6426a..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/ServiceGroupDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.GroupServiceList; - -public interface ServiceGroupDao { - List<GroupServiceList> getGroupServiceListData(); - List<String> getGroupServiceDataByName(); - void Save(GroupServiceList groupServiceList); - void delete(GroupServiceList groupServiceList); - void update(GroupServiceList groupServiceList); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SiteDictionaryDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SiteDictionaryDao.java deleted file mode 100644 index 21cae69b9..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/SiteDictionaryDao.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.ClosedLoopSite; - -public interface SiteDictionaryDao { - List<ClosedLoopSite> getClosedLoopSiteData(); - List<String> getCLSiteDataByName(); - void Save(ClosedLoopSite closedLoopSite); - void delete(ClosedLoopSite closedLoopSite); - void update(ClosedLoopSite closedLoopSite); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/TermListDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/TermListDao.java deleted file mode 100644 index c2c81cfd8..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/TermListDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.TermList; - -public interface TermListDao { - List<TermList> getTermListData(); - List<String> getTermListDataByName(); - void Save(TermList termList); - void delete(TermList termList); - void update(TermList termList); - TermList getTermListValueByName(String name); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VarbindDictionaryDao.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VarbindDictionaryDao.java deleted file mode 100644 index f3153f6df..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/VarbindDictionaryDao.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.dao; - -import java.util.List; - -import org.openecomp.policy.rest.jpa.VarbindDictionary; - -public interface VarbindDictionaryDao { - List<VarbindDictionary> getVarbindDictionaryData(); - List<VarbindDictionary> getVarbindEntityByName(String value); - List<String> getVarbindDataByName(); - void Save(VarbindDictionary varbindDictionary); - void delete(VarbindDictionary varbindDictionary); - void update(VarbindDictionary varbindDictionary); -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/package-info.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/package-info.java index c9f449f4f..84cd76a92 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/package-info.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/dao/package-info.java @@ -18,10 +18,4 @@ * ============LICENSE_END========================================================= */ -/** - * - */ -/** - * - */ package org.openecomp.policy.rest.dao; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionBodyEntity.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionBodyEntity.java index d12f6b3e1..bda58b607 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionBodyEntity.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionBodyEntity.java @@ -33,7 +33,6 @@ import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; -import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @@ -50,13 +49,11 @@ import com.fasterxml.jackson.annotation.JsonBackReference; @NamedQuery(name=" ActionBodyEntity.findAll", query="SELECT e FROM ActionBodyEntity e "), @NamedQuery(name="ActionBodyEntity.deleteAll", query="DELETE FROM ActionBodyEntity WHERE 1=1") }) -//@SequenceGenerator(name="seqActBody", initialValue=1, allocationSize=1) public class ActionBodyEntity implements Serializable { private static final long serialVersionUID = 1L; @Id - //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqActBody") @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="actionBodyId") @JsonBackReference diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionList.java index 0176c17be..0fea71a1c 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity @Table(name="actionlist") diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionPolicyDict.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionPolicyDict.java index fa7d2af95..f6c8965d2 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionPolicyDict.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ActionPolicyDict.java @@ -44,12 +44,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openecomp.policy.rest.XacmlAdminAuthorization; -import org.openecomp.policy.common.logging.eelf.MessageCodes; -import org.openecomp.policy.common.logging.eelf.PolicyLogger; @Entity @Table(name="ActionPolicyDict") -//@NamedQuery(name="ActionPolicyDict.findAll", query="SELECT e FROM ActionPolicyDict e ") @NamedQueries({ @NamedQuery(name="ActionPolicyDict.findAll", query="SELECT e FROM ActionPolicyDict e") }) @@ -144,8 +141,7 @@ public class ActionPolicyDict implements Serializable { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger - PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ActionPolicyDict", "Exception caused While adding Modified by Role"); + //PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ActionPolicyDict", "Exception caused While adding Modified by Role"); } } public int getId() { diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/AddressGroup.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/AddressGroup.java index 6418d6bc5..1b6430c21 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/AddressGroup.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/AddressGroup.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java index e79126ae2..184b4f80b 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java @@ -46,13 +46,8 @@ import javax.persistence.Transient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openecomp.policy.rest.XacmlAdminAuthorization; -import org.openecomp.policy.rest.jpa.UserInfo; -import com.att.research.xacml.api.Identifier; -import com.att.research.xacml.std.IdentifierImpl; -import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonManagedReference; /** * The persistent class for the Attribute database table. @@ -156,7 +151,7 @@ public class Attribute implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(Attribute.class); + private static Log LOGGER = LogFactory.getLog(Attribute.class); public Attribute() { } @@ -194,9 +189,7 @@ public class Attribute implements Serializable { try { this.userModifiedBy = XacmlAdminAuthorization.getUserId(); } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger - //PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "Attribute", "Exception caused While adding Modified by Role"); + LOGGER.error("Exception caused While adding Modified by Role"+e); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/BRMSController.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/BRMSController.java new file mode 100644 index 000000000..afa6d94cf --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/BRMSController.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.jpa; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.OrderBy; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name="BRMSController") +@NamedQuery(name="BRMSController.findAll", query="SELECT b from BRMSController b ") +public class BRMSController implements Serializable{ + private static final long serialVersionUID = -8666947569754164177L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="controller_name", nullable=false, length=1024, unique=true) + @OrderBy("asc") + private String controllerName; + + @Column(name="description", nullable=true, length=1024) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + @Column(name="controller", nullable=false) + private String controller; + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + public String getController() { + return controller; + } + + public void setController(String controller) { + this.controller = controller; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getControllerName() { + return controllerName; + } + + public void setControllerName(String controllerName) { + this.controllerName = controllerName; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/BRMSDependency.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/BRMSDependency.java new file mode 100644 index 000000000..9c4406948 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/BRMSDependency.java @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.jpa; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.OrderBy; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name="BRMSDependency") +@NamedQuery(name="BRMSDependency.findAll", query="SELECT b from BRMSDependency b ") +public class BRMSDependency implements Serializable{ + private static final long serialVersionUID = -7005622785653160761L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="dependency_name", nullable=false, length=1024, unique=true) + @OrderBy("asc") + private String dependencyName; + + @Column(name="description", nullable=true, length=1024) + private String description; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + @Column(name="dependency", nullable=false) + private String dependency; + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public Date getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + public String getDependency() { + return dependency; + } + + public void setDependency(String dependency) { + this.dependency = dependency; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getDependencyName() { + return dependencyName; + } + + public void setDependencyName(String dependencyName) { + this.dependencyName = dependencyName; + } +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Category.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Category.java index abc06879d..1f4243304 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Category.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Category.java @@ -38,7 +38,6 @@ import com.att.research.xacml.api.Identifier; import com.att.research.xacml.api.XACML3; import com.att.research.xacml.std.IdentifierImpl; import com.fasterxml.jackson.annotation.JsonBackReference; -import com.fasterxml.jackson.annotation.JsonIgnore; /** diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopD2Services.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopD2Services.java index 408190ac9..391ed9714 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopD2Services.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopD2Services.java @@ -42,10 +42,9 @@ import javax.persistence.TemporalType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.openecomp.policy.rest.XacmlAdminAuthorization; - import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.rest.XacmlAdminAuthorization; @Entity @@ -101,7 +100,7 @@ public class ClosedLoopD2Services implements Serializable{ this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(ClosedLoopD2Services.class); + private static Log LOGGER = LogFactory.getLog(ClosedLoopD2Services.class); public ClosedLoopD2Services(){ @@ -128,8 +127,7 @@ public class ClosedLoopD2Services implements Serializable{ try { this.userModifiedBy = XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ClosedLoopD2Services", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopSite.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopSite.java index b32091307..fd8b295b9 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopSite.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoopSite.java @@ -102,7 +102,7 @@ public class ClosedLoopSite implements Serializable{ this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(ClosedLoopSite.class); + private static Log LOGGER = LogFactory.getLog(ClosedLoopSite.class); public ClosedLoopSite(){ @@ -129,8 +129,7 @@ public class ClosedLoopSite implements Serializable{ try { this.userModifiedBy = XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ClosedLoopSite", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoops.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoops.java new file mode 100644 index 000000000..5732832c6 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ClosedLoops.java @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.jpa; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OrderBy; +import javax.persistence.Table; + +@Entity +@Table(name="ClosedLoops") +@NamedQueries({ + @NamedQuery(name="ClosedLoops.findAll", query="SELECT e FROM ClosedLoops e"), + @NamedQuery(name="ClosedLoops.deleteAll", query="DELETE FROM ClosedLoops WHERE 1=1") +}) +public class ClosedLoops implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -7796845092457926842L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="closedLoopControlName", nullable=false, length=255) + @OrderBy("asc") + private String closedLoopControlName; + + @Column(name="alarmConditions", nullable=true, length=255) + private String alarmConditions; + + @Column(name="yaml", nullable=true, length=1028) + private String yaml; + + public ClosedLoops() { + + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getClosedLoopControlName() { + return closedLoopControlName; + } + + public void setClosedLoopControlName(String closedLoopControlName) { + this.closedLoopControlName = closedLoopControlName; + } + + public String getAlarmConditions() { + return alarmConditions; + } + + public void setAlarmConditions(String alarmConditions) { + this.alarmConditions = alarmConditions; + } + + public String getYaml() { + return yaml; + } + + public void setYaml(String yaml) { + this.yaml = yaml; + } + +}
\ No newline at end of file diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConfigurationDataEntity.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConfigurationDataEntity.java index 71a6d6fb7..bf42a7788 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConfigurationDataEntity.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConfigurationDataEntity.java @@ -34,7 +34,6 @@ import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; -import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @@ -51,13 +50,11 @@ import com.fasterxml.jackson.annotation.JsonBackReference; @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "), @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1") }) -//@SequenceGenerator(name="seqConfig", initialValue=1, allocationSize=1) public class ConfigurationDataEntity implements Serializable { private static final long serialVersionUID = 1L; @Id - //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqConfig") @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="configurationDataId") @JsonBackReference diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEUsers.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEUsers.java index eb0c4cc1b..fdad24419 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEUsers.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEUsers.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEuuid.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEuuid.java index a71921b5e..9e7225fc7 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEuuid.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DCAEuuid.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Datatype.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Datatype.java index b3922f10b..05e4fbc0c 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Datatype.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Datatype.java @@ -39,7 +39,6 @@ import com.att.research.xacml.api.XACML3; import com.att.research.xacml.std.IdentifierImpl; import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonManagedReference; /** diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DecisionSettings.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DecisionSettings.java index 1d90af679..2d3e5b58a 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DecisionSettings.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DecisionSettings.java @@ -39,16 +39,9 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.openecomp.policy.rest.XacmlAdminAuthorization; - -import com.att.research.xacml.api.Identifier; -import com.att.research.xacml.std.IdentifierImpl; -import com.fasterxml.jackson.annotation.JsonManagedReference; - import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.rest.XacmlAdminAuthorization; @Entity @@ -115,8 +108,7 @@ public class DecisionSettings implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log logger = LogFactory.getLog(DecisionSettings.class); + public DecisionSettings() { } @@ -139,7 +131,7 @@ public class DecisionSettings implements Serializable { } public String setDecisionSettings(){ - return this.xacmlId = xacmlId; + return this.xacmlId; } @PrePersist public void prePersist() { @@ -154,8 +146,6 @@ public class DecisionSettings implements Serializable { try { this.userModifiedBy = XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DecisionSettings", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DescriptiveScope.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DescriptiveScope.java index 9f751f7c0..d4719cf41 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DescriptiveScope.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/DescriptiveScope.java @@ -99,7 +99,7 @@ public class DescriptiveScope implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(DescriptiveScope.class); + private static Log LOGGER = LogFactory.getLog(DescriptiveScope.class); public DescriptiveScope(){ @@ -126,8 +126,7 @@ public class DescriptiveScope implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DescriptiveScope", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/EcompName.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/EcompName.java index 599e47818..09dcd4738 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/EcompName.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/EcompName.java @@ -39,16 +39,9 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.openecomp.policy.rest.XacmlAdminAuthorization; -import org.openecomp.policy.rest.jpa.UserInfo; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonManagedReference; - import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.rest.XacmlAdminAuthorization; @Entity @@ -102,8 +95,6 @@ public class EcompName implements Serializable { public void setUserModifiedBy(UserInfo userModifiedBy) { this.userModifiedBy = userModifiedBy; } - - private static Log logger = LogFactory.getLog(EcompName.class); public EcompName() { @@ -130,8 +121,6 @@ public class EcompName implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId(); } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "EcompName", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FWTag.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FWTag.java new file mode 100644 index 000000000..f10f6662c --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FWTag.java @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.jpa; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.OrderBy; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openecomp.policy.common.logging.eelf.MessageCodes; +import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.rest.XacmlAdminAuthorization; + +@Entity +@Table(name = "FWTag") +@NamedQuery(name = "FWTag.findAll", query= "Select p from FWTag p") +public class FWTag implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name="tagName", nullable=false) + @OrderBy("asc") + private String fwTagName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="tagValues", nullable=true) + @OrderBy("asc") + private String tagValues; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + + private static Log LOGGER = LogFactory.getLog(FWTag.class); + + public FWTag(){ + + } + + public FWTag(String string, String userid) { + this(string); + } + + public FWTag(String domain) { + this.fwTagName = domain; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + try { + this.userModifiedBy =XacmlAdminAuthorization.getUserId();; + } catch (Exception e) { + LOGGER.error("Exception caused While adding Modified by Role"+e); + PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FWTag", "Exception caused While adding Modified by Role"); + } + } + + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public String getFwTagName() { + return fwTagName; + } + + public void setFwTagName(String fwTagName) { + this.fwTagName = fwTagName; + } + + public String getTagValues() { + return tagValues; + } + + public void setTagValues(String tagValues) { + this.tagValues = tagValues; + } + + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FWTagPicker.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FWTagPicker.java new file mode 100644 index 000000000..129ad37df --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FWTagPicker.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.policy.rest.jpa; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.OrderBy; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openecomp.policy.common.logging.eelf.MessageCodes; +import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.rest.XacmlAdminAuthorization; + +@Entity +@Table(name = "FWTagPicker") +@NamedQuery(name = "FWTagPicker.findAll", query= "Select p from FWTagPicker p") +public class FWTagPicker implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "Id") + private int id; + + @Column(name="tagPickerName", nullable=false) + @OrderBy("asc") + private String tagPickerName; + + @Column(name="description", nullable=true, length=2048) + private String description; + + @Column(name="tags", nullable=true) + @OrderBy("asc") + private String tagValues; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="created_date", updatable=false) + private Date createdDate; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="modified_date", nullable=false) + private Date modifiedDate; + + @ManyToOne(optional = false) + @JoinColumn(name="created_by") + private UserInfo userCreatedBy; + + @ManyToOne(optional = false) + @JoinColumn(name="modified_by") + private UserInfo userModifiedBy; + + private static Log logger = LogFactory.getLog(FWTagPicker.class); + + public FWTagPicker(){ + + } + + public FWTagPicker(String string, String userid) { + this(string); + } + + public FWTagPicker(String domain) { + this.tagPickerName = domain; + } + + @PrePersist + public void prePersist() { + Date date = new Date(); + this.createdDate = date; + this.modifiedDate = date; + } + + @PreUpdate + public void preUpdate() { + this.modifiedDate = new Date(); + try { + this.userModifiedBy =XacmlAdminAuthorization.getUserId(); + } catch (Exception e) { + logger.error("Exception caused While adding Modified by Role"+e); + PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DescriptiveScope", "Exception caused While adding Modified by Role"); + } + } + + public int getId() { + return this.id; + } + public void setId(int id) { + this.id = id; + } + + public String getTagPickerName() { + return tagPickerName; + } + + public void setTagPickerName(String tagPickerName) { + this.tagPickerName = tagPickerName; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getTagValues() { + return tagValues; + } + + public void setTagValues(String tagValues) { + this.tagValues = tagValues; + } + + public Date getCreatedDate() { + return this.createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public UserInfo getUserCreatedBy() { + return userCreatedBy; + } + + public void setUserCreatedBy(UserInfo userCreatedBy) { + this.userCreatedBy = userCreatedBy; + } + + public UserInfo getUserModifiedBy() { + return userModifiedBy; + } + + public void setUserModifiedBy(UserInfo userModifiedBy) { + this.userModifiedBy = userModifiedBy; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FirewallDictionaryList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FirewallDictionaryList.java index 3c47de817..712172acb 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FirewallDictionaryList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/FirewallDictionaryList.java @@ -21,29 +21,15 @@ package org.openecomp.policy.rest.jpa; import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.openecomp.policy.rest.XacmlAdminAuthorization; - -import org.openecomp.policy.common.logging.eelf.MessageCodes; -import org.openecomp.policy.common.logging.eelf.PolicyLogger; @Entity @@ -145,15 +131,10 @@ public class FirewallDictionaryList implements Serializable { this.userModifiedBy = userModifiedBy; }*/ - private static Log logger = LogFactory.getLog(FirewallDictionaryList.class); - public FirewallDictionaryList() { } - private static final Log auditLogger = LogFactory - .getLog("auditLogger"); - public FirewallDictionaryList(String string, String userid) { this(domain); } @@ -175,8 +156,6 @@ public class FirewallDictionaryList implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role"); } auditLogger.debug("Updated Term Name: "+this.parentItemName+" by "+this.userModifiedBy); diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupEntity.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupEntity.java index b3897d0ee..405a5d458 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupEntity.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupEntity.java @@ -35,26 +35,22 @@ import java.io.Serializable; import java.util.Date; import java.util.List; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; -import javax.persistence.Lob; import javax.persistence.ManyToMany; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; -import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.persistence.UniqueConstraint; import javax.persistence.Version; import com.fasterxml.jackson.annotation.JsonManagedReference; @@ -80,7 +76,6 @@ public class GroupEntity implements Serializable { @Id @Column (name="groupKey", nullable=false) - //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqGroup") @GeneratedValue(strategy = GenerationType.AUTO) private long groupKey; @@ -94,9 +89,8 @@ public class GroupEntity implements Serializable { @Column(name="version") private int version; - @ManyToMany - @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey", referencedColumnName="groupKey")}, - inverseJoinColumns={@JoinColumn(name="policyId",referencedColumnName="policyId")}) + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey")}, inverseJoinColumns={@JoinColumn(name="policyId")}) @JsonManagedReference private List<PolicyEntity> policies; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupPolicyScopeList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupPolicyScopeList.java index c57d1475a..a8e052282 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupPolicyScopeList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupPolicyScopeList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupServiceList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupServiceList.java index b5fbd9355..d214e4694 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupServiceList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/GroupServiceList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceAttribute.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceAttribute.java new file mode 100644 index 000000000..e30379e1d --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceAttribute.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.jpa; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.OrderBy; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Table; + +@Entity +@Table(name="MicroServiceAttribute") +@NamedQuery(name="MicroServiceAttribute.findAll", query="SELECT e FROM MicroServiceAttribute e ") +public class MicroServiceAttribute implements Serializable { + private static final long serialVersionUID = 1L; + + private static String domain; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="name", nullable=false) + @OrderBy("asc") + private String name; + + @Column(name="value") + private String value ; + + @Column(name="modelName") + private String modelName; + + + public MicroServiceAttribute() { + + } + public MicroServiceAttribute(String string, String userid) { + this(domain); + + } + public MicroServiceAttribute(String domain) { + + } + + @PrePersist + public void prePersist() { + + } + @PreUpdate + public void preUpdate() { + } + + + public int getId() { + return this.id; + } + + public void setId(int id) { + this.id = id; + } + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + + } + public String getValue() { + return this.value ; + } + + public void setValue(String value ) { + this.value = value ; + } + public String getModelName() { + return modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + +}
\ No newline at end of file diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceConfigName.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceConfigName.java index 594cacf33..0a1034c77 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceConfigName.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceConfigName.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceLocation.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceLocation.java index 8532f81a1..a72f690ac 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceLocation.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceLocation.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceModels.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceModels.java index ca7460640..c1eb24058 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceModels.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/MicroServiceModels.java @@ -31,7 +31,6 @@ package org.openecomp.policy.rest.jpa; import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -48,10 +47,6 @@ import javax.persistence.Table; * * @version: 0.1 */ -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import org.openecomp.policy.rest.jpa.UserInfo; @Entity @@ -87,6 +82,12 @@ public class MicroServiceModels implements Serializable{ @Column (name="version", nullable=false, length=2000) private String version; + @Column (name="enumValues", nullable=false, length=2000) + private String enumValues; + + @Column (name="annotation", nullable=false, length=2000) + private String annotation; + public String getSub_attributes() { return sub_attributes; } @@ -169,4 +170,20 @@ public class MicroServiceModels implements Serializable{ public void setModelName(String modelName){ this.modelName = modelName; } + + public String getEnumValues() { + return enumValues; + } + + public void setEnumValues(String enumValues) { + this.enumValues = enumValues; + } + + public String getAnnotation() { + return annotation; + } + + public void setAnnotation(String annotation) { + this.annotation = annotation; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ObadviceExpression.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ObadviceExpression.java index 28957fa85..1908b9dc9 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ObadviceExpression.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ObadviceExpression.java @@ -28,14 +28,11 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; -import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.Table; -import org.openecomp.policy.rest.jpa.Attribute; - /** * The persistent class for the ObadviceExpressions database table. diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PEPOptions.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PEPOptions.java index 8b05e8ffc..ed520472c 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PEPOptions.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PEPOptions.java @@ -101,7 +101,7 @@ public class PEPOptions implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(PEPOptions.class); + private static Log LOGGER = LogFactory.getLog(PEPOptions.class); public PEPOptions(){ @@ -128,8 +128,7 @@ public class PEPOptions implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PEPOptions", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java index 8f75bef89..07f1b3bbc 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PIPConfiguration.java @@ -51,21 +51,16 @@ import javax.persistence.Transient; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - +import org.openecomp.policy.common.logging.eelf.MessageCodes; +import org.openecomp.policy.common.logging.eelf.PolicyLogger; import org.openecomp.policy.xacml.api.XACMLErrorConstants; + import com.att.research.xacml.api.pip.PIPException; import com.att.research.xacml.std.pip.engines.StdConfigurableEngine; -import com.att.research.xacml.std.pip.engines.csv.CSVEngine; -import com.att.research.xacml.std.pip.engines.csv.HyperCSVEngine; -import com.att.research.xacml.std.pip.engines.jdbc.JDBCEngine; -import com.att.research.xacml.std.pip.engines.ldap.LDAPEngine; import com.att.research.xacml.util.XACMLProperties; import com.google.common.base.Joiner; import com.google.common.base.Splitter; -import org.openecomp.policy.common.logging.eelf.MessageCodes; -import org.openecomp.policy.common.logging.eelf.PolicyLogger; - /** * The persistent class for the PIPConfiguration database table. @@ -358,15 +353,12 @@ public class PIPConfiguration implements Serializable { PIPConfiguration configuration; try { String user = "super-admin"; - //TODO - //String user = ((XacmlAdminUI)UI.getCurrent()).getUserid(); configuration = new PIPConfiguration(id, properties, user); configuration.setCreatedBy(user); configuration.setModifiedBy(user); configurations.add(configuration); } catch (PIPException e) { logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Import failed: " + e.getLocalizedMessage()); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Import failed"); } } @@ -385,7 +377,6 @@ public class PIPConfiguration implements Serializable { this.id = Integer.parseInt(id); } catch (NumberFormatException e) { logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Convert id to integer failed: " + id); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Convert id to integer failed"); } } @@ -397,30 +388,6 @@ public class PIPConfiguration implements Serializable { throw new PIPException("PIP Engine defined without a classname"); } // - // These classes we know for sure require resolvers. - // - //TODO: Commented out due to JPAUtils class & As of now we are not using PIP. So, it will not impact any Errors - /*if (this.classname.equals(JDBCEngine.class.getCanonicalName())) { - this.setRequiresResolvers(true); - this.setPiptype(JPAUtils.getPIPType(PIPType.TYPE_SQL)); - } else if (this.classname.equals(LDAPEngine.class.getCanonicalName())) { - this.setRequiresResolvers(true); - this.setPiptype(JPAUtils.getPIPType(PIPType.TYPE_LDAP)); - } else if (this.classname.equals(HyperCSVEngine.class.getCanonicalName())) { - this.setRequiresResolvers(true); - this.setPiptype(JPAUtils.getPIPType(PIPType.TYPE_HYPERCSV)); - } else if (this.classname.equals(CSVEngine.class.getCanonicalName())) { - this.setRequiresResolvers(true); - this.setPiptype(JPAUtils.getPIPType(PIPType.TYPE_CSV)); - } else { - // - // Assume it does not require resolvers for now, if we encounter - // one then we will change it. The user can always change it via the gui. - // - this.setRequiresResolvers(false); - this.setPiptype(JPAUtils.getPIPType(PIPType.TYPE_CUSTOM)); - }*/ - // // Go through each property // for (Object name : properties.keySet()) { @@ -450,8 +417,6 @@ public class PIPConfiguration implements Serializable { properties.getProperty(name.toString()), properties,"super-admin" ); - //TODO: replace with UserId - //((XacmlAdminUI)UI.getCurrent()).getUserid() for (PIPResolver resolver : resolvers) { this.addPipresolver(resolver); } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PdpEntity.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PdpEntity.java index 191dfde60..c7d666056 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PdpEntity.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PdpEntity.java @@ -29,21 +29,15 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.Index; import javax.persistence.JoinColumn; -import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; -import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.persistence.UniqueConstraint; -import javax.persistence.Version; /* * The Entity class to persist a policy object and its configuration data diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyEntity.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyEntity.java index 80869c225..7b938e461 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyEntity.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyEntity.java @@ -29,7 +29,6 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.NamedQueries; @@ -37,11 +36,9 @@ import javax.persistence.NamedQuery; import javax.persistence.OneToOne; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; -import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.persistence.UniqueConstraint; import javax.persistence.Version; import com.fasterxml.jackson.annotation.JsonBackReference; @@ -56,13 +53,7 @@ import com.fasterxml.jackson.annotation.JsonManagedReference; */ @Entity //Add a non-unique index and a constraint that says the combo of policyName and scopeId must be unique -@Table(name="PolicyEntity", indexes = {@Index(name="scope", columnList="scope", unique=false), - @Index(name="policyName", columnList="policyName", unique=false)}, - uniqueConstraints=@UniqueConstraint(columnNames={"policyName", "scope"})) - -//Using a sequence generator because the value is available as soon as the -//the object is persisted. That is, you don't have to flush/commit to the DB. -//@SequenceGenerator(name="seqPolicy", initialValue=1, allocationSize=1) +@Table(name="PolicyEntity") @NamedQueries({ @NamedQuery(name="PolicyEntity.findAll", query="SELECT e FROM PolicyEntity e "), @@ -76,7 +67,6 @@ public class PolicyEntity implements Serializable { private static final long serialVersionUID = 1L; @Id - //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqPolicy") @GeneratedValue(strategy = GenerationType.AUTO) @Column (name="policyId") @JsonBackReference @@ -102,12 +92,12 @@ public class PolicyEntity implements Serializable { private String policyData = "NoData"; @OneToOne(optional=true, orphanRemoval=true) - @JoinColumn(name="configurationDataId", referencedColumnName="configurationDataId") + @JoinColumn(name="configurationDataId") @JsonManagedReference private ConfigurationDataEntity configurationDataEntity; @OneToOne(optional=true, orphanRemoval=true) - @JoinColumn(name="actionBodyId", referencedColumnName="actionBodyId") + @JoinColumn(name="actionBodyId") @JsonManagedReference private ActionBodyEntity actionBodyEntity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyRoles.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyRoles.java index 71df02b99..ede5d1020 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyRoles.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyRoles.java @@ -56,14 +56,14 @@ public class PolicyRoles implements Serializable { @ManyToOne @JoinColumn(name="loginid") @OrderBy("asc") - private UserInfo loginid; + private UserInfo loginId; public UserInfo getLoginId() { - return loginid; + return loginId; } - public void setLoginId(UserInfo loginid) { - this.loginid = loginid; + public void setLoginId(UserInfo loginId) { + this.loginId = loginId; } @Column(name="scope", nullable=true, length=45) diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeClosedLoop.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeClosedLoop.java index 484851d7b..8315ed070 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeClosedLoop.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeClosedLoop.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeResource.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeResource.java index e126c4118..76eb40d3e 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeResource.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeResource.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeService.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeService.java index cc8c11383..820616988 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeService.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeService.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeType.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeType.java index d4ade7fe9..65fe6e5f7 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeType.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScopeType.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScore.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScore.java index cae9cfc6a..3cd84eb2d 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScore.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyScore.java @@ -20,7 +20,6 @@ package org.openecomp.policy.rest.jpa; import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -30,11 +29,7 @@ import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OrderBy; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyVersion.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyVersion.java index 73d39ad8e..4355693f3 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyVersion.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyVersion.java @@ -44,7 +44,8 @@ import javax.persistence.TemporalType; @NamedQueries({ @NamedQuery(name="PolicyVersion.findAll", query="SELECT p FROM PolicyVersion p"), @NamedQuery(name="PolicyVersion.deleteAll", query="DELETE FROM PolicyVersion WHERE 1=1"), - @NamedQuery(name="PolicyVersion.findByPolicyName", query="Select p from PolicyVersion p where p.policyName=:pname") + @NamedQuery(name="PolicyVersion.findByPolicyName", query="Select p from PolicyVersion p where p.policyName=:pname"), + @NamedQuery(name="PolicyVersion.findAllCount", query="SELECT COUNT(p) FROM PolicyVersion p") }) public class PolicyVersion implements Serializable { private static final long serialVersionUID = 1L; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PortList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PortList.java index 88ce58afc..7bc4cf46a 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PortList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PortList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity @Table(name="portlist") diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PREFIXLIST.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PrefixList.java index aac04795c..e94afd4f1 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PREFIXLIST.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PrefixList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,13 +33,11 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity -@Table(name="PREFIXLIST") -@NamedQuery(name="PREFIXLIST.findAll", query="SELECT e FROM PREFIXLIST e ") -public class PREFIXLIST implements Serializable { +@Table(name="PrefixList") +@NamedQuery(name="PrefixList.findAll", query="SELECT e FROM PrefixList e ") +public class PrefixList implements Serializable { private static final long serialVersionUID = 1L; private static String domain; @@ -64,14 +61,14 @@ public class PREFIXLIST implements Serializable { @Column(name="modified_date", nullable=false) private Date modifiedDate;*/ - public PREFIXLIST() { + public PrefixList() { } - public PREFIXLIST(String string, String userid) { + public PrefixList(String string, String userid) { this(domain); } - public PREFIXLIST(String domain) { + public PrefixList(String domain) { } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ProtocolList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ProtocolList.java index a450c2551..d7cba8ffe 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ProtocolList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ProtocolList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity @Table(name="protocollist") diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RemoteCatalogValues.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RemoteCatalogValues.java index c906c79cb..b2b4df75b 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RemoteCatalogValues.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RemoteCatalogValues.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RiskType.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RiskType.java index da18c744e..077138e1f 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RiskType.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RiskType.java @@ -41,14 +41,9 @@ import javax.persistence.TemporalType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.openecomp.policy.rest.XacmlAdminAuthorization; -import org.openecomp.policy.rest.jpa.UserInfo; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonManagedReference; - import org.openecomp.policy.common.logging.eelf.MessageCodes; import org.openecomp.policy.common.logging.eelf.PolicyLogger; +import org.openecomp.policy.rest.XacmlAdminAuthorization; @Entity @@ -103,7 +98,7 @@ public class RiskType implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(RiskType.class); + private static Log LOGGER = LogFactory.getLog(RiskType.class); public RiskType() { @@ -130,8 +125,7 @@ public class RiskType implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId(); } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "RiskType", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SecurityZone.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SecurityZone.java index 2fbd4486d..5de032f8f 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SecurityZone.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SecurityZone.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity @Table(name="securityzone") diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ServiceList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ServiceList.java index 9a72916b1..b3e473b1a 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ServiceList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ServiceList.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity @Table(name="servicegroup") diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SystemLogDB.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SystemLogDB.java index a86857aee..6fa91ee03 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SystemLogDB.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/SystemLogDB.java @@ -32,25 +32,16 @@ package org.openecomp.policy.rest.jpa; import java.io.Serializable; import java.util.Date; -import java.util.HashSet; -import java.util.Set; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; -import javax.persistence.OneToMany; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.persistence.Transient; - -import com.att.research.xacml.api.Identifier; /** * The persistent class for the system log database table. @@ -93,7 +84,6 @@ public class SystemLogDB implements Serializable { public SystemLogDB(int id, String system, String description, String remote, String type, String logtype) { - // TODO Auto-generated constructor stub this.id = id; this.system = system; this.description = description; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/TermList.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/TermList.java index ce94fb8d8..38bbf793a 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/TermList.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/TermList.java @@ -125,7 +125,7 @@ public class TermList implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(TermList.class); + private static Log LOGGER = LogFactory.getLog(TermList.class); public TermList() { @@ -155,8 +155,7 @@ public class TermList implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role"); } auditLogger.debug("Updated Term Name: "+this.termName+" by "+this.userModifiedBy); diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/UserInfo.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/UserInfo.java index 6f5982aa8..9dd771e6c 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/UserInfo.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/UserInfo.java @@ -40,7 +40,7 @@ public class UserInfo implements Serializable { private static final long serialVersionUID = 1L; @Id - @Column(name="loginId", nullable=false, length=45) + @Column(name="loginid", nullable=false, length=45) private String userLoginId; @Column(name = "name", nullable = false, unique = true) diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VMType.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VMType.java index a1adcd447..e7ae197fc 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VMType.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VMType.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VNFType.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VNFType.java index a2c19da31..693e27553 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VNFType.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VNFType.java @@ -99,7 +99,7 @@ public class VNFType implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(VNFType.class); + private static Log LOGGER = LogFactory.getLog(VNFType.class); public VNFType() { @@ -134,8 +134,7 @@ public class VNFType implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VNFType", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VSCLAction.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VSCLAction.java index 39d671f1d..7f42650a3 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VSCLAction.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VSCLAction.java @@ -98,7 +98,7 @@ public class VSCLAction implements Serializable { this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(VSCLAction.class); + private static Log LOGGER = LogFactory.getLog(VSCLAction.class); public VSCLAction() { @@ -125,8 +125,7 @@ public class VSCLAction implements Serializable { try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VSCLAction", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VarbindDictionary.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VarbindDictionary.java index 05e5710d7..1bb56a067 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VarbindDictionary.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/VarbindDictionary.java @@ -100,7 +100,7 @@ public class VarbindDictionary implements Serializable{ this.userModifiedBy = userModifiedBy; } - private static Log logger = LogFactory.getLog(VarbindDictionary.class); + private static Log LOGGER = LogFactory.getLog(VarbindDictionary.class); public VarbindDictionary() { @@ -127,8 +127,7 @@ public class VarbindDictionary implements Serializable{ try { this.userModifiedBy =XacmlAdminAuthorization.getUserId();; } catch (Exception e) { - logger.error("Exception caused While adding Modified by Role"+e); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Exception caused While adding Modified by Role"+e); PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VarbindDictionary", "Exception caused While adding Modified by Role"); } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Zone.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Zone.java index e1db124c3..30e02e06d 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Zone.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Zone.java @@ -22,7 +22,6 @@ package org.openecomp.policy.rest.jpa; /* */ import java.io.Serializable; -import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -34,8 +33,6 @@ import javax.persistence.OrderBy; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; @Entity @Table(name="zone") diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/package-info.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/package-info.java index d5b935077..4e77ba9e7 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/package-info.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/package-info.java @@ -18,10 +18,4 @@ * ============LICENSE_END========================================================= */ -/** - * - */ -/** - * - */ package org.openecomp.policy.rest.jpa; diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java index 45b5aefb8..c912374ef 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSAttributeObject.java @@ -21,7 +21,6 @@ package org.openecomp.policy.rest.util; import java.util.HashMap; -import java.util.List; import java.util.Map; public class MSAttributeObject { @@ -31,8 +30,9 @@ public class MSAttributeObject { private HashMap<String, String> refAttribute = new HashMap<String, String>(); private HashMap<String, String> subClass = new HashMap<String, String>(); private String dependency; - private List<String> enumType; - + private HashMap<String, String> enumType = new HashMap<String, String>(); + private HashMap<String, String> matchingSet = new HashMap<String, String>(); + private boolean policyTempalate; public Map<String, String> getRefAttribute() { return refAttribute; @@ -52,10 +52,10 @@ public class MSAttributeObject { public void setAttribute(HashMap<String, String> attribute) { this.attribute = attribute; } - public List<String> getEnumType() { + public HashMap<String, String> getEnumType() { return enumType; } - public void setEnumType(List<String> enumType) { + public void setEnumType(HashMap<String, String> enumType) { this.enumType = enumType; } public void addAttribute(String key, String value){ @@ -85,4 +85,25 @@ public class MSAttributeObject { public void setDependency(String dependency) { this.dependency = dependency; } -} + public void addSingleEnum(String key, String value){ + this.enumType.put(key, value); + } + public HashMap<String, String> getMatchingSet() { + return matchingSet; + } + public void setMatchingSet(HashMap<String, String> matchingSet) { + this.matchingSet = matchingSet; + } + public void addMatchingSet(String key, String value){ + this.matchingSet.put(key, value); + } + public void addMatchingSet(HashMap<String, String> matchingSet){ + this.matchingSet.putAll(matchingSet); + } + public boolean isPolicyTempalate() { + return policyTempalate; + } + public void setPolicyTempalate(boolean policyTempalate) { + this.policyTempalate = policyTempalate; + } +}
\ No newline at end of file diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java new file mode 100644 index 000000000..7276a19f8 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtils.java @@ -0,0 +1,701 @@ +/*- + * ============LICENSE_START======================================================= + * ECOMP-REST + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.policy.rest.util; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.EMap; +import org.eclipse.emf.common.util.Enumerator; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EEnumLiteral; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.impl.EAttributeImpl; +import org.eclipse.emf.ecore.impl.EEnumImpl; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.json.JSONObject; +import org.openecomp.policy.rest.XACMLRestProperties; + +import com.att.research.xacml.util.XACMLProperties; +import com.google.gson.Gson; + + +public class MSModelUtils { + + private static final Log logger = LogFactory.getLog(MSModelUtils.class); + + private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>(); + private HashMap<String, String> enumMap = new HashMap<String, String>(); + private HashMap<String, String> matchingClass = new HashMap<String, String>(); + private String configuration = "configuration"; + private String dictionary = "dictionary"; + private String ecomp = ""; + private String policy = ""; + private String eProxyURI = "eProxyURI:"; + + public MSModelUtils(String ecomp, String policy){ + this.ecomp = ecomp; + this.policy = policy; + } + + private enum ANNOTATION_TYPE{ + MATCHING, VALIDATION, DICTIONARY + }; + + public enum MODEL_TYPE { + XMI + }; + + + public HashMap<String, MSAttributeObject> processEpackage(String file, MODEL_TYPE model){ + if (model == MODEL_TYPE.XMI ){ + processXMIEpackage(file); + } + return classMap; + + } + + private void processXMIEpackage(String xmiFile){ + EPackage root = getEpackage(xmiFile); + TreeIterator<EObject> treeItr = root.eAllContents(); + String className = null; + String returnValue = null; + + // Pulling out dependency from file + while (treeItr.hasNext()) { + EObject obj = (EObject) treeItr.next(); + if (obj instanceof EClassifier) { + EClassifier eClassifier = (EClassifier) obj; + className = eClassifier.getName(); + + if (obj instanceof EEnum) { + enumMap.putAll(getEEnum(obj)); + }else if (obj instanceof EClass) { + String temp = getDependencyList(eClassifier, className).toString(); + returnValue = StringUtils.replaceEach(temp, new String[]{"[", "]"}, new String[]{"", ""}); + getAttributes(className, returnValue, root); + } + } + } + + if (!enumMap.isEmpty()){ + addEnumClassMap(); + } + if (!matchingClass.isEmpty()){ + CheckForMatchingClass(); + } + } + + private void CheckForMatchingClass() { + HashMap<String, String> tempAttribute = new HashMap<String, String>(); + + for (Entry<String, String> set : matchingClass.entrySet()){ + String key = set.getKey(); + if (classMap.containsKey(key)){ + Map<String, String> listAttributes = classMap.get(key).getAttribute(); + Map<String, String> listRef = classMap.get(key).getRefAttribute(); + for ( Entry<String, String> eSet : listAttributes.entrySet()){ + String key2 = eSet.getKey(); + tempAttribute.put(key2, "matching-true"); + } + for ( Entry<String, String> eSet : listRef.entrySet()){ + String key3 = eSet.getKey(); + tempAttribute.put(key3, "matching-true"); + } + + } + UpdateMatching(tempAttribute, key); + } + + } + + + + private void UpdateMatching(HashMap<String, String> tempAttribute, String key) { + Map<String, MSAttributeObject> newClass = null; + + newClass = classMap; + + for (Entry<String, MSAttributeObject> updateClass : newClass.entrySet()){ + HashMap<String, String> valueMap = updateClass.getValue().getMatchingSet(); + String keymap = updateClass.getKey(); + if (valueMap.containsKey(key)){ + HashMap<String, String> modifyMap = classMap.get(keymap).getMatchingSet(); + modifyMap.remove(key); + modifyMap.putAll(tempAttribute); + classMap.get(keymap).setMatchingSet(modifyMap); + } + + } + } + + private void addEnumClassMap() { + for (Entry<String, MSAttributeObject> value :classMap.entrySet()){ + value.getValue().setEnumType(enumMap); + } + } + + private EPackage getEpackage(String xmiFile) { + ResourceSet resSet = new ResourceSetImpl(); + Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; + Map<String, Object> m = reg.getExtensionToFactoryMap(); + m.put("xmi", new XMIResourceFactoryImpl()); + Resource resource = resSet.getResource(URI.createFileURI(xmiFile), true); + try { + resource.load(Collections.EMPTY_MAP); + } catch (IOException e) { + logger.error("Error loading Encore Resource for new Model"); + } + + EPackage root = (EPackage) resource.getContents().get(0); + + return root; + } + + private HashMap<String, String> getEEnum(EObject obj) { + List<String> valueList = new ArrayList<>(); + HashMap<String, String> returnMap = new HashMap<String, String>(); + EEnum eenum = (EEnum)obj; + + String name = eenum.getName(); + for (EEnumLiteral eEnumLiteral : eenum.getELiterals()) + { + Enumerator instance = eEnumLiteral.getInstance(); + String value = instance.getLiteral(); + valueList.add(value); + } + returnMap.put(name, valueList.toString()); + return returnMap; + } + + public void getAttributes(String className, String dependency, EPackage root) { + List<String> dpendList = null; + if (dependency!=null){ + dpendList = new ArrayList<String>(Arrays.asList(dependency.split(","))); + } + MSAttributeObject msAttributeObject = new MSAttributeObject(); + msAttributeObject.setClassName(className); + String extendClass = getSubTypes(root, className); + HashMap<String, String> returnRefList = getRefAttributeList(root, className, extendClass); + HashMap<String, String> returnAttributeList = getAttributeList(root, className, extendClass); + HashMap<String, String> returnSubList = getSubAttributeList(root, className, extendClass); + HashMap<String, String> returnAnnotation = getAnnotation(root, className, extendClass); + msAttributeObject.setAttribute(returnAttributeList); + msAttributeObject.setRefAttribute(returnRefList); + msAttributeObject.setSubClass(returnSubList); + msAttributeObject.setDependency(dpendList.toString()); + msAttributeObject.addMatchingSet(returnAnnotation); + msAttributeObject.setPolicyTempalate(isPolicyTemplate(root, className)); + + this.classMap.put(className, msAttributeObject); + } + + private HashMap<String, String> getAnnotation(EPackage root, String className, String extendClass) { + TreeIterator<EObject> treeItr = root.eAllContents(); + boolean requiredAttribute = false; + boolean requiredMatchAttribute = false; + HashMap<String, String> annotationSet = new HashMap<String, String>(); + String matching = null; + String range = null; + String dictionary = null; + + // Pulling out dependency from file + while (treeItr.hasNext()) { + EObject obj = treeItr.next(); + if (obj instanceof EClassifier) { + requiredAttribute = isRequiredAttribute(obj, className ); + requiredMatchAttribute = isRequiredAttribute(obj, extendClass ); + } + + if (requiredAttribute){ + if (obj instanceof EStructuralFeature) { + EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; + if (eStrucClassifier.getEAnnotations().size() != 0) { + matching = annotationValue(eStrucClassifier, ANNOTATION_TYPE.MATCHING, policy); + if (matching!=null){ + annotationSet.put(eStrucClassifier.getName(), matching); + } + range = annotationValue(eStrucClassifier, ANNOTATION_TYPE.VALIDATION, policy); + if (range!=null){ + annotationSet.put(eStrucClassifier.getName(), range); + } + dictionary = annotationValue(eStrucClassifier, ANNOTATION_TYPE.DICTIONARY, policy); + if (dictionary!=null){ + annotationSet.put(eStrucClassifier.getName(), dictionary); + } + } + } + } else if (requiredMatchAttribute){ + if (obj instanceof EStructuralFeature) { + EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; + if (eStrucClassifier.getEAnnotations().size() != 0) { + matching = annotationValue(eStrucClassifier, ANNOTATION_TYPE.MATCHING, policy); + if (matching!=null){ + if (obj instanceof EReference){ + EClass refType = ((EReference) obj).getEReferenceType(); + annotationSet.put(refType.getName(), matching); + matchingClass.put(refType.getName(), matching); + }else{ + annotationSet.put(eStrucClassifier.getName(), matching); + } + } + } + } + } + } + return annotationSet; + } + + private HashMap<String, String> getSubAttributeList(EPackage root, String className , String superClass) { + TreeIterator<EObject> treeItr = root.eAllContents(); + boolean requiredAttribute = false; + HashMap<String, String> subAttribute = new HashMap<String, String>(); + int rollingCount = 0; + int processClass = 0; + boolean annotation = false; + + // Pulling out dependency from file + while (treeItr.hasNext() && rollingCount < 2) { + + EObject obj = treeItr.next(); + if (obj instanceof EClassifier) { + if (isRequiredAttribute(obj, className ) || isRequiredAttribute(obj, superClass )){ + requiredAttribute = true; + }else { + requiredAttribute = false; + } + if (requiredAttribute){ + processClass++; + } + rollingCount = rollingCount+processClass; + } + + if (requiredAttribute) { + if (obj instanceof EStructuralFeature) { + EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; + if (eStrucClassifier.getEAnnotations().size() != 0) { + annotation = annotationTest(eStrucClassifier, configuration, ecomp); + if (annotation && obj instanceof EReference) { + EClass refType = ((EReference) obj).getEReferenceType(); + if(!refType.toString().contains(eProxyURI)){ + subAttribute.put(eStrucClassifier.getName(), refType.getName()); + } + } + } + } + } + } + return subAttribute; + } + + public String checkDefultValue(String defultValue) { + if (defultValue!=null){ + return ":defaultValue-"+ defultValue; + } + return ":defaultValue-NA"; + + } + + public String checkRequiredPattern(int upper, int lower) { + + String pattern = XACMLProperties.getProperty(XACMLRestProperties.PROP_XCORE_REQUIRED_PATTERN); + + if (pattern!=null){ + if (upper == Integer.parseInt(pattern.split(",")[1]) && lower==Integer.parseInt(pattern.split(",")[0])){ + return ":required-true"; + } + } + + return ":required-false"; + } + + public JSONObject buildJavaObject(HashMap<String, String> map, String attributeType){ + + JSONObject returnValue = new JSONObject(map); + + return returnValue; + + } + + public HashMap<String, String> getRefAttributeList(EPackage root, String className, String superClass){ + + TreeIterator<EObject> treeItr = root.eAllContents(); + boolean requiredAttribute = false; + HashMap<String, String> refAttribute = new HashMap<String, String>(); + int rollingCount = 0; + int processClass = 0; + boolean annotation = false; + // Pulling out dependency from file + while (treeItr.hasNext()) { + EObject obj = treeItr.next(); + if (obj instanceof EClassifier) { + if (isRequiredAttribute(obj, className ) || isRequiredAttribute(obj, superClass )){ + requiredAttribute = true; + }else { + requiredAttribute = false; + } + if (requiredAttribute){ + processClass++; + } + rollingCount = rollingCount+processClass; + } + + if (requiredAttribute) { + if (obj instanceof EStructuralFeature) { + EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; + if (eStrucClassifier.getEAnnotations().size() != 0) { + annotation = annotationTest(eStrucClassifier, configuration, ecomp); + if ( annotation && obj instanceof EReference) { + EClass refType = ((EReference) obj).getEReferenceType(); + if(refType.toString().contains(eProxyURI)){ + String one = refType.toString().split(eProxyURI)[1]; + String refValue = StringUtils.replaceEach(one.split("#")[1], new String[]{"//", ")"}, new String[]{"", ""}); + refAttribute.put(eStrucClassifier.getName(), refValue); + } else { + String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); + refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); + } + } else if (annotation && obj instanceof EAttributeImpl){ + EClassifier refType = ((EAttributeImpl) obj).getEType(); + if (refType instanceof EEnumImpl){ + String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); + refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); } + } + } + } + } + } + return refAttribute; + } + + private boolean annotationTest(EStructuralFeature eStrucClassifier, String annotation, String type) { + String annotationType = null; + EAnnotation eAnnotation = null; + String ecompType = null; + String ecompValue = null; + + EList<EAnnotation> value = eStrucClassifier.getEAnnotations(); + + for (int i = 0; i < value.size(); i++){ + annotationType = value.get(i).getSource(); + eAnnotation = eStrucClassifier.getEAnnotations().get(i); + ecompType = eAnnotation.getDetails().get(0).getValue(); + ecompValue = eAnnotation.getDetails().get(0).getKey(); + if (annotationType.contains(type) && ecompType.contains(annotation)){ + return true; + } else if (annotationType.contains(type) && ecompValue.contains(annotation)){ + return true; + } + } + + return false; + } + + + private String annotationValue(EStructuralFeature eStrucClassifier, ANNOTATION_TYPE annotation, String type) { + String annotationType = null; + EAnnotation eAnnotation = null; + String ecompType = null; + String ecompValue = null; + + EList<EAnnotation> value = eStrucClassifier.getEAnnotations(); + + for (int i = 0; i < value.size(); i++){ + annotationType = value.get(i).getSource(); + eAnnotation = eStrucClassifier.getEAnnotations().get(i); + ecompType = eAnnotation.getDetails().get(0).getKey(); + if (annotationType.contains(type) && ecompType.compareToIgnoreCase(annotation.toString())==0){ + ecompValue = eAnnotation.getDetails().get(0).getValue(); + if (annotation == ANNOTATION_TYPE.VALIDATION){ + return ecompValue; + } else { + return ecompType + "-" + ecompValue; + } + } + } + + return ecompValue; + } + public boolean isRequiredAttribute(EObject obj, String className){ + EClassifier eClassifier = (EClassifier) obj; + String workingClass = eClassifier.getName(); + workingClass.trim(); + if (workingClass.equalsIgnoreCase(className)){ + return true; + } + + return false; + } + + private boolean isPolicyTemplate(EPackage root, String className){ + + for (EClassifier classifier : root.getEClassifiers()){ + if (classifier instanceof EClass) { + EClass eClass = (EClass)classifier; + if (eClass.getName().contentEquals(className)){ + EList<EAnnotation> value = eClass.getEAnnotations(); + for (EAnnotation workingValue : value){ + EMap<String, String> keyMap = workingValue.getDetails(); + if (keyMap.containsKey("policyTemplate")){ + return true; + } + } + } + } + } + return false; + } + private String getSubTypes(EPackage root, String className) { + String returnSubTypes = null; + for (EClassifier classifier : root.getEClassifiers()){ + if (classifier instanceof EClass) { + EClass eClass = (EClass)classifier; + + for (EClass eSuperType : eClass.getEAllSuperTypes()) + { + if (eClass.getName().contentEquals(className)){ + returnSubTypes = eSuperType.getName(); + } + } + } + } + return returnSubTypes; + } + + public HashMap<String, String> getAttributeList(EPackage root, String className, String superClass){ + + TreeIterator<EObject> treeItr = root.eAllContents(); + boolean requiredAttribute = false; + HashMap<String, String> refAttribute = new HashMap<String, String>(); + boolean annotation = false; + boolean dictionaryTest = false; + String defaultValue = null; + String eType = null; + + // Pulling out dependency from file + while (treeItr.hasNext()) { + EObject obj = treeItr.next(); + if (obj instanceof EClassifier) { + if (isRequiredAttribute(obj, className ) || isRequiredAttribute(obj, superClass )){ + requiredAttribute = true; + }else { + requiredAttribute = false; + } + + } + + if (requiredAttribute){ + if (obj instanceof EStructuralFeature) { + EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; + if (eStrucClassifier.getEAnnotations().size() != 0) { + annotation = annotationTest(eStrucClassifier, configuration, ecomp); + dictionaryTest = annotationTest(eStrucClassifier, dictionary, policy); + EClassifier refType = ((EStructuralFeature) obj).getEType(); + if (annotation && !(obj instanceof EReference) && !(refType instanceof EEnumImpl)) { + String name = eStrucClassifier.getName(); + if (dictionaryTest){ + eType = annotationValue(eStrucClassifier, ANNOTATION_TYPE.DICTIONARY, policy); + }else { + eType = eStrucClassifier.getEType().getInstanceClassName(); + } + defaultValue = checkDefultValue(((EStructuralFeature) obj).getDefaultValueLiteral()); + + String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); + String required = checkRequiredPattern(((EStructuralFeature) obj).getUpperBound(), ((EStructuralFeature) obj).getLowerBound()); + String attributeValue = eType + defaultValue + required + array; + refAttribute.put(name, attributeValue); + } + } + } + } + } + return refAttribute; + + } + + public String arrayCheck(int upperBound) { + + if (upperBound == -1){ + return ":MANY-true"; + } + + return ":MANY-false"; + } + + public List<String> getDependencyList(EClassifier eClassifier, String className){ + List<String> returnValue = new ArrayList<>();; + EList<EClass> somelist = ((EClass) eClassifier).getEAllSuperTypes(); + if (somelist.isEmpty()){ + return returnValue; + } + for(EClass depend: somelist){ + if (depend.toString().contains(eProxyURI)){ + String one = depend.toString().split(eProxyURI)[1]; + String value = StringUtils.replaceEach(one.split("#")[1], new String[]{"//", ")"}, new String[]{"", ""}); + returnValue.add(value); + } + } + + return returnValue; + } + + public Map<String, String> buildSubList(HashMap<String, String> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className){ + Map<String, String> missingValues = new HashMap<String, String>(); + Map<String, String> workingMap = new HashMap<String, String>(); + boolean enumType; + + for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){ + String value = map.getValue().split(":")[0]; + if (value!=null){ + classMap.get(className).getEnumType(); + enumType = classMap.get(className).getEnumType().containsKey(value); + if (!enumType){ + workingMap = classMap.get(value).getRefAttribute(); + for ( Entry<String, String> subMab : workingMap.entrySet()){ + String value2 = subMab.getValue().split(":")[0]; + if (!subClassAttributes.containsValue(value2)){ + missingValues.put(subMab.getKey(), subMab.getValue()); + } + } + + } + } + } + + return missingValues; + } + + public Map<String, HashMap<String, String>> recursiveReference(HashMap<String, MSAttributeObject> classMap, String className){ + + Map<String, HashMap<String, String>> returnObject = new HashMap<String, HashMap<String, String>>(); + HashMap<String, String> returnClass = getRefclass(classMap, className); + returnObject.put(className, returnClass); + for (Entry<String, String> reAttribute :returnClass.entrySet()){ + if (reAttribute.getValue().split(":")[1].contains("MANY")){ + if (classMap.get(reAttribute.getValue().split(":")[0]) != null){ + returnObject.putAll(recursiveReference(classMap, reAttribute.getValue().split(":")[0])); + } + } + + } + + return returnObject; + + } + + public String createJson(HashMap<String, String> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className) { + boolean enumType; + Map<String, HashMap<String, String>> myObject = new HashMap<String, HashMap<String, String>>(); + for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){ + String value = map.getValue().split(":")[0]; + if (value!=null){ + enumType = classMap.get(className).getEnumType().containsKey(value); + if (!enumType){ + if (map.getValue().split(":")[1].contains("MANY")){ + Map<String, HashMap<String, String>> testRecursive = recursiveReference(classMap, map.getValue().split(":")[0] ); + myObject.putAll(testRecursive); + } + } + } + } + + Gson gson = new Gson(); + String json = gson.toJson(myObject); + + return json; + } + + public HashMap<String, String> getRefclass(HashMap<String, MSAttributeObject> classMap, String className){ + HashMap<String, String> missingValues = new HashMap<String, String>(); + + if (classMap.get(className).getAttribute()!=null || !classMap.get(className).getAttribute().isEmpty()){ + missingValues.putAll(classMap.get(className).getAttribute()); + } + + if (classMap.get(className).getRefAttribute()!=null || !classMap.get(className).getRefAttribute().isEmpty()){ + missingValues.putAll(classMap.get(className).getRefAttribute()); + } + + return missingValues; + } + + public String createSubAttributes(ArrayList<String> dependency, HashMap<String, MSAttributeObject> classMap, String modelName) { + + HashMap <String, String> workingMap = new HashMap<String,String>(); + MSAttributeObject tempObject = new MSAttributeObject(); + if (dependency!=null){ + if (dependency.size()==0){ + return "{}"; + } + dependency.add(modelName); + for (String element: dependency){ + tempObject = classMap.get(element); + if (tempObject!=null){ + workingMap.putAll(classMap.get(element).getSubClass()); + } + } + } + + String returnValue = createJson(workingMap, classMap, modelName); + return returnValue; + } + + public ArrayList<String> getFullDependencyList(ArrayList<String> dependency, HashMap<String,MSAttributeObject > classMap) { + ArrayList<String> returnList = new ArrayList<String>(); + ArrayList<String> workingList = new ArrayList<String>(); + returnList.addAll(dependency); + for (String element : dependency ){ + if (classMap.containsKey(element)){ + MSAttributeObject value = classMap.get(element); + String rawValue = StringUtils.replaceEach(value.getDependency(), new String[]{"[", "]"}, new String[]{"", ""}); + workingList = new ArrayList<String>(Arrays.asList(rawValue.split(","))); + for(String depend : workingList){ + if (!returnList.contains(depend) && !depend.isEmpty()){ + returnList.add(depend.trim()); + } + } + } + } + + return returnList; + } +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtitils.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtitils.java deleted file mode 100644 index dd015be68..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/MSModelUtitils.java +++ /dev/null @@ -1,450 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.policy.rest.util; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EEnum; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; - -import org.json.JSONObject; -import org.openecomp.policy.rest.XACMLRestProperties; - -import com.att.research.xacml.util.XACMLProperties; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; - - -public class MSModelUtitils { - - private static final Log logger = LogFactory.getLog(MSModelUtitils.class); - - private HashMap<String,MSAttributeObject > classMap = new HashMap<String,MSAttributeObject>(); - - public HashMap<String, MSAttributeObject> processEpackage(String xmiFile){ - EPackage root = getEpackage(xmiFile); - TreeIterator<EObject> treeItr = root.eAllContents(); - String className = null; - String returnValue = null; - - // Pulling out dependency from file - while (treeItr.hasNext()) { - EObject obj = (EObject) treeItr.next(); - if (obj instanceof EClassifier) { - EClassifier eClassifier = (EClassifier) obj; - className = eClassifier.getName(); - - if (obj instanceof EEnum) { - // getEEnum(); - returnValue = null; - }else if (obj instanceof EClass) { - String temp = getDependencyList(eClassifier, className).toString(); - returnValue = StringUtils.replaceEach(temp, new String[]{"[", "]"}, new String[]{"", ""}); - getAttributes(className, returnValue, root); - } - } - } - return classMap; - } - - private EPackage getEpackage(String xmiFile) { - ResourceSet resSet = new ResourceSetImpl(); - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - Map<String, Object> m = reg.getExtensionToFactoryMap(); - m.put("xmi", new XMIResourceFactoryImpl()); - Resource resource = resSet.getResource(URI.createFileURI(xmiFile), true); - try { - resource.load(Collections.EMPTY_MAP); - } catch (IOException e) { - logger.error("Error loading Encore Resource for new Model"); - } - - EPackage root = (EPackage) resource.getContents().get(0); - - return root; - } - - private void getEEnum() { - - } - - public void getAttributes(String className, String dependency, EPackage root) { - List<String> dpendList = null; - if (dependency!=null){ - dpendList = new ArrayList<String>(Arrays.asList(dependency.split(","))); - } - MSAttributeObject msAttributeObject = new MSAttributeObject(); - msAttributeObject.setClassName(className); - HashMap<String, String> returnRefList = getRefAttributeList(root, className); - HashMap<String, String> returnAttributeList = getAttributeList(root, className); - HashMap<String, String> returnSubList = getSubAttributeList(root, className); - msAttributeObject.setAttribute(returnAttributeList); - msAttributeObject.setRefAttribute(returnRefList); - msAttributeObject.setSubClass(returnSubList); - msAttributeObject.setDependency(dpendList.toString()); - this.classMap.put(className, msAttributeObject); - } - - private HashMap<String, String> getSubAttributeList(EPackage root, String className) { - //EPackage root = (EPackage) resource.getContents().get(0); - TreeIterator<EObject> treeItr = root.eAllContents(); - boolean requiredAttribute = false; - HashMap<String, String> subAttribute = new HashMap<String, String>(); - int rollingCount = 0; - int processClass = 0; - boolean annotation = false; - - // Pulling out dependency from file - while (treeItr.hasNext() && rollingCount < 2) { - - EObject obj = treeItr.next(); - if (obj instanceof EClassifier) { - requiredAttribute = isRequiredAttribute(obj, className); - if (requiredAttribute){ - processClass++; - } - rollingCount = rollingCount+processClass; - } - - if (requiredAttribute) { - if (obj instanceof EStructuralFeature) { - EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; - if (eStrucClassifier.getEAnnotations().size() != 0) { - annotation = testAnnotation(eStrucClassifier); - if (annotation && obj instanceof EReference) { - EClass refType = ((EReference) obj).getEReferenceType(); - // String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - if(!refType.toString().contains("eProxyURI:")){ - subAttribute.put(eStrucClassifier.getName(), refType.getName()); - } - } - } - } - } - } - return subAttribute; - } - - public String checkDefultValue(String defultValue) { - if (defultValue!=null){ - return ":defaultValue-"+ defultValue; - } - return ":defaultValue-NA"; - - } - - public String checkRequiredPattern(int upper, int lower) { - String pattern = XACMLProperties.getProperty(XACMLRestProperties.PROP_XCORE_REQUIRED_PATTERN); - - if (pattern!=null){ - if (upper == Integer.parseInt(pattern.split(",")[1]) && lower==Integer.parseInt(pattern.split(",")[0])){ - return ":required-true"; - } - } - - return ":required-false"; - } - - public JSONObject buildJavaObject(HashMap<String, String> map, String attributeType){ - - JSONObject returnValue = new JSONObject(map); - - return returnValue; - - } - - public HashMap<String, String> getRefAttributeList(EPackage root, String className){ - - TreeIterator<EObject> treeItr = root.eAllContents(); - boolean requiredAttribute = false; - HashMap<String, String> refAttribute = new HashMap<String, String>(); - int rollingCount = 0; - int processClass = 0; - boolean annotation = false; - - // Pulling out dependency from file - while (treeItr.hasNext()) { - EObject obj = treeItr.next(); - if (obj instanceof EClassifier) { - requiredAttribute = isRequiredAttribute(obj, className); - if (requiredAttribute){ - processClass++; - } - rollingCount = rollingCount+processClass; - } - - if (requiredAttribute) { - if (obj instanceof EStructuralFeature) { - EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; - if (eStrucClassifier.getEAnnotations().size() != 0) { - annotation = testAnnotation(eStrucClassifier); - if ( annotation && obj instanceof EReference) { - EClass refType = ((EReference) obj).getEReferenceType(); - if(refType.toString().contains("eProxyURI:")){ - String one = refType.toString().split("eProxyURI:")[1]; - String refValue = StringUtils.replaceEach(one.split("#")[1], new String[]{"//", ")"}, new String[]{"", ""}); - refAttribute.put(eStrucClassifier.getName(), refValue); - } else { - String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - if (array.contains("false")){ - array = ""; - } - refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); - } - } - } - } - } - } - return refAttribute; - } - - private boolean testAnnotation(EStructuralFeature eStrucClassifier) { - String annotationType = null; - EAnnotation eAnnotation = null; - String ecompType = null; - - EList<EAnnotation> value = eStrucClassifier.getEAnnotations(); - - for (int i = 0; i < value.size(); i++){ - annotationType = value.get(i).getSource(); - eAnnotation = eStrucClassifier.getEAnnotations().get(i); - ecompType = eAnnotation.getDetails().get(0).getValue(); - if (annotationType.contains("http://localhost.com") && ecompType.contains("configuration")){ - return true; - } - } - - return false; - } - - public boolean isRequiredAttribute(EObject obj, String className){ - EClassifier eClassifier = (EClassifier) obj; - String workingClass = eClassifier.getName(); - workingClass.trim(); - if (workingClass.equalsIgnoreCase(className)){ - return true; - } - - return false; - } - - public HashMap<String, String> getAttributeList(EPackage root, String className){ - - TreeIterator<EObject> treeItr = root.eAllContents(); - boolean reference = false; - boolean requiredAttribute = false; - HashMap<String, String> refAttribute = new HashMap<String, String>(); - String workingClass = null; - boolean annotation = false; - - // Pulling out dependency from file - while (treeItr.hasNext()) { - reference = false; - EObject obj = treeItr.next(); - if (obj instanceof EClassifier) { - requiredAttribute = isRequiredAttribute(obj, className ); - } - - if (requiredAttribute){ - if (obj instanceof EStructuralFeature) { - EStructuralFeature eStrucClassifier = (EStructuralFeature) obj; - if (eStrucClassifier.getEAnnotations().size() != 0) { - annotation = testAnnotation(eStrucClassifier); - if (annotation && !(obj instanceof EReference)) { - String name = eStrucClassifier.getName(); - String defaultValue = checkDefultValue(((EStructuralFeature) obj).getDefaultValueLiteral()); - String eType = eStrucClassifier.getEType().getInstanceClassName(); - String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - String required = checkRequiredPattern(((EStructuralFeature) obj).getUpperBound(), ((EStructuralFeature) obj).getLowerBound()); - String attributeValue = eType + defaultValue + required + array; - refAttribute.put(name, attributeValue); - } - } - } - } - } - return refAttribute; - - } - - public String arrayCheck(int upperBound) { - - if (upperBound == -1){ - return ":MANY-true"; - } - - return ":MANY-false"; - } - - public List<String> getDependencyList(EClassifier eClassifier, String className){ - List<String> returnValue = new ArrayList<>();; - EList<EClass> somelist = ((EClass) eClassifier).getEAllSuperTypes(); - if (somelist.isEmpty()){ - return returnValue; - } - for(EClass depend: somelist){ - if (depend.toString().contains("eProxyURI:")){ - String one = depend.toString().split("eProxyURI:")[1]; - String value = StringUtils.replaceEach(one.split("#")[1], new String[]{"//", ")"}, new String[]{"", ""}); - returnValue.add(value); - } - } - - return returnValue; - } - - public String createJson(HashMap<String, String> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className) { - String json = ""; - JSONObject jsonObj; - - jsonObj = new JSONObject(); - - Map<String, String> missingValues = new HashMap<String, String>(); - Map<String, String> workingMap = new HashMap<String, String>(); - - for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){ - String value = map.getValue().split(":")[0]; - if (value!=null){ - workingMap = classMap.get(value).getRefAttribute(); - for ( Entry<String, String> subMab : workingMap.entrySet()){ - String value2 = subMab.getValue().split(":")[0]; - if (!subClassAttributes.containsValue(value2)){ - missingValues.put(subMab.getKey(), subMab.getValue()); - classMap.get(value).addAttribute(subMab.getKey(), subMab.getValue()); - } - } - - } - } - - if (!missingValues.isEmpty()){ - for (Entry<String, String> addValue : missingValues.entrySet()){ - subClassAttributes.put(addValue.getKey(), addValue.getValue().split(":")[0]); - } - } - - for ( Map.Entry<String, String> map : subClassAttributes.entrySet()){ - jsonObj.put(map.getValue().split(":")[0], classMap.get(map.getValue().split(":")[0]).getAttribute()); - } - - if (logger.isDebugEnabled()) { - logger.debug("Json value: " + jsonObj); - } - - return jsonObj.toString(); - } - - public String createSubAttributes(ArrayList<String> dependency, HashMap<String, MSAttributeObject> classMap, String modelName) { - - HashMap <String, String> workingMap = new HashMap<String,String>(); - MSAttributeObject tempObject = new MSAttributeObject(); - HashMap <String, String> refAttribute = new HashMap<String,String>(); - HashMap <String, String> workingSubMap = new HashMap<String,String>(); - Map<String, String> tempPefAttribute = null; - LinkedList linkedList = new LinkedList(); - String addedValue = null; - - boolean addingValues = false; - - if (dependency!=null){ - if (dependency.size()==0){ - return "{}"; - } - dependency.add(modelName); - for (String element: dependency){ - tempObject = classMap.get(element); - if (tempObject!=null){ - workingMap.putAll(classMap.get(element).getSubClass()); - // workingSubMap = CheckForSecondSubClass(classMap.get(element).getSubClass(), classMap); - // if (workingSubMap!=null){ - // workingMap.putAll(workingSubMap); - // } - } - } - } - - String returnValue = createJson(workingMap, classMap, modelName); - return returnValue; - } - - private HashMap<String, String> CheckForSecondSubClass(HashMap<String, String> subClass, HashMap<String, MSAttributeObject> mainMap) { - MSAttributeObject tempObject = new MSAttributeObject(); - HashMap<String, String> subClassValue = new HashMap<String,String>(); - - for (Entry<String, String> classSet : subClass.entrySet()){ - String key = classSet.getKey(); - String value = classSet.getValue(); - tempObject = mainMap.get(value); - subClassValue = tempObject.getSubClass(); - if (subClassValue!=null){ - return subClassValue; - } - } - return null; - - } - - public ArrayList<String> getFullDependencyList(ArrayList<String> dependency, HashMap<String,MSAttributeObject > classMap) { - ArrayList<String> returnList = new ArrayList<String>(); - ArrayList<String> workingList = new ArrayList<String>(); - int i = 0; - MSAttributeObject newDepend = null; - returnList.addAll(dependency); - for (String element : dependency ){ - if (classMap.containsKey(element)){ - MSAttributeObject value = classMap.get(element); - String rawValue = StringUtils.replaceEach(value.getDependency(), new String[]{"[", "]"}, new String[]{"", ""}); - workingList = new ArrayList<String>(Arrays.asList(rawValue.split(","))); - for(String depend : workingList){ - if (!returnList.contains(depend) && !depend.isEmpty()){ - returnList.add(depend.trim()); - } - } - } - } - - return returnList; - } -} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/ModelObject.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/ModelObject.java deleted file mode 100644 index bc7fa9f2d..000000000 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/ModelObject.java +++ /dev/null @@ -1,157 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - - -package org.openecomp.policy.rest.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; - -public class ModelObject { - private String name; - private String parent; - private List<String> attibutes = new ArrayList<String>(); - private List<String> arrays = new ArrayList<String>(); - private List<Integer> integers = new ArrayList<Integer>(); - private List<ModelObject> subObjects = new ArrayList<ModelObject>(); - private HashMap<String, LinkedList<ModelObject>> subObjectList = new HashMap<String, LinkedList<ModelObject>>(); - private HashMap<String, TextField> attribute = new HashMap<String, TextField>(); - private Map<String, LinkedList<TextField>> arrayTextList = new HashMap<String, LinkedList<TextField>>(); - private Map<String, VerticalLayout> textFieldLayout = new HashMap<String, VerticalLayout>(); - - private boolean many = false; - - public Map<String, LinkedList<TextField>> getArrayTextList() { - return arrayTextList; - } - public void setArrayTextList(Map<String, LinkedList<TextField>> arrayTextList) { - this.arrayTextList = arrayTextList; - } - public void addArrayTextList(String name, TextField textField ){ - LinkedList<TextField> list = new LinkedList<TextField>(); - if (getArrayTextList().get(name) != null){ - list = getArrayTextList().get(name); - } - - list.push(textField); - this.arrayTextList.put(name, list); - } - public void removeLastTextList(String name){ - LinkedList<TextField> list = getArrayTextList().get(name); - - list.pop(); - this.arrayTextList.put(name, list); - } - public HashMap<String, TextField> getAttribute() { - return attribute; - } - public void setAttribute(HashMap<String, TextField> attribute) { - this.attribute = attribute; - } - public void addAttribute(String name, TextField textField){ - this.attribute.put(name, textField); - } - public List<String> getAttibutes() { - return attibutes; - } - public void setAttibutes(List<String> attibutes) { - this.attibutes = attibutes; - } - public List<String> getArrays() { - return arrays; - } - public void setArrays(List<String> arrays) { - this.arrays = arrays; - } - public List<Integer> getIntegers() { - return integers; - } - public void setIntegers(List<Integer> integers) { - this.integers = integers; - } - public List<ModelObject> getSubObjects() { - return subObjects; - } - public void setSubObjects(List<ModelObject> subObjects) { - this.subObjects = subObjects; - } - public void addSubObject(ModelObject subObjects ){ - this.subObjects.add(subObjects); - } - public void addAttributes(String attibutes){ - this.attibutes.add(attibutes); - } - public void addArrays(String arrays){ - this.arrays.add(arrays); - } - public void addIntegers(Integer integers){ - this.integers.add(integers); - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public boolean isMany() { - return many; - } - public void setMany(boolean many) { - this.many = many; - } - public String getParent() { - return parent; - } - public void setParent(String parent) { - this.parent = parent; - } - public HashMap<String, LinkedList<ModelObject>> getSubObjectList() { - return subObjectList; - } - public void setSubObjectList(HashMap<String, LinkedList<ModelObject>> subObjectList) { - this.subObjectList = subObjectList; - } - public void addSubObjectList(String name, ModelObject object) { - LinkedList<ModelObject> list = new LinkedList<ModelObject>(); - if (subObjectList.get(name) != null){ - list = subObjectList.get(name); - } - - list.push(object); - - this.subObjectList.put(name, list); - } - public Map<String, VerticalLayout> getTextFieldLayout() { - return textFieldLayout; - } - public void setTextFieldLayout(Map<String, VerticalLayout> textFieldLayout) { - this.textFieldLayout = textFieldLayout; - } - public void addTextFieldLayout(String name, VerticalLayout vLayout){ - this.textFieldLayout.put(name, vLayout); - } - -} -*/ diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java index c2f4ff2c6..ef1eecf27 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java @@ -38,7 +38,7 @@ import org.openecomp.policy.common.logging.eelf.PolicyLogger; public class Webapps { private static String actionHome = null; private static String configHome = null; - private static Log logger = LogFactory.getLog(Webapps.class); + private static Log LOGGER = LogFactory.getLog(Webapps.class); private Webapps() { } @@ -66,8 +66,7 @@ public class Webapps { Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS)); //Sanity Check if (webappsPath == null) { - logger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS); - // TODO:EELF Cleanup - Remove logger + LOGGER.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS); PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS); throw new Exception("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS); } @@ -88,9 +87,8 @@ public class Webapps { try { Files.createDirectories(webappsPathConfig); } catch (IOException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: " + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: " + webappsPathConfig.toAbsolutePath().toString(), e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Webapps", "Failed to create config directory"); } } @@ -99,9 +97,8 @@ public class Webapps { try { Files.createDirectories(webappsPathAction); } catch (IOException e) { - logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: " + LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: " + webappsPathAction.toAbsolutePath().toString(), e); - // TODO:EELF Cleanup - Remove logger PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Webapps", "Failed to create config directory"); } } |