2 * ============LICENSE_START=======================================================
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
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.client.namingservice;
23 import java.util.List;
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;
32 public class NamingRequestObjectBuilder{
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);
43 public Deleteelement deleteElementMapper(String instanceGroupId){
44 Deleteelement deleteElement = new Deleteelement();
45 deleteElement.setExternalKey(instanceGroupId);
48 public NameGenRequest nameGenRequestMapper(List<Element> elements){
49 NameGenRequest nameGenRequest = new NameGenRequest();
50 nameGenRequest.setElements(elements);
51 return nameGenRequest;
53 public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements){
54 NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
55 nameGenDeleteRequest.setElements(deleteElements);
56 return nameGenDeleteRequest;