Implement Attributes/Outputs BE (part 2)
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / ComponentInstanceOutput.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2021, Nordix Foundation. 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 java.util.List;
24 import lombok.Getter;
25 import lombok.NoArgsConstructor;
26 import lombok.Setter;
27 import lombok.ToString;
28 import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
29 import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
30
31 @Getter
32 @Setter
33 @NoArgsConstructor
34 @ToString(callSuper = true)
35 public class ComponentInstanceOutput extends OutputDefinition implements IComponentInstanceConnectedElement, IAttributeOutputCommon {
36
37     /**
38      * The unique id of the attribute value on graph
39      */
40     private String valueUniqueUid;
41
42     private List<String> path;
43
44     private List<PropertyRule> rules;
45     private String componentInstanceName;
46     private String componentInstanceId;
47
48     public ComponentInstanceOutput(final AttributeDataDefinition curPropertyDef,
49                                    final String outputId,
50                                    final String value,
51                                    final String valueUniqueUid) {
52         super(curPropertyDef);
53         setOutputId(outputId);
54         setValue(value);
55         this.valueUniqueUid = valueUniqueUid;
56     }
57
58     public ComponentInstanceOutput(final OutputDefinition pd,
59                                    final String value,
60                                    final String valueUniqueUid) {
61         super(pd);
62
63         setValue(value);
64         this.valueUniqueUid = valueUniqueUid;
65     }
66
67     public ComponentInstanceOutput(AttributeDataDefinition attributeDataDefinition) {
68         super(attributeDataDefinition);
69         if (attributeDataDefinition.getGetOutputValues() != null && !attributeDataDefinition.getGetOutputValues()
70             .isEmpty()) {
71             setOutputId(attributeDataDefinition.getGetOutputValues().get(0).getOutputId());
72         }
73     }
74
75 }