Merge "Reorder modifiers"
[so.git] / bpmn / MSOInfrastructureBPMN / src / main / java / org / openecomp / mso / bpmn / infrastructure / workflow / serviceTask / client / builder / NetworkRpcInputEntityBuilder.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder;
22
23 import org.camunda.bpm.engine.delegate.DelegateExecution;
24 import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.*;
25
26 import java.util.List;
27 import java.util.Map;
28
29 public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
30
31     @Override
32     public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) {
33         RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity();
34         NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs);
35         rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity);
36         return rpcNetworkTopologyOperationInputEntity;
37     }
38
39     private void loadNetwrokRequestInputEntity(Map<String, String> inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
40         NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity();
41         {
42             NetworkInputPaarametersEntity networkInputPaarametersEntity = new NetworkInputPaarametersEntity();
43             {
44                 List<ParamEntity> paramEntityList = getParamEntities(inputs);
45                 networkInputPaarametersEntity.setParamList(paramEntityList);
46             }
47             networkRequestInputEntity.setNetworkInputPaarameters(networkInputPaarametersEntity);
48         }
49         networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity);
50     }
51
52     private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
53         RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
54         networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
55     }
56
57     private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
58         SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
59         {
60             sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
61             sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
62         }
63         networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity);
64     }
65
66     private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
67         ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
68         networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
69     }
70
71     private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map<String, String> inputs) {
72         NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity();
73         {
74             loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution);
75             loadRequestInformationEntity(networkTopologyOperationInputEntity, execution);
76             loadServiceInformation(networkTopologyOperationInputEntity, execution);
77             loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity);
78             loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity);
79         }
80         return networkTopologyOperationInputEntity;
81     }
82
83     private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
84         NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
85         {
86             OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
87             networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
88         }
89         networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity);
90     }
91 }