Fix checkstyle violations in sdc-main/common
[sdc.git] / common / onap-tosca-datatype / src / main / java / org / onap / sdc / tosca / datatypes / model / CapabilityDefinition.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.onap.sdc.tosca.datatypes.model;
22
23 import org.onap.sdc.tosca.services.DataModelCloneUtil;
24
25 import java.util.List;
26 import java.util.Map;
27
28 public class CapabilityDefinition implements Cloneable {
29
30   private String type;
31   private String description;
32   private Map<String, PropertyDefinition> properties;
33   private Map<String, AttributeDefinition> attributes;
34   private List<String> valid_source_types;
35   private Object[] occurrences;
36
37
38   /**
39    * Constructor.
40    */
41   public CapabilityDefinition() {
42     occurrences = new Object[2];
43     occurrences[0] = 1;
44     occurrences[1] = "UNBOUNDED";
45   }
46
47   public String getType() {
48     return type;
49   }
50
51   public void setType(String type) {
52     this.type = type;
53   }
54
55   public String getDescription() {
56     return description;
57   }
58
59   public void setDescription(String description) {
60     this.description = description;
61   }
62
63   public Map<String, PropertyDefinition> getProperties() {
64     return properties;
65   }
66
67   public void setProperties(Map<String, PropertyDefinition> properties) {
68     this.properties = properties;
69   }
70
71   public Map<String, AttributeDefinition> getAttributes() {
72     return attributes;
73   }
74
75   public void setAttributes(Map<String, AttributeDefinition> attributes) {
76     this.attributes = attributes;
77   }
78
79   public List<String> getValid_source_types() {
80     return valid_source_types;
81   }
82
83   public void setValid_source_types(List<String> valid_source_types) {
84     this.valid_source_types = valid_source_types;
85   }
86
87   public Object[] getOccurrences() {
88     return occurrences;
89   }
90
91   public void setOccurrences(Object[] occurrences) {
92     this.occurrences = occurrences;
93   }
94
95   @Override
96   public CapabilityDefinition clone() {
97     CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
98     capabilityDefinition
99         .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
100     capabilityDefinition
101         .setProperties(DataModelCloneUtil.clonePropertyDefinitions(this.getProperties()));
102     capabilityDefinition.setType(this.getType());
103     capabilityDefinition
104         .setAttributes(DataModelCloneUtil.cloneAttributeDefinitions(this.getAttributes()));
105     capabilityDefinition.setDescription(this.getDescription());
106     capabilityDefinition
107         .setValid_source_types(DataModelCloneUtil.cloneListString(this.getValid_source_types()));
108     return capabilityDefinition;
109
110   }
111
112 }