From eb654437ee2815028602daa943d0a939a5bee3cd Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Fri, 7 Jul 2017 16:00:59 -0500 Subject: [POLICY-67] Add new Rainy Day Decision Policy Change-Id: I8fb730e4363c885ccbe3a05ae971c5de5608d70c Signed-off-by: Michael Mokry --- .../policy/rest/adapter/PolicyRestAdapter.java | 56 +++++++++- .../policy/rest/adapter/RainyDayParams.java | 100 +++++++++++++++++ .../policy/rest/jpa/RainyDayTreatments.java | 118 +++++++++++++++++++++ 3 files changed, 273 insertions(+), 1 deletion(-) create mode 100644 ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/RainyDayParams.java create mode 100644 ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RainyDayTreatments.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 8c54f2a2d..27da724e2 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 @@ -127,6 +127,12 @@ public class PolicyRestAdapter { private String actionDictMethod = null; private YAMLParams yamlparams; + //Rainy Day Decision + private RainyDayParams rainyday; + private Map rainydayMap; + private List errorCodeList; + private List treatmentList; + //MicroSerice private String serviceType = null; private String uuid = null; @@ -150,7 +156,7 @@ public class PolicyRestAdapter { private String riskLevel; private String guard = null; private String ttlDate; - private Map matching; + private Map matching; private ArrayList triggerSignatures; private ArrayList symptomSignatures; @@ -839,4 +845,52 @@ public class PolicyRestAdapter { public void setYamlparams(YAMLParams yamlparams) { this.yamlparams = yamlparams; } + /** + * @return the rainyday + */ + public RainyDayParams getRainyday() { + return rainyday; + } + /** + * @param rainyday the rainyday to set + */ + public void setRainyday(RainyDayParams rainyday) { + this.rainyday = rainyday; + } + /** + * @return the errorCodeList + */ + public List getErrorCodeList() { + return errorCodeList; + } + /** + * @param errorCodeList the errorCodeList to set + */ + public void setErrorCodeList(List errorCodeList) { + this.errorCodeList = errorCodeList; + } + /** + * @return the treatmentList + */ + public List getTreatmentList() { + return treatmentList; + } + /** + * @param treatmentList the treatmentList to set + */ + public void setTreatmentList(List treatmentList) { + this.treatmentList = treatmentList; + } + /** + * @return the rainydayMap + */ + public Map getRainydayMap() { + return rainydayMap; + } + /** + * @param rainydayMap the rainydayMap to set + */ + public void setRainydayMap(Map rainydayMap) { + this.rainydayMap = rainydayMap; + } } diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/RainyDayParams.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/RainyDayParams.java new file mode 100644 index 000000000..8fdcc0ffb --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/RainyDayParams.java @@ -0,0 +1,100 @@ +package org.openecomp.policy.rest.adapter; + +import java.util.ArrayList; +import java.util.List; + +public class RainyDayParams { + private String serviceType; + private String vnfType; + private String bbid; + private String workstep; + private ArrayList treatmentTableChoices; + private List errorcode; + private List treatment; + + /** + * @return the serviceType + */ + public String getServiceType() { + return serviceType; + } + /** + * @param serviceType the serviceType to set + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + /** + * @return the vnfType + */ + public String getVnfType() { + return vnfType; + } + /** + * @param vnfType the vnfType to set + */ + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + /** + * @return the workstep + */ + public String getWorkstep() { + return workstep; + } + /** + * @param workstep the workstep to set + */ + public void setWorkstep(String workstep) { + this.workstep = workstep; + } + /** + * @return the bbid + */ + public String getBbid() { + return bbid; + } + /** + * @param bbid the bbid to set + */ + public void setBbid(String bbid) { + this.bbid = bbid; + } + /** + * @return the treatmentTableChoices + */ + public ArrayList getTreatmentTableChoices() { + return treatmentTableChoices; + } + /** + * @param treatmentTableChoices the treatmentTableChoices to set + */ + public void setTreatmentTableChoices(ArrayList treatmentTableChoices) { + this.treatmentTableChoices = treatmentTableChoices; + } + /** + * @return the errorcode + */ + public List getErrorcode() { + return errorcode; + } + /** + * @param errorcode the errorcode to set + */ + public void setErrorcode(List errorcode) { + this.errorcode = errorcode; + } + /** + * @return the treatment + */ + public List getTreatment() { + return treatment; + } + /** + * @param treatment the treatment to set + */ + public void setTreatment(List treatment) { + this.treatment = treatment; + } + +} diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RainyDayTreatments.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RainyDayTreatments.java new file mode 100644 index 000000000..7219c7d36 --- /dev/null +++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/RainyDayTreatments.java @@ -0,0 +1,118 @@ +/*- + * ============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 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.Table; + +import java.io.Serializable; + +/** + * The persistent class for the RainyDayTreatment database table. + * + */ +@Entity +@Table(name="RainyDayTreatments") +@NamedQuery(name="RainyDayTreatments.findAll", query="SELECT e FROM RainyDayTreatments e") +public class RainyDayTreatments implements Serializable { + /** + * + */ + private static final long serialVersionUID = -2491410352490381323L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="id") + private int id; + + @Column(name="bbid", nullable=false, length=255) + @OrderBy("asc") + private String bbid; + + @Column(name="workstep", nullable=true, length=255) + private String workstep; + + @Column(name="treatments", nullable=true, length=1028) + private String treatments; + + public RainyDayTreatments() { + + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + /** + * @return the bbid + */ + public String getBbid() { + return bbid; + } + + /** + * @param bbid the bbid to set + */ + public void setBbid(String bbid) { + this.bbid = bbid; + } + + /** + * @return the workstep + */ + public String getWorkstep() { + return workstep; + } + + /** + * @param workstep the workstep to set + */ + public void setWorkstep(String workstep) { + this.workstep = workstep; + } + + /** + * @return the treatments + */ + public String getTreatments() { + return treatments; + } + + /** + * @param treatments the treatments to set + */ + public void setTreatments(String treatments) { + this.treatments = treatments; + } + + +} \ No newline at end of file -- cgit 1.2.3-korg