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