Containerization feature of SO
[so.git] / asdc-controller / src / main / java / org / onap / so / asdc / client / test / emulators / ResourceInfoImpl.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.asdc.client.test.emulators;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 import org.onap.sdc.api.notification.IArtifactInfo;
27 import org.onap.sdc.api.notification.IResourceInstance;
28
29 public class ResourceInfoImpl implements IResourceInstance{
30         ResourceInfoImpl (){}
31         private String resourceInstanceName;
32         private String resourceCustomizationUUID;
33         private String resourceName;
34         private String resourceVersion;
35         private String resourceType;
36         private String resourceUUID;
37         private String resourceInvariantUUID;
38         private String category;
39         private String subcategory;
40         private List<ArtifactInfoImpl> artifacts;
41         
42         private ResourceInfoImpl(IResourceInstance resourceInstance){
43                 resourceInstanceName = resourceInstance.getResourceInstanceName();
44                 resourceCustomizationUUID = resourceInstance.getResourceCustomizationUUID();
45                 resourceName = resourceInstance.getResourceName();
46                 resourceVersion = resourceInstance.getResourceVersion();
47                 resourceType = resourceInstance.getResourceType();
48                 resourceUUID = resourceInstance.getResourceUUID();
49                 resourceInvariantUUID = resourceInstance.getResourceInvariantUUID();
50                 category = resourceInstance.getCategory();
51                 subcategory = resourceInstance.getSubcategory();
52                 artifacts = ArtifactInfoImpl.convertToArtifactInfoImpl(resourceInstance.getArtifacts());
53         }
54         
55         public static List<ResourceInfoImpl> convertToJsonContainer(List<IResourceInstance> resources){
56                  List<ResourceInfoImpl> buildResources = new ArrayList<ResourceInfoImpl>();
57                  if( resources != null ){
58                          for( IResourceInstance resourceInstance : resources ){
59                                  buildResources.add(new ResourceInfoImpl(resourceInstance));
60                          }
61                  }
62                  return buildResources;
63         }
64         
65         @Override
66         public String getResourceInstanceName() {
67                 return resourceInstanceName;
68         }
69
70         public void setResourceInstanceName(String resourceInstanceName) {
71                 this.resourceInstanceName = resourceInstanceName;
72         }
73         
74         @Override
75         public String getResourceName() {
76                 return resourceName;
77         }
78
79         public void setResourceName(String resourceName) {
80                 this.resourceName = resourceName;
81         }
82
83         @Override
84         public String getResourceVersion() {
85                 return resourceVersion;
86         }
87
88         public void setResourceVersion(String resourceVersion) {
89                 this.resourceVersion = resourceVersion;
90         }
91
92         @Override
93         public String getResourceType() {
94                 return resourceType;
95         }
96
97         public void setResoucreType(String resourceType) {
98                 this.resourceType = resourceType;
99         }
100
101         @Override
102         public String getResourceUUID() {
103                 return resourceUUID;
104         }
105
106         public void setResourceUUID(String resourceUUID) {
107                 this.resourceUUID = resourceUUID;
108         }
109
110         @Override
111         public List<IArtifactInfo> getArtifacts() {
112                 List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>();
113                 if( artifacts != null ){
114                         temp.addAll(artifacts);
115                 }
116                 return temp;
117         }
118
119         public void setArtifacts(List<ArtifactInfoImpl> artifacts) {
120                 this.artifacts = artifacts;
121         }
122         
123         public List<ArtifactInfoImpl> getArtifactsImpl(){
124                 return artifacts;
125         }
126         
127         @Override
128         public String getResourceInvariantUUID() {
129                 return resourceInvariantUUID;
130         }
131         
132         public void setResourceInvariantUUID(String resourceInvariantUUID) {
133                 this.resourceInvariantUUID = resourceInvariantUUID;
134         }
135         public String getResourceCustomizationUUID() {
136                 return resourceCustomizationUUID;
137         }
138
139         public void setResourceCustomizationUUID(String resourceCustomizationUUID) {
140                 this.resourceCustomizationUUID = resourceCustomizationUUID;
141         }
142
143         public String getCategory() {
144                 return category;
145         }
146
147         public void setCategory(String category) {
148                 this.category = category;
149         }
150
151         public String getSubcategory() {
152                 return subcategory;
153         }
154
155         public void setSubcategory(String subcategory) {
156                 this.subcategory = subcategory;
157         }
158 }