aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/policy
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/policy')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyProperties.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyResponseWrapper.java56
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInt.java66
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterface.java233
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceFactory.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceIfc.java58
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/PolicyUtil.java71
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/RestObject.java68
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/policy/rest/RequestDetails.java107
9 files changed, 699 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyProperties.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyProperties.java
new file mode 100644
index 000000000..2afb2d4a7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyProperties.java
@@ -0,0 +1,26 @@
+package org.onap.vid.policy;
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+
+public class PolicyProperties extends SystemProperties {
+
+ public static final String POLICY_CLIENTAUTH_VAL = "policy.ClientAuth";
+
+ public static final String POLICY_CLIENT_MECHID_VAL = "policy.client.mechId";
+
+ public static final String POLICY_CLIENT_PASSWORD_VAL = "policy.client.password";
+
+ public static final String POLICY_USERNAME_VAL = "policy.username";
+
+ public static final String POLICY_PASSWORD_VAL = "policy.password";
+
+ public static final String POLICY_AUTHORIZATION_VAL = "policy.Authorization";
+
+ public static final String POLICY_SERVER_URL_VAL = "policy.server.url";
+
+ public static final String POLICY_ENVIRONMENT_VAL = "policy.environment";
+
+ public static final String POLICY_GET_CONFIG_VAL = "policy.get.config";
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyResponseWrapper.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyResponseWrapper.java
new file mode 100644
index 000000000..d5a4d124c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyResponseWrapper.java
@@ -0,0 +1,56 @@
+package org.onap.vid.policy;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * This wrapper encapsulates the Policy response
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "status",
+ "entity"
+})
+
+public class PolicyResponseWrapper {
+
+ @JsonProperty("status")
+ private int status;
+
+ @JsonProperty("entity")
+ private String entity;
+
+ @JsonProperty("entity")
+ public String getEntity() {
+ return entity;
+ }
+
+ @JsonProperty("status")
+ public int getStatus() {
+ return status;
+ }
+
+ @JsonProperty("status")
+ public void setStatus(int v) {
+ this.status = v;
+ }
+
+ @JsonProperty("entity")
+ public void setEntity(String v) {
+ this.entity = v;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ public String getResponse () {
+
+ StringBuilder b = new StringBuilder ("{ \"status\": ");
+ b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}");
+ return (b.toString());
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInt.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInt.java
new file mode 100644
index 000000000..b58fe28ff
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInt.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.onap.vid.policy;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.policy.rest.RequestDetails;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class PolicyRestInt {
+
+ /** The logger. */
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyRestInt.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The request date format. */
+ public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z");
+
+ public PolicyRestInt() {
+ requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
+ }
+
+ /**
+ * Log request.
+ *
+ * @param r the r
+ */
+ public void logRequest ( RequestDetails r ) {
+ String methodName = "logRequest";
+ ObjectMapper mapper = new ObjectMapper();
+ String r_json_str = "";
+ if ( r != null ) {
+ r_json_str = r.toString();
+ try {
+ r_json_str = mapper.writeValueAsString(r);
+ }
+ catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse request as json");
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Request=(" + r_json_str + ")");
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterface.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterface.java
new file mode 100644
index 000000000..875586d99
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterface.java
@@ -0,0 +1,233 @@
+package org.onap.vid.policy;
+
+import org.apache.commons.codec.binary.Base64;
+import org.eclipse.jetty.util.security.Password;
+import org.json.simple.JSONObject;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.onap.vid.client.HttpBasicClient;
+import org.onap.vid.policy.rest.RequestDetails;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+
+public class PolicyRestInterface extends PolicyRestInt implements PolicyRestInterfaceIfc {
+
+ /** The logger. */
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyRestInterface.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The client. */
+ private static Client client = null;
+
+ /** The common headers. */
+ private MultivaluedHashMap<String, Object> commonHeaders;
+
+ public PolicyRestInterface() {
+ super();
+ }
+
+ public void initRestClient()
+ {
+ final String methodname = "initRestClient()";
+
+ //final String clientAuth = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENTAUTH_VAL);
+ //final String authorization = SystemProperties.getProperty(PolicyProperties.POLICY_AUTHORIZATION_VAL);
+ final String mechId = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_MECHID_VAL);
+ final String clientPassword = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_PASSWORD_VAL);
+ final String username = SystemProperties.getProperty(PolicyProperties.POLICY_USERNAME_VAL);
+ final String password = SystemProperties.getProperty(PolicyProperties.POLICY_PASSWORD_VAL);
+ final String environment = SystemProperties.getProperty(PolicyProperties.POLICY_ENVIRONMENT_VAL);
+
+ final String decrypted_client_password = Password.deobfuscate(clientPassword);
+ String mechAuthString = mechId + ":" + decrypted_client_password;
+ byte[] mechAuthEncBytes = Base64.encodeBase64(mechAuthString.getBytes());
+ String clientAuth = new String(mechAuthEncBytes);
+
+ final String decrypted_password = Password.deobfuscate(password);
+ String authString = username + ":" + decrypted_password;
+ byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
+ String authorization = new String(authEncBytes);
+
+ commonHeaders = new MultivaluedHashMap<String, Object> ();
+ commonHeaders.put("ClientAuth", Collections.singletonList((Object) ("Basic " + clientAuth)));
+ commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authorization)));
+ commonHeaders.put("Environment", Collections.singletonList((Object) (environment)));
+
+ if (client == null) {
+
+ try {
+ client = HttpBasicClient.getClient();
+ } catch (Exception e) {
+ System.out.println( methodname + " Unable to get the SSL client");
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception {
+ String methodName = "Get";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
+
+ String url="";
+ restObject.set(t);
+
+ url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path;
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
+
+ initRestClient();
+
+ final Response cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .headers(commonHeaders)
+ .get();
+
+ int status = cres.getStatus();
+ restObject.setStatusCode (status);
+
+ if (status == 200) {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!");
+
+ } else {
+ throw new Exception(methodName + " with status="+ status + ", url= " + url );
+ }
+
+ logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );
+
+ return;
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) {
+
+ String methodName = "Delete";
+ String url="";
+ Response cres = null;
+
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
+ logRequest (r);
+
+ try {
+ initRestClient();
+
+ url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url);
+
+ cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .headers(commonHeaders)
+ //.entity(r)
+ .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();
+ // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON));
+ //.delete(Entity.entity(r, MediaType.APPLICATION_JSON));
+
+ int status = cres.getStatus();
+ restObject.setStatusCode (status);
+
+ if (status == 404) { // resource not found
+ String msg = "Resource does not exist...: " + cres.getStatus();
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ } else if (status == 200 || status == 204){
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
+ } else if (status == 202) {
+ String msg = "Delete in progress: " + status;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ }
+ else {
+ String msg = "Deleting Resource failed: " + status;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ }
+
+ try {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ }
+ catch ( Exception e ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
+ + e.getMessage());
+ }
+
+ }
+ catch (Exception e)
+ {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
+ throw e;
+
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> void Post(T t, JSONObject requestDetails, String uuid, String path, RestObject<T> restObject) throws Exception {
+
+ String methodName = "Post";
+ String url="";
+
+ System.out.println( "POST policy rest interface");
+
+ // logRequest (requestDetails);
+ try {
+
+ initRestClient();
+
+ url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path;
+ System.out.println( "<== " + methodName + " sending request to url= " + url);
+ // Change the content length
+ final Response cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .headers(commonHeaders)
+ //.header("content-length", 201)
+ //.header("X-FromAppId", sourceID)
+ .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON));
+
+ try {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ }
+ catch ( Exception e ) {
+
+ System.out.println("<== " + methodName + " No response entity, this is probably ok, e=" + e.getMessage());
+ }
+
+ int status = cres.getStatus();
+ restObject.setStatusCode (status);
+
+ if ( status >= 200 && status <= 299 ) {
+ System.out.println( "<== " + methodName + " REST api POST was successful!");
+
+ } else {
+ System.out.println( "<== " + methodName + " with status="+status+", url="+url);
+ }
+
+ } catch (Exception e)
+ {
+ System.out.println( "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
+ throw e;
+
+ }
+ }
+
+ public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException
+ {
+ return clazz.newInstance();
+ }
+
+ @Override
+ public void logRequest(RequestDetails r) {
+ // TODO Auto-generated method stub
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceFactory.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceFactory.java
new file mode 100644
index 000000000..40cb854bf
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceFactory.java
@@ -0,0 +1,14 @@
+
+package org.onap.vid.policy;
+
+public class PolicyRestInterfaceFactory {
+
+
+ public static PolicyRestInterfaceIfc getInstance () {
+ PolicyRestInterfaceIfc obj = null;
+
+ obj = new PolicyRestInterface();
+
+ return ( obj );
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceIfc.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceIfc.java
new file mode 100644
index 000000000..59b0ad3dc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyRestInterfaceIfc.java
@@ -0,0 +1,58 @@
+
+package org.onap.vid.policy;
+
+import org.json.simple.JSONObject;
+import org.onap.vid.policy.rest.RequestDetails;
+
+public interface PolicyRestInterfaceIfc {
+ /**
+ * Inits the rest client.
+ */
+ public void initRestClient();
+
+ /**
+ * Gets the.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @param sourceId the source id
+ * @param path the path
+ * @param restObject the rest object
+ * @throws Exception the exception
+ */
+ public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception;
+
+ /**
+ * Delete.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @param r the r
+ * @param sourceID the source ID
+ * @param path the path
+ * @param restObject the rest object
+ * @throws Exception the exception
+ */
+ public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
+
+ /**
+ * Post.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @param r the r
+ * @param sourceID the source ID
+ * @param path the path
+ * @param restObject the rest object
+ * @throws Exception the exception
+ */
+ public <T> void Post(T t, JSONObject r, String sourceID, String path, RestObject<T> restObject) throws Exception;
+
+ /***
+ * Log request.
+ *
+ * @param r the r
+ */
+ public void logRequest ( RequestDetails r );
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/PolicyUtil.java b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyUtil.java
new file mode 100644
index 000000000..608352845
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/PolicyUtil.java
@@ -0,0 +1,71 @@
+package org.onap.vid.policy;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.glassfish.jersey.client.ClientResponse;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.policy.PolicyResponseWrapper;
+import org.onap.vid.policy.PolicyUtil;
+import org.onap.vid.policy.RestObject;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class PolicyUtil {
+
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyUtil.class);
+
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ public static PolicyResponseWrapper wrapResponse ( String body, int statusCode ) {
+
+ PolicyResponseWrapper w = new PolicyResponseWrapper();
+ w.setStatus (statusCode);
+ w.setEntity(body);
+
+ return w;
+ }
+
+ public static PolicyResponseWrapper wrapResponse (ClientResponse cres) {
+ String resp_str = "";
+ if ( cres != null ) {
+ resp_str = cres.readEntity(String.class);
+ }
+ int statuscode = cres.getStatus();
+ PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, statuscode );
+ return (w);
+ }
+
+ public static PolicyResponseWrapper wrapResponse (RestObject<String> rs) {
+ String resp_str = "";
+ int status = 0;
+ if ( rs != null ) {
+ resp_str = rs.get();
+ status = rs.getStatusCode();
+ }
+ PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, status );
+ return (w);
+ }
+
+ public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException {
+
+ String methodName = "convertPojoToString";
+ ObjectMapper mapper = new ObjectMapper();
+ String r_json_str = "";
+ if ( t != null ) {
+ try {
+ r_json_str = mapper.writeValueAsString(t);
+ }
+ catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json");
+ }
+ }
+ return (r_json_str);
+ }
+
+
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/RestObject.java b/vid-app-common/src/main/java/org/onap/vid/policy/RestObject.java
new file mode 100644
index 000000000..81b354eb0
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/RestObject.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.onap.vid.policy;
+
+/**
+ * The Class RestObject.
+ *
+ * @param <T> the generic type
+ */
+public class RestObject<T> {
+
+ /**
+ * Generic version of the RestObject class.
+ *
+ */
+ // T stands for "Type"
+ private T t;
+
+ /** The status code. */
+ private int statusCode= 0;
+
+ /**
+ * Sets the.
+ *
+ * @param t the t
+ */
+ public void set(T t) { this.t = t; }
+
+ /**
+ * Gets the.
+ *
+ * @return the t
+ */
+ public T get() { return t; }
+
+ /**
+ * Sets the status code.
+ *
+ * @param v the new status code
+ */
+ public void setStatusCode(int v) { this.statusCode = v; }
+
+ /**
+ * Gets the status code.
+ *
+ * @return the status code
+ */
+ public int getStatusCode() { return this.statusCode; }
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/policy/rest/RequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/policy/rest/RequestDetails.java
new file mode 100644
index 000000000..81e2f2d8b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/policy/rest/RequestDetails.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.onap.vid.policy.rest;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+/*
+ [
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"TimeLimitAndVerticalTopology\",\"policyName\":\"SNIRO_CM_1707.Demo_TimeLimitAndVerticalTopology_zone_localTime\",\"description\":\"dev instance\",\"templateVersion\":\"1702.03\",\"version\":\"1707\",\"priority\":\"4\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"serviceType\":\"networkOnDemand\",\"identity\":\"vnf_upgrade_policy\",\"policyScope\":{\"serviceType\":[\"networkOnDemand\"],\"aicZone\":[\" \"],\"entityType\":[\"vnf\"]},\"timeSchedule\":{\"allowedPeriodicTime\":[{\"day\":\"weekday\",\"timeRange\":[{\"start_time\":\"04:00:00\",\"end_time\":\"13:00:00\"}]}]},\"nodeType\":[\"vnf\"],\"type\":\"timeLimitAndVerticalTopology\",\"conflictScope\":\"vnf_zone\"}}",
+ "policyName": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_zone_localTime.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "TimeLimitAndVerticalTopology",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": {},
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"TimeLimitAndVerticalTopology\",\"policyName\":\"SNIRO_CM_1707.Demo_TimeLimitAndVerticalTopology_pserver_localTime\",\"description\":\"dev instance\",\"templateVersion\":\"1702.03\",\"version\":\"1707\",\"priority\":\"4\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"serviceType\":\"networkOnDemand\",\"identity\":\"vnf_upgrade_policy\",\"policyScope\":{\"serviceType\":[\"networkOnDemand\"],\"aicZone\":[\" \"],\"entityType\":[\"vnf\"]},\"timeSchedule\":{\"allowedPeriodicTime\":[{\"day\":\"weekday\",\"timeRange\":[{\"start_time\":\"04:00:00\",\"end_time\":\"13:00:00\"}]}]},\"nodeType\":[\"vnf\"],\"type\":\"timeLimitAndVerticalTopology\",\"conflictScope\":\"vnf_pserver\"}}",
+ "policyName": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_pserver_localTime.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "TimeLimitAndVerticalTopology",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": {},
+ "property": null
+ },
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"service\":\"TimeLimitAndVerticalTopology\",\"policyName\":\"SNIRO_CM_1707.Demo_TimeLimitAndVerticalTopology_vnf_localTime\",\"description\":\"dev instance\",\"templateVersion\":\"1702.03\",\"version\":\"1707\",\"priority\":\"4\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"serviceType\":\"networkOnDemand\",\"identity\":\"vnf_upgrade_policy\",\"policyScope\":{\"serviceType\":[\"networkOnDemand\"],\"aicZone\":[\" \"],\"entityType\":[\"vnf\"]},\"timeSchedule\":{\"allowedPeriodicTime\":[{\"day\":\"weekday\",\"timeRange\":[{\"start_time\":\"04:00:00\",\"end_time\":\"13:00:00\"}]}]},\"nodeType\":[\"vnf\"],\"type\":\"timeLimitAndVerticalTopology\",\"conflictScope\":\"vnf\"}}",
+ "policyName": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_vnf_localTime.1.xml",
+ "policyVersion": "1",
+ "matchingConditions": {
+ "ECOMPName": "SNIRO-Placement",
+ "ConfigName": "",
+ "service": "TimeLimitAndVerticalTopology",
+ "uuid": "",
+ "Location": ""
+ },
+ "responseAttributes": {},
+ "property": null
+ }
+ ]
+*/
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "policyConfigMessage",
+ "policyConfigStatus",
+ "type",
+ "config",
+ "policyName",
+ "policyVersion",
+ "matchingConditions"
+})
+public class RequestDetails {
+
+ @JsonProperty("policyName")
+ private String policyName;
+
+ @JsonProperty("policyName")
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ @JsonProperty("policyName")
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+} \ No newline at end of file