ba9f170d71d83e3e46dcd71e17cdc9aa3f80d1b0
[so.git] / bpmn / so-bpmn-tasks / src / main / java / org / onap / so / client / namingservice / NamingRequestObjectBuilder.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 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.client.namingservice;
22
23 import java.util.List;
24
25 import org.onap.namingservice.model.Deleteelement;
26 import org.onap.namingservice.model.Element;
27 import org.onap.namingservice.model.NameGenDeleteRequest;
28 import org.onap.namingservice.model.NameGenRequest;
29 import org.springframework.stereotype.Component;
30
31 @Component
32 public class NamingRequestObjectBuilder{
33         
34         public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType, String nfNamingCode, String instanceGroupName){
35                 Element element = new Element();
36                 element.put("external-key", instanceGroupId);
37                 element.put("policy-instance-name", policyInstanceName);
38                 element.put("naming-type", namingType);
39                 element.put("resource-name", instanceGroupName);
40                 element.put("nf-naming-code", nfNamingCode);
41                 return element;
42         }
43         public Deleteelement deleteElementMapper(String instanceGroupId){
44                 Deleteelement deleteElement = new Deleteelement();
45                 deleteElement.setExternalKey(instanceGroupId);
46                 return deleteElement;
47         }
48         public NameGenRequest nameGenRequestMapper(List<Element> elements){
49                 NameGenRequest nameGenRequest = new NameGenRequest();
50                 nameGenRequest.setElements(elements);
51                 return nameGenRequest;
52         }
53         public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements){
54                 NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
55                 nameGenDeleteRequest.setElements(deleteElements);
56                 return nameGenDeleteRequest;
57         }
58 }