8d0caaa76584090a47b4782cea7548688ea102a1
[so.git] /
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 /**
30  * Created by 10112215 on 2017/9/20.
31  */
32 public class NetworkRpcInputEntityBuilder extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
33
34     @Override
35     public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) {
36         RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity = new RpcNetworkTopologyOperationInputEntity();
37         NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = getNetworkTopologyOperationInputEntity(execution, inputs);
38         rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity);
39         return rpcNetworkTopologyOperationInputEntity;
40     }
41
42     private void loadNetwrokRequestInputEntity(Map<String, String> inputs, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
43         NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity();
44         {
45             NetworkInputPaarametersEntity networkInputPaarametersEntity = new NetworkInputPaarametersEntity();
46             {
47                 List<ParamEntity> paramEntityList = getParamEntities(inputs);
48                 networkInputPaarametersEntity.setParamList(paramEntityList);
49             }
50             networkRequestInputEntity.setNetworkInputPaarameters(networkInputPaarametersEntity);
51         }
52         networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity);
53     }
54
55     private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
56         RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
57         networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
58     }
59
60     private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
61         SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
62         {
63             sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
64             sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
65         }
66         networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity);
67     }
68
69     private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity, DelegateExecution execution) {
70         ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
71         networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
72     }
73
74     private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution, Map<String, String> inputs) {
75         NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity = new NetworkTopologyOperationInputEntity();
76         {
77             loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution);
78             loadRequestInformationEntity(networkTopologyOperationInputEntity, execution);
79             loadServiceInformation(networkTopologyOperationInputEntity, execution);
80             loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity);
81             loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity);
82         }
83         return networkTopologyOperationInputEntity;
84     }
85
86     private void loadNetworkInformationEntity(DelegateExecution execution, NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
87         NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
88         {
89             OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
90             networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
91         }
92         networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity);
93     }
94 }