Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCoreBPMN / src / main / java / org / onap / so / bpmn / core / domain / Resource.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.bpmn.core.domain;
22
23 import java.io.Serializable;
24 import com.fasterxml.jackson.annotation.JsonIgnore;
25 import com.fasterxml.jackson.annotation.JsonInclude;
26
27
28
29 public abstract class Resource extends JsonWrapper implements Serializable {
30
31     private static final long serialVersionUID = 1L;
32     private String resourceId; // TODO name this field just id instead, should be the id of the object as it is in aai
33     protected ResourceType resourceType; // Enum of vnf or network or allotted resource
34     protected ModelInfo modelInfo;
35     private long concurrencyCounter = 1L;
36
37     // private List modules;
38     private ResourceInstance resourceInstance = new ResourceInstance(); // TODO possibly remove
39     private HomingSolution homingSolution = new HomingSolution();
40     @JsonInclude(JsonInclude.Include.NON_NULL)
41     private HomingSolution currentHomingSolution;
42
43     // common parameters for all Resources
44     private String toscaNodeType;
45
46     // GET and SET
47     public String getResourceId() {
48         return resourceId;
49     }
50
51     public void setResourceId(String resourceId) {
52         this.resourceId = resourceId;
53     }
54
55     public ModelInfo getModelInfo() {
56         return modelInfo;
57     }
58
59     public void setModelInfo(ModelInfo modelInfo) {
60         this.modelInfo = modelInfo;
61     }
62
63     public ResourceInstance getResourceInstance() {
64         return resourceInstance;
65     }
66
67     public void setResourceInstance(ResourceInstance resourceInstance) {
68         this.resourceInstance = resourceInstance;
69     }
70
71     public HomingSolution getHomingSolution() {
72         return homingSolution;
73     }
74
75     public void setHomingSolution(HomingSolution homingSolution) {
76         this.homingSolution = homingSolution;
77     }
78
79     public HomingSolution getCurrentHomingSolution() {
80         return currentHomingSolution;
81     }
82
83     public void setCurrentHomingSolution(HomingSolution currentHomingSolution) {
84         this.currentHomingSolution = currentHomingSolution;
85     }
86
87     public void setResourceType(ResourceType resourceType) {
88         this.resourceType = resourceType;
89     }
90
91     public ResourceType getResourceType() {
92         return resourceType;
93     }
94
95     public String getToscaNodeType() {
96         return toscaNodeType;
97     }
98
99     public void setToscaNodeType(String toscaNodeType) {
100         this.toscaNodeType = toscaNodeType;
101     }
102
103     // Utility methods
104
105     public String getResourceInstanceId() {
106         return this.getResourceInstance().getInstanceId();
107     }
108
109     public String getResourceInstanceName() {
110         return this.getResourceInstance().getInstanceName();
111     }
112     // TODO
113     // @JsonIgnore
114     // public String getResourceHomingSolution() {
115     // }
116
117     public void setResourceInstanceId(String newInstanceId) {
118         this.getResourceInstance().setInstanceId(newInstanceId);
119     }
120
121     public void setResourceInstanceName(String newInstanceName) {
122         this.getResourceInstance().setInstanceName(newInstanceName);
123     }
124
125     // TODO
126     // @JsonIgnore
127     // public String setResourceHomingSolution() {
128     // }
129     /**
130      * To be used by macro flow to increment concurrency counter after update to it's structure was completed
131      */
132     public void incrementConcurrencyCounter() {
133         this.concurrencyCounter++;
134     }
135
136     /**
137      * Method to get concurrency counter data
138      * 
139      * @return long value for the counter
140      */
141     @JsonIgnore
142     public long getConcurrencyCounter() {
143         return concurrencyCounter;
144     }
145
146 }