2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
23 import java.util.List;
26 import org.camunda.bpm.engine.delegate.DelegateExecution;
27 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInformationEntity;
28 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInputParametersEntity;
29 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRequestInputEntity;
30 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkTopologyOperationInputEntity;
31 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity;
32 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity;
33 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity;
34 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity;
35 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity;
36 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity;
38 public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
41 public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) {
42 RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity();
43 NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs);
44 rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity);
45 return rpcNetworkTopologyOperationInputEntity;
48 private void loadNetwrokRequestInputEntity(Map<String, String> inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
49 NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity();
50 NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity();
51 List<ParamEntity> paramEntityList = getParamEntities(inputs);
52 networkInputParametersEntity.setParamList(paramEntityList);
53 networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity);
54 networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity);
57 private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
58 RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
59 networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
62 private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
63 SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
64 sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
65 sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
66 networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity);
69 private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
70 ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
71 networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
74 private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map<String, String> inputs) {
75 NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity();
76 loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution);
77 loadRequestInformationEntity(networkTopologyOperationInputEntity, execution);
78 loadServiceInformation(networkTopologyOperationInputEntity, execution);
79 loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity);
80 loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity);
81 return networkTopologyOperationInputEntity;
84 private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
85 NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
86 OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
87 networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
88 networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity);