diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java/org/openecomp')
106 files changed, 0 insertions, 12532 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.java deleted file mode 100644 index 5a0de6f5e9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/PayloadClient.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.bpmn.appc.payload; - -import org.openecomp.mso.bpmn.appc.payload.beans.*; - -import java.util.Optional; - -import com.fasterxml.jackson.core.JsonProcessingException; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class PayloadClient { - - protected static ObjectMapper mapper = new ObjectMapper(); - - - public static Optional<String> upgradeFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ - UpgradeAction payloadResult = new UpgradeAction(); - ConfigurationParametersUpgrade configParams = new ConfigurationParametersUpgrade(); - String payloadString = payload.get(); - String existingSoftware = JsonUtils.getJsonValue(payloadString, "existing-software-version"); - String newSoftware = JsonUtils.getJsonValue(payloadString, "new-software-version"); - configParams.setExistingSoftwareVersion(existingSoftware); - configParams.setNewSoftwareVersion(newSoftware); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> resumeTrafficFormat(String vnfName) throws JsonProcessingException{ - ResumeTrafficAction payloadResult = new ResumeTrafficAction(); - ConfigurationParametersResumeTraffic configParams = new ConfigurationParametersResumeTraffic(); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> quiesceTrafficFormat(Optional<String> payload, String vnfName) throws JsonProcessingException{ - QuiesceTrafficAction payloadResult = new QuiesceTrafficAction(); - ConfigurationParametersQuiesce configParams = new ConfigurationParametersQuiesce(); - String payloadString = payload.get(); - String operationsTimeout = JsonUtils.getJsonValue(payloadString, "operations-timeout"); - configParams.setOperationsTimeout(operationsTimeout); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> startStopFormat(String aicIdentity) throws JsonProcessingException{ - StartStopAction payloadResult = new StartStopAction(); - payloadResult.setAICIdentity(aicIdentity); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{ - HealthCheckAction payloadResult = new HealthCheckAction(); - RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); - ConfigurationParametersHealthCheck configParams = new ConfigurationParametersHealthCheck(); - requestParams.setVnfName(vnfName); - configParams.setVnfName(vnfName); - payloadResult.setConfigurationParameters(configParams); - payloadResult.setRequestParameters(requestParams); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - public static Optional<String> snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{ - SnapshotAction payloadResult = new SnapshotAction(); - payloadResult.setVmId(vmId); - payloadResult.setIdentityUrl(identityUrl); - return Optional.of(mapper.writeValueAsString(payloadResult)); - } - - /*public Optional<String> verifySnapshotFormat(Optional<String> payload) throws Exception, JsonProcessingException, JsonMappingException{ - final Snapshot check = mapper.readValue(payload.get(), Snapshot.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional<String> verifyUpgradeFormat(Optional<String> payload) throws Exception, JsonProcessingException, JsonMappingException{ - final UpdateCheck check = mapper.readValue(payload.get(), UpdateCheck.class); - return Optional.of(mapper.writeValueAsString(check)); - } - - public Optional<String> verifyQuiesceTrafficFormat(Optional<String> payload)throws Exception, JsonProcessingException, JsonMappingException{ - final QuiesceTraffic check = mapper.readValue(payload.get(), QuiesceTraffic.class); - return Optional.of(mapper.writeValueAsString(check)); - } - */ - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java deleted file mode 100644 index 09ad2bf439..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigModifyAction.java +++ /dev/null @@ -1,59 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"request-parameters",
-"configuration-parameters"
-})
-public class ConfigModifyAction {
-
-@JsonProperty("request-parameters")
-private RequestParametersConfigModify requestParameters;
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersConfigModify configurationParameters;
-
-@JsonProperty("request-parameters")
-public RequestParametersConfigModify getRequestParameters() {
-return requestParameters;
-}
-
-@JsonProperty("request-parameters")
-public void setRequestParameters(RequestParametersConfigModify requestParameters) {
-this.requestParameters = requestParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersConfigModify getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersConfigModify configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.java deleted file mode 100644 index dda7856168..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersConfigModify.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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"node0_hostname",
-"node0_backup_router_address"
-})
-public class ConfigurationParametersConfigModify {
-
-@JsonProperty("node0_hostname")
-private String node0Hostname;
-@JsonProperty("node0_backup_router_address")
-private String node0BackupRouterAddress;
-
-@JsonProperty("node0_hostname")
-public String getNode0Hostname() {
-return node0Hostname;
-}
-
-@JsonProperty("node0_hostname")
-public void setNode0Hostname(String node0Hostname) {
-this.node0Hostname = node0Hostname;
-}
-
-@JsonProperty("node0_backup_router_address")
-public String getNode0BackupRouterAddress() {
-return node0BackupRouterAddress;
-}
-
-@JsonProperty("node0_backup_router_address")
-public void setNode0BackupRouterAddress(String node0BackupRouterAddress) {
-this.node0BackupRouterAddress = node0BackupRouterAddress;
-}
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java deleted file mode 100644 index 000b1bdbf7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersHealthCheck.java +++ /dev/null @@ -1,45 +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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf_name" -}) -public class ConfigurationParametersHealthCheck { - -@JsonProperty("vnf_name") -private String vnfName; - -@JsonProperty("vnf_name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf_name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java deleted file mode 100644 index e354d9ca2e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersQuiesce.java +++ /dev/null @@ -1,59 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name",
-"operations_timeout"
-})
-public class ConfigurationParametersQuiesce {
-
-@JsonProperty("vnf_name")
-private String vnfName;
-@JsonProperty("operations_timeout")
-private String operationsTimeout;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-
-@JsonProperty("operations_timeout")
-public String getOperationsTimeout() {
-return operationsTimeout;
-}
-
-@JsonProperty("operations_timeout")
-public void setOperationsTimeout(String operationsTimeout) {
-this.operationsTimeout = operationsTimeout;
-}
-
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java deleted file mode 100644 index 820618e828..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersResumeTraffic.java +++ /dev/null @@ -1,45 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name"
-})
-public class ConfigurationParametersResumeTraffic {
-
-@JsonProperty("vnf_name")
-private String vnfName;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java deleted file mode 100644 index 0845e7c37d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ConfigurationParametersUpgrade.java +++ /dev/null @@ -1,71 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf_name",
-"existing-software-version",
-"new-software-version"
-})
-public class ConfigurationParametersUpgrade {
-@JsonProperty("vnf_name")
-private String vnfName;
-@JsonProperty("existing-software-version")
-private String existingSoftwareVersion;
-@JsonProperty("new-software-version")
-private String newSoftwareVersion;
-
-@JsonProperty("vnf_name")
-public String getVnfName() {
-return vnfName;
-}
-
-@JsonProperty("vnf_name")
-public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
-}
-
-@JsonProperty("existing-software-version")
-public String getExistingSoftwareVersion() {
-return existingSoftwareVersion;
-}
-
-@JsonProperty("existing-software-version")
-public void setExistingSoftwareVersion(String existingSoftwareVersion) {
-this.existingSoftwareVersion = existingSoftwareVersion;
-}
-
-@JsonProperty("new-software-version")
-public String getNewSoftwareVersion() {
-return newSoftwareVersion;
-}
-
-@JsonProperty("new-software-version")
-public void setNewSoftwareVersion(String newSoftwareVersion) {
-this.newSoftwareVersion = newSoftwareVersion;
-}
-
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java deleted file mode 100644 index 53408f1ead..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/HealthCheckAction.java +++ /dev/null @@ -1,59 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"request-parameters",
-"configuration-parameters"
-})
-public class HealthCheckAction {
-
-@JsonProperty("request-parameters")
-private RequestParametersHealthCheck requestParameters;
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersHealthCheck configurationParameters;
-
-@JsonProperty("request-parameters")
-public RequestParametersHealthCheck getRequestParameters() {
-return requestParameters;
-}
-
-@JsonProperty("request-parameters")
-public void setRequestParameters(RequestParametersHealthCheck requestParameters) {
-this.requestParameters = requestParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersHealthCheck getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersHealthCheck configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java deleted file mode 100644 index cbe8ee0b91..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/QuiesceTrafficAction.java +++ /dev/null @@ -1,46 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
-public class QuiesceTrafficAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersQuiesce configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersQuiesce getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersQuiesce configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java deleted file mode 100644 index 41b3314e7c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersConfigModify.java +++ /dev/null @@ -1,46 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vnf-host-ip-address"
-})
-public class RequestParametersConfigModify {
-
-@JsonProperty("vnf-host-ip-address")
-private String vnfHostIpAddress;
-
-@JsonProperty("vnf-host-ip-address")
-public String getVnfHostIpAddress() {
-return vnfHostIpAddress;
-}
-
-@JsonProperty("vnf-host-ip-address")
-public void setVnfHostIpAddress(String vnfHostIpAddress) {
-this.vnfHostIpAddress = vnfHostIpAddress;
-}
-
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java deleted file mode 100644 index dcdb4fb71e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/RequestParametersHealthCheck.java +++ /dev/null @@ -1,47 +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.bpmn.appc.payload.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ -"vnf-name" -}) -public class RequestParametersHealthCheck { - -@JsonProperty("vnf-name") -private String vnfName; - - -@JsonProperty("vnf-name") -public String getVnfName() { -return vnfName; -} - -@JsonProperty("vnf-name") -public void setVnfName(String vnfName) { -this.vnfName = vnfName; -} - -}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java deleted file mode 100644 index de4fe25cd7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/ResumeTrafficAction.java +++ /dev/null @@ -1,45 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
-public class ResumeTrafficAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersResumeTraffic configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersResumeTraffic getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersResumeTraffic configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java deleted file mode 100644 index bb74798300..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/SnapshotAction.java +++ /dev/null @@ -1,59 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"vm-id",
-"identity-url"
-})
-public class SnapshotAction {
-
-@JsonProperty("vm-id")
-private String vmId;
-@JsonProperty("identity-url")
-private String identityUrl;
-
-@JsonProperty("vm-id")
-public String getVmId() {
-return vmId;
-}
-
-@JsonProperty("vm-id")
-public void setVmId(String vmId) {
-this.vmId = vmId;
-}
-
-@JsonProperty("identity-url")
-public String getIdentityUrl() {
-return identityUrl;
-}
-
-@JsonProperty("identity-url")
-public void setIdentityUrl(String identityUrl) {
-this.identityUrl = identityUrl;
-}
-
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java deleted file mode 100644 index 988c282076..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/StartStopAction.java +++ /dev/null @@ -1,55 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- " AICIdentity "
-})
-public class StartStopAction {
-
- @JsonProperty(" AICIdentity ")
- private String aICIdentity;
-
- @JsonProperty(" AICIdentity ")
- public String getAICIdentity() {
- return aICIdentity;
- }
-
- @JsonProperty(" AICIdentity ")
- public void setAICIdentity(String aICIdentity) {
- this.aICIdentity = aICIdentity;
- } - - public String getaICIdentity() { - return aICIdentity; - } - - public void setaICIdentity(String aICIdentity) { - this.aICIdentity = aICIdentity; - } - -
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java deleted file mode 100644 index 3486fa73ba..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/appc/payload/beans/UpgradeAction.java +++ /dev/null @@ -1,45 +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.bpmn.appc.payload.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"configuration-parameters"
-})
-public class UpgradeAction {
-
-@JsonProperty("configuration-parameters")
-private ConfigurationParametersUpgrade configurationParameters;
-
-@JsonProperty("configuration-parameters")
-public ConfigurationParametersUpgrade getConfigurationParameters() {
-return configurationParameters;
-}
-
-@JsonProperty("configuration-parameters")
-public void setConfigurationParameters(ConfigurationParametersUpgrade configurationParameters) {
-this.configurationParameters = configurationParameters;
-}
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java deleted file mode 100644 index 67109d5578..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java +++ /dev/null @@ -1,139 +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.bpmn.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String requestId; - @XmlElement(name = "ResponseCode", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected String responseMessage; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java deleted file mode 100644 index 1835fbe41c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java +++ /dev/null @@ -1,91 +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.bpmn.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link RequestHeader }
- *
- */
- public RequestHeader createRequestHeader() {
- return new RequestHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterResponse }
- *
- */
- public SDNCAdapterResponse createSDNCAdapterResponse() {
- return new SDNCAdapterResponse();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterCallbackRequest }
- *
- */
- public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() {
- return new SDNCAdapterCallbackRequest();
- }
-
- /**
- * Create an instance of {@link CallbackHeader }
- *
- */
- public CallbackHeader createCallbackHeader() {
- return new CallbackHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterRequest }
- *
- */
- public SDNCAdapterRequest createSDNCAdapterRequest() {
- return new SDNCAdapterRequest();
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java deleted file mode 100644 index 12f2fef668..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java +++ /dev/null @@ -1,223 +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.bpmn.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "svcInstanceId",
- "svcAction",
- "svcOperation",
- "callbackUrl",
- "msoAction"
-})
-@XmlRootElement(name = "RequestHeader")
-public class RequestHeader {
-
- @XmlElement(name = "RequestId", required = true)
- protected String requestId;
- @XmlElement(name = "SvcInstanceId")
- protected String svcInstanceId;
- @XmlElement(name = "SvcAction", required = true)
- protected String svcAction;
- @XmlElement(name = "SvcOperation", required = true)
- protected String svcOperation;
- @XmlElement(name = "CallbackUrl", required = true)
- protected String callbackUrl;
- @XmlElement(name = "MsoAction")
- protected String msoAction;
-
- /**
- * Gets the value of the requestId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRequestId() {
- return requestId;
- }
-
- /**
- * Sets the value of the requestId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRequestId(String value) {
- this.requestId = value;
- }
-
- /**
- * Gets the value of the svcInstanceId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
-
- /**
- * Sets the value of the svcInstanceId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcInstanceId(String value) {
- this.svcInstanceId = value;
- }
-
- /**
- * Gets the value of the svcAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcAction() {
- return svcAction;
- }
-
- /**
- * Sets the value of the svcAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcAction(String value) {
- this.svcAction = value;
- }
-
- /**
- * Gets the value of the svcOperation property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcOperation() {
- return svcOperation;
- }
-
- /**
- * Sets the value of the svcOperation property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcOperation(String value) {
- this.svcOperation = value;
- }
-
- /**
- * Gets the value of the callbackUrl property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- /**
- * Sets the value of the callbackUrl property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCallbackUrl(String value) {
- this.callbackUrl = value;
- }
-
- /**
- * Gets the value of the msoAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMsoAction() {
- return msoAction;
- }
-
- /**
- * Sets the value of the msoAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMsoAction(String value) {
- this.msoAction = value;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 8c9d4e2a50..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,130 +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.bpmn.common.adapter.sdnc; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData", required=false, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") - protected Object requestData; - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - StringWriter writer = new StringWriter(); - try { - JAXBContext context = JAXBContext - .newInstance(SDNCAdapterCallbackRequest.class); - Marshaller m = context.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(this, writer); - return writer.getBuffer().toString(); - } catch (JAXBException e) { - return ""; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java deleted file mode 100644 index 1043b48944..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java +++ /dev/null @@ -1,111 +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.bpmn.common.adapter.sdnc; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java deleted file mode 100644 index 34e68d68ef..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java +++ /dev/null @@ -1,51 +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.bpmn.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "")
-@XmlRootElement(name = "SDNCAdapterResponse")
-public class SDNCAdapterResponse {
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java deleted file mode 100644 index c2f68ff6a4..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.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.bpmn.common.adapter.sdnc; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.4-b01 - * Generated source version: 2.2 - * - */ -@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - - /** - * - * @param sdncAdapterCallbackRequest - * @return - * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse - */ - @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java deleted file mode 100644 index 42f4ce374f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java +++ /dev/null @@ -1,22 +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========================================================= - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.bpmn.common.adapter.sdnc; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java deleted file mode 100644 index 1b5c080045..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java +++ /dev/null @@ -1,462 +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.bpmn.common.adapter.vnf; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for createVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="createVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="outputs" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "createVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "vnfId", - "outputs", - "rollback" -}) -public class CreateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected String vnfId; - protected CreateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link CreateVnfNotification.Outputs } - * - */ - public void setOutputs(CreateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List<CreateVnfNotification.Outputs.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link CreateVnfNotification.Outputs.Entry } - * - * - */ - public List<CreateVnfNotification.Outputs.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - // Not a generated method - @Override - public String toString() { - StringBuilder out = new StringBuilder(); - out.append("<outputs>\n"); - if (entry != null) { - for (Entry e : entry) { - out.append(e.toString()); - out.append('\n'); - } - } - out.append("</outputs>"); - return out.toString(); - } - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - - } - - // Not a generated method - @Override - public String toString() { - String entrystr; - entrystr = - "<entry>"+ '\n' + - " <key>"+key+"</key>" + '\n' + - " <value>"+value+"</value>" + '\n' + - "</entry>"; - return entrystr; - } - - } - - } - - // Not a generated method - @Override - public String toString() { - String createVnfNotification; - if (exception==null) { - createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <vnfId>"+vnfId+"</vnfId>" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " <rollback>"+rollback+"</rollback>" + '\n' + - "</ns2:createVnfNotification>"; - } else { - createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - (outputs == null ? "" : outputs.toString() + '\n') + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:createVnfNotification>"; - } - return createVnfNotification; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java deleted file mode 100644 index 651fd1aca7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java +++ /dev/null @@ -1,198 +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.bpmn.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for deleteVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="deleteVnfNotification">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
-public class DeleteVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Overrides toString() method
- * @return String type (deleteVnfNotification)
- */
-
- @Override
- public String toString() {
- String deleteVnfNotification;
- if (exception == null) {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:deleteVnfNotification>";
- } else {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:deleteVnfNotification>";
- }
- return deleteVnfNotification;
- }
-
-/*
- public String toString() {
- StringWriter writer = new StringWriter();
- try {
- JAXBContext context = JAXBContext
- .newInstance(DeleteVnfNotification.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(this, writer);
- //System.out.println("toString() - " + writer.getBuffer().toString());
- return writer.getBuffer().toString();
- } catch (JAXBException e) {
- //System.out.println("JAXBException - " + e.getStackTrace());
- return "";
- }
- }
-*/
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java deleted file mode 100644 index 02dc1edcb7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java +++ /dev/null @@ -1,61 +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.bpmn.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for msoExceptionCategory.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="msoExceptionCategory">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * <enumeration value="OPENSTACK"/>
- * <enumeration value="IO"/>
- * <enumeration value="INTERNAL"/>
- * <enumeration value="USERDATA"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-@XmlType(name = "msoExceptionCategory")
-@XmlEnum
-public enum MsoExceptionCategory {
-
- OPENSTACK,
- IO,
- INTERNAL,
- USERDATA;
-
- public String value() {
- return name();
- }
-
- public static MsoExceptionCategory fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java deleted file mode 100644 index eabd465934..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java +++ /dev/null @@ -1,112 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for msoRequest complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="msoRequest"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "msoRequest", propOrder = { - "requestId", - "serviceInstanceId" -}) -public class MsoRequest { - - protected String requestId; - protected String serviceInstanceId; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the serviceInstanceId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * Sets the value of the serviceInstanceId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceInstanceId(String value) { - this.serviceInstanceId = value; - } - - @Override - public String toString() { - return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId - + "</serviceInstanceId>"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java deleted file mode 100644 index c22fd286cf..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java +++ /dev/null @@ -1,208 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.vnf.async.client package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _RollbackVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "rollbackVnfNotification"); - private final static QName _DeleteVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "deleteVnfNotification"); - private final static QName _CreateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "createVnfNotification"); - private final static QName _UpdateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "updateVnfNotification"); - private final static QName _QueryVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "queryVnfNotification"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.vnf.async.client - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link UpdateVnfNotification } - * - */ - public UpdateVnfNotification createUpdateVnfNotification() { - return new UpdateVnfNotification(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() { - return new UpdateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link QueryVnfNotification } - * - */ - public QueryVnfNotification createQueryVnfNotification() { - return new QueryVnfNotification(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs } - * - */ - public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() { - return new QueryVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link CreateVnfNotification } - * - */ - public CreateVnfNotification createCreateVnfNotification() { - return new CreateVnfNotification(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs } - * - */ - public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() { - return new CreateVnfNotification.Outputs(); - } - - /** - * Create an instance of {@link DeleteVnfNotification } - * - */ - public DeleteVnfNotification createDeleteVnfNotification() { - return new DeleteVnfNotification(); - } - - /** - * Create an instance of {@link RollbackVnfNotification } - * - */ - public RollbackVnfNotification createRollbackVnfNotification() { - return new RollbackVnfNotification(); - } - - /** - * Create an instance of {@link MsoRequest } - * - */ - public MsoRequest createMsoRequest() { - return new MsoRequest(); - } - - /** - * Create an instance of {@link VnfRollback } - * - */ - public VnfRollback createVnfRollback() { - return new VnfRollback(); - } - - /** - * Create an instance of {@link UpdateVnfNotification.Outputs.Entry } - * - */ - public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() { - return new UpdateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link QueryVnfNotification.Outputs.Entry } - * - */ - public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() { - return new QueryVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link CreateVnfNotification.Outputs.Entry } - * - */ - public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() { - return new CreateVnfNotification.Outputs.Entry(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "rollbackVnfNotification") - public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) { - return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "deleteVnfNotification") - public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) { - return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "createVnfNotification") - public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) { - return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "updateVnfNotification") - public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) { - return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "queryVnfNotification") - public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) { - return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java deleted file mode 100644 index 4e84234c81..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java +++ /dev/null @@ -1,488 +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.bpmn.common.adapter.vnf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for queryVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="queryVnfNotification">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/>
- * <element name="outputs" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="entry" maxOccurs="unbounded" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfExists",
- "vnfId",
- "status",
- "outputs"
-})
-public class QueryVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected Boolean vnfExists;
- protected String vnfId;
- protected VnfStatus status;
- protected QueryVnfNotification.Outputs outputs;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the vnfExists property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean isVnfExists() {
- return vnfExists;
- }
-
- /**
- * Sets the value of the vnfExists property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setVnfExists(Boolean value) {
- this.vnfExists = value;
- }
-
- /**
- * Gets the value of the vnfId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getVnfId() {
- return vnfId;
- }
-
- /**
- * Sets the value of the vnfId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setVnfId(String value) {
- this.vnfId = value;
- }
-
- /**
- * Gets the value of the status property.
- *
- * @return
- * possible object is
- * {@link VnfStatus }
- *
- */
- public VnfStatus getStatus() {
- return status;
- }
-
- /**
- * Sets the value of the status property.
- *
- * @param value
- * allowed object is
- * {@link VnfStatus }
- *
- */
- public void setStatus(VnfStatus value) {
- this.status = value;
- }
-
- /**
- * Gets the value of the outputs property.
- *
- * @return
- * possible object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public QueryVnfNotification.Outputs getOutputs() {
- return outputs;
- }
-
- /**
- * Sets the value of the outputs property.
- *
- * @param value
- * allowed object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public void setOutputs(QueryVnfNotification.Outputs value) {
- this.outputs = value;
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="entry" maxOccurs="unbounded" minOccurs="0">
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </element>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
- public static class Outputs {
-
- protected List<QueryVnfNotification.Outputs.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link QueryVnfNotification.Outputs.Entry }
- *
- *
- */
- public List<QueryVnfNotification.Outputs.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<>();
- }
- return this.entry;
- }
-
- // Not a generated method
- public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- // Not a generated method
- public String toString() {
- String entry = "";
- entry =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entry;
- }
-
- }
-
- }
-
- // Not a generated method
- public String toString() {
- String queryVnfNotification = "";
- if (exception==null) {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- " <status>"+status+"</status>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- "</ns2:queryVnfNotification>";
- } else {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:queryVnfNotification>";
- }
- return queryVnfNotification;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java deleted file mode 100644 index 0cf088d023..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java +++ /dev/null @@ -1,175 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for rollbackVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="rollbackVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rollbackVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage" -}) -public class RollbackVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - public String toString() { - String rollbackVnfNotification = ""; - if (exception==null) { - rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - "</ns2:rollbackVnfNotification>"; - } else { - rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:rollbackVnfNotification>"; - } - return rollbackVnfNotification; - - } - - } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java deleted file mode 100644 index 79188e77b6..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java +++ /dev/null @@ -1,412 +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.bpmn.common.adapter.vnf; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for updateVnfNotification complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="updateVnfNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="outputs" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateVnfNotification1", propOrder = { - "messageId", - "completed", - "exception", - "errorMessage", - "outputs", - "rollback" -}) -public class UpdateVnfNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected UpdateVnfNotification.Outputs outputs; - protected VnfRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return - * possible object is - * {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value - * allowed object is - * {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the outputs property. - * - * @return - * possible object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public UpdateVnfNotification.Outputs getOutputs() { - return outputs; - } - - /** - * Sets the value of the outputs property. - * - * @param value - * allowed object is - * {@link UpdateVnfNotification.Outputs } - * - */ - public void setOutputs(UpdateVnfNotification.Outputs value) { - this.outputs = value; - } - - /** - * Gets the value of the rollback property. - * - * @return - * possible object is - * {@link VnfRollback } - * - */ - public VnfRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value - * allowed object is - * {@link VnfRollback } - * - */ - public void setRollback(VnfRollback value) { - this.rollback = value; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "entry" - }) - public static class Outputs { - - protected List<UpdateVnfNotification.Outputs.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a <CODE>set</CODE> method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link UpdateVnfNotification.Outputs.Entry } - * - * - */ - public List<UpdateVnfNotification.Outputs.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "key", - "value" - }) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - public String toString() { - String entry = ""; - entry = - " <key>"+key+"</key>" + '\n' + - " <value>"+value+"</value>"; - return entry; - } - } - - } - - public String toString(){ - String updateVnfNotification = ""; - if (exception==null) { - updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <rollback>"+rollback+"</rollback>" + '\n' + - "</ns2:updateVnfNotification>"; - } else { - updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' + - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' + - " <messageId>"+messageId+"</messageId>" + '\n' + - " <completed>"+completed+"</completed>" + '\n' + - " <exception>"+exception+"</exception>" + '\n' + - " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' + - "</ns2:updateVnfNotification>"; - } - - return updateVnfNotification; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java deleted file mode 100644 index d192bb34a9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java +++ /dev/null @@ -1,177 +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.bpmn.common.adapter.vnf; - -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.Action; -import javax.xml.ws.RequestWrapper; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface VnfAdapterNotify { - - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - - /** - * - * @param errorMessage - * @param vnfExists - * @param status - * @param exception - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfExists", targetNamespace = "") - Boolean vnfExists, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "status", targetNamespace = "") - VnfStatus status, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param vnfId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "vnfId", targetNamespace = "") - String vnfId, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param rollback - * @param outputs - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage, - @WebParam(name = "outputs", targetNamespace = "") - org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, - @WebParam(name = "rollback", targetNamespace = "") - VnfRollback rollback); - - /** - * - * @param errorMessage - * @param exception - * @param messageId - * @param completed - */ - @WebMethod - @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification( - @WebParam(name = "messageId", targetNamespace = "") - String messageId, - @WebParam(name = "completed", targetNamespace = "") - boolean completed, - @WebParam(name = "exception", targetNamespace = "") - MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") - String errorMessage); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java deleted file mode 100644 index 38385fbe9c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java +++ /dev/null @@ -1,108 +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.bpmn.common.adapter.vnf; - -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.2.8 - * Generated source version: 2.2 - * - */ -@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") -public class VnfAdapterNotify_Service extends Service -{ - - private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; - private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; - private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "vnfAdapterNotify"); - - static { - VNFADAPTERNOTIFY_WSDL_LOCATION = org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); - WebServiceException e = null; - if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { - e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); - } - VNFADAPTERNOTIFY_EXCEPTION = e; - } - - public VnfAdapterNotify_Service() { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(WebServiceFeature... features) { - super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { - super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns VnfAdapterNotify - */ - @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") - public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); - } - - private static URL __getWsdlLocation() { - if (VNFADAPTERNOTIFY_EXCEPTION!= null) { - throw VNFADAPTERNOTIFY_EXCEPTION; - } - return VNFADAPTERNOTIFY_WSDL_LOCATION; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java deleted file mode 100644 index a546b82325..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java +++ /dev/null @@ -1,210 +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.bpmn.common.adapter.vnf; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for vnfRollback complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="vnfRollback"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="msoRequest" type="{http://org.openecomp.mso/vnfNotify}msoRequest" minOccurs="0"/> - * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "vnfRollback", propOrder = { - "cloudSiteId", - "msoRequest", - "tenantCreated", - "tenantId", - "vnfCreated", - "vnfId" -}) -public class VnfRollback { - - protected String cloudSiteId; - protected MsoRequest msoRequest; - protected boolean tenantCreated; - protected String tenantId; - protected boolean vnfCreated; - protected String vnfId; - - /** - * Gets the value of the cloudSiteId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCloudSiteId() { - return cloudSiteId; - } - - /** - * Sets the value of the cloudSiteId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCloudSiteId(String value) { - this.cloudSiteId = value; - } - - /** - * Gets the value of the msoRequest property. - * - * @return - * possible object is - * {@link MsoRequest } - * - */ - public MsoRequest getMsoRequest() { - return msoRequest; - } - - /** - * Sets the value of the msoRequest property. - * - * @param value - * allowed object is - * {@link MsoRequest } - * - */ - public void setMsoRequest(MsoRequest value) { - this.msoRequest = value; - } - - /** - * Gets the value of the tenantCreated property. - * - */ - public boolean isTenantCreated() { - return tenantCreated; - } - - /** - * Sets the value of the tenantCreated property. - * - */ - public void setTenantCreated(boolean value) { - this.tenantCreated = value; - } - - /** - * Gets the value of the tenantId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTenantId() { - return tenantId; - } - - /** - * Sets the value of the tenantId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTenantId(String value) { - this.tenantId = value; - } - - /** - * Gets the value of the vnfCreated property. - * - */ - public boolean isVnfCreated() { - return vnfCreated; - } - - /** - * Sets the value of the vnfCreated property. - * - */ - public void setVnfCreated(boolean value) { - this.vnfCreated = value; - } - - /** - * Gets the value of the vnfId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getVnfId() { - return vnfId; - } - - /** - * Sets the value of the vnfId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setVnfId(String value) { - this.vnfId = value; - } - - public String toString() { - String msoRequestElement = msoRequest == null ? "" - : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n'; - - return - "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' + - msoRequestElement + - "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' + - "<tenantId>"+tenantId+"</tenantId>" + '\n' + - "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' + - "<vnfId>"+vnfId+"</vnfId>"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java deleted file mode 100644 index aef85470a7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java +++ /dev/null @@ -1,61 +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.bpmn.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for vnfStatus.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="vnfStatus">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * <enumeration value="ACTIVE"/>
- * <enumeration value="FAILED"/>
- * <enumeration value="NOTFOUND"/>
- * <enumeration value="UNKNOWN"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-@XmlType(name = "vnfStatus")
-@XmlEnum
-public enum VnfStatus {
-
- ACTIVE,
- FAILED,
- NOTFOUND,
- UNKNOWN;
-
- public String value() {
- return name();
- }
-
- public static VnfStatus fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java deleted file mode 100644 index c6ee6ca015..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java +++ /dev/null @@ -1,22 +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========================================================= - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp.mso/vnfNotify") -package org.openecomp.mso.bpmn.common.adapter.vnf; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java deleted file mode 100644 index 033c6876bd..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnIntegerParam.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============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; - -public class BpmnIntegerParam { - - @JsonProperty("value") - private int value; - @JsonProperty("type") - private final String type = "Integer"; - - public BpmnIntegerParam() { - } - - @JsonProperty("value") - public int getValue() { - return value; - } - - @JsonProperty("type") - public void setValue(int value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + Integer.toString(value) + ", type=" + type + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java deleted file mode 100644 index 4b58b51560..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnParam.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============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; - -/** - * The bpmn workflow input param object - */ -public class BpmnParam { - - @JsonProperty("value") - private String value; - @JsonProperty("type") - private String type = "String"; - - - public BpmnParam() { - /* Empty constructor */ - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "CamundaInput [value=" + value + ", type=" + type + "]"; - } - -} 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 deleted file mode 100644 index 6a17d600cb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/BpmnRestClient.java +++ /dev/null @@ -1,224 +0,0 @@ -/*-
- * ============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 java.io.IOException;
-import java.security.GeneralSecurityException;
-
-import javax.xml.bind.DatatypeConverter;
-
-import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.utils.CryptoUtils;
-
-/**
- * Support to call resource recipes from the BPMN workflow.
- * Such as call resource recipe in service workflow.
- * <br>
- * <p>
- * </p>
- *
- * @author
- * @version ONAP Beijing Release 2018-02-27
- */
-public class BpmnRestClient {
-
- public static final String DEFAULT_BPEL_AUTH = "admin:admin";
-
- public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
-
- public static final String CONTENT_TYPE_JSON = "application/json";
-
- public static final String CAMUNDA_AUTH = "camundaAuth";
-
- private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
-
- private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static boolean noProperties = true;
-
- //because for NS it will take a long time the time out of the resouce will be 2 hours.
- private static final String DEFAULT_TIME_OUT = "7200";
-
- public synchronized static MsoJavaProperties loadMsoProperties() {
- MsoJavaProperties msoProperties;
- try {
- msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_APIHANDLER_INFRA);
- } catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError,
- "Exception when loading MSO Properties", e);
- return null;
- }
-
- if(msoProperties != null && msoProperties.size() > 0) {
- noProperties = false;
- msoLogger.info(MessageEnum.APIH_PROPERTY_LOAD_SUC, "", "");
- return msoProperties;
- } else {
- msoLogger.error(MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError,
- "No MSO APIH_INFRA Properties found");
- return null;
- }
- }
-
- public synchronized static final boolean getNoPropertiesState() {
- return noProperties;
- }
-
- /**
- * post the recipe Uri
- * <br>
- *
- * @param recipeUri The request recipe uri
- * @param requestId the request id
- * @param recipeTimeout The recipe time out
- * @param requestAction The request action
- * @param serviceInstanceId The service instance id
- * @param serviceType The service Type
- * @param requestDetails The request Details, these information is from runtime
- * @param recipeParamXsd The recipe params, its from recipe design
- * @return The response of the recipe.
- * @throws ClientProtocolException
- * @throws IOException
- * @since ONAP Beijing Release
- */
- public static HttpResponse post(String recipeUri, String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType,
- String requestDetails, String recipeParamXsd) throws ClientProtocolException, IOException {
-
- HttpClient client = HttpClientBuilder.create().build();
-
- HttpPost post = new HttpPost(recipeUri);
- MsoJavaProperties props = loadMsoProperties();
- msoLogger.debug("call the bpmn, url:" + recipeUri);
- String jsonReq = wrapResourceRequest(requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, requestDetails, recipeParamXsd);
-
- StringEntity input = new StringEntity(jsonReq);
- input.setContentType(CONTENT_TYPE_JSON);
- String encryptedCredentials;
- if(props != null) {
- encryptedCredentials = props.getProperty(CAMUNDA_AUTH, null);
- if(encryptedCredentials != null) {
- String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY);
- if(userCredentials != null) {
- post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()));
- }
- }
- }
- post.setEntity(input);
- return client.execute(post);
- }
-
- /**
- * prepare the resource recipe bpmn request.
- * <br>
- *
- * @param requestId
- * @param recipeTimeout
- * @param requestAction
- * @param serviceInstanceId
- * @param serviceType
- * @param requestDetails
- * @param recipeParams
- * @return
- * @since ONAP Beijing Release
- */
- private static String wrapResourceRequest(String requestId, int recipeTimeout, String requestAction, String serviceInstanceId, String serviceType,
- String requestDetails, String recipeParams) {
- String jsonReq = null;
- if(requestId == null) {
- requestId = "";
- }
- if(requestAction == null) {
- requestAction = "";
- }
- if(serviceInstanceId == null) {
- serviceInstanceId = "";
- }
-
- if(requestDetails == null) {
- requestDetails = "";
- }
-
- try {
- ResourceRecipeRequest recipeRequest = new ResourceRecipeRequest();
- BpmnParam resourceInput = new BpmnParam();
- BpmnParam host = new BpmnParam();
- BpmnParam requestIdInput = new BpmnParam();
- BpmnParam requestActionInput = new BpmnParam();
- BpmnParam serviceInstanceIdInput = new BpmnParam();
- BpmnParam serviceTypeInput = new BpmnParam();
- BpmnParam recipeParamsInput = new BpmnParam();
- BpmnParam recipeTimeoutInput = new BpmnParam();
- recipeTimeoutInput.setValue(DEFAULT_TIME_OUT);
- // host.setValue(parseURL());
- requestIdInput.setValue(requestId);
- requestActionInput.setValue(requestAction);
- serviceInstanceIdInput.setValue(serviceInstanceId);
- serviceTypeInput.setValue(serviceType);
- recipeParamsInput.setValue(recipeParams);
- resourceInput.setValue(requestDetails);
- recipeRequest.setHost(host);
- recipeRequest.setRequestId(requestIdInput);
- recipeRequest.setRequestAction(requestActionInput);
- recipeRequest.setServiceInstanceId(serviceInstanceIdInput);
- recipeRequest.setServiceType(serviceTypeInput);
- recipeRequest.setRecipeParams(recipeParamsInput);
- recipeRequest.setResourceInput(resourceInput);
- recipeRequest.setRecipeTimeout(recipeTimeoutInput);
- jsonReq = recipeRequest.toString();
- msoLogger.debug("request body is " + jsonReq);
- } catch(Exception e) {
- msoLogger.error(MessageEnum.APIH_WARP_REQUEST, "Camunda", "wrapVIDRequest", MsoLogger.ErrorCode.BusinessProcesssError, "Error in APIH Warp request",
- e);
- }
- return jsonReq;
- }
-
- /**
- * <br>
- *
- * @param prop
- * @param defaultValue
- * @param encryptionKey
- * @return
- * @since ONAP Beijing Release
- */
- protected static String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) {
- try {
- return CryptoUtils.decrypt(prop, encryptionKey);
- } catch(GeneralSecurityException e) {
- msoLogger.debug("Security exception", e);
- }
- return defaultValue;
- }
-
-}
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 deleted file mode 100644 index 42547faa1e..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceInput.java +++ /dev/null @@ -1,295 +0,0 @@ -/*- - * ============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 org.openecomp.mso.bpmn.core.domain.ModelInfo; -import org.openecomp.mso.logger.MsoLogger; - -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", "serviceModelInfo","resourceModelInfo", "resourceInstancenUuid","resourceParameters","operationType"}) -@JsonRootName("variables") -public class ResourceInput { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); - - @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; - - @JsonProperty("serviceModelInfo") - private ModelInfo serviceModelInfo; - - @JsonProperty("resourceModelInfo") - private ModelInfo resourceModelInfo; - - //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 serviceModelInfo. - */ - @JsonProperty("serviceModelInfo") - public ModelInfo getServiceModelInfo() { - return serviceModelInfo; - } - - - - /** - * @param serviceModelInfo The serviceModelInfo to set. - */ - @JsonProperty("serviceModelInfo") - public void setServiceModelInfo(ModelInfo serviceModelInfo) { - this.serviceModelInfo = serviceModelInfo; - } - - - - /** - * @return Returns the resourceModelInfo. - */ - @JsonProperty("resourceModelInfo") - public ModelInfo getResourceModelInfo() { - return resourceModelInfo; - } - - - - /** - * @param resourceModelInfo The resourceModelInfo to set. - */ - @JsonProperty("resourceModelInfo") - public void setResourceModelInfo(ModelInfo resourceModelInfo) { - this.resourceModelInfo = resourceModelInfo; - } - - - /** - * @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, false); - String jsonStr = ""; - try { - jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); - } - return jsonStr; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java deleted file mode 100644 index 3ec43e10ae..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/recipe/ResourceRecipeRequest.java +++ /dev/null @@ -1,159 +0,0 @@ -/*- - * ============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 org.openecomp.mso.logger.MsoLogger; - -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; - -/** - * java object of the resource recipe , it - * will be passed to the Camunda process - */ -@JsonPropertyOrder({"resourceInput", "host", "requestId", "requestAction", "serviceInstanceId", "serviceType", "recipeParams"}) -@JsonRootName("variables") -public class ResourceRecipeRequest { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); - - @JsonProperty("resourceInput") - private BpmnParam resourceInput; - - @JsonProperty("host") - private BpmnParam host; - - @JsonProperty("mso-request-id") - private BpmnParam requestId; - - @JsonProperty("requestAction") - private BpmnParam requestAction; - - @JsonProperty("serviceInstanceId") - private BpmnParam serviceInstanceId; - - @JsonProperty("serviceType") - private BpmnParam serviceType; - - @JsonProperty("recipeParams") - private BpmnParam recipeParams; - - @JsonProperty("mso-service-request-timeout") - private BpmnParam recipeTimeout; - - @JsonProperty("resourceInput") - public BpmnParam getResourceInput() { - return resourceInput; - } - - @JsonProperty("resourceInput") - public void setResourceInput(BpmnParam resourceInput) { - this.resourceInput = resourceInput; - } - - @JsonProperty("host") - public BpmnParam getHost() { - return host; - } - - @JsonProperty("host") - public void setHost(BpmnParam host) { - this.host = host; - } - - @JsonProperty("mso-request-id") - public BpmnParam getRequestId() { - return requestId; - } - - @JsonProperty("mso-request-id") - public void setRequestId(BpmnParam requestId) { - this.requestId = requestId; - } - - @JsonProperty("requestAction") - public BpmnParam getRequestAction() { - return requestAction; - } - - @JsonProperty("requestAction") - public void setRequestAction(BpmnParam requestAction) { - this.requestAction = requestAction; - } - - @JsonProperty("serviceInstanceId") - public BpmnParam getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty("serviceInstanceId") - public void setServiceInstanceId(BpmnParam serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - @JsonProperty("serviceType") - public BpmnParam getServiceType() { - return serviceType; - } - - @JsonProperty("serviceType") - public void setServiceType(BpmnParam serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty("recipeParams") - public BpmnParam getRecipeParams() { - return recipeParams; - } - - @JsonProperty("recipeParams") - public void setRecipeParams(BpmnParam recipeParams) { - this.recipeParams = recipeParams; - } - - @JsonProperty("mso-service-request-timeout") - public BpmnParam getRecipeTimeout() { - return recipeTimeout; - } - - @JsonProperty("mso-service-request-timeout") - public void setRecipeTimeout(BpmnParam recipeTimeout) { - this.recipeTimeout = recipeTimeout; - } - - @Override - public String toString() { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - String jsonStr = "ResourceRecipeRequest"; - try { - jsonStr = mapper.writeValueAsString(this); - } catch(JsonProcessingException e) { - msoLogger.error("JsonProcessingException", e); - } - return jsonStr; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java deleted file mode 100644 index d1ec60a1cd..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/resource/ResourceRequestBuilder.java +++ /dev/null @@ -1,227 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.bpmn.common.resource; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import javax.ws.rs.core.Response; - -import org.camunda.bpm.engine.runtime.Execution; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; -import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; -import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; -import org.onap.sdc.toscaparser.api.NodeTemplate; -import org.onap.sdc.toscaparser.api.Property; -import org.onap.sdc.toscaparser.api.functions.GetInput; -import org.onap.sdc.toscaparser.api.parameters.Input; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -public class ResourceRequestBuilder { - - public static String CUSTOMIZATION_UUID = "customizationUUID"; - - public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - - static JsonUtils jsonUtil = new JsonUtils(); - - /** - * build the resource Parameters detail. - * It's a json string for resource instantiant - * { - * "locationConstraints":[...] - * "requestInputs":{K,V} - * } - * <br> - * - * @param execution Execution context - * @param serviceUuid The service template uuid - * @param resourceCustomizationUuid The resource customization uuid - * @param serviceParameters the service parameters passed from the API - * @return the resource instantiate parameters - * @since ONAP Beijing Release - */ - @SuppressWarnings("unchecked") - public static String buildResourceRequestParameters(Execution execution, String serviceUuid, String resourceCustomizationUuid, String serviceParameters) { - List<String> resourceList = jsonUtil.StringArrayToList(execution, (String)JsonUtils.getJsonValue(serviceParameters, "resources")); - //Get the right location str for resource. default is an empty array. - String locationConstraints ="[]"; - String resourceInputsFromUui = ""; - for(String resource: resourceList){ - String resCusUuid = (String)JsonUtils.getJsonValue(resource, "resourceCustomizationUuid"); - if(resourceCustomizationUuid.equals(resCusUuid)){ - String resourceParameters = JsonUtils.getJsonValue(resource, "parameters"); - locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); - resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs"); - } - } - Map<String, Object> serviceInput = null; - if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) { - serviceInput = getJsonObject((String)JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class); - } - - Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class); - - if (serviceInput == null) { - serviceInput = new HashMap(); - } - - if (resourceInputsFromUuiMap == null) { - resourceInputsFromUuiMap = new HashMap(); - } - - try { - Map<String, Object> resourceInputsFromServiceDeclaredLevel = buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput); - resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel); - } catch(SdcToscaParserException e) { - LOGGER.error("SdcToscaParserException", e); - } - String resourceInputsStr = getJsonString(resourceInputsFromUuiMap); - String result = "{\n" - + "\"locationConstraints\":" + locationConstraints +",\n" - + "\"requestInputs\":" + resourceInputsStr +"\n" - +"}"; - return result; - } - - public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid, Map<String, Object> serviceInputs) - throws SdcToscaParserException { - - Map<String, Object> resouceRequest = new HashMap<>(); - String csarpath = null; - try { - csarpath = getCsarFromUuid(serviceUuid); - } catch(Exception e) { - LOGGER.debug("csar file is not available for service uuid:" + serviceUuid, e); - return resouceRequest; - } - - SdcToscaParserFactory toscaParser = SdcToscaParserFactory.getInstance(); - ISdcCsarHelper iSdcCsarHelper = toscaParser.getSdcCsarHelper(csarpath, false); - - List<Input> serInput = iSdcCsarHelper.getServiceInputs(); - Optional<NodeTemplate> nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream() - .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)).findFirst(); - - if(nodeTemplateOpt.isPresent()) { - NodeTemplate nodeTemplate = nodeTemplateOpt.get(); - LinkedHashMap<String, Property> resourceProperties = nodeTemplate.getProperties(); - - for(String key : resourceProperties.keySet()) { - Property property = resourceProperties.get(key); - - Object value = getValue(property.getValue(), serviceInputs, serInput); - resouceRequest.put(key, value); - } - } - return resouceRequest; - } - - private static Object getValue(Object value, Map<String, Object> serviceInputs, List<Input> servInputs) { - if(value instanceof Map) { - Map<String, Object> valueMap = new HashMap<>(); - - Map<String, Object> propertyMap = (Map<String, Object>)value; - - for(String key : propertyMap.keySet()) { - valueMap.put(key, getValue(propertyMap.get(key), serviceInputs, servInputs)); - } - return valueMap; // return if the value is nested hashmap - } else if(value instanceof GetInput) { - String inputName = ((GetInput)value).getInputName(); - - if(serviceInputs.get(inputName) != null) { - value = serviceInputs.get(inputName); - } else { - for(Input input : servInputs) { - if(input.getName().equals(inputName)) { - return input.getDefault(); // return default value - } - } - } - } - return value; // return property value - } - - private static String getCsarFromUuid(String uuid) throws Exception { - - ResteasyClient client = new ResteasyClientBuilder().build(); - Map<String, String> properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - String catalogEndPoint = properties.get("mso.catalog.db.endpoint"); - ResteasyWebTarget target = client.target(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid); - Response response = target.request().get(); - String value = response.readEntity(String.class); - - HashMap<String, String> map = new Gson().fromJson(value, new TypeToken<HashMap<String, String>>() {}.getType()); - - File csarFile = new File(System.getProperty("mso.config.path") + "ASDC/" + map.get("name")); - - if(!csarFile.exists()) { - throw new Exception("csar file does not exist."); - } - - return csarFile.getAbsolutePath(); - } - - public static <T> T getJsonObject(String jsonstr, Class<T> type) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - try { - return mapper.readValue(jsonstr, type); - } catch(IOException e) { - LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "fail to unMarshal json", e); - } - return null; - } - - public static String getJsonString(Object srcObj) { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - String jsonStr = null; - try { - jsonStr = mapper.writeValueAsString(srcObj); - } catch(JsonProcessingException e) { - LOGGER.error("SdcToscaParserException", e); - } - return jsonStr; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java deleted file mode 100644 index 13cff65018..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 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.util;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import org.openecomp.mso.logger.MsoLogger;
-import java.util.Properties;
-
-public class CryptoHandler implements ICryptoHandler {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
- private static String msoAaiEncryptedPwd;
-
- @Override
- public String getMsoAaiPassword() {
- Properties keyProp = new Properties ();
- try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties"));
- msoAaiEncryptedPwd =(String) keyProp.get ("mso.AaiEncrypted.Pwd");
- return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
- } catch (GeneralSecurityException | IOException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
-
- @Override
- public String encryptMsoPassword(String plainMsoPwd) {
- try {
- return CryptoUtils.encrypt(plainMsoPwd, msoKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
- @Override
- public String decryptMsoPassword(String encryptedPwd) {
- try {
- return CryptoUtils.decrypt(encryptedPwd, msoKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("GeneralSecurityException :",e);
- return null;
- }
- }
-
-}
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 deleted file mode 100644 index 846b87aba8..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ /dev/null @@ -1,98 +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.bpmn.common.util;
-
-
-import java.security.GeneralSecurityException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
-//Need to add BPM error handler
-
-/**
- * CryptoUtils adapted from RTTP client.
- *
- */
-public class CryptoUtils {
-
- public static final String AES = "AES";
-
- /**
- * encrypt a value and generate a keyfile
- * if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * */
- public static String encrypt(String value, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.ENCRYPT_MODE, sks, cipher.getParameters());
- byte[] encrypted = cipher.doFinal(value.getBytes());
- return byteArrayToHexString(encrypted);
- }
-
- /**
- * decrypt a value
- * @throws GeneralSecurityException
- */
- public static String decrypt(String message, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.DECRYPT_MODE, sks);
- byte[] decrypted = cipher.doFinal(hexStringToByteArray(message));
- return new String(decrypted);
- }
-
- private static SecretKeySpec getSecretKeySpec(String keyString) throws NoSuchAlgorithmException
- {
- byte [] key = hexStringToByteArray(keyString);
- SecretKeySpec sks = new SecretKeySpec(key, CryptoUtils.AES);
- return sks;
- }
-
-
- private static String byteArrayToHexString(byte[] b){
- StringBuilder sb = new StringBuilder(b.length * 2);
- for (byte aB : b) {
- int v = aB & 0xff;
- if (v < 16) {
- sb.append('0');
- }
- sb.append(Integer.toHexString(v));
- }
- return sb.toString().toUpperCase();
- }
-
- private static byte[] hexStringToByteArray(String s) {
- byte[] b = new byte[s.length() / 2];
- for (int i = 0; i < b.length; i++){
- int index = i * 2;
- int v = Integer.parseInt(s.substring(index, index + 2), 16);
- b[i] = (byte)v;
- }
- return b;
- }
-
-}
-
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java deleted file mode 100644 index acf92f5aa8..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java +++ /dev/null @@ -1,27 +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.bpmn.common.util;
-
-public interface ICryptoHandler {
- public String getMsoAaiPassword();
- public String encryptMsoPassword(String plainPwd);
- public String decryptMsoPassword(String encryptedPwd);
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java deleted file mode 100644 index f61c692775..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java +++ /dev/null @@ -1,421 +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.bpmn.common.workflow.service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.OptimisticLockingException;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.Execution;
-import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Abstract base class for callback services.
- */
-public abstract class AbstractCallbackService extends ProcessEngineAwareService {
- public static final long DEFAULT_TIMEOUT_SECONDS = 60;
- public static final long FAST_POLL_DUR_SECONDS = 5;
- public static final long FAST_POLL_INT_MS = 100;
- public static final long SLOW_POLL_INT_MS = 1000;
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker) {
-
- return handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker, null);
- }
-
- /**
- * Parameterized callback handler.
- */
- protected CallbackResult handleCallback(String method, Object message,
- String messageEventName, String messageVariable,
- String correlationVariable, String correlationValue,
- String logMarker, Map<String, Object> injectedVariables) {
-
- long startTime = System.currentTimeMillis();
-
- LOGGER.debug(logMarker + " " + method + " received message: "
- + (message == null ? "" : System.lineSeparator()) + message);
-
- try {
- Map<String, Object> variables = new HashMap<>();
-
- if (injectedVariables != null) {
- variables.putAll(injectedVariables);
- }
-
- variables.put(correlationVariable, correlationValue);
- variables.put(messageVariable, message == null ? null : message.toString());
-
- boolean ok = correlate(messageEventName, correlationVariable,
- correlationValue, variables, logMarker);
-
- if (!ok) {
- String msg = "No process is waiting for " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
-
- logCallbackSuccess(method, startTime);
- return new CallbackSuccess();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- String msg = "Caught " + e.getClass().getSimpleName()
- + " processing " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'";
- logCallbackError(method, startTime, msg);
- return new CallbackError(msg);
- }
- }
-
- /**
- * Performs message correlation. Waits a limited amount of time for
- * a process to become ready for correlation. The return value indicates
- * whether or not a process was found to receive the message. Due to the
- * synchronous nature of message injection in Camunda, by the time this
- * method returns, one of 3 things will have happened: (1) the process
- * received the message and ended, (2) the process received the message
- * and reached an activity that suspended, or (3) an exception occurred
- * during correlation or while the process was executing. Correlation
- * exceptions are handled differently from process execution exceptions.
- * Correlation exceptions are thrown so the client knows something went
- * wrong with the delivery of the message. Process execution exceptions
- * are logged but not thrown.
- * @param messageEventName the message event name
- * @param correlationVariable the process variable used as the correlator
- * @param correlationValue the correlation value
- * @param variables variables to inject into the process
- * @param logMarker a marker for debug logging
- * @return true if a process could be found, false if not
- * @throws Exception for correlation errors
- */
- protected boolean correlate(String messageEventName, String correlationVariable,
- String correlationValue, Map<String, Object> variables, String logMarker)
- throws Exception {
- try{
- LOGGER.debug(logMarker + " Attempting to find process waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'");
-
- RuntimeService runtimeService =
- getProcessEngineServices().getRuntimeService();
-
- Map<String, String> properties =
- PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
-
- long timeout = DEFAULT_TIMEOUT_SECONDS;
-
- // The code is here in case we ever need to change the default.
- String s = properties.get("mso.correlation.timeout");
- if (s != null) {
- try {
- timeout = Long.parseLong(s);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- long now = System.currentTimeMillis();
- long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
- long endTime = now + (timeout * 1000);
- long sleep = FAST_POLL_INT_MS;
-
- List<Execution> waitingProcesses = null;
- Exception queryException = null;
- int queryCount = 0;
- int queryFailCount = 0;
-
- while (true) {
- try {
- ++queryCount;
- waitingProcesses = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName(messageEventName)
- .processVariableValueEquals(correlationVariable, correlationValue)
- .list();
- } catch (Exception e) {
- ++queryFailCount;
- queryException = e;
- }
-
- if (waitingProcesses != null && waitingProcesses.size() > 0) {
- break;
- }
-
- if (now > endTime - sleep) {
- break;
- }
-
- Thread.sleep(sleep);
- now = System.currentTimeMillis();
-
- if (now > fastPollEndTime) {
- sleep = SLOW_POLL_INT_MS;
- }
- }
-
- if (waitingProcesses == null) {
- waitingProcesses = new ArrayList<Execution>(0);
- }
-
- int count = waitingProcesses.size();
-
- List<ExecInfo> execInfoList = new ArrayList<>(count);
- for (Execution execution : waitingProcesses) {
- execInfoList.add(new ExecInfo(execution));
- }
-
- LOGGER.debug(logMarker + " Found " + count + " process(es) waiting"
- + " for " + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "': " + execInfoList);
-
- if (count == 0) {
- if (queryFailCount > 0) {
- String msg = queryFailCount + "/" + queryCount
- + " execution queries failed attempting to correlate "
- + messageEventName + " with " + correlationVariable
- + " = '" + correlationValue + "'; last exception was:"
- + queryException;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, queryException);
- }
-
- return false;
- }
-
- if (count > 1) {
- // Only one process should be waiting. Throw an exception back to the client.
- throw new MismatchingMessageCorrelationException(messageEventName,
- "more than 1 process is waiting with " + correlationVariable
- + " = '" + correlationValue + "'");
- }
-
- // We prototyped an asynchronous solution, i.e. resuming the process
- // flow in a separate thread, but this affected too many existing tests,
- // and we went back to the synchronous solution. The synchronous solution
- // has some troublesome characteristics though. For example, the
- // resumed flow may send request #2 to a remote system before MSO has
- // acknowledged the notification associated with request #1.
-
- try {
- LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
- + messageEventName + " with " + correlationVariable + " = '"
- + correlationValue + "'");
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
-
- } catch (MismatchingMessageCorrelationException e) {
- // A correlation exception occurred even after we identified
- // one waiting process. Throw it back to the client.
- throw e;
- } catch (OptimisticLockingException ole) {
-
- String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + ole;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, ole);
-
- //Retry for OptimisticLocking Exceptions
- int retryCount = 0;
- String retryStr = properties.get("mso.bpmn.optimisticlockingexception.retrycount");
- if (retryStr != null) {
- try {
- retryCount = Integer.parseInt(retryStr);
- } catch (NumberFormatException e) {
- // Ignore
- }
- }
-
- LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount);
-
- for (; retryCount >0 ; retryCount--) {
-
- try{
- Thread.sleep(SLOW_POLL_INT_MS);
-
- @SuppressWarnings("unused")
- MessageCorrelationResult result = runtimeService
- .createMessageCorrelation(messageEventName)
- .setVariables(variables)
- .processInstanceVariableEquals(correlationVariable, correlationValue)
- .correlateWithResult();
- retryCount = 0;
- LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount);
- } catch (OptimisticLockingException olex) {
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, olex);
- } catch (Exception excep) {
- retryCount = 0;
- //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
- String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
- LOGGER.debug(strMsg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, strMsg, excep);
- }
-
- }
-
- }catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " running "
- + execInfoList.get(0) + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
- } catch (Exception e) {
- // This must be an exception from the flow itself. Log it, but don't
- // report it back to the client.
- String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName
- + " with " + correlationVariable + " = '" + correlationValue
- + "': " + e;
- LOGGER.debug(msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
-
- return true;
- }
-
- /**
- * Records audit and metric events in the log for a callback success.
- * @param method the method name
- * @param startTime the request start time
- */
- protected void logCallbackSuccess(String method, long startTime) {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- */
- protected void logCallbackError(String method, long startTime, String msg) {
- logCallbackError(method, startTime, msg, null);
- }
-
- /**
- * Records error, audit and metric events in the log for a callback
- * internal error.
- * @param method the method name
- * @param startTime the request start time
- * @param msg the error message
- * @param e the exception
- */
- protected void logCallbackError(String method, long startTime, String msg, Exception e) {
- if (e == null) {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg);
- } else {
- LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, e);
- }
-
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method);
-
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.InternalError, "Completed " + method,
- "BPMN", MsoLogger.getServiceName(), null);
- }
-
- /**
- * Abstract callback result object.
- */
- protected abstract class CallbackResult {
- }
-
- /**
- * Indicates that callback handling was successful.
- */
- protected class CallbackSuccess extends CallbackResult {
- }
-
- /**
- * Indicates that callback handling failed.
- */
- protected class CallbackError extends CallbackResult {
- private final String errorMessage;
-
- public CallbackError(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- /**
- * Gets the error message.
- */
- public String getErrorMessage() {
- return errorMessage;
- }
- }
-
- private static class ExecInfo {
- private final Execution execution;
-
- public ExecInfo(Execution execution) {
- this.execution = execution;
- }
-
- @Override
- public String toString() {
- return "Process[" + execution.getProcessInstanceId()
- + ":" + execution.getId() + "]";
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java deleted file mode 100644 index dbb6674a64..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/ProcessEngineAwareService.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 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.workflow.service; - -import java.util.Optional; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; - -/** - * Base class for services that must be process-engine aware. The only - * process engine currently supported is the "default" process engine. - */ -public class ProcessEngineAwareService { - - private final String processEngineName = "default"; - private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty(); - - /** - * Gets the process engine name. - * @return the process engine name - */ - public String getProcessEngineName() { - return processEngineName; - } - - /** - * Gets process engine services. - * @return process engine services - */ - public ProcessEngineServices getProcessEngineServices() { - return pes4junit.orElse(ProcessEngines.getProcessEngine( - getProcessEngineName())); - } - - /** - * Allows a particular process engine to be specified, overriding the - * usual process engine lookup by name. Intended primarily for the - * unit test environment. - * @param pes process engine services - */ - public void setProcessEngineServices4junit(ProcessEngineServices pes) { - pes4junit = Optional.ofNullable(pes); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java deleted file mode 100644 index c5f0d02dff..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ /dev/null @@ -1,83 +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.bpmn.common.workflow.service;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Implementation of SDNCAdapterCallbackService.
- */
-@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
-public class SDNCAdapterCallbackServiceImpl extends AbstractCallbackService implements SDNCCallbackAdapterPortType {
-
- private final String logMarker = "[SDNC-CALLBACK]";
-
- @Context WebServiceContext wsContext;
-
- @WebMethod(operationName = "SDNCAdapterCallback")
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
- public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
-
- String method = "sdncAdapterCallback";
- Object message = sdncAdapterCallbackRequest;
- String messageEventName = "sdncAdapterCallbackRequest";
- String messageVariable = "sdncAdapterCallbackRequest";
- String correlationVariable = "SDNCA_requestId";
- String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- CallbackResult result = handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, logMarker);
-
- if (result instanceof CallbackError) {
- return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
- } else {
- return new SDNCAdapterResponse();
- }
- }
-
- // This subclass allows unit tests to extract the error
- public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
- private String error;
-
- public SDNCAdapterErrorResponse(String error) {
- this.error = error;
- }
-
- public String getError() {
- return error;
- }
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java deleted file mode 100644 index 621e35e57d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java +++ /dev/null @@ -1,249 +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.bpmn.common.workflow.service;
-
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.Action;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.WebServiceContext;
-
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory;
-import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Implementation of the VnfAdapterNotify service.
- */
-@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify")
-public class VnfAdapterNotifyServiceImpl extends AbstractCallbackService implements VnfAdapterNotify{
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - - private final String logMarker = "[VNF-NOTIFY]";
-
- @Context WebServiceContext wsContext;
-
- @WebMethod(operationName = "rollbackVnfNotification")
- @Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification")
- @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") - public void rollbackVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
-
- rollbackVnfNotification.setMessageId(messageId);
- rollbackVnfNotification.setCompleted(completed);
- rollbackVnfNotification.setException(exception);
- rollbackVnfNotification.setErrorMessage(errorMessage);
-
- String method = "rollbackVnfNotification";
- Object message = rollbackVnfNotification;
- String messageEventName = "rollbackVnfNotificationCallback";
- String messageVariable = "rollbackVnfNotificationCallback";
- String correlationVariable = "VNFRB_messageId";
- String correlationValue = messageId;
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "queryVnfNotification")
- @Oneway
- @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") - public void queryVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfExists", targetNamespace = "")
- Boolean vnfExists,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "status", targetNamespace = "")
- VnfStatus status,
- @WebParam(name = "outputs", targetNamespace = "")
- QueryVnfNotification.Outputs outputs){
-
- String method = "queryVnfNotification";
- String messageEventName = "queryVnfNotificationCallback";
- String messageVariable = "queryVnfNotificationCallback";
- String correlationVariable = "VNFQ_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- QueryVnfNotification message = new QueryVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfExists(vnfExists);
- message.setVnfId(vnfId);
- message.setStatus(status);
- message.setOutputs(outputs);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "createVnfNotification")
- @Oneway
- @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") - public void createVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "outputs", targetNamespace = "")
- CreateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "createVnfNotification";
- String messageEventName = "createVnfNotificationCallback";
- String messageVariable = "createVnfNotificationCallback";
- String correlationVariable = "VNFC_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- CreateVnfNotification message = new CreateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setVnfId(vnfId);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "updateVnfNotification")
- @Oneway
- @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") - public void updateVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "outputs", targetNamespace = "")
- UpdateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- String method = "updateVnfNotification";
- String messageEventName = "updateVnfNotificationCallback";
- String messageVariable = "updateVnfNotificationCallback";
- String correlationVariable = "VNFU_messageId";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- UpdateVnfNotification message = new UpdateVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
- message.setOutputs(outputs);
- message.setRollback(rollback);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-
- @WebMethod(operationName = "deleteVnfNotification")
- @Oneway
- @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") - public void deleteVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- String method = "deleteVnfNotification";
- String messageEventName = "deleteVnfACallback";
- String messageVariable = "deleteVnfACallback";
- String correlationVariable = "VNFDEL_uuid";
- String correlationValue = messageId;
-
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlationValue, "N/A");
-
- DeleteVnfNotification message = new DeleteVnfNotification();
-
- message.setMessageId(messageId);
- message.setCompleted(completed);
- message.setException(exception);
- message.setErrorMessage(errorMessage);
-
- handleCallback(method, message, messageEventName, messageVariable,
- correlationVariable, correlationValue, logMarker);
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java deleted file mode 100644 index cd98860efe..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.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.bpmn.common.workflow.service; - -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.ProcessEngines; - - -public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { - - @Override - public String getProcessEngineName() { - return "default"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java deleted file mode 100644 index b4543b1445..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ /dev/null @@ -1,289 +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.bpmn.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.jboss.resteasy.annotations.Suspend;
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
-public class WorkflowAsyncResource extends ProcessEngineAwareService {
-
- private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- protected Optional<ProcessEngineServices> pes4junit = Optional.empty();
-
- private final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static final String logMarker = "[WRKFLOW-RESOURCE]";
- private static final long DEFAULT_WAIT_TIME = 30000; //default wait time
-
- /**
- * Asynchronous JAX-RS method that starts a process instance.
- * @param asyncResponse an object that will receive the asynchronous response
- * @param processKey the process key
- * @param variableMap input variables to the process
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public void startProcessInstanceByKey(final @Suspend(180000) AsynchronousResponse asyncResponse,
- @PathParam("processKey") String processKey, VariableMapImpl variableMap) {
-
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
- WorkflowContext workflowContext = null;
-
- try {
- inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- // This variable indicates that the flow was invoked asynchronously
- inputVariables.put("isAsyncProcess", "true");
-
- workflowContext = new WorkflowContext(processKey, getRequestId(inputVariables),
- asyncResponse, getWaitTime(inputVariables));
-
- msoLogger.debug("Adding the workflow context into holder: "
- + workflowContext.getProcessKey() + ":"
- + workflowContext.getRequestId() + ":"
- + workflowContext.getTimeout());
-
- contextHolder.put(workflowContext);
-
- ProcessThread processThread = new ProcessThread(processKey, inputVariables);
- processThread.start();
- } catch (Exception e) {
- setLogContext(processKey, inputVariables);
-
- if (workflowContext != null) {
- contextHolder.remove(workflowContext);
- }
-
- msoLogger.debug(logMarker + "Exception in startProcessInstance by key");
- WorkflowResponse response = new WorkflowResponse();
- response.setMessage("Fail" );
- response.setContent("Error occurred while executing the process: " + e);
- response.setMessageCode(500);
- recordEvents(processKey, response, startTime);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
- + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
-
- Response errorResponse = Response.serverError().entity(response).build();
- asyncResponse.setResponse(errorResponse);
- }
- }
-
- /**
- *
- * @version 1.0
- *
- */
- class ProcessThread extends Thread {
- private final String processKey;
- private final Map<String,Object> inputVariables;
-
- public ProcessThread(String processKey, Map<String, Object> inputVariables) {
- this.processKey = processKey;
- this.inputVariables = inputVariables;
- }
-
- public void run() {
-
- String processInstanceId = null;
- long startTime = System.currentTimeMillis();
-
- try {
- setLogContext(processKey, inputVariables);
-
- // Note: this creates a random businessKey if it wasn't specified.
- String businessKey = getBusinessKey(inputVariables);
-
- msoLogger.debug(logMarker + "***Received MSO startProcessInstanceByKey with processKey: "
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
- processKey, businessKey, inputVariables);
- processInstanceId = processInstance.getId();
-
- msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " +
- (processInstance.isEnded() ? "ENDED" : "RUNNING"));
- } catch (Exception e) {
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- logMarker + "Error in starting the process: "+ e.getMessage());
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setStatusCode(500);
- callbackResponse.setMessage("Fail");
- callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
- // TODO: is the processInstanceId used by the API handler? I don't think so.
- // It may be null here.
- WorkflowContextHolder.getInstance().processCallback(
- processKey, processInstanceId,
- getRequestId(inputVariables),
- callbackResponse);
- }
- }
- }
-
-
- /**
- * Callback resource which is invoked from BPMN to process to send the workflow response
- *
- * @param processKey
- * @param processInstanceId
- * @param requestId
- * @param callbackResponse
- * @return
- */
- @POST
- @Path("/services/callback/{processKey}/{processInstanceId}/{requestId}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response processWorkflowCallback(
- @PathParam("processKey") String processKey,
- @PathParam("processInstanceId") String processInstanceId,
- @PathParam("requestId")String requestId,
- WorkflowCallbackResponse callbackResponse) {
-
- msoLogger.debug(logMarker + "Process instance ID:" + processInstanceId + ":" + requestId + ":" + processKey + ":" + isProcessEnded(processInstanceId));
- msoLogger.debug(logMarker + "About to process the callback request:" + callbackResponse.getResponse() + ":" + callbackResponse.getMessage() + ":" + callbackResponse.getStatusCode());
- return contextHolder.processCallback(processKey, processInstanceId, requestId, callbackResponse);
- }
-
- private static String getOrCreate(Map<String, Object> inputVariables, String key) {
- String value = Objects.toString(inputVariables.get(key), null);
- if (value == null) {
- value = UUID.randomUUID().toString();
- inputVariables.put(key, value);
- }
- return value;
- }
-
- // Note: the business key is used to identify the process in unit tests
- private static String getBusinessKey(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-business-key");
- }
-
- private static String getRequestId(Map<String, Object> inputVariables) {
- return getOrCreate(inputVariables, "mso-request-id");
- }
-
- private long getWaitTime(Map<String, Object> inputVariables)
- {
-
- String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
-
- if (timeout != null) {
- try {
- return Long.parseLong(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
-
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response,
- long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + "for processKey: " + processKey + " with content: " + response.getContent());
-
- }
-
- private static void setLogContext(String processKey,
- Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
- }
- }
-
- private static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- if (inputVariables == null) {
- return "";
- }
-
- return Objects.toString(inputVariables.get(key), "N/A");
- }
-
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
- }
-
- private static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java deleted file mode 100644 index 25669d7625..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java +++ /dev/null @@ -1,52 +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.bpmn.common.workflow.service;
-
-/**
- * @version 1.0
- * Workflow Response bean to generate workflow response in JSON format
- */
-public class WorkflowCallbackResponse {
-
- private String response;
- private int statusCode;
- private String message;
-
- public String getResponse() {
- return response;
- }
- public void setResponse(String response) {
- this.response = response;
- }
- public int getStatusCode() {
- return statusCode;
- }
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java deleted file mode 100644 index fc0ba44974..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java +++ /dev/null @@ -1,96 +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.bpmn.common.workflow.service;
-
-import java.util.concurrent.Delayed;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.resteasy.spi.AsynchronousResponse;
-
-/**
- * @version 1.0
- * Workflow context object used to send timeout response, if workflow instance does not write the response in time
- */
-public class WorkflowContext implements Delayed {
- private final String processKey;
- private final String requestId;
- private final AsynchronousResponse asynchronousResponse;
- private final long startTime;
- private final long timeout;
-
- public WorkflowContext(String processKey, String requestId,
- AsynchronousResponse asynchronousResponse, long timeout) {
- this.processKey = processKey;
- this.requestId = requestId;
- this.asynchronousResponse = asynchronousResponse;
- this.timeout = timeout;
- this.startTime = System.currentTimeMillis();
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public String getProcessKey() {
- return processKey;
- }
-
- public AsynchronousResponse getAsynchronousResponse() {
- return asynchronousResponse;
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * Required implementation by Delay queue
- * Returns the elapsed time for this context
- */
- @Override
- public long getDelay(TimeUnit unit) {
- // 0 or negative means this object is considered to be expired
- return unit.convert(startTime + timeout - System.currentTimeMillis(), unit);
- }
-
- /**
- * Required implementation by Delay queue
- * Compares the object to determine whether the object can be marked as expired
- */
- @Override
- public int compareTo(Delayed object) {
- WorkflowContext that = (WorkflowContext) object;
- long thisEndTime = startTime + timeout;
- long thatEndTime = that.startTime + that.timeout;
-
- if (thisEndTime < thatEndTime) {
- return -1;
- } else if (thisEndTime > thatEndTime) {
- return 1;
- } else {
- return 0;
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java deleted file mode 100644 index 4dfae8b2a3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java +++ /dev/null @@ -1,188 +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.bpmn.common.workflow.service; - -import java.util.concurrent.DelayQueue; -import java.util.concurrent.TimeUnit; - -import javax.ws.rs.core.Response; - -import org.jboss.resteasy.spi.AsynchronousResponse; -import org.slf4j.MDC; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java - * @version 1.0 - * - */ -public class WorkflowContextHolder { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]"; - private static WorkflowContextHolder instance = null; - - /** - * Delay Queue which holds workflow context holder objects - */ - private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<>(); - private final TimeoutThread timeoutThread = new TimeoutThread(); - - private WorkflowContextHolder() { - timeoutThread.start(); - } - - /** - * Singleton holder which eliminates hot lock - * Since the JVM synchronizes static method there is no synchronization needed for this method - * @return - */ - public static synchronized WorkflowContextHolder getInstance() { - if (instance == null) { - instance = new WorkflowContextHolder(); - } - return instance; - } - - public void put(WorkflowContext context) { - msoLogger.debug(logMarker + " Adding context to the queue: " - + context.getRequestId()); - responseQueue.put(context); - } - - public void remove(WorkflowContext context) { - msoLogger.debug(logMarker + " Removing context from the queue: " - + context.getRequestId()); - responseQueue.remove(context); - } - - public WorkflowContext getWorkflowContext(String requestId) { - // Note: DelayQueue interator is threadsafe - for (WorkflowContext context : responseQueue) { - if (requestId.equals(context.getRequestId())) { - msoLogger.debug("Found context for request id: " + requestId); - return context; - } - } - - msoLogger.debug("Unable to find context for request id: " + requestId); - return null; - } - - /** - * Builds the callback response object to respond to client - * @param processKey - * @param processInstanceId - * @param requestId - * @param callbackResponse - * @return - */ - public Response processCallback(String processKey, String processInstanceId, - String requestId, WorkflowCallbackResponse callbackResponse) { - WorkflowResponse workflowResponse = new WorkflowResponse(); - WorkflowContext workflowContext = getWorkflowContext(requestId); - - if (workflowContext == null) { - msoLogger.debug("Unable to correlate workflow context for request id: " + requestId - + ":processInstance Id:" + processInstanceId - + ":process key:" + processKey); - workflowResponse.setMessage("Fail"); - workflowResponse.setMessageCode(400); - workflowResponse.setContent("Unable to correlate workflow context, bad request. Request Id: " + requestId); - return Response.serverError().entity(workflowResponse).build(); - } - - responseQueue.remove(workflowContext); - - msoLogger.debug("Using callback response for request id: " + requestId); - workflowResponse.setContent(callbackResponse.getResponse()); - workflowResponse.setProcessInstanceId(processInstanceId); - workflowResponse.setMessageCode(callbackResponse.getStatusCode()); - workflowResponse.setMessage(callbackResponse.getMessage()); - sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse); - return Response.ok().entity(workflowResponse).build(); - } - - /** - * Send the response to client asynchronously when invoked by the BPMN process - * @param processKey - * @param workflowContext - * @param workflowResponse - */ - private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext, - WorkflowResponse workflowResponse) { - msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId()); - recordEvents(processKey, workflowResponse, workflowContext.getStartTime()); - Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build(); - AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse(); - asyncResp.setResponse(response); - } - - /** - * Timeout thread which monitors the delay queue for expired context and send timeout response - * to client - *git review -R - * */ - private class TimeoutThread extends Thread { - public void run() { - while (!isInterrupted()) { - try { - WorkflowContext requestObject = responseQueue.take(); - msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS)); - msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId()); - WorkflowResponse response = new WorkflowResponse(); - response.setMessage("Fail"); - response.setContent("Request timedout, request id:" + requestObject.getRequestId()); - //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId()); - recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime()); - response.setMessageCode(500); - Response result = Response.status(500).entity(response).build(); - requestObject.getAsynchronousResponse().setResponse(result); - msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response); - } catch (InterruptedException e) { - break; - } catch (Exception e) { - msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e); - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread"); - - } - } - - msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting"); - } - } - - private static void recordEvents(String processKey, WorkflowResponse response, - long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - logMarker + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker - + response.getMessage() + " for processKey: " - + processKey + " with content: " + response.getContent()); - - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java deleted file mode 100644 index 4ba35907b9..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java +++ /dev/null @@ -1,108 +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.bpmn.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Generalized REST interface that injects a message event into a waiting BPMN process.
- * Examples:
- * <pre>
- * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
- * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
- * </pre>
- */
-@Path("/")
-public class WorkflowMessageResource extends AbstractCallbackService {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
-
- @POST
- @Path("/WorkflowMessage/{messageType}/{correlator}")
- @Consumes("*/*")
- @Produces(MediaType.TEXT_PLAIN)
- public Response deliver(
- @HeaderParam("Content-Type") String contentType,
- @PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator,
- String message) {
-
- String method = "receiveWorkflowMessage";
- MsoLogger.setServiceName("MSO." + method);
- MsoLogger.setLogContext(correlator, "N/A");
-
- LOGGER.debug(LOGMARKER + " Received workflow message"
- + " type='" + messageType + "'"
- + " correlator='" + correlator + "'"
- + (contentType == null ? "" : " contentType='" + contentType + "'")
- + " message=" + System.lineSeparator() + message);
-
- if (messageType == null || messageType.isEmpty()) {
- String msg = "Missing message type";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- if (correlator == null || correlator.isEmpty()) {
- String msg = "Missing correlator";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- String messageEventName = "WorkflowMessage";
- String messageVariable = messageType + "_MESSAGE";
- String correlationVariable = messageType + "_CORRELATOR";
- String correlationValue = correlator;
- String contentTypeVariable = messageType + "_CONTENT_TYPE";
-
- Map<String, Object> variables = new HashMap<>();
-
- if (contentType != null) {
- variables.put(contentTypeVariable, contentType);
- }
-
- CallbackResult result = handleCallback(method, message, messageEventName,
- messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
-
- if (result instanceof CallbackError) {
- return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build();
- } else {
- return Response.status(204).build();
- }
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java deleted file mode 100644 index 25c67fed63..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java +++ /dev/null @@ -1,615 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 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.workflow.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.camunda.bpm.engine.HistoryService;
-import org.camunda.bpm.engine.ProcessEngineException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.VariableMap;
-import org.camunda.bpm.engine.variable.Variables;
-import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-@Path("/workflow")
-public class WorkflowResource extends ProcessEngineAwareService {
-
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
-
- private static final int DEFAULT_WAIT_TIME = 30000;
-
- @Context
- private UriInfo uriInfo = null;
-
- /**
- * Starts the process instance and responds to client synchronously
- * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
- * Note: value specified in mso-service-request-timeout is in seconds
- * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
- * returned to the client
- * @param processKey
- * @param variableMap
- * @return
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
- VariableMapImpl variableMap) {
-
- Map<String, Object> inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- WorkflowResponse workflowResponse = new WorkflowResponse();
- long startTime = System.currentTimeMillis();
- ProcessInstance processInstance = null;
-
- try {
- //Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
- thread.start();
-
- Map<String, Object> responseMap = null;
-
- //wait for process to be completed
- long waitTime = getWaitTime(inputVariables);
- long now = System.currentTimeMillis();
- long start = now;
- long endTime = start + waitTime;
- long pollingInterval = 500;
-
- // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
- // If this is a unit test (method is invoked directly), wait a max
- // of 5 seconds after process ended for a result. In production,
- // wait up to 60 seconds.
- long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
- AtomicLong timeProcessEnded = new AtomicLong(0);
- boolean endedWithNoResponse = false;
-
- while (now <= endTime) {
- Thread.sleep(pollingInterval);
-
- now = System.currentTimeMillis();
-
- // Increase the polling interval over time
-
- long elapsed = now - start;
-
- if (elapsed > 60000) {
- pollingInterval = 5000;
- } else if (elapsed > 10000) {
- pollingInterval = 1000;
- }
- Exception exception = thread.getException();
- if (exception != null) {
- throw new Exception(exception);
- }
-
- processInstance = thread.getProcessInstance();
-
- if (processInstance == null) {
- msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
- continue;
- }
-
- String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceId(processInstanceId);
-
- responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
-
- if (responseMap == null) {
- msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
-
- if (timeProcessEnded.longValue() != 0) {
- long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
-
- if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
- endedWithNoResponse = true;
- break;
- }
- }
- } else {
- processResponseMap(workflowResponse, responseMap);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
- }
- }
-
- //if we dont get response after waiting then send timeout response
-
- String state;
- String processInstanceId;
-
- if (processInstance == null) {
- processInstanceId = "N/A";
- state = "NOT STARTED";
- } else {
- processInstanceId = processInstance.getProcessInstanceId();
- state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
- }
-
- workflowResponse.setMessage("Fail");
- if (endedWithNoResponse) {
- workflowResponse.setContent("Process ended without producing a response");
- } else {
- workflowResponse.setContent("Request timed out, process state: " + state);
- }
- workflowResponse.setProcessInstanceId(processInstanceId);
- recordEvents(processKey, workflowResponse, startTime);
- workflowResponse.setMessageCode(500);
- return Response.status(500).entity(workflowResponse).build();
- } catch (Exception ex) {
- msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
- workflowResponse.setMessage("Fail" );
- workflowResponse.setContent("Error occurred while executing the process: " + ex.getMessage());
- if (processInstance != null) workflowResponse.setProcessInstanceId(processInstance.getId());
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
- + " for processKey: " + processKey + " with content: " + workflowResponse.getContent());
-
- workflowResponse.setMessageCode(500);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(500).entity(workflowResponse).build();
- }
- }
-
- /**
- * Returns the wait time, this is used by the resource on how long it should wait to send a response
- * If none specified DEFAULT_WAIT_TIME is used
- * @param inputVariables
- * @return
- */
- private int getWaitTime(Map<String, Object> inputVariables)
- {
- String timeout = inputVariables.get("mso-service-request-timeout") == null
- ? null : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Integer.parseInt(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
- }
-
- private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
- getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
- }
- }
-
- private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- Object value = inputVariables.get(key);
- if (value == null) {
- return "N/A";
- } else {
- return value.toString();
- }
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param processInstanceId the process instance ID
- * @return true if the process is ended
- */
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- try {
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
- } catch (Exception e) {
- msoLogger.debug("Exception :",e);
- return true;
- }
- }
-
- private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
- Object object = responseMap.get("Response");
- String content = object == null ? null : String.valueOf(object);
- if (content == null){
- object = responseMap.get("WorkflowResponse");
- content = object == null ? null : String.valueOf(object);
- }
-
- workflowResponse.setContent(content);
-
- object = responseMap.get("ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
-
- try {
- workflowResponse.setMessageCode(Integer.parseInt(responseCode));
- } catch(NumberFormatException nex) {
- msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
- workflowResponse.setMessageCode(-1);
- }
-
- Object status = responseMap.get("Status");
-
- if ("Success".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Success");
- } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Fail");
- } else {
- msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
- workflowResponse.setMessage("Fail");
- }
- }
-
- /**
- * @version 1.0
- * Triggers the workflow in a separate thread
- */
- private class ProcessThread extends Thread {
- private final Map<String,Object> inputVariables;
- private final String processKey;
- private final MsoLogger msoLogger;
- private final String businessKey;
- private ProcessInstance processInstance = null;
- private Exception exception = null;
-
- public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
- this.inputVariables = inputVariables;
- this.processKey = processKey;
- this.msoLogger = msoLogger;
- this.businessKey = UUID.randomUUID().toString();
- }
-
- /**
- * If an exception occurs when starting the process instance, it may
- * be obtained by calling this method. Note that exceptions are only
- * recorded while the process is executing in its original thread.
- * Once a process is suspended, exception recording stops.
- * @return the exception, or null if none has occurred
- */
- public Exception getException() {
- return exception;
- }
-
-
- public ProcessInstance getProcessInstance() {
- return this.processInstance;
- }
-
- /**
- * Sets the process instance exception.
- * @param exception the exception
- */
- private void setException(Exception exception) {
- this.exception = exception;
- }
-
- public void run() {
- setLogContext(processKey, inputVariables);
-
- long startTime = System.currentTimeMillis();
-
- try {
- msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
- + " processKey:" + processKey
- + " businessKey:" + businessKey
- + " variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- // Note that this method doesn't return until the process suspends
- // itself or finishes. We provide a business key so we can identify
- // the process instance immediately.
- processInstance = runtimeService.startProcessInstanceByKey(
- processKey, inputVariables);
-
- } catch (Exception e) {
- msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
- + processKey + ": " + e);
- setException(e);
- }
- }
-
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- VariableMap inputVariables = Variables.createVariables();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String key : vMap.keySet()) { //variabe name vn
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
- inputVariables.putValueTyped(key, Variables
- .objectValue(valueMap.get("value"))
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create());
- }
- return inputVariables;
- }
-
- /**
- * Attempts to get a response map from the specified process instance.
- * @return the response map, or null if it is unavailable
- */
- private Map<String, Object> getResponseMap(ProcessInstance processInstance,
- String processKey, AtomicLong timeProcessEnded) {
-
- String responseMapVariable = processKey + "ResponseMap";
- String processInstanceId = processInstance.getId();
-
- // Query the runtime service to see if a response map is ready.
-
-/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- List<Execution> executions = runtimeService.createExecutionQuery()
- .processInstanceId(processInstanceId).list();
-
- for (Execution execution : executions) {
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromExecution(runtimeService, execution.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " execution "
- + execution.getId());
- return responseMap;
- }
- }
-*/
- //Querying history seem to return consistent results compared to querying the runtime service
-
- boolean alreadyEnded = timeProcessEnded.longValue() != 0;
-
- if (alreadyEnded || isProcessEnded(processInstance.getId())) {
- if (!alreadyEnded) {
- timeProcessEnded.set(System.currentTimeMillis());
- }
-
- // Query the history service to see if a response map exists.
-
- HistoryService historyService = getProcessEngineServices().getHistoryService();
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromHistory(historyService, processInstance.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " history");
- return responseMap;
- }
-
- // Query the history service for old-style response variables.
-
- String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
-
- if (prefix != null) {
-
- // Check for 'WorkflowResponse' variable
- Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
- String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
- msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
-
- if (workflowResponse != null) {
- Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("WorkflowResponse", workflowResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
-
- // Check for 'WorkflowException' variable
- WorkflowException workflowException = null;
- String workflowExceptionText = null;
-
- Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
- if(workflowExceptionObject != null) {
- if(workflowExceptionObject instanceof WorkflowException) {
- workflowException = (WorkflowException) workflowExceptionObject;
- workflowExceptionText = workflowException.toString();
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", workflowException.getErrorCode());
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- else if (workflowExceptionObject instanceof String) {
- Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- workflowExceptionText = (String) workflowExceptionObject;
- responseMap = new HashMap<>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
-
- }
- msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
- String response = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
-
- if (response != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", response);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
- String errorResponse = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
-
- if (errorResponse != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<>();
- responseMap.put("Response", errorResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- }
- }
- return null;
- }
-
- /**
- * Gets a variable value from the specified execution.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromExecution(RuntimeService runtimeService,
- String executionId, String variableName) {
- try {
- return runtimeService.getVariable(executionId, variableName);
- } catch (ProcessEngineException e) {
- // Most likely cause is that the execution no longer exists.
- msoLogger.debug("Error retrieving execution " + executionId
- + " variable " + variableName + ": " + e);
- return null;
- }
- }
- /**
- * Gets a variable value from specified historical process instance.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromHistory(HistoryService historyService,
- String processInstanceId, String variableName) {
- try {
- HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
- .processInstanceId(processInstanceId).variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- msoLogger.debug("Error retrieving process " + processInstanceId
- + " variable " + variableName + " from history: " + e);
- return null;
- }
- }
-
- @POST
- @Path("/services/{processKey}/{processInstanceId}")
- @Produces("application/json")
- @Consumes("application/json")
- public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
- //TODO filter only set of variables
- WorkflowResponse response = new WorkflowResponse();
-
- long startTime = System.currentTimeMillis();
- try {
- ProcessEngineServices engine = getProcessEngineServices();
- List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
- Map<String,String> variablesMap = new HashMap<>();
- for (HistoricVariableInstance variableInstance: variables) {
- variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
- }
-
- msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
- + processKey + " and variables: "
- + variablesMap.toString());
-
-
- response.setVariables(variablesMap);
- response.setMessage("Success");
- response.setContent("Successfully retrieved the variables");
- response.setProcessInstanceId(processInstanceId);
-
- msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with content: " + response.getContent());
- } catch (Exception ex) {
- response.setMessage("Fail");
- response.setContent("Failed to retrieve the variables," + ex.getMessage());
- response.setProcessInstanceId(processInstanceId);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
- + response.getMessage()
- + " for processKey: "
- + processKey
- + " with content: "
- + response.getContent());
- msoLogger.debug("Exception :",ex);
- }
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with content: " + response.getContent());
-
- return response;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java deleted file mode 100644 index 64e5adc091..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java +++ /dev/null @@ -1,46 +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.bpmn.common.workflow.service;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-@ApplicationPath("/")
-public class WorkflowResourceApplication extends Application {
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public WorkflowResourceApplication() {
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java deleted file mode 100644 index 02702e3b3c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java +++ /dev/null @@ -1,97 +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.bpmn.common.workflow.service;
-
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * A synchronous response from a workflow.
- */
-public class WorkflowResponse {
-
- @JsonProperty("processInstanceId")
- private String processInstanceId;
-
- @JsonProperty("messageCode")
- private int messageCode;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("variables")
- private Map<String,String> variables;
-
- @JsonProperty("content")
- private String content;
-
- public String getProcessInstanceId() {
- return processInstanceId;
- }
-
- public void setProcessInstanceId(String processInstanceId) {
- this.processInstanceId = processInstanceId;
- }
-
- public int getMessageCode() {
- return messageCode;
- }
-
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Map<String,String> getVariables() {
- return variables;
- }
-
- public void setVariables(Map<String,String> variables) {
- this.variables = variables;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "["
- + "processInstanceId=" + processInstanceId
- + ",messageCode=" + messageCode
- + ",message=" + message
- + ",variables=" + variables
- + ",content=" + content
- + "]";
- }
-}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java deleted file mode 100644 index 5e3aca5613..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClient.java +++ /dev/null @@ -1,45 +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.adapter.network;
-
-import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest;
-import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse;
-
-public interface NetworkAdapterClient {
-
- CreateNetworkResponse createNetwork(CreateNetworkRequest req);
-
- DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req);
-
- RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req);
-
- QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId);
-
- UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req);
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java deleted file mode 100644 index 6a1c862a66..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterClientImpl.java +++ /dev/null @@ -1,97 +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.adapter.network; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkResponse; -import org.openecomp.mso.client.adapter.vnf.AdapterRestClient; - -public class NetworkAdapterClientImpl implements NetworkAdapterClient { - - private final NetworkAdapterRestProperties props; - public NetworkAdapterClientImpl() { - this.props = new NetworkAdapterRestProperties(); - } - @Override - public CreateNetworkResponse createNetwork(CreateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("").build()).post(req, - CreateNetworkResponse.class); - } - - @Override - public DeleteNetworkResponse deleteNetwork(String aaiNetworkId, DeleteNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - DeleteNetworkResponse.class); - } - - @Override - public RollbackNetworkResponse rollbackNetwork(String aaiNetworkId, RollbackNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).delete(req, - RollbackNetworkResponse.class); - } - - @Override - public QueryNetworkResponse queryNetwork(String aaiNetworkId, String cloudSiteId, String tenantId, - String networkStackId, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiNetworkId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (networkStackId != null) { - builder.queryParam("networkStackId", networkStackId); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.TEXT_XML, MediaType.TEXT_XML) - .get(QueryNetworkResponse.class); - } - - @Override - public UpdateNetworkResponse updateNetwork(String aaiNetworkId, UpdateNetworkRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req, - UpdateNetworkResponse.class); - } - - protected UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.java deleted file mode 100644 index 62d78d423c..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/network/NetworkAdapterRestProperties.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.adapter.network; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; - -public class NetworkAdapterRestProperties implements AdapterRestProperties { - - private final Map<String, String> props; - - public NetworkAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - - @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); - } - @Override - public String getKey() { - return props.get("mso.msoKey"); - } - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.network.rest.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.java deleted file mode 100644 index c3ba8e16ea..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapter.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.adapter.requests.db; - -import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException; -import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest; -import org.openecomp.mso.requestsdb.InfraActiveRequests; - -public interface MsoRequestsDbAdapter { - - public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException; - - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException; - - public boolean getSiteStatus(String siteName); - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java deleted file mode 100644 index 2443169151..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/MsoRequestsDbAdapterClient.java +++ /dev/null @@ -1,300 +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.adapter.requests.db;
-
-import java.sql.Timestamp;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.openecomp.mso.client.adapter.requests.db.entities.MsoRequestsDbException;
-import org.openecomp.mso.client.adapter.requests.db.entities.RequestStatusType;
-import org.openecomp.mso.client.adapter.requests.db.entities.UpdateInfraRequest;
-import org.openecomp.mso.db.AbstractSessionFactoryManager;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.requestsdb.InfraActiveRequests;
-import org.openecomp.mso.requestsdb.RequestsDbSessionFactoryManager;
-import org.openecomp.mso.requestsdb.SiteStatus;
-import org.openecomp.mso.utils.UUIDChecker;
-
-public class MsoRequestsDbAdapterClient implements MsoRequestsDbAdapter {
-
- protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager();
-
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- @Override
- public void updateInfraRequest(UpdateInfraRequest request) throws MsoRequestsDbException {
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
- int result = 0;
- long startTime = System.currentTimeMillis();
- if (request.getRequestId() != null && request.getLastModifiedBy() != null) {
- MsoLogger.setLogContext(request.getRequestId(), null);
- try {
- session.beginTransaction();
- StringBuilder queryString = new StringBuilder("update InfraActiveRequests set ");
- String statusMessage = null;
- String responseBody = null;
- RequestStatusType requestStatus = null;
- String progress = null;
- String vnfOutputs = null;
- String serviceInstanceId = null;
- String networkId = null;
- String vnfId = null;
- String vfModuleId = null;
- String volumeGroupId = null;
- String serviceInstanceName = null;
- String vfModuleName = null;
- String configurationId = null;
- String configurationName = null;
- if (request.getStatusMessage() != null) {
- queryString.append("statusMessage = :statusMessage, ");
- statusMessage = request.getStatusMessage();
- }
- if (request.getResponseBody() != null) {
- queryString.append("responseBody = :responseBody, ");
- responseBody = request.getResponseBody();
- }
- if (request.getRequestStatus() != null) {
- queryString.append("requestStatus = :requestStatus, ");
- requestStatus = request.getRequestStatus();
- }
- if (request.getProgress() != null) {
- queryString.append("progress = :progress, ");
- progress = request.getProgress();
- }
- if (request.getVnfOutputs() != null) {
- queryString.append("vnfOutputs = :vnfOutputs, ");
- vnfOutputs = request.getVnfOutputs();
- }
- if (request.getServiceInstanceId() != null) {
- queryString.append("serviceInstanceId = :serviceInstanceId, ");
- serviceInstanceId = request.getServiceInstanceId();
- }
- if (request.getNetworkId() != null) {
- queryString.append("networkId = :networkId, ");
- networkId = request.getNetworkId();
- }
- if (request.getVnfId() != null) {
- queryString.append("vnfId = :vnfId, ");
- vnfId = request.getVnfId();
- }
- if (request.getVfModuleId() != null) {
- queryString.append("vfModuleId = :vfModuleId, ");
- vfModuleId = request.getVfModuleId();
- }
- if (request.getVolumeGroupId() != null) {
- queryString.append("volumeGroupId = :volumeGroupId, ");
- volumeGroupId = request.getVolumeGroupId();
- }
- if (request.getServiceInstanceName() != null) {
- queryString.append("serviceInstanceName = :serviceInstanceName, ");
- serviceInstanceName = request.getServiceInstanceName();
- }
- if (request.getVfModuleName() != null) {
- queryString.append("vfModuleName = :vfModuleName, ");
- vfModuleName = request.getVfModuleName();
- }
- if (request.getConfigurationId() != null) {
- queryString.append("configurationId = :configurationId, ");
- configurationId = request.getConfigurationId();
- }
- if (request.getConfigurationName() != null) {
- queryString.append("configurationName = :configurationName, ");
- configurationName = request.getConfigurationName();
- }
- if (request.getRequestStatus() == RequestStatusType.COMPLETE
- || request.getRequestStatus() == RequestStatusType.FAILED) {
- queryString.append("endTime = :endTime, ");
- } else {
- queryString.append("modifyTime = :modifyTime, ");
- }
- queryString.append("lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId");
-
- LOGGER.debug("Executing update: " + queryString.toString());
-
- Query query = session.createQuery(queryString.toString());
- query.setParameter("requestId", request.getRequestId());
- if (statusMessage != null) {
- query.setParameter("statusMessage", statusMessage);
- LOGGER.debug("StatusMessage in updateInfraRequest is set to: " + statusMessage);
- }
- if (responseBody != null) {
- query.setParameter("responseBody", responseBody);
- LOGGER.debug("ResponseBody in updateInfraRequest is set to: " + responseBody);
- }
- if (requestStatus != null) {
- query.setParameter("requestStatus", requestStatus.toString());
- LOGGER.debug("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString());
- }
-
- if (progress != null) {
- query.setParameter("progress", Long.parseLong(progress));
- LOGGER.debug("Progress in updateInfraRequest is set to: " + progress);
- }
- if (vnfOutputs != null) {
- query.setParameter("vnfOutputs", vnfOutputs);
- LOGGER.debug("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs);
- }
- if (serviceInstanceId != null) {
- query.setParameter("serviceInstanceId", serviceInstanceId);
- LOGGER.debug("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId);
- }
- if (networkId != null) {
- query.setParameter("networkId", networkId);
- LOGGER.debug("NetworkId in updateInfraRequest is set to: " + networkId);
- }
- if (vnfId != null) {
- query.setParameter("vnfId", vnfId);
- LOGGER.debug("VnfId in updateInfraRequest is set to: " + vnfId);
- }
- if (vfModuleId != null) {
- query.setParameter("vfModuleId", vfModuleId);
- LOGGER.debug("vfModuleId in updateInfraRequest is set to: " + vfModuleId);
- }
- if (volumeGroupId != null) {
- query.setParameter("volumeGroupId", volumeGroupId);
- LOGGER.debug("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId);
- }
- if (serviceInstanceName != null) {
- query.setParameter("serviceInstanceName", serviceInstanceName);
- LOGGER.debug("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName);
- }
- if (configurationId != null) {
- query.setParameter("configurationId", configurationId);
- LOGGER.debug("configurationId in updateInfraRequest is set to: " + configurationId);
- }
- if (configurationName != null) {
- query.setParameter("configurationName", configurationName);
- LOGGER.debug("configurationName in updateInfraRequest is set to: " + configurationName);
- }
- if (vfModuleName != null) {
- query.setParameter("vfModuleName", vfModuleName);
- LOGGER.debug("vfModuleName in updateInfraRequest is set to: " + vfModuleName);
- }
- Timestamp nowTimeStamp = new Timestamp(System.currentTimeMillis());
- if (request.getRequestStatus() == RequestStatusType.COMPLETE
- || request.getRequestStatus() == RequestStatusType.FAILED) {
- query.setParameter("endTime", nowTimeStamp);
- LOGGER.debug("EndTime in updateInfraRequest is set to: " + nowTimeStamp);
- } else {
- query.setParameter("modifyTime", nowTimeStamp);
- LOGGER.debug("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp);
- }
- query.setParameter("lastModifiedBy", request.getLastModifiedBy());
- LOGGER.debug("LastModifiedBy in updateInfraRequest is set to: " + request.getLastModifiedBy());
- result = query.executeUpdate();
- checkIfExists(result, request.getRequestId(), startTime);
- session.getTransaction().commit();
- } catch (HibernateException e) {
- String error = "Unable to update MSO Requests DB: " + e.getMessage();
- LOGGER.error(MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", request.getRequestId(), "",
- "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError,
- error);
- throw new MsoRequestsDbException(error, e);
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
- "Required fields: requestId and lastModifiedBy");
- }
- }
-
- private void checkIfExists(int result, String requestId, long startTime) throws MsoRequestsDbException {
- if (result == 0) {
- String error = "Request ID does not exist in MSO Requests DB: " + requestId;
- LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error);
- throw new MsoRequestsDbException(error);
- }
- }
-
- @Override
- public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException {
- long startTime = System.currentTimeMillis();
- MsoLogger.setLogContext(requestId, null);
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
-
- LOGGER.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId);
-
- InfraActiveRequests request = null;
- try {
- session.beginTransaction();
- Query query = session.createQuery(
- "FROM InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId");
- query.setParameter("requestId", requestId);
- request = (InfraActiveRequests) query.uniqueResult();
- } catch (HibernateException e) {
- String error = "Unable to retrieve MSO Infra Requests DB for Request ID " + requestId;
- LOGGER.error(MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error);
- throw new MsoRequestsDbException(error, e);
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return request;
- }
-
- /**
- * Get SiteStatus by SiteName.
- *
- * @param siteName
- * The unique name of the site
- * @return Status of that site
- */
- public boolean getSiteStatus(String siteName) {
- UUIDChecker.generateUUID(LOGGER);
- Session session = requestsDbSessionFactoryManager.getSessionFactory().openSession();
-
- long startTime = System.currentTimeMillis();
- SiteStatus siteStatus = null;
- LOGGER.debug("Request database - get Site Status with Site name:" + siteName);
- try {
- String hql = "FROM SiteStatus WHERE siteName = :site_name";
- Query query = session.createQuery(hql);
- query.setParameter("site_name", siteName);
-
- siteStatus = (SiteStatus) query.uniqueResult();
- } finally {
- if (session != null && session.isOpen()) {
- session.close();
- }
- }
- if (siteStatus == null) {
- // if not exist in DB, it means the site is not disabled, thus
- // return true
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return true;
- } else {
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return siteStatus.getStatus();
- }
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java deleted file mode 100644 index a495d0eac1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbException.java +++ /dev/null @@ -1,62 +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.adapter.requests.db.entities; - - - -import javax.xml.ws.WebFault; - -/** - * This class simply extends Exception (without addition additional functionality) - * to provide an identifier for RequestsDB related exceptions on create, delete, query. - * - * - */ -@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.openecomp.mso/requestsdb") -public class MsoRequestsDbException extends Exception { - - private static final long serialVersionUID = 1L; - - private MsoRequestsDbExceptionBean faultInfo; - - public MsoRequestsDbException (String msg) { - super(msg); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbException (Throwable e) { - super(e); - faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); - } - - public MsoRequestsDbException (String msg, Throwable e) { - super (msg, e); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbExceptionBean getFaultInfo() { - return faultInfo; - } - - public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { - this.faultInfo = faultInfo; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.java deleted file mode 100644 index f566418ade..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/MsoRequestsDbExceptionBean.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.adapter.requests.db.entities; - - -import java.io.Serializable; - -/** - * Jax-WS Fault Bean for MsoRequestsDB Exception - */ -public class MsoRequestsDbExceptionBean implements Serializable { - - private static final long serialVersionUID = 1360000062602372639L; - - private String message; - - public MsoRequestsDbExceptionBean () {} - - public MsoRequestsDbExceptionBean (String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.java deleted file mode 100644 index 2fa6f2b6a2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/RequestStatusType.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========================================================= - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.07.24 at 11:49:17 AM EDT -// - - -package org.openecomp.mso.client.adapter.requests.db.entities; - - - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for request-status-type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * <p> - * <pre> - * <simpleType name="request-status-type"> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="COMPLETE"/> - * <enumeration value="FAILED"/> - * <enumeration value="IN_PROGRESS"/> - * </restriction> - * </simpleType> - * </pre> - * - */ -@XmlType(name = "request-status-type") -@XmlEnum -public enum RequestStatusType { - - COMPLETE, - FAILED, - IN_PROGRESS; - - public String value() { - return name(); - } - - public static RequestStatusType fromValue(String v) { - return valueOf(v); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.java deleted file mode 100644 index cc00fd1ff2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/ResponseStatus.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.adapter.requests.db.entities; - - - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum ResponseStatus { - SENDING_FINAL_NOTIFY, - SUCCESS, - FAILED, - TIMEOUT -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java deleted file mode 100644 index e9750a2b3b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/Status.java +++ /dev/null @@ -1,40 +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.adapter.requests.db.entities; - - -/* - * Enum for Status values returned by API Handler to Tail-F -*/ -public enum Status { - PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT; - - public boolean isFinished () { - switch (this) { - case COMPLETED: - case FAILED: - case TIMEOUT: - return true; - default: - return false; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java deleted file mode 100644 index 15c57253f3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/requests/db/entities/UpdateInfraRequest.java +++ /dev/null @@ -1,138 +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.adapter.requests.db.entities;
-
-public class UpdateInfraRequest {
-
- private String requestId;
- private String lastModifiedBy;
- private String statusMessage;
- private String responseBody;
- private RequestStatusType requestStatus;
- private String progress;
- private String vnfOutputs;
- private String serviceInstanceId;
- private String networkId;
- private String vnfId;
- private String vfModuleId;
- private String volumeGroupId;
- private String serviceInstanceName;
- private String configurationId;
- private String configurationName;
- private String vfModuleName;
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getLastModifiedBy() {
- return lastModifiedBy;
- }
- public void setLastModifiedBy(String lastModifiedBy) {
- this.lastModifiedBy = lastModifiedBy;
- }
- public String getStatusMessage() {
- return statusMessage;
- }
- public void setStatusMessage(String statusMessage) {
- this.statusMessage = statusMessage;
- }
- public String getResponseBody() {
- return responseBody;
- }
- public void setResponseBody(String responseBody) {
- this.responseBody = responseBody;
- }
- public RequestStatusType getRequestStatus() {
- return requestStatus;
- }
- public void setRequestStatus(RequestStatusType requestStatus) {
- this.requestStatus = requestStatus;
- }
- public String getProgress() {
- return progress;
- }
- public void setProgress(String progress) {
- this.progress = progress;
- }
- public String getVnfOutputs() {
- return vnfOutputs;
- }
- public void setVnfOutputs(String vnfOutputs) {
- this.vnfOutputs = vnfOutputs;
- }
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
- public String getNetworkId() {
- return networkId;
- }
- public void setNetworkId(String networkId) {
- this.networkId = networkId;
- }
- public String getVnfId() {
- return vnfId;
- }
- public void setVnfId(String vnfId) {
- this.vnfId = vnfId;
- }
- public String getVfModuleId() {
- return vfModuleId;
- }
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
- public String getVolumeGroupId() {
- return volumeGroupId;
- }
- public void setVolumeGroupId(String volumeGroupId) {
- this.volumeGroupId = volumeGroupId;
- }
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
- public String getConfigurationId() {
- return configurationId;
- }
- public void setConfigurationId(String configurationId) {
- this.configurationId = configurationId;
- }
- public String getConfigurationName() {
- return configurationName;
- }
- public void setConfigurationName(String configurationName) {
- this.configurationName = configurationName;
- }
- public String getVfModuleName() {
- return vfModuleName;
- }
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java deleted file mode 100644 index 16fd351b43..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.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.adapter.vnf; - -import java.net.URI; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; - -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.ext.ContextResolver; - -import org.openecomp.mso.client.ResponseExceptionMapperImpl; -import org.openecomp.mso.client.policy.JettisonStyleMapperProvider; -import org.openecomp.mso.client.policy.RestClient; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class AdapterRestClient extends RestClient { - - private final AdapterRestProperties props; - public AdapterRestClient(AdapterRestProperties props, URI uri) { - super(props, UUID.randomUUID(), Optional.of(uri)); - this.props = props; - } - - public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) { - super(props, UUID.randomUUID(), Optional.of(uri), accept, contentType); - this.props = props; - } - - @Override - protected void initializeHeaderMap(Map<String, String> headerMap) { - addBasicAuthHeader(props.getAuth(), props.getKey()); - } - - @Override - protected Optional<ClientResponseFilter> addResponseFilter() { - return Optional.of(new ResponseExceptionMapperImpl()); - } - - @Override - public RestClient addRequestId(UUID requestId) { - return null; - } - - @Override - protected ContextResolver<ObjectMapper> getMapper() { - return new JettisonStyleMapperProvider(); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java deleted file mode 100644 index af429db1f2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestProperties.java +++ /dev/null @@ -1,29 +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.adapter.vnf; - -import org.openecomp.mso.client.RestProperties; - -public interface AdapterRestProperties extends RestProperties { - - public String getAuth(); - public String getKey(); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.java deleted file mode 100644 index 5ee38fe0fb..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClient.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.adapter.vnf;
-
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest;
-import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse;
-
-public interface VnfAdapterClient {
-
- CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req);
-
- RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, RollbackVfModuleRequest req);
-
- DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req);
-
- UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req);
-
- QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, String tenantId,
- String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId);
-
- String healthCheck();
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java deleted file mode 100644 index 2b391d302d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterClientImpl.java +++ /dev/null @@ -1,106 +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.adapter.vnf; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.UriBuilder; - -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; - -public class VnfAdapterClientImpl implements VnfAdapterClient { - - private static final String VF_MODULES = "/vf-modules/"; - - private final VnfAdapterRestProperties props; - public VnfAdapterClientImpl() { - this.props = new VnfAdapterRestProperties(); - } - - @Override - public CreateVfModuleResponse createVfModule(String aaiVnfId, CreateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req, - CreateVfModuleResponse.class); - } - - @Override - public RollbackVfModuleResponse rollbackVfModule(String aaiVnfId, String aaiVfModuleId, - RollbackVfModuleRequest req) { - return new AdapterRestClient(this.props, - this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req, - RollbackVfModuleResponse.class); - } - - @Override - public DeleteVfModuleResponse deleteVfModule(String aaiVnfId, String aaiVfModuleId, DeleteVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .delete(req, DeleteVfModuleResponse.class); - } - - @Override - public UpdateVfModuleResponse updateVfModule(String aaiVnfId, String aaiVfModuleId, UpdateVfModuleRequest req) { - return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build()) - .put(req, UpdateVfModuleResponse.class); - } - - @Override - public QueryVfModuleResponse queryVfModule(String aaiVnfId, String aaiVfModuleId, String cloudSiteId, - String tenantId, String vfModuleName, boolean skipAAI, String requestId, String serviceInstanceId) { - UriBuilder builder = this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId); - if (cloudSiteId != null) { - builder.queryParam("cloudSiteId", cloudSiteId); - } - if (tenantId != null) { - builder.queryParam("tenantId", tenantId); - } - if (vfModuleName != null) { - builder.queryParam("vfModuleName", vfModuleName); - } - - builder.queryParam("skipAAI", skipAAI); - - if (requestId != null) { - builder.queryParam("msoRequest.requestId", requestId); - } - if (serviceInstanceId != null) { - builder.queryParam("msoRequest.serviceInstanceId", serviceInstanceId); - } - return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON) - .get(QueryVfModuleResponse.class); - } - - @Override - public String healthCheck() { - return new AdapterRestClient(this.props, this.getUri("/healthcheck").build()).get(String.class); - } - - public UriBuilder getUri(String path) { - return UriBuilder.fromPath(path); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.java deleted file mode 100644 index e342aeedac..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/VnfAdapterRestProperties.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.adapter.vnf; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.adapter.vnf.AdapterRestProperties; - -public class VnfAdapterRestProperties implements AdapterRestProperties { - - private final Map<String, String> props; - - public VnfAdapterRestProperties() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - - @Override - public String getAuth() { - return props.get("mso.adapters.po.auth"); - } - @Override - public String getKey() { - return props.get("mso.msoKey"); - } - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("mso.adapters.vnf.rest.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java deleted file mode 100644 index 3c00627bff..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java +++ /dev/null @@ -1,178 +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.appc; - -import java.util.HashMap; -import java.util.List; - -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; -import org.openecomp.mso.bpmn.appc.payload.PayloadClient; -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator; -import java.util.Optional; -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; -import java.lang.NoSuchMethodError; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -public class ApplicationControllerAction { - protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator(); - private String errorCode = "1002"; - private String errorMessage = "Unable to reach App C Servers"; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - public void runAppCCommand(Action action, String msoRequestId, String vnfId, Optional<String> payload, HashMap<String, String> payloadInfo, String controllerType){ Status appCStatus = null; - try{ - String vnfName = payloadInfo.getOrDefault("vnfName", ""); - String aicIdentity = payloadInfo.getOrDefault("vnfName",""); - String vnfHostIpAddress = payloadInfo.getOrDefault("vnfHostIpAddress",""); - String vmIdList = payloadInfo.getOrDefault("vmIdList", ""); - String identityUrl = payloadInfo.getOrDefault("identityUrl", ""); - switch(action){ - case ResumeTraffic: - appCStatus = resumeTrafficAction(msoRequestId, vnfId, vnfName, controllerType); - break; - case Start: - case Stop: - appCStatus = startStopAction(action, msoRequestId, vnfId, aicIdentity, controllerType); - break; - case Unlock: - case Lock: - appCStatus = client.vnfCommand(action, msoRequestId, vnfId, Optional.empty(), controllerType); - break; - case QuiesceTraffic: - appCStatus = quiesceTrafficAction(msoRequestId, vnfId, payload, vnfName, controllerType); - break; - case HealthCheck: - appCStatus = healthCheckAction(msoRequestId, vnfId, vnfName, vnfHostIpAddress, controllerType); - break; - case Snapshot: - String vmIds = JsonUtils.getJsonValue(vmIdList, "vmIds"); - String vmId = ""; - ObjectMapper mapper = new ObjectMapper(); - List<String> vmIdJsonList = mapper.readValue(vmIds, new TypeReference<List<String>>(){}); - int i = 0; - while(i < vmIdJsonList.size()){ - vmId = vmIdJsonList.get(i); - appCStatus = snapshotAction(msoRequestId, vnfId, vmId, identityUrl, controllerType); - i++; - } - break; - case ConfigModify: - case ConfigScaleOut: - appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); - break; - case UpgradePreCheck: - case UpgradePostCheck: - case UpgradeSoftware: - case UpgradeBackup: - appCStatus = upgradeAction(action,msoRequestId, vnfId, payload, vnfName, controllerType); - break; - default: - errorMessage = "Unable to idenify Action request for AppCClient"; - break; - } - if(appCStatus != null){ - errorCode = Integer.toString(appCStatus.getCode()); - errorMessage = appCStatus.getMessage(); - - } - if(ApplicationControllerSupport.getCategoryOf(appCStatus).equals(StatusCategory.NORMAL)){ - errorCode = "0"; - } - } - catch(JsonProcessingException e){ - auditLogger.log(Level.ERROR, "Incorrect Payload format for action request" + action.toString(),e, e.getMessage()); - errorMessage = e.getMessage(); - } - catch(ApplicationControllerOrchestratorException e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - errorCode = "1002"; - errorMessage = e.getMessage(); - } - catch (NoSuchMethodError e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - errorMessage = e.getMessage(); - } - catch(Exception e){ - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - errorMessage = e.getMessage(); - } - } - - private Status payloadAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + action.toString()); - } - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); - } - - private Status quiesceTrafficAction(String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + Action.QuiesceTraffic.toString()); - } - payload = PayloadClient.quiesceTrafficFormat(payload, vnfName); - return client.vnfCommand(Action.QuiesceTraffic, msoRequestId, vnfId, payload, controllerType); - } - - private Status upgradeAction(Action action, String msoRequestId, String vnfId, Optional<String> payload, String vnfName, String controllerType) throws JsonProcessingException, IllegalArgumentException,ApplicationControllerOrchestratorException{ - if(!(payload.isPresent())){ - throw new IllegalArgumentException("Payload is not present for " + action.toString()); - } - payload = PayloadClient.upgradeFormat(payload, vnfName); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); - } - - private Status resumeTrafficAction(String msoRequestId, String vnfId, String vnfName, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.resumeTrafficFormat(vnfName); - return client.vnfCommand(Action.ResumeTraffic, msoRequestId, vnfId, payload, controllerType); - } - - private Status startStopAction(Action action, String msoRequestId, String vnfId, String aicIdentity, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.startStopFormat(aicIdentity); - return client.vnfCommand(action, msoRequestId, vnfId, payload, controllerType); - } - - private Status healthCheckAction(String msoRequestId, String vnfId, String vnfName, String vnfHostIpAddress, String controllerType)throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.healthCheckFormat(vnfName, vnfHostIpAddress); - return client.vnfCommand(Action.HealthCheck, msoRequestId, vnfId, payload, controllerType); - } - - private Status snapshotAction(String msoRequestId, String vnfId, String vmId, String identityUrl, String controllerType) throws JsonProcessingException, ApplicationControllerOrchestratorException{ - Optional<String> payload = PayloadClient.snapshotFormat(vmId, identityUrl); - return client.vnfCommand(Action.Snapshot, msoRequestId, vnfId, payload, controllerType); - } - - public String getErrorMessage(){ - return errorMessage; - } - - public String getErrorCode(){ - return errorCode; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java deleted file mode 100644 index 1bb4dc7eed..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerCallback.java +++ /dev/null @@ -1,40 +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.appc; - -import org.onap.appc.client.lcm.api.ResponseHandler; -import org.onap.appc.client.lcm.exceptions.AppcClientException; - -public class ApplicationControllerCallback<T> implements ResponseHandler<T> { - - @Override - public void onResponse(T response) { - System.out.println("ON RESPONSE"); - - } - - @Override - public void onException(AppcClientException exception) { - System.out.println("ON EXCEPTION"); - - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java deleted file mode 100644 index c9e2e880e7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java +++ /dev/null @@ -1,212 +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.appc; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.time.Instant; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider; -import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory; -import org.onap.appc.client.lcm.api.ApplicationContext; -import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; -import org.onap.appc.client.lcm.exceptions.AppcClientException; -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.CommonHeader; -import org.onap.appc.client.lcm.model.Flags; -import org.onap.appc.client.lcm.model.Flags.Force; -import org.onap.appc.client.lcm.model.Flags.Mode; -import org.onap.appc.client.lcm.model.Payload; -import org.onap.appc.client.lcm.model.Status; -import org.onap.appc.client.lcm.model.ZULU; -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.springframework.beans.factory.annotation.Autowired; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFLogger.Level; -import com.att.eelf.configuration.EELFManager; - -public class ApplicationControllerClient { - - public static final String DEFAULT_CONTROLLER_TYPE = "SDNC"; - - private static final String CLIENT_NAME = "MSO"; - - private static final String API_VER = "2.00"; - private static final String ORIGINATOR_ID = "MSO"; - private static final int FLAGS_TTL = 65000; - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - @Autowired - public ApplicationControllerSupport appCSupport; - - // APPC gave us an API where the controllerType is configured in the - // client object, which is not what we asked for. We asked for an API - // in which the client would have additional methods that could take - // the controllerType as a parameter, so that we would not need to - // maintain multiple client objects. This map should be removed when - // the (hopefully short-term) controllerType becomes obsolete. - - private final String controllerType; - - private static ConcurrentHashMap<String, LifeCycleManagerStateful> appCClients = new ConcurrentHashMap<>(); - - /** - * Creates an ApplicationControllerClient for communication with APP-C. - */ - public ApplicationControllerClient() { - this(DEFAULT_CONTROLLER_TYPE); - } - - /** - * Creates an ApplicationControllerClient for the specified controller type. - * @param controllerType the controller type: "appc" or "sdnc". - */ - public ApplicationControllerClient(String controllerType) { - if (controllerType == null) { - controllerType = DEFAULT_CONTROLLER_TYPE; - } - this.controllerType = controllerType.toUpperCase(); - appCSupport = new ApplicationControllerSupport(); - } - - /** - * Gets the controller type. - * @return the controllertype - */ - public String getControllerType() { - return controllerType; - } - - /** - * Returns the AppC client object associated with this ApplicationControllerClient. - * AppC client objects are shared objects. One is created if it does not exist. - * @return the client object, or null if creation failed - */ - public LifeCycleManagerStateful getAppCClient() { - return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k)); - } - - protected LifeCycleManagerStateful createAppCClient(String controllerType) { - try { - if (controllerType == null) { - controllerType = DEFAULT_CONTROLLER_TYPE; - } - controllerType = controllerType.toUpperCase(); - return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) - .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); - } catch (AppcClientException e) { - auditLogger.log(Level.ERROR, "Error in getting LifeCycleManagerStateful: ", e, e.getMessage()); - // This null value will cause NullPointerException when used later. - // Error handling could certainly be improved here. - return null; - } - } - - public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, - org.onap.appc.client.lcm.model.Payload payload, String requestID) - throws ApplicationControllerOrchestratorException { - Object requestObject = createRequest(action, actionIdentifiers, payload, requestID); - appCSupport.logLCMMessage(requestObject); - LifeCycleManagerStateful client = getAppCClient(); - Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, false); - try { - Object response = lcmMethod.invoke(client, requestObject); - return appCSupport.getStatusFromGenericResponse(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e); - } - } - - protected Properties getLCMProperties() { - return getLCMProperties("appc"); - } - - protected Properties getLCMProperties(String controllerType) { - Properties properties = new Properties(); - Map<String, String> globalProperties = PropertyConfiguration.getInstance() - .getProperties("mso.bpmn.urn.properties"); - - properties.put("topic.read", globalProperties.get("appc.client.topic.read")); - properties.put("topic.write", globalProperties.get("appc.client.topic.write")); - properties.put("SDNC-topic.read", globalProperties.get("appc.client.topic.sdnc.read")); - properties.put("SDNC-topic.write", globalProperties.get("appc.client.topic.sdnc.write")); - properties.put("topic.read.timeout", globalProperties.get("appc.client.topic.read.timeout")); - properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout")); - properties.put("poolMembers", globalProperties.get("appc.client.poolMembers")); - properties.put("controllerType", controllerType); - properties.put("client.key", globalProperties.get("appc.client.key")); - properties.put("client.secret", globalProperties.get("appc.client.secret")); - properties.put("client.name", CLIENT_NAME); - properties.put("service", globalProperties.get("appc.client.service")); - return properties; - } - - public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) { - Object requestObject = appCSupport.getInput(action.name()); - try { - CommonHeader commonHeader = buildCommonHeader(requestId); - requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject, - commonHeader); - requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action); - requestObject.getClass().getDeclaredMethod("setActionIdentifiers", ActionIdentifiers.class) - .invoke(requestObject, identifier); - if (payload != null) { - requestObject.getClass().getDeclaredMethod("setPayload", Payload.class).invoke(requestObject, payload); - } - } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Error building Appc request: ", e, e.getMessage()); - } - return requestObject; - } - - private CommonHeader buildCommonHeader(String requestId) { - CommonHeader commonHeader = new CommonHeader(); - commonHeader.setApiVer(API_VER); - commonHeader.setOriginatorId(ORIGINATOR_ID); - commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId); - commonHeader.setSubRequestId(requestId); - Flags flags = new Flags(); - String flagsMode = "NORMAL"; - Mode mode = Mode.valueOf(flagsMode); - flags.setMode(mode); - String flagsForce = "FALSE"; - Force force = Force.valueOf(flagsForce); - flags.setForce(force); - flags.setTtl(FLAGS_TTL); - commonHeader.setFlags(flags); - Instant timestamp = Instant.now(); - ZULU zulu = new ZULU(timestamp.toString()); - commonHeader.setTimestamp(zulu); - return commonHeader; - } - - public Flags createRequestFlags() { - Flags flags = new Flags(); - flags.setTtl(6000); - return flags; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java deleted file mode 100644 index 744be5f28f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestrator.java +++ /dev/null @@ -1,50 +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.appc; - -import java.util.Optional; - -import org.openecomp.mso.client.appc.ApplicationControllerSupport.StatusCategory; - -import org.onap.appc.client.lcm.model.Action; -import org.onap.appc.client.lcm.model.ActionIdentifiers; -import org.onap.appc.client.lcm.model.Payload; -import org.onap.appc.client.lcm.model.Status; - -public class ApplicationControllerOrchestrator { - - public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> request, String controllerType) throws ApplicationControllerOrchestratorException { - ApplicationControllerClient client = new ApplicationControllerClient(controllerType); - Status status; - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - Payload payload = null; - if (request.isPresent()) { - payload = new Payload(request.get()); - } - status = client.runCommand(action, actionIdentifiers, payload, requestId); - if (ApplicationControllerSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) { - throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode()); - } else { - return status; - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java deleted file mode 100644 index 4692f1dcc2..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerOrchestratorException.java +++ /dev/null @@ -1,36 +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.appc;
-
-public class ApplicationControllerOrchestratorException extends Exception {
-
- private final int appcCode;
-
- public ApplicationControllerOrchestratorException(String message, int code) {
- super(message);
- appcCode = code;
- }
-
- public int getAppcCode()
- {
- return appcCode;
- }
-}
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 deleted file mode 100644 index e3ed432dfc..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerSupport.java +++ /dev/null @@ -1,215 +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.appc; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.springframework.stereotype.Component; - -import org.onap.appc.client.lcm.api.LifeCycleManagerStateful; -import org.onap.appc.client.lcm.api.ResponseHandler; -import org.onap.appc.client.lcm.model.Status; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.EELFLogger.Level; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; - -@Component -public class ApplicationControllerSupport { - - private static final int ACCEPT_SERIES = 100; - private static final int ERROR_SERIES = 200; - private static final int REJECT_SERIES = 300; - private static final int SUCCESS_SERIES = 400; - private static final int SUCCESS_STATUS = SUCCESS_SERIES; - private static final int PARTIAL_SERIES = 500; - private static final int PARTIAL_SUCCESS_STATUS = PARTIAL_SERIES; - private static final int PARTIAL_FAILURE_STATUS = PARTIAL_SERIES + 1; - - protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - private String lcmModelPackage = "org.onap.appc.client.lcm.model"; - - /** - * @param action - * @return - * @throws ClassNotFoundException - * @throws InstantiationException - * @throws IllegalAccessException - */ - public Object getInput(String action) { - try { - return getInputClass(action).newInstance(); - } catch (IllegalAccessException | InstantiationException e) { - throw new RuntimeException( - String.format("%s : %s", "Unable to instantiate viable LCM Kit input class for action", action), e); - } - } - - /** - * @param action - * @return - * @throws ClassNotFoundException - */ - public Method getAPIMethod(String action, LifeCycleManagerStateful lcmStateful, boolean async) { - Method[] methods = lcmStateful.getClass().getMethods(); - for (Method method : methods) { - if (method.getName().equalsIgnoreCase(action)) { - Class<?>[] methodParameterTypes = method.getParameterTypes(); - if (methodParameterTypes.length > 0) { - if (getInputClass(action).equals(methodParameterTypes[0])) { - if (async) { - if (methodParameterTypes.length == 2 - && ResponseHandler.class.isAssignableFrom(methodParameterTypes[1])) { - return method; - } - } else if (methodParameterTypes.length == 1) { - return method; - } - } - } - } - } - throw new RuntimeException(String.format("%s : %s, async=%b", - "Unable to derive viable LCM Kit API method for action", action, async)); - } - - public Status getStatusFromGenericResponse(Object response) { - Method statusReader = getBeanPropertyMethodFor(response.getClass(), "status", false); - if (statusReader != null) { - try { - return (Status) statusReader.invoke(response); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - auditLogger.log(Level.ERROR, "Unable to obtain status from LCM Kit response", e, e.getMessage()); - } - } - return new Status(); - } - - public static StatusCategory getCategoryOf(Status status) { - int codeSeries = status.getCode() - (status.getCode() % 100); - switch (codeSeries) { - case ACCEPT_SERIES: - return StatusCategory.NORMAL; - case ERROR_SERIES: - case REJECT_SERIES: - return StatusCategory.ERROR; - case SUCCESS_SERIES: - return status.getCode() == SUCCESS_STATUS ? StatusCategory.NORMAL : StatusCategory.ERROR; - case PARTIAL_SERIES: - switch (status.getCode()) { - case PARTIAL_SUCCESS_STATUS: - return StatusCategory.NORMAL; - case PARTIAL_FAILURE_STATUS: - return StatusCategory.ERROR; - default: - return StatusCategory.WARNING; - } - default: - return StatusCategory.WARNING; - } - } - - public static boolean getFinalityOf(Status status) { - int codeSeries = status.getCode() - (status.getCode() % 100); - switch (codeSeries) { - case ACCEPT_SERIES: - case PARTIAL_SERIES: - return false; - case ERROR_SERIES: - case REJECT_SERIES: - case SUCCESS_SERIES: - return true; - default: - return true; - } - } - - private Method getBeanPropertyMethodFor(Class<?> clazz, String propertyName, boolean isWriter) { - BeanInfo beanInfo; - try { - beanInfo = Introspector.getBeanInfo(clazz, Object.class); - } catch (IntrospectionException e) { - throw new RuntimeException( - String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", - clazz.getName(), propertyName, isWriter), - e); - } - PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); - for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { - if (propertyDescriptor.getName().equals(propertyName)) { - return isWriter ? propertyDescriptor.getWriteMethod() : propertyDescriptor.getReadMethod(); - } - } - throw new RuntimeException( - String.format("Unable to produce bean property method for class : %s, property : %s, writer=%b", - clazz.getName(), propertyName, isWriter)); - } - - /** - * @param action - * @return - * @throws ClassNotFoundException - */ - private Class<?> getInputClass(String action) { - try { - return Class.forName(lcmModelPackage + '.' + action + "Input"); - } catch (ClassNotFoundException e) { - throw new RuntimeException(String.format("%s : %s using package : %s", - "Unable to identify viable LCM Kit input class for action", action, lcmModelPackage), e); - } - } - - public enum StatusCategory { - NORMAL("normal"), WARNING("warning"), ERROR("error"); - - private final String category; - - private StatusCategory(final String category) { - this.category = category; - } - - @Override - public String toString() { - return category; - } - } - - public void logLCMMessage(Object message) { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); - String inputAsJSON; - try { - inputAsJSON = writer.writeValueAsString(message); - auditLogger.log(Level.INFO, "\nLCM Kit input message follows: \n" + inputAsJSON, null); - } catch (JsonProcessingException e) { - auditLogger.log(Level.ERROR, "Error in logging LCM Message: ", e, e.getMessage()); - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java deleted file mode 100644 index c3bf53cfde..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaaproperties/DefaultDmaapPropertiesImpl.java +++ /dev/null @@ -1,39 +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.dmaaproperties; - -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.dmaap.DmaapProperties; - -public class DefaultDmaapPropertiesImpl implements DmaapProperties { - - private final Map<String, String> properties; - public DefaultDmaapPropertiesImpl() { - this.properties = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - } - @Override - public Map<String, String> getProperties() { - return this.properties; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java deleted file mode 100644 index 73bad21c87..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/AAIOrchestrator.java +++ /dev/null @@ -1,114 +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.orchestration; - -import java.util.Optional; -import java.util.logging.Logger; - -import org.modelmapper.ModelMapper; -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; -import org.openecomp.mso.client.aai.AAIResourcesClient; -import org.openecomp.mso.client.aai.entities.AAIEntityObject; -import org.openecomp.mso.client.aai.objects.AAIOwningEntity; -import org.openecomp.mso.client.aai.objects.AAIProject; -import org.openecomp.mso.client.aai.objects.AAIServiceInstance; - -public class AAIOrchestrator { - - private static Logger LOGGER = Logger.getLogger("AAIOrchestrator"); - - public void createServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(serviceInstance.getUri(), Optional.of(serviceInstance)); - }catch(Exception ex) { - String msg = "Failed to create service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void deleteServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.delete(serviceInstance.getUri()); - } catch (Exception ex) { - String msg = "Failed to delete service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createProject(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)); - }catch(Exception ex) { - String msg = "Failed to create project in A&AI."; - throw new IllegalStateException(msg); } - } - - public void createProjectandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject project = modelMapper.map(serviceDecomp.getProject(), AAIProject.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(project.getUri(), Optional.of(project)).connect(project.getUri(), serviceInstance.getUri()); - } catch(Exception ex) { - String msg = "Failed to create project and connect service instance in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntity(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)); - }catch(Exception ex) { - String msg = "Failed to create owning entity in A&AI."; - throw new IllegalStateException(msg); - } - } - - public void createOwningEntityandConnectServiceInstance(ServiceDecomposition serviceDecomp) { - try{ - ModelMapper modelMapper = new ModelMapper(); - AAIEntityObject owningEntity = modelMapper.map(serviceDecomp.getOwningEntity(), AAIOwningEntity.class); - AAIEntityObject serviceInstance = modelMapper.map(serviceDecomp.getServiceInstance(), AAIServiceInstance.class); - AAIResourcesClient aaiRC = this.getClient(); - aaiRC.createIfNotExists(owningEntity.getUri(), Optional.of(owningEntity)).connect(owningEntity.getUri(), serviceInstance.getUri()); - }catch(Exception ex) { - String msg = "Failed to create owning entity and connect service instance in A&AI."; - throw new IllegalStateException(msg); } - } - - protected AAIResourcesClient getClient() { - return new AAIResourcesClient(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java deleted file mode 100644 index 4cefad2a3b..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/orchestration/SDNCOrchestrator.java +++ /dev/null @@ -1,61 +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.orchestration;
-
-import java.util.Optional;
-import java.util.logging.Logger;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-import org.openecomp.mso.client.sdnc.mapper.ServiceTopologyOperationRequestMapper;
-import org.openecomp.mso.client.sdnc.sync.SDNCSyncRpcClient;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-public class SDNCOrchestrator {
-
- private static MsoPropertiesFactory msoPF = new MsoPropertiesFactory();
-
- public void createServiceInstance (ServiceDecomposition serviceDecomp) {
-
- try{
- msoPF.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", "mso.sdnc.properties");
- Optional<String> msoAction = getMSOAction(serviceDecomp);
- ServiceTopologyOperationRequestMapper sdncRM = new ServiceTopologyOperationRequestMapper(msoAction, SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, "CreateServiceInstance");
- SDNCRequest request = sdncRM.reqMapper(serviceDecomp);
- SDNCSyncRpcClient sdncRC = new SDNCSyncRpcClient (request, msoPF);
- sdncRC.run();
- } catch (Exception ex) {
- throw new IllegalStateException();
- }
- }
-
- private Optional<String> getMSOAction (ServiceDecomposition serviceDecomp){
- String serviceType = serviceDecomp.getServiceInstance().getServiceType();
- if(serviceType == null || serviceType.equals("")){
- return Optional.empty();
- }
-
- return Optional.of(serviceType);
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java deleted file mode 100644 index a1ef35a49d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java +++ /dev/null @@ -1,64 +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.restproperties; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.aai.AAIProperties; -import org.openecomp.mso.client.aai.AAIVersion; - -public class AAIPropertiesImpl implements AAIProperties { - - final Map<String, String> props; - - public AAIPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - } - - @Override - public URL getEndpoint() throws MalformedURLException { - return new URL(props.get("aai.endpoint")); - } - - @Override - public String getSystemName() { - return "MSO"; - } - - @Override - public AAIVersion getDefaultVersion() { - return AAIVersion.LATEST; - } - - @Override - public String getAuth() { - return props.get("aai.auth"); - } - - @Override - public String getKey() { - return props.get("mso.msoKey"); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java deleted file mode 100644 index eccf87c09d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/PolicyRestPropertiesImpl.java +++ /dev/null @@ -1,64 +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.restproperties; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; - -import org.openecomp.mso.bpmn.core.PropertyConfiguration; -import org.openecomp.mso.client.policy.PolicyRestProperties; - -public class PolicyRestPropertiesImpl implements PolicyRestProperties { - - - final Map<String, String> props; - public PolicyRestPropertiesImpl() { - this.props = PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties"); - - } - @Override - public URL getEndpoint() { - try { - return new URL(props.getOrDefault("policy.endpoint", "")); - } catch (MalformedURLException e) { - return null; - } - } - - @Override - public String getSystemName() { - return "MSO"; - } - - public String getClientAuth() { - return props.get("policy.client.auth"); - } - - public String getAuth() { - return props.get("policy.auth"); - } - - public String getEnvironment() { - return props.get("policy.environment"); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java deleted file mode 100644 index cd04fc5ef0..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCRequest.java +++ /dev/null @@ -1,95 +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.sdnc.beans;
-
-public class SDNCRequest {
- private String requestId;
- private String svcInstanceId;
- private SDNCSvcAction svcAction;
- private SDNCSvcOperation svcOperation;
- private String callbackUrl;
- private String msoAction;
- private String requestData;
-
- public SDNCRequest(String requestId, String svcInstanceId, SDNCSvcAction svcAction, SDNCSvcOperation svcOperation,
- String callbackUrl, String msoAction, String requestData) {
- this.requestId = requestId;
- this.svcInstanceId = svcInstanceId;
- this.svcAction = svcAction;
- this.svcOperation = svcOperation;
- this.callbackUrl = callbackUrl;
- this.msoAction = msoAction;
- this.requestData = requestData;
- }
- public SDNCRequest(){
-
- }
-
- public String getRequestId() {
- return requestId;
- }
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
- public void setSvcInstanceId(String svcInstanceId) {
- this.svcInstanceId = svcInstanceId;
- }
- public SDNCSvcAction getSvcAction() {
- return svcAction;
- }
- public void setSvcAction(SDNCSvcAction svcAction) {
- this.svcAction = svcAction;
- }
- public SDNCSvcOperation getSvcOperation() {
- return svcOperation;
- }
- public void setSvcOperation(SDNCSvcOperation svcOperation) {
- this.svcOperation = svcOperation;
- }
- public String getCallbackUrl() {
- return callbackUrl;
- }
- public void setCallbackUrl(String callbackUrl) {
- this.callbackUrl = callbackUrl;
- }
- public String getMsoAction() {
- return msoAction;
- }
- public void setMsoAction(String msoAction) {
- this.msoAction = msoAction;
- }
-
- public String getRequestData() {
- return requestData;
- }
- public void setRequestData(String requestData) {
- this.requestData = requestData;
- }
- @Override
- public String toString() {
- return "SDNCRequest [requestId=" + requestId + ", svcInstanceId=" + svcInstanceId + ", svcAction=" + svcAction
- + ", svcOperation=" + svcOperation + ", callbackUrl=" + callbackUrl + ", msoAction=" + msoAction
- + ", requestData=" + requestData + "]";
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java deleted file mode 100644 index 91e3a59276..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcAction.java +++ /dev/null @@ -1,46 +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.sdnc.beans;
-
-public enum SDNCSvcAction {
- ACTIVATE("activate"),
- DELETE("delete"),
- ASSIGN("assign"),
- ROLLBACK("rollback"),
- UNASSIGN("unassign"),
- DEACTIVATE("deactivate"),
- CHANGE_DELETE("changedelete"),
- CHANGE_ASSIGN("changeassign"),
- CREATE("create"),
- ENABLE("enable"),
- DISABLE("disable");
-
- private final String name;
-
- private SDNCSvcAction(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java deleted file mode 100644 index 8cf1052064..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/beans/SDNCSvcOperation.java +++ /dev/null @@ -1,43 +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.sdnc.beans;
-
-public enum SDNCSvcOperation {
-
- VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
- NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
- VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
- CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
- SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
- PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
- SERVICE_TOPOLOGY_OPERATION("service-topology-operation");
-
- private final String name;
-
- private SDNCSvcOperation(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java deleted file mode 100644 index 3e714e901d..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/SDNCRequestMapper.java +++ /dev/null @@ -1,46 +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.sdnc.mapper;
-
-import java.util.Optional;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-
-public abstract class SDNCRequestMapper {
-
- protected final Optional<String> msoAction;
- protected final SDNCSvcOperation svcOperation;
- protected final SDNCSvcAction svcAction;
- protected final String requestAction;
-
- public SDNCRequestMapper (Optional<String> msoAction, SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, String requestAction) {
- this.msoAction = msoAction;
- this.svcOperation = svcOperation;
- this.svcAction = svcAction;
- this.requestAction = requestAction;
- }
-
- public abstract SDNCRequest reqMapper (ServiceDecomposition serviceDecomp);
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java deleted file mode 100644 index b87ed00650..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/mapper/ServiceTopologyOperationRequestMapper.java +++ /dev/null @@ -1,98 +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.sdnc.mapper;
-
-import java.io.StringWriter;
-import java.util.Optional;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.client.sdnc.beans.SDNCRequest;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction;
-import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation;
-
-import openecomp.org.mso.workflow.schema.v1.EcompModelInformation;
-import openecomp.org.mso.workflow.schema.v1.RequestInformation;
-import openecomp.org.mso.workflow.schema.v1.SDNCServiceInstanceRequestData;
-import openecomp.org.mso.workflow.schema.v1.ServiceInformation;
-import openecomp.org.mso.workflow.schema.v1.ServiceRequestInput;
-
-public class ServiceTopologyOperationRequestMapper extends SDNCRequestMapper{
-
- public ServiceTopologyOperationRequestMapper(Optional<String> msoAction, SDNCSvcOperation svcOperation,
- SDNCSvcAction svcAction, String requestAction) {
- super(msoAction, svcOperation, svcAction, requestAction);
- }
-
- @Override
- public SDNCRequest reqMapper (ServiceDecomposition serviceDecomp) {
- SDNCRequest req = new SDNCRequest();
- req.setCallbackUrl(serviceDecomp.getCallbackURN());
- if(msoAction.isPresent()){
- req.setMsoAction(msoAction.get());
- }
- req.setRequestId(serviceDecomp.getRequest().getSdncRequestId());
- req.setSvcInstanceId(serviceDecomp.getServiceInstance().getInstanceId());
- req.setSvcAction(svcAction);
- req.setSvcOperation(svcOperation);
- String reqData ="";
-
- RequestInformation reqInfo = new RequestInformation();
- reqInfo.setRequestAction(requestAction);
- reqInfo.setSource("MSO");
- reqInfo.setRequestId(serviceDecomp.getRequest().getRequestId());
- ServiceInformation servInfo = new ServiceInformation();
- EcompModelInformation emi = new EcompModelInformation();
- emi.setModelInvariantUuid(serviceDecomp.getRequest().getModelInfo().getModelInvariantUuid());
- emi.setModelName(serviceDecomp.getRequest().getModelInfo().getModelName());
- emi.setModelVersion(serviceDecomp.getRequest().getModelInfo().getModelVersion() );
- servInfo.setEcompModelInformation(emi);
- servInfo.setServiceId(serviceDecomp.getServiceInstance().getServiceId());
- servInfo.setSubscriptionServiceType(serviceDecomp.getCustomer().getSubscriptionServiceType());
- servInfo.setServiceInstanceId(serviceDecomp.getServiceInstance().getInstanceName());
- servInfo.setGlobalCustomerId(serviceDecomp.getCustomer().getGlobalSubscriberId());
- ServiceRequestInput servReqInput = new ServiceRequestInput();
- servReqInput.setServiceInstanceName(serviceDecomp.getServiceInstance().getInstanceName());
- SDNCServiceInstanceRequestData sdncSIRD = new SDNCServiceInstanceRequestData();
- sdncSIRD.setRequestInformation(reqInfo);
- sdncSIRD.setServiceInformation(servInfo);
- sdncSIRD.setServiceRequestInput(servReqInput);
-
- try {
- JAXBContext context = JAXBContext.newInstance(SDNCServiceInstanceRequestData.class);
-
- Marshaller jaxbMarshaller = context.createMarshaller();
- jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-
- StringWriter sw = new StringWriter();
- jaxbMarshaller.marshal(sdncSIRD, sw);
- reqData = sw.toString();
- req.setRequestData(reqData);
- } catch (JAXBException e) {
- e.printStackTrace();
- }
-
- return req;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java deleted file mode 100644 index 2ddafc1c17..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/CallbackHeader.java +++ /dev/null @@ -1,154 +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.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Async response header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}) -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "ResponseCode", required = true) - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true) - protected String responseMessage; - - public CallbackHeader() { - } - - public CallbackHeader(String reqId, String respCode, String respMsg) { - this.requestId = reqId; - this.responseCode = respCode; - this.responseMessage = respMsg; - } - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - - @Override - public String toString() { - return "CallbackHeader [requestId=" + requestId + ", responseCode=" - + responseCode + ", responseMessage=" + responseMessage + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.java deleted file mode 100644 index 331fefa677..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Constants.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.sdnc.sync; - - -public interface Constants { - - public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl"; - public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl"; - public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; - - public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl"; - public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; - - public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth"; - public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; - - public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB"; - public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.bpelauth"; - - - public static final String SDNC_SVCCFGRESP_ROOT = "input"; - public static final String SDNC_REQ_ID = "/svc-request-id"; - public static final String SDNC_RESP_CODE = "/response-code"; - public static final String SDNC_RESP_MSG = "/response-message"; - public static final String SDNC_CONNECTTIME_PROP = "org.openecomp.mso.adapters.sdnc.sdncconnecttime"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - - public static final String REQUEST_TUNABLES = "org.openecomp.mso.adapters.sdnc"; -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java deleted file mode 100644 index 3ddfdb2925..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/ObjectFactory.java +++ /dev/null @@ -1,77 +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.sdnc.sync; - - -import javax.xml.bind.annotation.XmlRegistry; - - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.sdnc package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link RequestHeader } - * - */ - public RequestHeader createRequestHeader() { - return new RequestHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterResponse } - * - */ - public SDNCAdapterResponse createSDNCAdapterResponse() { - return new SDNCAdapterResponse(); - } - - /** - * Create an instance of {@link SDNCAdapterRequest } - * - */ - public SDNCAdapterRequest createSDNCAdapterRequest() { - return new SDNCAdapterRequest(); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java deleted file mode 100644 index dee79898fa..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestHeader.java +++ /dev/null @@ -1,219 +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.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//BPEL to SDNCAdapter request header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "svcInstanceId", - "svcAction", - "svcOperation", - "callbackUrl", - "msoAction" -}) -@XmlRootElement(name = "RequestHeader") -public class RequestHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "SvcInstanceId") - protected String svcInstanceId; - @XmlElement(name = "SvcAction", required = true) - protected String svcAction; - @XmlElement(name = "SvcOperation", required = true) - protected String svcOperation; - @XmlElement(name = "CallbackUrl", required = true) - protected String callbackUrl; - @XmlElement(name = "MsoAction") - protected String msoAction; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - public String getSvcInstanceId() { - return svcInstanceId; - } - - public void setSvcInstanceId(String svcInstanceId) { - this.svcInstanceId = svcInstanceId; - } - - /** - * Gets the value of the svcAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcAction() { - return svcAction; - } - - /** - * Sets the value of the svcAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcAction(String value) { - this.svcAction = value; - } - - /** - * Gets the value of the svcOperation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcOperation() { - return svcOperation; - } - - /** - * Sets the value of the svcOperation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcOperation(String value) { - this.svcOperation = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCallbackUrl(String value) { - this.callbackUrl = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMsoAction() { - return msoAction; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMsoAction(String value) { - this.msoAction = value; - } - - - @Override - public String toString() { - return "RequestHeader [requestId=" + requestId + - ", svcInstanceId=" + svcInstanceId + - ", svcAction=" + svcAction + - ", svcOperation=" + svcOperation + - ", callbackUrl=" + callbackUrl + - ", msoAction=" + msoAction + "]"; - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java deleted file mode 100644 index 55d42df6e1..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/RequestTunables.java +++ /dev/null @@ -1,222 +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.sdnc.sync; - - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import org.openecomp.mso.logger.MessageEnum; -public class RequestTunables { - - private MsoPropertiesFactory msoPropertiesFactory; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - //criteria - private String reqId = ""; - private String msoAction = ""; - private String operation = ""; - private String action = ""; - - //tunables - private String reqMethod = "POST"; - private String sdncUrl = null; - private String timeout = "60000"; - private String headerName = "sdnc-request-header"; - private String namespace = ""; - private String asyncInd = "N"; //future use - - private String sdncaNotificationUrl = null; - - public RequestTunables(String reqId, String msoAction, String operation, String action, MsoPropertiesFactory msoPropFactory) { - super(); - msoPropertiesFactory = msoPropFactory; - if (reqId != null) { - this.reqId = reqId; - } - if (msoAction != null) { - this.msoAction = msoAction; - } - if (operation != null) { - this.operation = operation; - } - if (action != null) { - this.action = action; - } - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public String getReqMethod() { - return reqMethod; - } - public void setReqMethod(String reqMethod) { - this.reqMethod = reqMethod; - } - public String getMsoAction() { - return msoAction; - } - public void setMsoAction(String msoAction) { - this.msoAction = msoAction; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getOperation() { - return operation; - } - public void setOperation(String operation) { - this.operation = operation; - } - public String getSdncUrl() { - return sdncUrl; - } - public void setSdncUrl(String sdncUrl) { - this.sdncUrl = sdncUrl; - } - public String getTimeout() { - return timeout; - } - public void setTimeout(String timeout) { - this.timeout = timeout; - } - public String getAsyncInd() { - return asyncInd; - } - public void setAsyncInd(String asyncInd) { - this.asyncInd = asyncInd; - } - public String getHeaderName() { - return headerName; - } - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - - public String getSdncaNotificationUrl() { - return sdncaNotificationUrl; - } - - public void setSdncaNotificationUrl(String sdncaNotificationUrl) { - this.sdncaNotificationUrl = sdncaNotificationUrl; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - @Override - public String toString() { - return "RequestTunables [reqId=" + reqId + ", msoAction=" + msoAction - + ", operation=" + operation + ", action=" + action - + ", reqMethod=" + reqMethod + ", sdncUrl=" + sdncUrl - + ", timeout=" + timeout + ", headerName=" + headerName - + ", sdncaNotificationUrl=" + sdncaNotificationUrl - + ", namespace=" + namespace + "]"; - } - - public void setTunables() - { - String error = null; - String key = null; - if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action; - msoLogger.debug("Generated key: " + key); - } - else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "..." + action; - msoLogger.debug("Generated key: " + key); - } else { - key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action; - msoLogger.debug("Generated key: " + key); - } - - String value; - try { - value = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, ""); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - value=""; - } - - if (value != null && value.length() > 0) { - - String[] parts = value.split("\\|"); //escape pipe - if (parts.length < 3) { - msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - } - - for (int i = 0; i < parts.length; i++) { - if (i == 0) { - reqMethod = parts[i]; - msoLogger.debug("Request Method is set to: " + reqMethod); - } else if (i == 1) { - timeout = parts[i]; - msoLogger.debug("Timeout is set to: " + timeout); - } else if (i == 2) { - sdncUrl = SDNCAdapterPortTypeImpl.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i], "",msoPropertiesFactory); - if (operation != null && sdncUrl != null) { - sdncUrl = sdncUrl + operation; - } - msoLogger.debug("SDNC Url is set to: " + sdncUrl); - } else if (i == 3) { - headerName = parts[i]; - msoLogger.debug("HeaderName is set to: " + headerName); - } else if (i == 4) { - namespace = parts[i]; - msoLogger.debug("NameSpace is set to: " + namespace); - } else if (i == 5) { - asyncInd = parts[i]; - msoLogger.debug("AsyncInd is set to: " + asyncInd); - } - } - if (sdncUrl == null) { - error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; - } - } else { - error = "Missing configuration for:" + key; - } - if (error != null) { - msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString()); - return; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 6e9d6757ad..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,136 +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.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import java.io.StringWriter; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Async response -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true) - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData") - protected Object requestData; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - try { - JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client"); - Marshaller m = ctx.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); - StringWriter w = new StringWriter(); - m.marshal(this, w); - return (w.toString()); - } - catch (Exception e) - { - msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e); - } - return(""); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.java deleted file mode 100644 index 8b56932769..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortType.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.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; - - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-27T18:25:50.914-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") - @WebMethod(operationName = "SDNCAdapter") - public SDNCAdapterResponse sdncAdapter( - @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterRequest sdncAdapterRequest - ); - - @WebMethod - public void healthCheck(); - - SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java deleted file mode 100644 index 3d9aab666a..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterPortTypeImpl.java +++ /dev/null @@ -1,108 +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.sdnc.sync; - -import javax.annotation.PostConstruct; -import javax.jws.WebService; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//BPEL SDNCAdapter SOAP Web Service implementation -@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.client.sdnc.sync.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/ad") -public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { - - private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - private static final String LOG_SERVICE_NAME = "MSO-BPMN:MSO-SDNCAdapter."; - private static final String LOG_REPLY_NAME = "MSO-SDNCAdapter:MSO-BPMN."; - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - @PostConstruct - public void init () { - msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType"); - } - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck () - { - msoLogger.debug("Health check call in SDNC Adapter"); - } - - public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) { - String value; - try { - value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return null; - } - msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value); - return value; - } - - @Override - public SDNCAdapterResponse sdncAdapter(SDNCRequest bpelRequest) { - String bpelReqId = bpelRequest.getRequestId(); - String callbackUrl = bpelRequest.getCallbackUrl(); - long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName (bpelRequest.getSvcAction().toString()); - msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", ""); - - SDNCSyncRpcClient sdncClient = new SDNCSyncRpcClient(bpelRequest,msoPropertiesFactory); - long subStartTime = System.currentTimeMillis (); - try { - Thread sdncClientThread = new Thread(sdncClient); - sdncClientThread.start(); - } - catch (Exception e){ - String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - SDNCResponse sdncResp = new SDNCResponse(bpelReqId); - sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - sdncResp.setRespMsg(respMsg); - } - - msoLogger.debug("Sending synchronous response to BPEL"); - SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return (wsResp); - } - - @Override - public org.openecomp.mso.client.sdnc.sync.SDNCAdapterResponse sdncAdapter( - org.openecomp.mso.client.sdnc.sync.SDNCAdapterRequest sdncAdapterRequest) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java deleted file mode 100644 index 5beedb12be..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequest.java +++ /dev/null @@ -1,128 +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.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> - * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//BPEL to SDNCAdapter request -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - - String rd = ""; - if (requestData != null) - { - Node node = (Node) requestData; - Document doc = node.getOwnerDocument(); - rd = Utils.domToStr(doc); - } - return "SDNCAdapterRequest [requestHeader=" + requestHeader.toString() - + ", requestData=" + rd + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.java deleted file mode 100644 index 4625bfb74f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterResponse.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.sdnc.sync; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p>Java class for anonymous complex type. - * - * <p>The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -//SDNCAdapter to BPEL Sync Response(ACK) - async response(s) follow -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "SDNCAdapterResponse") -public class SDNCAdapterResponse { - - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java deleted file mode 100644 index 08d3bdbad7..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterPortType.java +++ /dev/null @@ -1,45 +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.sdnc.sync; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - - - -//SDNCAdapter to BPEL Async response WEB Service -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCCallbackAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - @WebMethod(operationName = "SDNCAdapterCallback") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest - ); -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java deleted file mode 100644 index 0e65a3080f..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCCallbackAdapterService.java +++ /dev/null @@ -1,126 +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.sdnc.sync; - - -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-28T11:07:02.074-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//SDNCAdapter to BPEL Async response WEB Service -@WebServiceClient(name = "SDNCCallbackAdapterService", - wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", - targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -public class SDNCCallbackAdapterService extends Service { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); - public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); - static { - URL wsdlUrl = null; - try { - wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); - //wsdlUrl = SDNCCallbackAdapterService.class.getClassLoader().getResource("SDNCCallbackAdapter.wsdl"); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); - } - if(wsdlUrl == null) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); - } else { - try { - msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC", ""); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); - } - } - WSDL_LOCATION = wsdlUrl; - } - - public SDNCCallbackAdapterService(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public SDNCCallbackAdapterService() { - super(WSDL_LOCATION, SERVICE); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(WebServiceFeature ... features) { - super(WSDL_LOCATION, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, WebServiceFeature ... features) { - super(wsdlLocation, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort() { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values. - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort(WebServiceFeature... features) { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class, features); - } - -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java deleted file mode 100644 index d905748591..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCRequestIdUtil.java +++ /dev/null @@ -1,39 +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.sdnc.sync; - - -public class SDNCRequestIdUtil { - // Add private constructor to prevent instance creation. - private SDNCRequestIdUtil () {} - - public static String getSDNCOriginalRequestId (String newRequestId) { - - // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique while sending request to SDNC - // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts - // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char '-', since valid UUID contains 4 times '-' - // If the requestId is not a valid UUID with postfix, we do nothing - if (newRequestId.split("-").length == 6) { - return newRequestId.substring(0, newRequestId.lastIndexOf('-')); - } - return newRequestId; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java deleted file mode 100644 index 850f5b4734..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCResponse.java +++ /dev/null @@ -1,73 +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.sdnc.sync; - - -import java.io.Serializable; - -public class SDNCResponse implements Serializable { - - private static final long serialVersionUID = 1L; - private String reqId = null; - private int respCode = 0; - private String respMsg = null; - private String sdncResp = null; - - public SDNCResponse(String reqId) { - this.reqId = reqId; - } - public SDNCResponse(String reqId, int respCode, String respMsg) { - this.reqId = reqId; - this.respCode = respCode; - this.respMsg = respMsg; - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public int getRespCode() { - return respCode; - } - public void setRespCode(int respCode) { - this.respCode = respCode; - } - public String getRespMsg() { - return respMsg; - } - public void setRespMsg(String respMsg) { - this.respMsg = respMsg; - } - public String getSdncResp() { - return sdncResp; - } - public void setSdncResp(String sdncResp) { - this.sdncResp = sdncResp; - } - - @Override - public String toString() { - return "SDNCResponse [reqId=" + reqId + ", respCode=" + respCode - + ", respMsg=" + respMsg + ", sdncResp=" + sdncResp + "]"; - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java deleted file mode 100644 index ce9b706760..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/SDNCSyncRpcClient.java +++ /dev/null @@ -1,317 +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.sdnc.sync; - - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.bind.DatatypeConverter; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.handler.MessageContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.json.JSONArray; -import org.json.JSONObject; -import org.openecomp.mso.client.sdnc.beans.SDNCRequest; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcAction; -import org.openecomp.mso.client.sdnc.beans.SDNCSvcOperation; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//SDNCAdapter to SDNC Rest Client -public class SDNCSyncRpcClient implements Runnable { - - private MsoPropertiesFactory msoPropertiesFactory; - - private SDNCRequest bpelRequest; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - - public SDNCSyncRpcClient(SDNCRequest bpelRequest,MsoPropertiesFactory msoPropFactory) { - this.bpelRequest = bpelRequest; - msoPropertiesFactory = msoPropFactory; - } - - @Override - public void run() - { - String action = bpelRequest.getSvcAction().toString(); - String operation = bpelRequest.getSvcOperation().toString(); - String bpelReqId = bpelRequest.getRequestId(); - String msoAction = bpelRequest.getMsoAction(); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getSvcInstanceId()); - MsoLogger.setServiceName("SDNCRestClient"); - String sdncReqBody = ""; - - msoLogger.debug("BPEL Request:" + bpelRequest.toString()); - RequestTunables rt = new RequestTunables(bpelReqId, msoAction, operation, action, msoPropertiesFactory); - rt.setTunables(); - rt.setSdncaNotificationUrl(SDNCAdapterPortTypeImpl.getProperty(Constants.MY_URL_PROP, Constants.DEFAULT_MY_URL,msoPropertiesFactory)); - - if ("POST".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } else if("PUT".equals(rt.getReqMethod())) { - try { - DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - InputSource is = new InputSource(); - is.setCharacterStream(new StringReader(bpelRequest.getRequestData())); - Document reqDoc = db.parse(is); - sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); - }catch(Exception ex) { - throw new IllegalStateException(); - } - } - long sdncStartTime = System.currentTimeMillis(); - SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt, msoPropertiesFactory); - msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); - msoLogger.debug ("Got the SDNC Code : " + sdncResp.getRespCode()); - msoLogger.debug ("Got the SDNC Response Message:" + sdncResp.getRespMsg()); - validateSDNCResponse(sdncResp.getSdncResp()); - return; - } - - public static SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt, MsoPropertiesFactory msoPropertiesFactoryp) { - URL url; - HttpURLConnection con = null; - DataOutputStream out = null; - BufferedReader in = null; - SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuffer response = new StringBuffer(); - - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); - msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); - - try { - msoLogger.debug("url is: " + rt.getSdncUrl()); - url = new URL(rt.getSdncUrl()); - con = (HttpURLConnection) url.openConnection(); - con.setConnectTimeout(Integer.parseInt(SDNCAdapterPortTypeImpl.getProperty(Constants.SDNC_CONNECTTIME_PROP, "2000",msoPropertiesFactoryp))); - con.setReadTimeout(Integer.parseInt(rt.getTimeout())); - con.setRequestProperty("Accept", "application/json"); - String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.SDNC_AUTH_PROP, Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - con.setRequestProperty ("Authorization", basicAuth); - con.setRequestMethod(rt.getReqMethod()); - - if ("POST".equals(rt.getReqMethod()) || "PUT".equals(rt.getReqMethod())) { - con.setRequestProperty("Content-type", "application/json"); - con.setRequestProperty("Content-length",String.valueOf(sdncReqBody.length())); - con.setDoOutput(true); - out = new DataOutputStream(con.getOutputStream()); - out.writeBytes(sdncReqBody); - out.flush(); - out.close(); - } - - //Get response - sdncResp.setRespCode(con.getResponseCode()); - sdncResp.setRespMsg(con.getResponseMessage()); - - if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) { - in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - //Not parsing the response -it contains a responseHdr section and data section - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } - - sdncResp.setSdncResp(response.toString()); - msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", ""); - return(sdncResp); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e); - //default - sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); - String respMsg = "Error processing request to SDNC. "; - String sdncErrMsg = null; - - if (e instanceof java.net.SocketTimeoutException ) { - sdncResp.setRespCode(HttpURLConnection.HTTP_CLIENT_TIMEOUT); - respMsg = "Request to SDNC timed out. "; - } - if (con != null) { - try { //e1 - if (con.getResponseCode() != HttpURLConnection.HTTP_OK) //seen in SocketException connection reset - sdncResp.setRespCode(con.getResponseCode()); - respMsg = respMsg + con.getResponseMessage() + ". "; - InputStream is = con.getErrorStream(); - if (is != null) { - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db; - Document doc = null; - try { //e2 - db = dbf.newDocumentBuilder(); - doc = db.parse(is); - NodeList errors = (NodeList)xpath.evaluate("errors/error", doc, XPathConstants.NODESET); - for (int i = 0; i < errors.getLength(); i++) { - Element error = (Element) errors.item(i); - String eType = null; - try { - eType = xpath.evaluate("error-type", error); - sdncErrMsg = ". SDNC Returned-[error-type:" + eType; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eTag = null; - try { - eTag = xpath.evaluate( "error-tag", error); - sdncErrMsg = sdncErrMsg + ", error-tag:" + eTag; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eMsg = null; - try { - eMsg = xpath.evaluate("error-message", error); - sdncErrMsg = sdncErrMsg + ", error-message:" + eMsg + "]"; - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - } - } catch (Exception e2) { - msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2); - } - } //is != null - } catch (Exception e1) { - msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1); - } - } //con != null - - if (e.getMessage() != null) { - respMsg = respMsg + e.getMessage(); - } - if (sdncErrMsg != null) { - respMsg = respMsg + sdncErrMsg; - } - - sdncResp.setRespMsg(respMsg); - - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - return(sdncResp); - } - finally { - if (con != null) { - con.disconnect(); - } - } - } - public void validateSDNCResponse (String sdncResponse){ - String msg; - msoLogger.debug ("Starting validate sdnc response"); - String responseMessage = ""; - String responseCode = ""; - if (sdncResponse != null || !sdncResponse.equals("")){ - try{ - msoLogger.debug ("Got the SDNC Response: " + sdncResponse); - JSONObject jsonObj = new JSONObject(sdncResponse); - msoLogger.debug ("jsonObj has been created"); - - JSONObject requestData = jsonObj.getJSONObject("v1:RequestData"); - JSONObject output = requestData.getJSONObject("output"); - try{ - responseMessage = output.getString("response-message"); - responseCode = output.getString("response-code"); - } catch (Exception ex) { - msoLogger.debug("Response not in lower hyphen"); - } - if(responseMessage.equals("")&&responseCode.equals("")){ - try{ - responseMessage = output.getString("ResponseMessage"); - responseCode = output.getString("ResponseCode"); - } catch (Exception ex) { - msoLogger.debug("Response does not exist"); - } - } - msoLogger.debug("ResponseMessage is: " + responseMessage); - msoLogger.debug("Response Code is: " + responseCode); - if(responseMessage.equals("")){ - msg = "Error from SDNC: Response Message is empty."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - - if(responseCode.equals("")){ - responseCode = "0"; - } - - int code = Integer.parseInt(responseCode); - if(code >=200 && code <=299 || code ==0){ - msoLogger.debug ("Successful Response from SDNC"); - - } else { - msg = "Error from SDNC: Code is not 200-299 or 0."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } catch (Exception ex) { - msg = "Validate SDNC Response has failed."; - msoLogger.debug(msg); - throw new IllegalStateException(msg); - } - } - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java deleted file mode 100644 index 7457b59390..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/sdnc/sync/Utils.java +++ /dev/null @@ -1,195 +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.sdnc.sync; - - -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -public class Utils { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static String genSdncReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElementNS(rt.getNamespace(), "input"); - newdoc.appendChild(root); - - //Header - Element hdr = newdoc.createElement(rt.getHeaderName()); - root.appendChild(hdr); - - String elemData = rt.getReqId(); - Element hdrChild; - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-request-id"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getAction(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-action"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getSdncaNotificationUrl(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-notification-url"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); - } - return(null); - } - - public static String genSdncPutReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - - - Element root = newdoc.createElement(nodes.item(0).getNodeName()); - newdoc.appendChild(root); - - NodeList childNodes = nodes.item(0).getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node n = childNodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncPutReq:\n" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e); - } - return(null); - } - - public static String genMsoFailResp(SDNCResponse resp) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElement("output"); - newdoc.appendChild(root); - - Element elem1 = newdoc.createElement("svc-request-id"); - elem1.appendChild(newdoc.createTextNode(resp.getReqId())); - root.appendChild(elem1); - - Element elem2 = newdoc.createElement("response-code"); - elem2.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespCode()))); - root.appendChild(elem2); - - Element elem3 = newdoc.createElement("response-message"); - elem3.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespMsg()))); - root.appendChild(elem3); - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:" + s); - return (s); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e); - } - return(null); - } - - - public static String domToStr(Document doc) - { - if (doc != null) - { - try { - DOMSource ds = new DOMSource(doc); - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - //t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");//<?xml version="1.0" encoding="UTF-8"?> - t.transform(ds, sr); - String s = sw.toString(); - - // This is an awful fix for now but we don't want that xmlns="" to be generated - s = s.replaceAll("xmlns=\"\"", ""); - return(s); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); - } - } - return(null); - } -} |