diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
7 files changed, 329 insertions, 37 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java index 446de10ee2..e43af18ceb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java @@ -129,7 +129,7 @@ public class BpmnRestClient { if(encryptedCredentials != null) {
String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY);
if(userCredentials != null) {
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java new file mode 100644 index 0000000000..1cddc54f43 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java @@ -0,0 +1,317 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.bpmn.common.recipe;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+/**
+ * the inputs for the resource recipe
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Beijing Release 2018-03-08
+ */
+@JsonPropertyOrder({"resourceInstanceName", "resourceInstanceDes", "globalSubscriberId", "serviceType", "serviceId", "operationId", "resourceType","resourceCustomizationUuid"})
+@JsonRootName("variables")
+public class ResourceInput {
+
+ @JsonProperty("resourceInstanceName")
+ private String resourceInstanceName;
+
+ @JsonProperty("resourceInstanceDes")
+ private String resourceInstanceDes;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("serviceType")
+ private String serviceType;
+
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+
+ @JsonProperty("operationId")
+ private String operationId;
+
+ //for create resource
+ @JsonProperty("resourceInvariantUuid")
+ private String resourceInvariantUuid;
+
+ //for create resource
+ @JsonProperty("resourceUuid")
+ private String resourceUuid;
+
+ //for create resource
+ @JsonProperty("resourceCustomizationUuid")
+ private String resourceCustomizationUuid;
+
+ //for delete resource
+ @JsonProperty("resourceInstancenUuid")
+ private String resourceInstancenUuid;
+
+ @JsonProperty("resourceParameters")
+ private String resourceParameters;
+
+ @JsonProperty("operationType")
+ private String operationType;
+
+
+ /**
+ * @return Returns the resourceInstanceName.
+ */
+ @JsonProperty("resourceInstanceName")
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+
+ /**
+ * @param resourceInstanceName The resourceInstanceName to set.
+ */
+ @JsonProperty("resourceInstanceName")
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+
+ /**
+ * @return Returns the resourceInstanceDes.
+ */
+ @JsonProperty("resourceInstanceDes")
+ public String getResourceInstanceDes() {
+ return resourceInstanceDes;
+ }
+
+
+ /**
+ * @param resourceInstanceDes The resourceInstanceDes to set.
+ */
+ @JsonProperty("resourceInstanceDes")
+ public void setResourceInstanceDes(String resourceInstanceDes) {
+ this.resourceInstanceDes = resourceInstanceDes;
+ }
+
+
+ /**
+ * @return Returns the globalSubscriberId.
+ */
+ @JsonProperty("globalSubscriberId")
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+
+ /**
+ * @param globalSubscriberId The globalSubscriberId to set.
+ */
+ @JsonProperty("globalSubscriberId")
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+
+ /**
+ * @return Returns the serviceType.
+ */
+ @JsonProperty("serviceType")
+ public String getServiceType() {
+ return serviceType;
+ }
+
+
+ /**
+ * @param serviceType The serviceType to set.
+ */
+ @JsonProperty("serviceType")
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+
+ /**
+ * @return Returns the serviceId.
+ */
+ @JsonProperty("serviceInstanceId")
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+
+ /**
+ * @param serviceId The serviceId to set.
+ */
+ @JsonProperty("serviceInstanceId")
+ public void setServiceInstanceId(String serviceId) {
+ this.serviceInstanceId = serviceId;
+ }
+
+
+ /**
+ * @return Returns the operationId.
+ */
+ @JsonProperty("operationId")
+ public String getOperationId() {
+ return operationId;
+ }
+
+
+ /**
+ * @param operationId The operationId to set.
+ */
+ @JsonProperty("operationId")
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+
+
+ /**
+ * @return Returns the resourceInvariantUuid.
+ */
+ @JsonProperty("resourceInvariantUuid")
+ public String getResourceInvariantUuid() {
+ return resourceInvariantUuid;
+ }
+
+
+
+ /**
+ * @param resourceInvariantUuid The resourceInvariantUuid to set.
+ */
+ @JsonProperty("resourceInvariantUuid")
+ public void setResourceInvariantUuid(String resourceInvariantUuid) {
+ this.resourceInvariantUuid = resourceInvariantUuid;
+ }
+
+
+
+ /**
+ * @return Returns the resourceUuid.
+ */
+ @JsonProperty("resourceUuid")
+ public String getResourceUuid() {
+ return resourceUuid;
+ }
+
+
+
+ /**
+ * @param resourceUuid The resourceUuid to set.
+ */
+ @JsonProperty("resourceUuid")
+ public void setResourceUuid(String resourceUuid) {
+ this.resourceUuid = resourceUuid;
+ }
+
+
+ /**
+ * @return Returns the resourceCustomizationUuid.
+ */
+ @JsonProperty("resourceCustomizationUuid")
+ public String getResourceCustomizationUuid() {
+ return resourceCustomizationUuid;
+ }
+
+
+ /**
+ * @param resourceCustomizationUuid The resourceCustomizationUuid to set.
+ */
+ @JsonProperty("resourceCustomizationUuid")
+ public void setResourceCustomizationUuid(String resourceCustomizationUuid) {
+ this.resourceCustomizationUuid = resourceCustomizationUuid;
+ }
+
+
+ /**
+ * @return Returns the resourceParameters.
+ */
+ @JsonProperty("resourceParameters")
+ public String getResourceParameters() {
+ return resourceParameters;
+ }
+
+
+ /**
+ * @param resourceParameters The resourceParameters to set.
+ */
+ @JsonProperty("resourceParameters")
+ public void setResourceParameters(String resourceParameters) {
+ this.resourceParameters = resourceParameters;
+ }
+
+
+ /**
+ * @return Returns the operationType.
+ */
+ @JsonProperty("operationType")
+ public String getOperationType() {
+ return operationType;
+ }
+
+
+ /**
+ * @param operationType The operationType to set.
+ */
+ @JsonProperty("operationType")
+ public void setOperationType(String operationType) {
+ this.operationType = operationType;
+ }
+
+
+
+ /**
+ * @return Returns the resourceInstancenUuid.
+ */
+ @JsonProperty("resourceInstancenUuid")
+ public String getResourceInstancenUuid() {
+ return resourceInstancenUuid;
+ }
+
+
+
+ /**
+ * @param resourceInstancenUuid The resourceInstancenUuid to set.
+ */
+ @JsonProperty("resourceInstancenUuid")
+ public void setResourceInstancenUuid(String resourceInstancenUuid) {
+ this.resourceInstancenUuid = resourceInstancenUuid;
+ }
+
+ @Override
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ String jsonStr = "";
+ try {
+ jsonStr = mapper.writeValueAsString(this);
+ } catch(JsonProcessingException e) {
+
+ e.printStackTrace();
+ }
+ return jsonStr;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java index 5972c76c41..846b87aba8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java @@ -38,11 +38,10 @@ public class CryptoUtils { public static final String AES = "AES";
/**
- * encrypt a value and generate a keyfile
+ * encrypt a value and generate a keyfile
* if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * @throws IOException
- */
+ * @throws GeneralSecurityException
+ * */
public static String encrypt(String value, String keyString) throws GeneralSecurityException
{
SecretKeySpec sks = getSecretKeySpec(keyString);
@@ -53,9 +52,8 @@ public class CryptoUtils { }
/**
- * decrypt a value
+ * decrypt a value
* @throws GeneralSecurityException
- * @throws IOException
*/
public static String decrypt(String message, String keyString) throws GeneralSecurityException
{
@@ -96,23 +94,5 @@ public class CryptoUtils { return b;
}
- /**
- * Not Used...
- *
- * Call Rttp utility jar to encrypt pwd
- * @param clearPassword
- * @return
- * @throws GeneralSecurityException
- * @throws Exception
- *
- public static String encryptRttpPwd(String clearPassword) throws GeneralSecurityException {
- try {
- return RttpBasicAuth.encrypt(clearPassword);
- } catch (Exception e) {
- // wrap generic exception
- throw new GeneralSecurityException(e);
- }
- }
- */
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java index 765bf61c49..f7db52b1c0 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java @@ -71,7 +71,7 @@ public class ApplicationControllerSupport { } /** - * @param inputClass + * @param action * @return * @throws ClassNotFoundException * @throws InstantiationException diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java index 74b1c3f802..1436d83a94 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/RestClient.java @@ -157,14 +157,9 @@ public abstract class RestClient { } client.register(this.getMapper()); Optional<ClientResponseFilter> responseFilter = this.addResponseFilter(); - if (responseFilter.isPresent()) { - client.register(responseFilter.get()); - } - if (!path.isPresent()) { - webTarget = client.target(host.toString()); - } else { - webTarget = client.target(UriBuilder.fromUri(host + path.get().toString())); - } + responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter)); + webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString()))) + .orElseGet(() -> client.target(host.toString())); this.accept = MediaType.APPLICATION_JSON; this.contentType = MediaType.APPLICATION_JSON; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java index b5ab63ce35..01f6738947 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java @@ -36,7 +36,7 @@ public enum PolicyServiceType { private final String name; - private PolicyServiceType(String name) { + PolicyServiceType(String name) { this.name = name; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java index c746c0d448..df30e43822 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java @@ -27,8 +27,8 @@ public interface SDNOValidator { /** * Issues a health diagnostic request for a given vnf to SDN-O * - * @param vnfName - * @param uuid + * @param vnfId + * @param requestingUserId * @throws IOException * @throws Exception */ |