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