2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.bpmn.core.domain;
\r
23 import java.util.ArrayList;
\r
24 import java.util.List;
\r
25 import java.util.UUID;
\r
27 import com.fasterxml.jackson.annotation.JsonIgnore;
\r
28 import com.fasterxml.jackson.annotation.JsonProperty;
\r
29 import com.fasterxml.jackson.annotation.JsonRootName;
\r
32 * Encapsulates VNF resource data set
\r
35 @JsonRootName("vnfResource")
\r
36 public class VnfResource extends Resource {
\r
38 private static final long serialVersionUID = 1L;
\r
41 * set resourceType for this object
\r
43 public VnfResource(){
\r
44 resourceType = ResourceType.VNF;
\r
45 setResourceId(UUID.randomUUID().toString());
\r
49 * fields specific to VNF resource type
\r
51 @JsonProperty("vfModules")
\r
52 private List <ModuleResource> vfModules;
\r
53 private String vnfType;
\r
54 private String nfFunction;
\r
55 private String nfType;
\r
56 private String nfRole;
\r
57 private String nfNamingCode;
\r
62 public List<ModuleResource> getVfModules() {
\r
65 public void setModules(List<ModuleResource> moduleResources) {
\r
66 this.vfModules = moduleResources;
\r
69 public void setVnfType(String vnfType) {
\r
70 this.vnfType = vnfType;
\r
72 public String getVnfType() {
\r
75 public String getNfFunction() {
\r
78 public void setNfFunction(String nfFunction) {
\r
79 this.nfFunction = nfFunction;
\r
81 public String getNfType() {
\r
84 public void setNfType(String nfType) {
\r
85 this.nfType = nfType;
\r
87 public String getNfRole() {
\r
90 public void setNfRole(String nfRole) {
\r
91 this.nfRole = nfRole;
\r
93 public String getNfNamingCode() {
\r
94 return nfNamingCode;
\r
96 public void setNfNamingCode(String nfNamingCode) {
\r
97 this.nfNamingCode = nfNamingCode;
\r
100 * GET accessors per design requirements
\r
104 * Returns a list of all VfModule objects.
\r
105 * Base module is first entry in the list
\r
106 * @return ordered list of ModuleResources objects
\r
109 public List<ModuleResource> getAllVfModuleObjects(){
\r
110 if (vfModules == null) {
\r
114 for (int i = 0; i < vfModules.size(); i++) {
\r
115 ModuleResource moduleResource = vfModules.get(i);
\r
116 if (moduleResource.getIsBase()){
\r
117 vfModules.remove(moduleResource);
\r
118 vfModules.add(0,moduleResource);
\r
126 * @return Returns JSON list of all VfModule structures.
\r
129 public String getAllVfModulesJson(){
\r
131 return listToJson(vfModules);
\r
134 // methods to add to the list
\r
135 public void addVfModule(ModuleResource moduleResource) {
\r
136 if (vfModules == null){
\r
137 vfModules = new ArrayList<>();
\r
139 this.vfModules.add(moduleResource);
\r
144 * Utility method to allow construction of the filed in the form of
\r
145 * <serviceResources.modelInfo.modelName>/<serviceVnfs.modelInfo.modelInstanceName>
\r
147 * default setter for this field deprecated
\r
148 * @param modelName << serviceResources.modelInfo.modelName
\r
150 public void constructVnfType(String modelName) {
\r
151 this.vnfType = modelName.concat("/").concat(this.modelInfo.getModelInstanceName());
\r