Catalog alignment
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / ComponentInstanceProperty.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.openecomp.sdc.be.model;
22
23 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
24 import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
25
26 import java.util.List;
27
28 public class ComponentInstanceProperty extends PropertyDefinition implements IComponentInstanceConnectedElement, IPropertyInputCommon {
29
30     /**
31      * The unique id of the property value on graph
32      */
33     private String valueUniqueUid;
34
35     private List<String> path;
36
37     private List<PropertyRule> rules ;
38
39
40     private String componentInstanceName;
41
42     private String componentInstanceId;
43
44     public String getComponentInstanceName() {
45         return componentInstanceName;
46     }
47
48     public void setComponentInstanceName(String componentInstanceName) {
49         this.componentInstanceName = componentInstanceName;
50     }
51
52     public String getComponentInstanceId() {
53         return componentInstanceId;
54     }
55
56     public void setComponentInstanceId(String componentInstanceId) {
57         this.componentInstanceId = componentInstanceId;
58     }
59
60     public ComponentInstanceProperty() {
61         super();
62     }
63     public ComponentInstanceProperty(PropertyDataDefinition pd) {
64         super(pd);
65         getConstraints();
66     }
67
68     public ComponentInstanceProperty(PropertyDefinition pd) {
69         super(pd);
70     }
71
72     public ComponentInstanceProperty(PropertyDefinition pd, String value, String valueUniqueUid) {
73         super(pd);
74
75         this.setValue(value);
76         this.valueUniqueUid = valueUniqueUid;
77     }
78
79     public ComponentInstanceProperty(Boolean hidden, PropertyDefinition pd, String valueUniqueUid) {
80         super(pd);
81
82         this.hidden = hidden;
83         this.valueUniqueUid = valueUniqueUid;
84         setParentUniqueId(pd.getParentUniqueId());
85     }
86
87
88
89     public String getValueUniqueUid() {
90         return valueUniqueUid;
91     }
92
93     public void setValueUniqueUid(String valueUniqueUid) {
94         this.valueUniqueUid = valueUniqueUid;
95     }
96
97
98     public List<String> getPath() {
99         return path;
100     }
101
102     public void setPath(List<String> path) {
103         this.path = path;
104     }
105
106     public List<PropertyRule> getRules() {
107         return rules;
108     }
109
110     public void setRules(List<PropertyRule> rules) {
111         this.rules = rules;
112     }
113
114
115     @Override
116     public String toString() {
117         return "ComponentInstanceProperty [ " + super.toString() + " , value=" + getValue() + ", valueUniqueUid = " + valueUniqueUid + " , rules=" + rules + " , path=" + path + " ]";
118     }
119         
120         public void updateCapabilityProperty(ComponentInstanceProperty property) {
121                 if(property != null && property.getValue() != null){
122                         setValue(property.getValue());
123                 }
124         }
125
126 }