From dda032f8bb161d54eb1f59de2b4a3efb774fc4d1 Mon Sep 17 00:00:00 2001 From: "ITSERVICES\\rb7147" Date: Mon, 8 May 2017 22:20:44 -0400 Subject: Policy 1707 Second commit Change-Id: I18f5b142238733d17280cf17c3d1dd28204d34e9 Signed-off-by: ITSERVICES\rb7147 --- .../policy/rest/adapter/PolicyRestAdapter.java | 15 +++++ .../org/openecomp/policy/rest/adapter/Tags.java | 7 +++ .../openecomp/policy/rest/adapter/YAMLParams.java | 67 ++++++++++++++++++++++ .../org/openecomp/policy/rest/jpa/FWTagPicker.java | 11 ++++ .../policy/rest/jpa/PolicyGroupEntity.java | 60 +++++++++++++++++++ .../policy/rest/util/MSAttributeObject.java | 8 +-- .../openecomp/policy/rest/util/MSModelUtils.java | 10 ++-- 7 files changed, 169 insertions(+), 9 deletions(-) create mode 100644 ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/YAMLParams.java create mode 100644 ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyGroupEntity.java (limited to 'ECOMP-REST/src') 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 index c823ec6ab..2cfacab85 100644 --- 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 @@ -31,6 +31,14 @@ import org.openecomp.policy.rest.jpa.EcompName; public class PolicyRestAdapter { + /* + * + * Note : Make Sure if any variables are added in PolicyRestAdapter.java, add them to PolicyElasticData.java file + * + * + * */ + + //Common private Object data; private String policyName = null; @@ -117,6 +125,7 @@ public class PolicyRestAdapter { private String actionDictType = null; private String actionDictUrl = null; private String actionDictMethod = null; + private YAMLParams yamlparams; //MicroSerice private String serviceType = null; @@ -824,4 +833,10 @@ public class PolicyRestAdapter { public void setExistingCLName(String existingCLName) { this.existingCLName = existingCLName; } + public YAMLParams getYamlparams() { + return yamlparams; + } + public void setYamlparams(YAMLParams yamlparams) { + this.yamlparams = yamlparams; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Tags.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Tags.java index 8fec46482..43bff884c 100644 --- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Tags.java +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/Tags.java @@ -28,6 +28,7 @@ public class Tags { String ruleName; List tags; String tagPickerName; + String networkRole; public String getRuleName() { return ruleName; @@ -48,5 +49,11 @@ public class Tags { public void setTagPickerName(String tagPickerName) { this.tagPickerName = tagPickerName; } + public String getNetworkRole() { + return networkRole; + } + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/YAMLParams.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/YAMLParams.java new file mode 100644 index 000000000..adcce2633 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/YAMLParams.java @@ -0,0 +1,67 @@ +/*- + * ============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 YAMLParams { + private String actor; + private String recipe; + private String limit; + private String timeWindow; + private String guardActiveStart; + private String guardActiveEnd; + + public String getActor() { + return actor; + } + public void setActor(String actor) { + this.actor = actor; + } + public String getRecipe() { + return recipe; + } + public void setRecipe(String recipe) { + this.recipe = recipe; + } + public String getLimit() { + return limit; + } + public void setLimit(String limit) { + this.limit = limit; + } + public String getTimeWindow() { + return timeWindow; + } + public void setTimeWindow(String timeWindow) { + this.timeWindow = timeWindow; + } + public String getGuardActiveStart() { + return guardActiveStart; + } + public void setGuardActiveStart(String guardActiveStart) { + this.guardActiveStart = guardActiveStart; + } + public String getGuardActiveEnd() { + return guardActiveEnd; + } + public void setGuardActiveEnd(String guardActiveEnd) { + this.guardActiveEnd = guardActiveEnd; + } +} 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 index 129ad37df..032f77f3c 100644 --- 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 @@ -59,6 +59,9 @@ public class FWTagPicker implements Serializable { @Column(name="description", nullable=true, length=2048) private String description; + + @Column(name="networkRole", nullable=true) + private String networkRole; @Column(name="tags", nullable=true) @OrderBy("asc") @@ -135,6 +138,14 @@ public class FWTagPicker implements Serializable { this.description = description; } + public String getNetworkRole() { + return networkRole; + } + + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + public String getTagValues() { return tagValues; } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyGroupEntity.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyGroupEntity.java new file mode 100644 index 000000000..85c42ee48 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/PolicyGroupEntity.java @@ -0,0 +1,60 @@ +/*- + * ============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.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +@Entity +@Table(name="PolicyGroupEntity") +@NamedQuery(name="PolicyGroupEntity.findAll", query="SELECT p FROM PolicyGroupEntity p ") +public class PolicyGroupEntity implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @Column(name="groupKey") + private int groupKey; + + @Id + @Column(name="policyid") + private int policyid; + + public int getGroupKey() { + return groupKey; + } + + public void setGroupKey(int groupKey) { + this.groupKey = groupKey; + } + + public int getPolicyid() { + return policyid; + } + + public void setPolicyid(int policyid) { + this.policyid = policyid; + } +} 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 c912374ef..a04f77e7e 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 @@ -28,7 +28,7 @@ public class MSAttributeObject { private String className; private HashMap attribute = new HashMap(); private HashMap refAttribute = new HashMap(); - private HashMap subClass = new HashMap(); + private HashMap subClass = new HashMap(); private String dependency; private HashMap enumType = new HashMap(); private HashMap matchingSet = new HashMap(); @@ -70,13 +70,13 @@ public class MSAttributeObject { public void addAllRefAttribute(Map map){ this.refAttribute.putAll(map); } - public HashMap getSubClass() { + public HashMap getSubClass() { return subClass; } - public void setSubClass(HashMap subClass) { + public void setSubClass(HashMap subClass) { this.subClass = subClass; } - public void addAllSubClass(HashMap subClass){ + public void addAllSubClass(HashMap subClass){ this.subClass.putAll(subClass); } public String getDependency() { 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 index 7276a19f8..057d8544e 100644 --- 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 @@ -217,7 +217,7 @@ public class MSModelUtils { String extendClass = getSubTypes(root, className); HashMap returnRefList = getRefAttributeList(root, className, extendClass); HashMap returnAttributeList = getAttributeList(root, className, extendClass); - HashMap returnSubList = getSubAttributeList(root, className, extendClass); + HashMap returnSubList = getSubAttributeList(root, className, extendClass); HashMap returnAnnotation = getAnnotation(root, className, extendClass); msAttributeObject.setAttribute(returnAttributeList); msAttributeObject.setRefAttribute(returnRefList); @@ -285,10 +285,10 @@ public class MSModelUtils { return annotationSet; } - private HashMap getSubAttributeList(EPackage root, String className , String superClass) { + private HashMap getSubAttributeList(EPackage root, String className , String superClass) { TreeIterator treeItr = root.eAllContents(); boolean requiredAttribute = false; - HashMap subAttribute = new HashMap(); + HashMap subAttribute = new HashMap(); int rollingCount = 0; int processClass = 0; boolean annotation = false; @@ -622,7 +622,7 @@ public class MSModelUtils { } - public String createJson(HashMap subClassAttributes, HashMap classMap, String className) { + public String createJson(HashMap subClassAttributes, HashMap classMap, String className) { boolean enumType; Map> myObject = new HashMap>(); for ( Entry map : classMap.get(className).getRefAttribute().entrySet()){ @@ -660,7 +660,7 @@ public class MSModelUtils { public String createSubAttributes(ArrayList dependency, HashMap classMap, String modelName) { - HashMap workingMap = new HashMap(); + HashMap workingMap = new HashMap(); MSAttributeObject tempObject = new MSAttributeObject(); if (dependency!=null){ if (dependency.size()==0){ -- cgit 1.2.3-korg