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;
24 import org.onap.namingservice.model.Deleteelement;
25 import org.onap.namingservice.model.Element;
26 import org.onap.namingservice.model.NameGenDeleteRequest;
27 import org.onap.namingservice.model.NameGenRequest;
28 import org.springframework.stereotype.Component;
31 public class NamingRequestObjectBuilder {
33 public Element elementMapper(String instanceGroupId, String policyInstanceName, String namingType,
34 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);
44 public Deleteelement deleteElementMapper(String instanceGroupId) {
45 Deleteelement deleteElement = new Deleteelement();
46 deleteElement.setExternalKey(instanceGroupId);
50 public NameGenRequest nameGenRequestMapper(List<Element> elements) {
51 NameGenRequest nameGenRequest = new NameGenRequest();
52 nameGenRequest.setElements(elements);
53 return nameGenRequest;
56 public NameGenDeleteRequest nameGenDeleteRequestMapper(List<Deleteelement> deleteElements) {
57 NameGenDeleteRequest nameGenDeleteRequest = new NameGenDeleteRequest();
58 nameGenDeleteRequest.setElements(deleteElements);
59 return nameGenDeleteRequest;