Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / java / org / onap / so / 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.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder;
22
23 import java.util.List;
24 import java.util.Map;
25 import org.camunda.bpm.engine.delegate.DelegateExecution;
26 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInformationEntity;
27 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkInputParametersEntity;
28 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkRequestInputEntity;
29 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.NetworkTopologyOperationInputEntity;
30 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.OnapModelInformationEntity;
31 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ParamEntity;
32 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RequestInformationEntity;
33 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity;
34 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.SdncRequestHeaderEntity;
35 import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.ServiceInformationEntity;
36
37 public class NetworkRpcInputEntityBuilder
38         extends AbstractBuilder<Map<String, String>, RpcNetworkTopologyOperationInputEntity> {
39
40     @Override
41     public RpcNetworkTopologyOperationInputEntity build(DelegateExecution execution, Map<String, String> inputs) {
42         RpcNetworkTopologyOperationInputEntity rpcNetworkTopologyOperationInputEntity =
43                 new RpcNetworkTopologyOperationInputEntity();
44         NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity =
45                 getNetworkTopologyOperationInputEntity(execution, inputs);
46         rpcNetworkTopologyOperationInputEntity.setInput(networkTopologyOperationInputEntity);
47         return rpcNetworkTopologyOperationInputEntity;
48     }
49
50     private void loadNetwrokRequestInputEntity(Map<String, String> inputs,
51             NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
52         NetworkRequestInputEntity networkRequestInputEntity = new NetworkRequestInputEntity();
53         NetworkInputParametersEntity networkInputParametersEntity = new NetworkInputParametersEntity();
54         List<ParamEntity> paramEntityList = getParamEntities(inputs);
55         networkInputParametersEntity.setParamList(paramEntityList);
56         networkRequestInputEntity.setNetworkInputPaarameters(networkInputParametersEntity);
57         networkTopologyOperationInputEntity.setNetworkRequestInput(networkRequestInputEntity);
58     }
59
60     private void loadRequestInformationEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
61             DelegateExecution execution) {
62         RequestInformationEntity requestInformationEntity = getRequestInformationEntity(execution);
63         networkTopologyOperationInputEntity.setRequestInformation(requestInformationEntity);
64     }
65
66     private void loadSdncRequestHeaderEntity(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
67             DelegateExecution execution) {
68         SdncRequestHeaderEntity sdncRequestHeaderEntity = new SdncRequestHeaderEntity();
69         sdncRequestHeaderEntity.setSvcRequestId(getRequestId(execution));
70         sdncRequestHeaderEntity.setSvcAction(getSvcAction(execution));
71         networkTopologyOperationInputEntity.setSdncRequestHeader(sdncRequestHeaderEntity);
72     }
73
74     private void loadServiceInformation(NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity,
75             DelegateExecution execution) {
76         ServiceInformationEntity serviceInformationEntity = getServiceInformationEntity(execution);
77         networkTopologyOperationInputEntity.setServiceInformation(serviceInformationEntity);
78     }
79
80     private NetworkTopologyOperationInputEntity getNetworkTopologyOperationInputEntity(DelegateExecution execution,
81             Map<String, String> inputs) {
82         NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity =
83                 new NetworkTopologyOperationInputEntity();
84         loadSdncRequestHeaderEntity(networkTopologyOperationInputEntity, execution);
85         loadRequestInformationEntity(networkTopologyOperationInputEntity, execution);
86         loadServiceInformation(networkTopologyOperationInputEntity, execution);
87         loadNetworkInformationEntity(execution, networkTopologyOperationInputEntity);
88         loadNetwrokRequestInputEntity(inputs, networkTopologyOperationInputEntity);
89         return networkTopologyOperationInputEntity;
90     }
91
92     private void loadNetworkInformationEntity(DelegateExecution execution,
93             NetworkTopologyOperationInputEntity networkTopologyOperationInputEntity) {
94         NetworkInformationEntity networkInformationEntity = new NetworkInformationEntity();
95         OnapModelInformationEntity onapModelInformationEntity = getOnapNetworkModelInformationEntity(execution);
96         networkInformationEntity.setOnapModelInformation(onapModelInformationEntity);
97         networkTopologyOperationInputEntity.setNetworkInformation(networkInformationEntity);
98     }
99 }