Merge "Fixed string literal comparision"
[so.git] / bpmn / MSOCoreBPMN / src / main / java / org / openecomp / mso / bpmn / core / domain / Resource.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\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
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\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
19  */\r
20 \r
21 package org.openecomp.mso.bpmn.core.domain;\r
22 \r
23 import java.io.Serializable;\r
24 \r
25 import com.fasterxml.jackson.annotation.JsonIgnore;\r
26 \r
27 \r
28 \r
29 public abstract class Resource extends JsonWrapper  implements Serializable {\r
30 \r
31         private static final long serialVersionUID = 1L;\r
32         private String resourceId;\r
33         protected ResourceType resourceType; // Enum of vnf or network or allotted resource\r
34         protected ModelInfo modelInfo;\r
35         private long concurrencyCounter = 1L;\r
36 \r
37         //private List modules;\r
38         private ResourceInstance resourceInstance = new ResourceInstance(); // TODO possibly remove\r
39         private HomingSolution homingSolution = new HomingSolution(); // TODO maybe this instead of resourceInstance being "bridge"\r
40 \r
41         //common parameters for all Resources\r
42         private String toscaNodeType;\r
43 \r
44         // GET and SET\r
45         public String getResourceId() {\r
46                 return resourceId;\r
47         }\r
48         public void setResourceId(String resourceId) {\r
49                 this.resourceId = resourceId;\r
50         }\r
51         public ModelInfo getModelInfo() {\r
52                 return modelInfo;\r
53         }\r
54         public void setModelInfo(ModelInfo modelInfo) {\r
55                 this.modelInfo = modelInfo;\r
56         }\r
57 \r
58         public ResourceInstance getResourceInstance() {\r
59                 return resourceInstance;\r
60         }\r
61         public void setResourceInstance(ResourceInstance resourceInstance) {\r
62                 this.resourceInstance = resourceInstance;\r
63         }\r
64         public HomingSolution getHomingSolution(){\r
65                 return homingSolution;\r
66         }\r
67 \r
68         public void setHomingSolution(HomingSolution homingSolution){\r
69                 this.homingSolution = homingSolution;\r
70         }\r
71         public void setResourceType(ResourceType resourceType) {\r
72                 this.resourceType = resourceType;\r
73         }\r
74 \r
75         public ResourceType getResourceType(){\r
76                 return resourceType;\r
77         }\r
78 \r
79         public String getToscaNodeType() {\r
80                 return toscaNodeType;\r
81         }\r
82         public void setToscaNodeType(String toscaNodeType) {\r
83                 this.toscaNodeType = toscaNodeType;\r
84         }\r
85 \r
86         //Utility methods\r
87 \r
88         public String getResourceInstanceId() {\r
89                 return this.getResourceInstance().getInstanceId();\r
90         }\r
91         public String getResourceInstanceName() {\r
92                 return this.getResourceInstance().getInstanceName();\r
93         }\r
94         //TODO\r
95 //      @JsonIgnore\r
96 //      public String getResourceHomingSolution() {\r
97 //      }\r
98 \r
99         public void setResourceInstanceId(String newInstanceId){\r
100                 this.getResourceInstance().setInstanceId(newInstanceId);\r
101         }\r
102         public void setResourceInstanceName(String newInstanceName){\r
103                 this.getResourceInstance().setInstanceName(newInstanceName);\r
104         }\r
105 \r
106         //TODO\r
107 //      @JsonIgnore\r
108 //      public String setResourceHomingSolution() {\r
109 //      }\r
110         /**\r
111          * To be used by macro flow to increment concurrency counter after update to it's structure was completed\r
112          */\r
113         public void incrementConcurrencyCounter(){\r
114                 this.concurrencyCounter ++;\r
115         }\r
116         /**\r
117          * Method to get concurrency counter data\r
118          * @return long value for the counter\r
119          */\r
120         @JsonIgnore\r
121         public long getConcurrencyCounter(){\r
122                 return concurrencyCounter;\r
123         }\r
124 \r
125 }