From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../client/policy/CommonObjectMapperProvider.java | 49 ----- .../mso/client/policy/DecisionAttributes.java | 93 -------- .../client/policy/JettisonStyleMapperProvider.java | 49 ----- .../openecomp/mso/client/policy/LoggingFilter.java | 157 ------------- .../openecomp/mso/client/policy/PolicyClient.java | 33 --- .../mso/client/policy/PolicyClientImpl.java | 94 -------- .../mso/client/policy/PolicyDecision.java | 57 ----- .../mso/client/policy/PolicyDecisionRequest.java | 57 ----- .../mso/client/policy/PolicyRestClient.java | 66 ------ .../mso/client/policy/PolicyRestProperties.java | 35 --- .../openecomp/mso/client/policy/RestClient.java | 243 --------------------- .../openecomp/mso/client/policy/RestClientSSL.java | 109 --------- .../client/policy/entities/AllowedTreatments.java | 105 --------- .../openecomp/mso/client/policy/entities/Bbid.java | 87 -------- .../client/policy/entities/DecisionAttributes.java | 94 -------- .../mso/client/policy/entities/DictionaryData.java | 105 --------- .../policy/entities/DictionaryItemsRequest.java | 56 ----- .../mso/client/policy/entities/DictionaryJson.java | 53 ----- .../openecomp/mso/client/policy/entities/Id.java | 69 ------ .../mso/client/policy/entities/PolicyDecision.java | 58 ----- .../policy/entities/PolicyDecisionRequest.java | 58 ----- .../client/policy/entities/PolicyServiceType.java | 48 ---- .../mso/client/policy/entities/Treatments.java | 87 -------- .../mso/client/policy/entities/Workstep.java | 88 -------- 24 files changed, 1950 deletions(-) delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/RestClient.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java delete mode 100644 common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java (limited to 'common/src/main/java/org/openecomp/mso/client/policy') diff --git a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java deleted file mode 100644 index 4f41b6441e..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import javax.ws.rs.ext.ContextResolver; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -public class CommonObjectMapperProvider implements ContextResolver { - - final ObjectMapper mapper; - - public CommonObjectMapperProvider() { - - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } - - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java b/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java deleted file mode 100644 index 7b765ebb5f..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode" }) -public class DecisionAttributes { - - @JsonProperty("ServiceType") - private String serviceType; - @JsonProperty("VNFType") - private String vNFType; - @JsonProperty("BB_ID") - private String bbID; - @JsonProperty("WorkStep") - private String workStep; - @JsonProperty("ErrorCode") - private String errorCode; - - @JsonProperty("ServiceType") - public String getServiceType() { - return serviceType; - } - - @JsonProperty("ServiceType") - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty("VNFType") - public String getVNFType() { - return vNFType; - } - - @JsonProperty("VNFType") - public void setVNFType(String vNFType) { - this.vNFType = vNFType; - } - - @JsonProperty("BB_ID") - public String getBBID() { - return bbID; - } - - @JsonProperty("BB_ID") - public void setBBID(String bBID) { - this.bbID = bBID; - } - - @JsonProperty("WorkStep") - public String getWorkStep() { - return workStep; - } - - @JsonProperty("WorkStep") - public void setWorkStep(String workStep) { - this.workStep = workStep; - } - - @JsonProperty("ErrorCode") - public String getErrorCode() { - return errorCode; - } - - @JsonProperty("ErrorCode") - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java b/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java deleted file mode 100644 index 19579e810b..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import javax.ws.rs.ext.ContextResolver; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -public class JettisonStyleMapperProvider implements ContextResolver { - - final ObjectMapper mapper; - - public JettisonStyleMapperProvider() { - - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } - - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java b/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java deleted file mode 100644 index b04069697e..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java +++ /dev/null @@ -1,157 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import java.io.BufferedInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FilterOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; - -import javax.annotation.Priority; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.ext.Provider; -import javax.ws.rs.ext.WriterInterceptor; -import javax.ws.rs.ext.WriterInterceptorContext; - -import org.openecomp.mso.logger.MsoLogger; - - -@Provider -@Priority(0) -public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor { - - private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream"; - private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - private final int maxEntitySize; - - public LoggingFilter() { - maxEntitySize = 1024 * 1024; - } - - public LoggingFilter(int maxPayloadSize) { - this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024); - } - - private void log(StringBuilder sb) { - logger.debug(sb.toString()); - } - - protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset) - throws IOException { - if (!stream.markSupported()) { - stream = new BufferedInputStream(stream); - } - stream.mark(maxEntitySize + 1); - final byte[] entity = new byte[maxEntitySize + 1]; - final int entitySize = stream.read(entity); - if (entitySize != -1) { - b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset)); - } - if (entitySize > maxEntitySize) { - b.append("...more..."); - } - b.append('\n'); - stream.reset(); - return stream; - } - - @Override - public void filter(ClientRequestContext requestContext) throws IOException { - if (requestContext.hasEntity()) { - final OutputStream stream = new LoggingStream(requestContext.getEntityStream()); - requestContext.setEntityStream(stream); - requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream); - } - String method = formatMethod(requestContext); - log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: " + requestContext.getHeaders().toString())); - - } - - @Override - public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { - final StringBuilder sb = new StringBuilder(); - if (responseContext.hasEntity()) { - responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET)); - String method = formatMethod(requestContext); - log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: " + responseContext.getHeaders().toString())); - } - } - - @Override - public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { - final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY); - context.proceed(); - if (stream != null) { - log(stream.getStringBuilder(DEFAULT_CHARSET)); - } - } - - private class LoggingStream extends FilterOutputStream { - - private final StringBuilder sb = new StringBuilder(); - private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - LoggingStream(OutputStream out) { - super(out); - } - - StringBuilder getStringBuilder(Charset charset) { - // write entity to the builder - final byte[] entity = baos.toByteArray(); - - sb.append(new String(entity, 0, entity.length, charset)); - if (entity.length > maxEntitySize) { - sb.append("...more..."); - } - sb.append('\n'); - - return sb; - } - - @Override - public void write(final int i) throws IOException { - if (baos.size() <= maxEntitySize) { - baos.write(i); - } - out.write(i); - } - } - - private String formatMethod(ClientRequestContext requestContext) { - String method = requestContext.getHeaderString("X-HTTP-Method-Override"); - if (method == null) { - method = requestContext.getMethod(); - } else { - method = requestContext.getMethod() + " (overridden to " + method + ")"; - } - - return method; - } -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java deleted file mode 100644 index defd11bc99..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import org.openecomp.mso.client.policy.entities.AllowedTreatments; -import org.openecomp.mso.client.policy.entities.DictionaryData; -import org.openecomp.mso.client.policy.entities.PolicyDecision; - -public interface PolicyClient { - - public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep, - String errorCode); - - public DictionaryData getAllowedTreatments(String bbID, String workStep); -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java deleted file mode 100644 index 0ce1911c82..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import org.openecomp.mso.client.RestPropertiesLoader; -import org.openecomp.mso.client.defaultproperties.PolicyRestPropertiesImpl; -import org.openecomp.mso.client.policy.entities.AllowedTreatments; -import org.openecomp.mso.client.policy.entities.Bbid; -import org.openecomp.mso.client.policy.entities.DecisionAttributes; -import org.openecomp.mso.client.policy.entities.DictionaryData; -import org.openecomp.mso.client.policy.entities.DictionaryItemsRequest; -import org.openecomp.mso.client.policy.entities.DictionaryJson; -import org.openecomp.mso.client.policy.entities.PolicyDecision; -import org.openecomp.mso.client.policy.entities.PolicyDecisionRequest; -import org.openecomp.mso.client.policy.entities.PolicyServiceType; -import org.openecomp.mso.client.policy.entities.Workstep; - -import java.util.List; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -public class PolicyClientImpl implements PolicyClient { - - protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - private PolicyRestProperties props; - public PolicyClientImpl() { - props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class); - if (props == null) { - metricsLogger.error("No RestProperty.PolicyRestProperties implementation found on classpath"); - props = new PolicyRestPropertiesImpl(); - } - } - public PolicyDecision getDecision(String serviceType, String vnfType, String bbID, String workStep, - String errorCode) { - DecisionAttributes decisionAttributes = new DecisionAttributes(); - decisionAttributes.setServiceType(serviceType); - decisionAttributes.setVNFType(vnfType); - decisionAttributes.setBBID(bbID); - decisionAttributes.setWorkStep(workStep); - decisionAttributes.setErrorCode(errorCode); - - return this.getDecision(decisionAttributes); - } - - protected PolicyDecision getDecision(DecisionAttributes decisionAttributes) { - PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DECISION); - PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest(); - decisionRequest.setDecisionAttributes(decisionAttributes); - decisionRequest.setEcompcomponentName(RestClient.ECOMP_COMPONENT_NAME); - - return client.post(decisionRequest, PolicyDecision.class); - } - - public DictionaryData getAllowedTreatments(String bbID, String workStep) - { - PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DICTIONARY_ITEMS); - DictionaryItemsRequest dictionaryItemsRequest = new DictionaryItemsRequest(); - dictionaryItemsRequest.setDictionaryType("Decision"); - dictionaryItemsRequest.setDictionary("RainyDayTreatments"); - final AllowedTreatments response = client.post(dictionaryItemsRequest, AllowedTreatments.class); - final DictionaryJson dictionaryJson = response.getDictionaryJson(); - final List dictionaryDataList = dictionaryJson.getDictionaryDatas(); - for(DictionaryData dictData : dictionaryDataList){ - Bbid bBid = dictData.getBbid(); - Workstep workstep = dictData.getWorkstep(); - String bBidString = bBid.getString(); - String workstepString = workstep.getString(); - if(bbID.equals(bBidString) && workStep.equals(workstepString)){ - return dictData; - } - } - metricsLogger.error("There is no AllowedTreatments with that specified parameter set"); - return null; - } - -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java deleted file mode 100644 index 98c7e1558d..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "decision", "details" }) -public class PolicyDecision { - - @JsonProperty("decision") - private String decision; - @JsonProperty("details") - private String details; - - @JsonProperty("decision") - public String getDecision() { - return decision; - } - - @JsonProperty("decision") - public void setDecision(String decision) { - this.decision = decision; - } - - @JsonProperty("details") - public String getDetails() { - return details; - } - - @JsonProperty("details") - public void setDetails(String details) { - this.details = details; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java deleted file mode 100644 index c83fb19e34..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" }) -public class PolicyDecisionRequest { - - @JsonProperty("decisionAttributes") - private DecisionAttributes decisionAttributes; - @JsonProperty("ecompcomponentName") - private String ecompcomponentName; - - @JsonProperty("decisionAttributes") - public DecisionAttributes getDecisionAttributes() { - return decisionAttributes; - } - - @JsonProperty("decisionAttributes") - public void setDecisionAttributes(DecisionAttributes decisionAttributes) { - this.decisionAttributes = decisionAttributes; - } - - @JsonProperty("ecompcomponentName") - public String getEcompcomponentName() { - return ecompcomponentName; - } - - @JsonProperty("ecompcomponentName") - public void setEcompcomponentName(String ecompcomponentName) { - this.ecompcomponentName = ecompcomponentName; - } - -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java deleted file mode 100644 index 77fec34de6..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import java.net.MalformedURLException; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.core.UriBuilderException; - -import org.openecomp.mso.client.ResponseExceptionMapperImpl; -import org.openecomp.mso.client.RestProperties; -import org.openecomp.mso.client.policy.entities.PolicyServiceType; -import org.springframework.stereotype.Service; - -@Service -public class PolicyRestClient extends RestClient { - - private static final UUID X_ECOMP_REQUESTID = UUID.randomUUID(); - private final PolicyRestProperties properties; - public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) { - super(props, UUID.randomUUID(), Optional.of(UriBuilder.fromPath(serviceType.toString()).build())); - this.properties = props; - this.getClient(); - } - - @Override - protected void initializeHeaderMap(Map headerMap) { - headerMap.put("ClientAuth", properties.getClientAuth()); - headerMap.put("Authorization", properties.getAuth()); - headerMap.put("Environment", properties.getEnvironment()); - this.addRequestId(X_ECOMP_REQUESTID); - } - - @Override - protected Optional addResponseFilter() { - return Optional.of(new ResponseExceptionMapperImpl()); - } - - @Override - public RestClient addRequestId(UUID requestId) { - this.headerMap.put("X-ECOMP-RequestID", requestId.toString()); - return this; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java b/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java deleted file mode 100644 index d89bd54f66..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.client.RestProperties; - -public interface PolicyRestProperties extends RestProperties { - - public String getClientAuth(); - public String getAuth(); - public String getEnvironment(); - -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java deleted file mode 100644 index 77afe82758..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java +++ /dev/null @@ -1,243 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation.Builder; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.ext.ContextResolver; - -import org.apache.commons.codec.binary.Base64; -import org.apache.log4j.Logger; -import org.openecomp.mso.client.RestProperties; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.CryptoUtils; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.databind.ObjectMapper; - -@Service -public abstract class RestClient { - protected static final String ECOMP_COMPONENT_NAME = "MSO"; - - private static final int MAX_PAYLOAD_SIZE = 1024 * 1024; - private WebTarget webTarget; - - protected final Map headerMap; - protected final MsoLogger msoLogger; - protected URL host; - protected Optional path; - protected Logger logger; - protected String accept; - protected String contentType; - protected UUID requestId; - - protected RestClient(RestProperties props, UUID requestId, Optional path) { - logger = Logger.getLogger(getClass().getName()); - msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - this.requestId = requestId; - headerMap = new HashMap<>(); - try { - host = props.getEndpoint(); - } catch (MalformedURLException e) { - logger.error("url not valid", e); - throw new RuntimeException(e); - } - - this.path = path; - initializeClient(getClient()); - } - - protected RestClient(RestProperties props, UUID requestId, Optional path, String accept, String contentType) { - this(props, requestId, path); - this.accept = accept; - this.contentType = contentType; - } - - protected RestClient(URL host, UUID requestId, String contentType) { - headerMap = new HashMap<>(); - logger = Logger.getLogger(getClass().getName()); - msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - this.path = Optional.empty(); - this.host = host; - this.contentType = contentType; - this.requestId = requestId; - initializeClient(getClient()); - } - - /** - * Override method to return false to disable logging. - * - * @return true - to enable logging, false otherwise - */ - protected boolean enableLogging() { - return true; - } - - /** - * Override method to return custom value for max payload size. - * - * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024 - */ - protected int getMaxPayloadSize() - { - return MAX_PAYLOAD_SIZE; - } - - protected Builder getBuilder() { - - Builder builder = webTarget.request(); - initializeHeaderMap(headerMap); - - for (Entry entry : headerMap.entrySet()) { - builder.header(entry.getKey(), entry.getValue()); - } - return builder; - } - - protected abstract void initializeHeaderMap(Map headerMap); - - protected abstract Optional addResponseFilter(); - - public abstract RestClient addRequestId(UUID requestId); - - /** - * Adds a basic authentication header to the request. - * @param auth the encrypted credentials - * @param key the key for decrypting the credentials - */ - protected void addBasicAuthHeader(String auth, String key) { - try { - byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes(); - String authHeaderValue = "Basic " + new String(Base64.encodeBase64(decryptedAuth)); - headerMap.put("Authorization", authHeaderValue); - } catch (GeneralSecurityException e) { - logger.warn(e.getMessage(), e); - } - } - - protected ContextResolver getMapper() { - return new CommonObjectMapperProvider(); - } - - protected String getAccept() { - return accept; - } - - protected String getContentType() { - return contentType; - } - - protected String getMergeContentType() { - return "application/merge-patch+json"; - } - - protected Client getClient() { - return ClientBuilder.newBuilder().build(); - } - - protected UUID getRequestId() { - return this.requestId; - } - protected void initializeClient(Client client) { - if (this.enableLogging()) { - client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize())); - } - client.register(this.getMapper()); - Optional responseFilter = this.addResponseFilter(); - responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter)); - webTarget = path.map(uri -> client.target(UriBuilder.fromUri(host + uri.toString()))) - .orElseGet(() -> client.target(host.toString())); - this.accept = MediaType.APPLICATION_JSON; - this.contentType = MediaType.APPLICATION_JSON; - } - - public Response get() { - return this.getBuilder().accept(this.getAccept()).get(); - } - - public Response post(Object obj) { - return this.getBuilder().accept(this.getAccept()).post(Entity.entity(obj, this.getContentType())); - } - - public Response patch(Object obj) { - return this.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.getAccept()) - .post(Entity.entity(obj, this.getMergeContentType())); - } - - public Response put(Object obj) { - return this.getBuilder().accept(this.getAccept()).put(Entity.entity(obj, this.getContentType())); - } - - public Response delete() { - return this.getBuilder().accept(this.getAccept()).delete(); - } - - public Response delete(Object obj) { - return this.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.getAccept()) - .put(Entity.entity(obj, this.getContentType())); - } - - public T get(Class resultClass) { - return this.get().readEntity(resultClass); - } - - public T get(GenericType resultClass) { - return this.get().readEntity(resultClass); - } - - public T post(Object obj, Class resultClass) { - return this.post(obj).readEntity(resultClass); - } - - public T patch(Object obj, Class resultClass) { - return this.patch(obj).readEntity(resultClass); - } - - public T put(Object obj, Class resultClass) { - return this.put(obj).readEntity(resultClass); - } - - public T delete(Class resultClass) { - return this.delete().readEntity(resultClass); - } - - public T delete(Object obj, Class resultClass) { - return this.delete(obj).readEntity(resultClass); - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java deleted file mode 100644 index 6146fc373f..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy; - -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URI; -import java.security.NoSuchAlgorithmException; -import java.security.KeyStore; -import java.util.Optional; -import java.util.Properties; -import java.util.UUID; - -import javax.net.ssl.SSLContext; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; - -import org.openecomp.mso.client.RestProperties; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -public abstract class RestClientSSL extends RestClient { - - public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore"; - public static String SSL_KEY_STORE_PASSWORD_KEY; - public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore"; - - - protected RestClientSSL(RestProperties props, UUID requestId, Optional path) { - super(props, requestId, path); - } - - protected RestClientSSL(RestProperties props, UUID requestId, Optional path, String accept, String contentType) { - super(props, requestId, path, accept, contentType); - } - - @Override - protected Client getClient() { - Client client = null; - Properties keyProp = new Properties (); - try { - keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("Policy.properties")); - SSL_KEY_STORE_PASSWORD_KEY=(String) keyProp.get ("ssl.key.store.password.key"); - String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY); - if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase("true")) { - KeyStore ks = getKeyStore(); - if(ks != null) { - client = ClientBuilder.newBuilder().keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build(); - this.msoLogger.debug("RestClientSSL not using default SSL context - setting keystore here."); - return client; - } - } - //Use default SSL context - client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build(); - this.msoLogger.debug("RestClientSSL using default SSL context!"); - } catch (NoSuchAlgorithmException | IOException e) { - this.msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e); - throw new RuntimeException(e); - } - return client; - } - - private KeyStore getKeyStore() throws IOException { - KeyStore ks = null; - Properties keyProp = new Properties (); - - keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("Policy.properties")); - SSL_KEY_STORE_PASSWORD_KEY=(String) keyProp.get ("ssl.key.store.password.key"); - char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray(); - FileInputStream fis = null; - - try { - ks = KeyStore.getInstance(KeyStore.getDefaultType()); - fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY)); - ks.load(fis, password); - } - catch(Exception e) { - return null; - } - - finally { - if (fis != null) { - try { - fis.close(); - } - catch(Exception e) {} - } - } - return ks; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java deleted file mode 100644 index 50db843416..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"dictionaryJson", -"dictionaryData", -"responseCode", -"responseMessage" -}) -public class AllowedTreatments{ - -@JsonProperty("dictionaryJson") -private DictionaryJson dictionaryJson; -@JsonProperty("dictionaryData") -private Object dictionaryData; -@JsonProperty("responseCode") -private Integer responseCode; -@JsonProperty("responseMessage") -private String responseMessage; - -@JsonProperty("dictionaryJson") -public DictionaryJson getDictionaryJson() { -return dictionaryJson; - } - -@JsonProperty("dictionaryJson") -public void setDictionaryJson(DictionaryJson dictionaryJson) { -this.dictionaryJson = dictionaryJson; - } - -public AllowedTreatments withDictionaryJson(DictionaryJson dictionaryJson) { -this.dictionaryJson = dictionaryJson; -return this; - } - -@JsonProperty("dictionaryData") -public Object getDictionaryData() { -return dictionaryData; - } - -@JsonProperty("dictionaryData") -public void setDictionaryData(Object dictionaryData) { -this.dictionaryData = dictionaryData; - } - -public AllowedTreatments withDictionaryData(Object dictionaryData) { -this.dictionaryData = dictionaryData; -return this; - } - -@JsonProperty("responseCode") -public Integer getResponseCode() { -return responseCode; - } - -@JsonProperty("responseCode") -public void setResponseCode(Integer responseCode) { -this.responseCode = responseCode; - } - -public AllowedTreatments withResponseCode(Integer responseCode) { -this.responseCode = responseCode; -return this; - } - -@JsonProperty("responseMessage") -public String getResponseMessage() { -return responseMessage; - } - -@JsonProperty("responseMessage") -public void setResponseMessage(String responseMessage) { -this.responseMessage = responseMessage; - } - -public AllowedTreatments withResponseMessage(String responseMessage) { -this.responseMessage = responseMessage; -return this; - } - -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java deleted file mode 100644 index 382b27a04b..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"valueType", -"string", -"chars" -}) -public class Bbid { - -@JsonProperty("valueType") -private String valueType; -@JsonProperty("string") -private String string; -@JsonProperty("chars") -private String chars; - -@JsonProperty("valueType") -public String getValueType() { -return valueType; - } - -@JsonProperty("valueType") -public void setValueType(String valueType) { -this.valueType = valueType; - } - -public Bbid withValueType(String valueType) { -this.valueType = valueType; -return this; - } - -@JsonProperty("string") -public String getString() { -return string; - } - -@JsonProperty("string") -public void setString(String string) { -this.string = string; - } - -public Bbid withString(String string) { -this.string = string; -return this; - } - -@JsonProperty("chars") -public String getChars() { -return chars; - } - -@JsonProperty("chars") -public void setChars(String chars) { -this.chars = chars; - } - -public Bbid withChars(String chars) { -this.chars = chars; -return this; - } - -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java deleted file mode 100644 index 655f71f823..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "ServiceType", "VNFType", "BB_ID", "WorkStep", "ErrorCode" }) -public class DecisionAttributes { - - @JsonProperty("ServiceType") - private String serviceType; - @JsonProperty("VNFType") - private String VNFType; - @JsonProperty("BB_ID") - private String BBID; - @JsonProperty("WorkStep") - private String workStep; - @JsonProperty("ErrorCode") - private String errorCode; - - @JsonProperty("ServiceType") - public String getServiceType() { - return serviceType; - } - - @JsonProperty("ServiceType") - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty("VNFType") - public String getVNFType() { - return VNFType; - } - - @JsonProperty("VNFType") - public void setVNFType(String vNFType) { - this.VNFType = vNFType; - } - - @JsonProperty("BB_ID") - public String getBBID() { - return BBID; - } - - @JsonProperty("BB_ID") - public void setBBID(String bBID) { - this.BBID = bBID; - } - - @JsonProperty("WorkStep") - public String getWorkStep() { - return workStep; - } - - @JsonProperty("WorkStep") - public void setWorkStep(String workStep) { - this.workStep = workStep; - } - - @JsonProperty("ErrorCode") - public String getErrorCode() { - return errorCode; - } - - @JsonProperty("ErrorCode") - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java deleted file mode 100644 index 1ecf3366c7..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"id", -"bbid", -"workstep", -"treatments" -}) -public class DictionaryData { - -@JsonProperty("id") -private Id id; -@JsonProperty("bbid") -private Bbid bbid; -@JsonProperty("workstep") -private Workstep workstep; -@JsonProperty("treatments") -private Treatments treatments; - -@JsonProperty("id") -public Id getId() { -return id; - } - -@JsonProperty("id") -public void setId(Id id) { -this.id = id; - } - -public DictionaryData withId(Id id) { -this.id = id; -return this; - } - -@JsonProperty("bbid") -public Bbid getBbid() { -return bbid; - } - -@JsonProperty("bbid") -public void setBbid(Bbid bbid) { -this.bbid = bbid; - } - -public DictionaryData withBbid(Bbid bbid) { -this.bbid = bbid; -return this; - } - -@JsonProperty("workstep") -public Workstep getWorkstep() { -return workstep; - } - -@JsonProperty("workstep") -public void setWorkstep(Workstep workstep) { -this.workstep = workstep; - } - -public DictionaryData withWorkstep(Workstep workstep) { -this.workstep = workstep; -return this; - } - -@JsonProperty("treatments") -public Treatments getTreatments() { -return treatments; - } - -@JsonProperty("treatments") -public void setTreatments(Treatments treatments) { -this.treatments = treatments; - } - -public DictionaryData withTreatments(Treatments treatments) { -this.treatments = treatments; -return this; - } - -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java deleted file mode 100644 index d37d0c6f13..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "dictionaryType", "dictionary" }) -public class DictionaryItemsRequest { - - @JsonProperty("dictionary") - private String dictionary; - @JsonProperty("dictionaryType") - private String dictionaryType; - - @JsonProperty("dictionary") - public String getDictionary() { - return dictionary; - } - - @JsonProperty("dictionary") - public void setDictionary(String dictionary) { - this.dictionary = dictionary; - } - - @JsonProperty("dictionaryType") - public String getDictionaryType() { - return dictionaryType; - } - - @JsonProperty("dictionaryType") - public void setDictionaryType(String dictionaryType) { - this.dictionaryType = dictionaryType; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java deleted file mode 100644 index b6a95ae12a..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"DictionaryDatas" -}) -public class DictionaryJson { - -@JsonProperty("DictionaryDatas") -private List dictionaryDatas = new ArrayList(); - -@JsonProperty("DictionaryDatas") -public List getDictionaryDatas() { -return dictionaryDatas; - } - -@JsonProperty("DictionaryDatas") -public void setDictionaryDatas(List dictionaryDatas) { -this.dictionaryDatas = dictionaryDatas; - } - -public DictionaryJson withDictionaryDatas(List dictionaryDatas) { -this.dictionaryDatas = dictionaryDatas; -return this; - } - -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java deleted file mode 100644 index 728381a60b..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"integral", -"valueType" -}) -public class Id { - -@JsonProperty("integral") -private Boolean integral; -@JsonProperty("valueType") -private String valueType; - -@JsonProperty("integral") -public Boolean getIntegral() { -return integral; - } - -@JsonProperty("integral") -public void setIntegral(Boolean integral) { -this.integral = integral; - } - -public Id withIntegral(Boolean integral) { -this.integral = integral; -return this; - } - -@JsonProperty("valueType") -public String getValueType() { -return valueType; - } - -@JsonProperty("valueType") -public void setValueType(String valueType) { -this.valueType = valueType; - } - -public Id withValueType(String valueType) { -this.valueType = valueType; -return this; - } - -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java deleted file mode 100644 index fbc8e23151..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "decision", "details" }) -public class PolicyDecision { - - @JsonProperty("decision") - private String decision; - @JsonProperty("details") - private String details; - - @JsonProperty("decision") - public String getDecision() { - return decision; - } - - @JsonProperty("decision") - public void setDecision(String decision) { - this.decision = decision; - } - - @JsonProperty("details") - public String getDetails() { - return details; - } - - @JsonProperty("details") - public void setDetails(String details) { - this.details = details; - } -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java deleted file mode 100644 index bc20b9c143..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" }) -public class PolicyDecisionRequest { - - @JsonProperty("decisionAttributes") - private DecisionAttributes decisionAttributes; - @JsonProperty("ecompcomponentName") - private String ecompcomponentName; - - @JsonProperty("decisionAttributes") - public DecisionAttributes getDecisionAttributes() { - return decisionAttributes; - } - - @JsonProperty("decisionAttributes") - public void setDecisionAttributes(DecisionAttributes decisionAttributes) { - this.decisionAttributes = decisionAttributes; - } - - @JsonProperty("ecompcomponentName") - public String getEcompcomponentName() { - return ecompcomponentName; - } - - @JsonProperty("ecompcomponentName") - public void setEcompcomponentName(String ecompcomponentName) { - this.ecompcomponentName = ecompcomponentName; - } - -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java deleted file mode 100644 index 01f6738947..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -public enum PolicyServiceType { - GET_CONFIG("getConfig"), - SEND_EVENT("sendEvent"), - PUSH_POLICY("pushPolicy"), - CREATE_POLICY("createPolicy"), - UPDATE_POLICY("updatePolicy"), - GET_DECISION("getDecision"), - GET_METRICS("getMetrics"), - DELETE_POLICY("deletePolicy"), - LIST_CONFIG("listConfig"), - CREATE_DICTIONARY_ITEM("createDictionaryItem"), - UPDATE_DICTIONARY_ITEM("updateDictionaryItem"), - GET_DICTIONARY_ITEMS("getDictionaryItems"); - - private final String name; - - PolicyServiceType(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - -} diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java deleted file mode 100644 index 13af8932aa..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"valueType", -"string", -"chars" -}) -public class Treatments { - -@JsonProperty("valueType") -private String valueType; -@JsonProperty("string") -private String string; -@JsonProperty("chars") -private String chars; - -@JsonProperty("valueType") -public String getValueType() { -return valueType; - } - -@JsonProperty("valueType") -public void setValueType(String valueType) { -this.valueType = valueType; - } - -public Treatments withValueType(String valueType) { -this.valueType = valueType; -return this; - } - -@JsonProperty("string") -public String getString() { -return string; - } - -@JsonProperty("string") -public void setString(String string) { -this.string = string; - } - -public Treatments withString(String string) { -this.string = string; -return this; - } - -@JsonProperty("chars") -public String getChars() { -return chars; - } - -@JsonProperty("chars") -public void setChars(String chars) { -this.chars = chars; - } - -public Treatments withChars(String chars) { -this.chars = chars; -return this; - } - -} \ No newline at end of file diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java b/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java deleted file mode 100644 index 9d2adfe2c0..0000000000 --- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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.mso.client.policy.entities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"valueType", -"string", -"chars" -}) -public class Workstep { - -@JsonProperty("valueType") -private String valueType; -@JsonProperty("string") -private String string; -@JsonProperty("chars") -private String chars; - -@JsonProperty("valueType") -public String getValueType() { -return valueType; - } - -@JsonProperty("valueType") -public void setValueType(String valueType) { -this.valueType = valueType; - } - -public Workstep withValueType(String valueType) { -this.valueType = valueType; -return this; - } - -@JsonProperty("string") -public String getString() { -return string; - } - -@JsonProperty("string") -public void setString(String string) { -this.string = string; - } - -public Workstep withString(String string) { -this.string = string; -return this; - } - -@JsonProperty("chars") -public String getChars() { -return chars; - } - -@JsonProperty("chars") -public void setChars(String chars) { -this.chars = chars; - } - -public Workstep withChars(String chars) { -this.chars = chars; -return this; - } - -} -- cgit 1.2.3-korg