diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-27 22:58:29 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-29 07:15:14 +0000 |
commit | 04c236567737c965545f64c9542a7d75ed6f9046 (patch) | |
tree | 8d2a3ea1bcb80b8d66603bb31a8b6877a98d84f8 /common/onap-tosca-datatype | |
parent | be66acfea37b8d96cbb1b1e14592de57ec3bc4ae (diff) |
Reformat common
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3449
Change-Id: Ifa1412b8a614f7cdb4c52f05d811ab5e9cf20d83
Diffstat (limited to 'common/onap-tosca-datatype')
68 files changed, 1285 insertions, 1550 deletions
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java index 42d9d109b3..abcb8b52a4 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import lombok.Getter; @@ -27,9 +26,8 @@ import lombok.Setter; @Setter public class ActivityDefinition { - private String delegate; - private String set_state; - private String call_operation; - private String inline; - + private String delegate; + private String set_state; + private String call_operation; + private String inline; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java index 11f535461e..90809f0304 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,20 +17,18 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; - import lombok.Getter; import lombok.Setter; @Getter @Setter public class ArtifactDefinition { - private String type; - private String file; - private String repository; - private String description; - private String deploy_path; + private String type; + private String file; + private String repository; + private String description; + private String deploy_path; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java index 54ca3089c7..8b80a9548f 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; @@ -25,18 +24,15 @@ import java.util.Map; import lombok.Getter; import lombok.Setter; - @Getter @Setter public class ArtifactType { - private String derived_from; - private String version; - private Map<String, String> metadata; - private String description; - private String mime_type; - private List<String> file_ext; - private Map<String, PropertyDefinition> properties; - - + private String derived_from; + private String version; + private Map<String, String> metadata; + private String description; + private String mime_type; + private List<String> file_ext; + private Map<String, PropertyDefinition> properties; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java index 9dfbc39880..ab988fe837 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import com.fasterxml.jackson.annotation.JsonProperty; @@ -41,10 +40,7 @@ public class AttributeDefinition implements Cloneable { status = Status.SUPPORTED.getName(); } - public AttributeDefinition(final String type, - final String description, - final Object _default, - final String status, + public AttributeDefinition(final String type, final String description, final Object _default, final String status, final EntrySchema entry_schema) { this.setType(type); this.setDescription(description); @@ -60,8 +56,7 @@ public class AttributeDefinition implements Cloneable { attributeDefinition.setDescription(this.getDescription()); attributeDefinition.set_default(this.get_default()); attributeDefinition.setStatus(this.getStatus()); - attributeDefinition.setEntry_schema( - Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone()); + attributeDefinition.setEntry_schema(Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone()); return attributeDefinition; } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java index bed4e8c6b0..e16d5cf55c 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,31 +17,28 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; - - public class CapabilityAssignment { - private Map<String, Object> properties; - private Map<String, Object> attributes; + private Map<String, Object> properties; + private Map<String, Object> attributes; - public Map<String, Object> getProperties() { - return properties; - } + public Map<String, Object> getProperties() { + return properties; + } - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } - public Map<String, Object> getAttributes() { - return attributes; - } + public Map<String, Object> getAttributes() { + return attributes; + } - public void setAttributes(Map<String, Object> attributes) { - this.attributes = attributes; - } + public void setAttributes(Map<String, Object> attributes) { + this.attributes = attributes; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java index 4d0a38a77e..144822d07d 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,96 +17,87 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; -import org.onap.sdc.tosca.services.DataModelCloneUtil; - import java.util.List; import java.util.Map; +import org.onap.sdc.tosca.services.DataModelCloneUtil; public class CapabilityDefinition implements Cloneable { - private String type; - private String description; - private Map<String, PropertyDefinition> properties; - private Map<String, AttributeDefinition> attributes; - private List<String> valid_source_types; - private Object[] occurrences; - - - /** - * Constructor. - */ - public CapabilityDefinition() { - occurrences = new Object[2]; - occurrences[0] = 1; - occurrences[1] = "UNBOUNDED"; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map<String, PropertyDefinition> getProperties() { - return properties; - } - - public void setProperties(Map<String, PropertyDefinition> properties) { - this.properties = properties; - } - - public Map<String, AttributeDefinition> getAttributes() { - return attributes; - } - - public void setAttributes(Map<String, AttributeDefinition> attributes) { - this.attributes = attributes; - } - - public List<String> getValid_source_types() { - return valid_source_types; - } - - public void setValid_source_types(List<String> valid_source_types) { - this.valid_source_types = valid_source_types; - } - - public Object[] getOccurrences() { - return occurrences; - } - - public void setOccurrences(Object[] occurrences) { - this.occurrences = occurrences; - } - - @Override - public CapabilityDefinition clone() { - CapabilityDefinition capabilityDefinition = new CapabilityDefinition(); - capabilityDefinition - .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]}); - capabilityDefinition - .setProperties(DataModelCloneUtil.clonePropertyDefinitions(this.getProperties())); - capabilityDefinition.setType(this.getType()); - capabilityDefinition - .setAttributes(DataModelCloneUtil.cloneAttributeDefinitions(this.getAttributes())); - capabilityDefinition.setDescription(this.getDescription()); - capabilityDefinition - .setValid_source_types(DataModelCloneUtil.cloneListString(this.getValid_source_types())); - return capabilityDefinition; - - } - + private String type; + private String description; + private Map<String, PropertyDefinition> properties; + private Map<String, AttributeDefinition> attributes; + private List<String> valid_source_types; + private Object[] occurrences; + + /** + * Constructor. + */ + public CapabilityDefinition() { + occurrences = new Object[2]; + occurrences[0] = 1; + occurrences[1] = "UNBOUNDED"; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, PropertyDefinition> getProperties() { + return properties; + } + + public void setProperties(Map<String, PropertyDefinition> properties) { + this.properties = properties; + } + + public Map<String, AttributeDefinition> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, AttributeDefinition> attributes) { + this.attributes = attributes; + } + + public List<String> getValid_source_types() { + return valid_source_types; + } + + public void setValid_source_types(List<String> valid_source_types) { + this.valid_source_types = valid_source_types; + } + + public Object[] getOccurrences() { + return occurrences; + } + + public void setOccurrences(Object[] occurrences) { + this.occurrences = occurrences; + } + + @Override + public CapabilityDefinition clone() { + CapabilityDefinition capabilityDefinition = new CapabilityDefinition(); + capabilityDefinition.setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]}); + capabilityDefinition.setProperties(DataModelCloneUtil.clonePropertyDefinitions(this.getProperties())); + capabilityDefinition.setType(this.getType()); + capabilityDefinition.setAttributes(DataModelCloneUtil.cloneAttributeDefinitions(this.getAttributes())); + capabilityDefinition.setDescription(this.getDescription()); + capabilityDefinition.setValid_source_types(DataModelCloneUtil.cloneListString(this.getValid_source_types())); + return capabilityDefinition; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java index dc868c938a..682a159116 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; @@ -23,7 +22,6 @@ import java.util.Map; * @author KATYR * @since May 13, 2018 */ - public class CapabilityFilter { private List<Map<String, List<Constraint>>> properties; @@ -40,5 +38,4 @@ public class CapabilityFilter { public String toString() { return "CapabilityFilter{" + "properties=" + properties + '}'; } - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java index a6368f8a6f..403b48ed29 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,68 +17,65 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Map; - - public class CapabilityType { - private String derived_from; - private String version; - private String description; - private Map<String, PropertyDefinition> properties; - private Map<String, AttributeDefinition> attributes; - private List<String> valid_source_types; + private String derived_from; + private String version; + private String description; + private Map<String, PropertyDefinition> properties; + private Map<String, AttributeDefinition> attributes; + private List<String> valid_source_types; - public String getDerived_from() { - return derived_from; - } + public String getDerived_from() { + return derived_from; + } - public void setDerived_from(String derived_from) { - this.derived_from = derived_from; - } + public void setDerived_from(String derived_from) { + this.derived_from = derived_from; + } - public String getVersion() { - return version; - } + public String getVersion() { + return version; + } - public void setVersion(String version) { - this.version = version; - } + public void setVersion(String version) { + this.version = version; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - public Map<String, PropertyDefinition> getProperties() { - return properties; - } + public Map<String, PropertyDefinition> getProperties() { + return properties; + } - public void setProperties(Map<String, PropertyDefinition> properties) { - this.properties = properties; - } + public void setProperties(Map<String, PropertyDefinition> properties) { + this.properties = properties; + } - public Map<String, AttributeDefinition> getAttributes() { - return attributes; - } + public Map<String, AttributeDefinition> getAttributes() { + return attributes; + } - public void setAttributes(Map<String, AttributeDefinition> attributes) { - this.attributes = attributes; - } + public void setAttributes(Map<String, AttributeDefinition> attributes) { + this.attributes = attributes; + } - public List<String> getValid_source_types() { - return valid_source_types; - } + public List<String> getValid_source_types() { + return valid_source_types; + } - public void setValid_source_types(List<String> valid_source_types) { - this.valid_source_types = valid_source_types; - } + public void setValid_source_types(List<String> valid_source_types) { + this.valid_source_types = valid_source_types; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java index f85ea5c7d2..628e094cfc 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; @@ -26,5 +25,4 @@ public class Condition { private String period; private Integer evaluations; private String method; - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java index 5b62af0dc9..b0bf1377a2 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,12 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.ArrayList; import java.util.List; - import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -32,58 +30,58 @@ import lombok.Setter; @NoArgsConstructor public class Constraint implements Cloneable { - private Object equal; - private Object greater_or_equal; - private Object greater_than; - private Object less_than; - private Object less_or_equal; - private Object[] in_range; - private List<Object> valid_values; - private Integer length; - private Integer min_length; - private Integer max_length; - private Object pattern; - - /** - * Sets in_range attribute. - * @param in_range. - */ - public void setIn_range(Object[] in_range) { - this.in_range = new Object[2]; - this.in_range[0] = in_range[0]; - this.in_range[1] = in_range[1]; - } + private Object equal; + private Object greater_or_equal; + private Object greater_than; + private Object less_than; + private Object less_or_equal; + private Object[] in_range; + private List<Object> valid_values; + private Integer length; + private Integer min_length; + private Integer max_length; + private Object pattern; - @Override - public Constraint clone() { - Constraint constraint = new Constraint(); - constraint.setEqual(this.getEqual()); - constraint.setGreater_or_equal(this.getGreater_or_equal()); - constraint.setGreater_than(this.getGreater_than()); - cloneInRange(constraint); - constraint.setLength(this.getLength()); - constraint.setLess_or_equal(this.getLess_or_equal()); - constraint.setLess_than(this.getLess_than()); - constraint.setMax_length(this.getMax_length()); - constraint.setMin_length(this.getMin_length()); - constraint.setPattern(this.getPattern()); - cloneValidValues(constraint); + /** + * Sets in_range attribute. + * + * @param in_range. + */ + public void setIn_range(Object[] in_range) { + this.in_range = new Object[2]; + this.in_range[0] = in_range[0]; + this.in_range[1] = in_range[1]; + } - return constraint; - } + @Override + public Constraint clone() { + Constraint constraint = new Constraint(); + constraint.setEqual(this.getEqual()); + constraint.setGreater_or_equal(this.getGreater_or_equal()); + constraint.setGreater_than(this.getGreater_than()); + cloneInRange(constraint); + constraint.setLength(this.getLength()); + constraint.setLess_or_equal(this.getLess_or_equal()); + constraint.setLess_than(this.getLess_than()); + constraint.setMax_length(this.getMax_length()); + constraint.setMin_length(this.getMin_length()); + constraint.setPattern(this.getPattern()); + cloneValidValues(constraint); + return constraint; + } - private void cloneInRange(Constraint constraint) { - if (this.getIn_range() != null) { - constraint.setIn_range(new Object[]{this.getIn_range()[0], this.getIn_range()[1]}); + private void cloneInRange(Constraint constraint) { + if (this.getIn_range() != null) { + constraint.setIn_range(new Object[]{this.getIn_range()[0], this.getIn_range()[1]}); + } } - } - private void cloneValidValues(Constraint constraint) { - if (this.getValid_values() != null) { - constraint.setValid_values(new ArrayList<>()); - for (Object entry : this.getValid_values()) { - constraint.getValid_values().add(entry); - } + private void cloneValidValues(Constraint constraint) { + if (this.getValid_values() != null) { + constraint.setValid_values(new ArrayList<>()); + for (Object entry : this.getValid_values()) { + constraint.getValid_values().add(entry); + } + } } - } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java index 217af07d05..b843c629d8 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,59 +17,59 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; public class Credential { - private String protocol; - private String token_type; - private String token; - private Map<String, String> keys; - private String user; - public Credential() { - this.token_type = "password"; - } + private String protocol; + private String token_type; + private String token; + private Map<String, String> keys; + private String user; + + public Credential() { + this.token_type = "password"; + } - public String getProtocol() { - return protocol; - } + public String getProtocol() { + return protocol; + } - public void setProtocol(String protocol) { - this.protocol = protocol; - } + public void setProtocol(String protocol) { + this.protocol = protocol; + } - public String getToken_type() { - return token_type; - } + public String getToken_type() { + return token_type; + } - public void setToken_type(String token_type) { - this.token_type = token_type; - } + public void setToken_type(String token_type) { + this.token_type = token_type; + } - public String getToken() { - return token; - } + public String getToken() { + return token; + } - public void setToken(String token) { - this.token = token; - } + public void setToken(String token) { + this.token = token; + } - public Map<String, String> getKeys() { - return keys; - } + public Map<String, String> getKeys() { + return keys; + } - public void setKeys(Map<String, String> keys) { - this.keys = keys; - } + public void setKeys(Map<String, String> keys) { + this.keys = keys; + } - public String getUser() { - return user; - } + public String getUser() { + return user; + } - public void setUser(String user) { - this.user = user; - } + public void setUser(String user) { + this.user = user; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java index acf11c25f9..6ea83ceef7 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; @@ -25,108 +24,108 @@ import java.util.Map; public class DataType { - private String derived_from; - private String version; - private Map<String, String> metadata; - private String description; - private List<Constraint> constraints; - private Map<String, PropertyDefinition> properties; - - /** - * Gets derived from. - * - * @return the derived from - */ - public String getDerived_from() { - return derived_from; - } - - /** - * Sets derived from. - * - * @param derived_from the derived from - */ - public void setDerived_from(String derived_from) { - this.derived_from = derived_from; - } - - /** - * Gets version. - * - * @return the version - */ - public String getVersion() { - return version; - } - - /** - * Sets version. - * - * @param version the version - */ - public void setVersion(String version) { - this.version = version; - } - - public Map<String, String> getMetadata() { - return metadata; - } - - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - /** - * Gets description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Sets description. - * - * @param description the description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets constraints. - * - * @return the constraints - */ - public List<Constraint> getConstraints() { - return constraints; - } - - /** - * Sets constraints. - * - * @param constraints the constraints - */ - public void setConstraints(List<Constraint> constraints) { - this.constraints = constraints; - } - - /** - * Gets properties. - * - * @return the properties - */ - public Map<String, PropertyDefinition> getProperties() { - return properties; - } - - /** - * Sets properties. - * - * @param properties the properties - */ - public void setProperties(Map<String, PropertyDefinition> properties) { - this.properties = properties; - } + private String derived_from; + private String version; + private Map<String, String> metadata; + private String description; + private List<Constraint> constraints; + private Map<String, PropertyDefinition> properties; + + /** + * Gets derived from. + * + * @return the derived from + */ + public String getDerived_from() { + return derived_from; + } + + /** + * Sets derived from. + * + * @param derived_from the derived from + */ + public void setDerived_from(String derived_from) { + this.derived_from = derived_from; + } + + /** + * Gets version. + * + * @return the version + */ + public String getVersion() { + return version; + } + + /** + * Sets version. + * + * @param version the version + */ + public void setVersion(String version) { + this.version = version; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + /** + * Gets description. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Sets description. + * + * @param description the description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Gets constraints. + * + * @return the constraints + */ + public List<Constraint> getConstraints() { + return constraints; + } + + /** + * Sets constraints. + * + * @param constraints the constraints + */ + public void setConstraints(List<Constraint> constraints) { + this.constraints = constraints; + } + + /** + * Gets properties. + * + * @return the properties + */ + public Map<String, PropertyDefinition> getProperties() { + return properties; + } + + /** + * Sets properties. + * + * @param properties the properties + */ + public void setProperties(Map<String, PropertyDefinition> properties) { + this.properties = properties; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java index 310f9004af..73b5d77599 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; @@ -22,91 +21,89 @@ import org.onap.sdc.tosca.services.DataModelCloneUtil; public class DefinitionOfDataType implements Cloneable { - private String type; - private String description; - private Object value; - private Boolean required; - private Object _default; - private String status; - private List<Constraint> constraints; - private EntrySchema entry_schema; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public Boolean getRequired() { - return required; - } - - public void setRequired(Boolean required) { - this.required = required; - } - - public Object get_default() { - return _default; - } - - public void set_default(Object _default) { - this._default = _default; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public List<Constraint> getConstraints() { - return constraints; - } - - public void setConstraints(List<Constraint> constraints) { - this.constraints = constraints; - } - - public EntrySchema getEntry_schema() { - return entry_schema; - } - - public void setEntry_schema(EntrySchema entry_schema) { - this.entry_schema = entry_schema; - } - - @Override - public DefinitionOfDataType clone() { - DefinitionOfDataType definitionOfDataType = new DefinitionOfDataType(); - definitionOfDataType.setType(this.getType()); - definitionOfDataType.setDescription(this.getDescription()); - definitionOfDataType.setRequired(this.getRequired()); - definitionOfDataType.set_default(this.get_default()); - definitionOfDataType.setStatus(this.getStatus()); - definitionOfDataType.setEntry_schema( - Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone()); - definitionOfDataType.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints())); - return definitionOfDataType; - } - + private String type; + private String description; + private Object value; + private Boolean required; + private Object _default; + private String status; + private List<Constraint> constraints; + private EntrySchema entry_schema; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public Object get_default() { + return _default; + } + + public void set_default(Object _default) { + this._default = _default; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public List<Constraint> getConstraints() { + return constraints; + } + + public void setConstraints(List<Constraint> constraints) { + this.constraints = constraints; + } + + public EntrySchema getEntry_schema() { + return entry_schema; + } + + public void setEntry_schema(EntrySchema entry_schema) { + this.entry_schema = entry_schema; + } + + @Override + public DefinitionOfDataType clone() { + DefinitionOfDataType definitionOfDataType = new DefinitionOfDataType(); + definitionOfDataType.setType(this.getType()); + definitionOfDataType.setDescription(this.getDescription()); + definitionOfDataType.setRequired(this.getRequired()); + definitionOfDataType.set_default(this.get_default()); + definitionOfDataType.setStatus(this.getStatus()); + definitionOfDataType.setEntry_schema(Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone()); + definitionOfDataType.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints())); + return definitionOfDataType; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java index e072a733ec..1b4e1ee09d 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java @@ -17,21 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; - import lombok.AllArgsConstructor; import lombok.Getter; @Getter @AllArgsConstructor public enum Directive { - - - SELECTABLE("selectable"), - SUBSTITUTABLE("substitutable"); - - private final String displayName; - + SELECTABLE("selectable"), SUBSTITUTABLE("substitutable"); + private final String displayName; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java index b83e7ddc2e..932e3c7836 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,49 +17,47 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; -import org.onap.sdc.tosca.services.DataModelCloneUtil; - import java.util.List; +import org.onap.sdc.tosca.services.DataModelCloneUtil; public class EntrySchema implements Cloneable { - private String description; - private String type; - private List<Constraint> constraints; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List<Constraint> getConstraints() { - return constraints; - } - - public void setConstraints(List<Constraint> constraints) { - this.constraints = constraints; - } - - @Override - public EntrySchema clone() { - EntrySchema entrySchema = new EntrySchema(); - entrySchema.setDescription(this.getDescription()); - entrySchema.setType(this.getType()); - entrySchema.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints())); - return entrySchema; - } + private String description; + private String type; + private List<Constraint> constraints; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List<Constraint> getConstraints() { + return constraints; + } + + public void setConstraints(List<Constraint> constraints) { + this.constraints = constraints; + } + + @Override + public EntrySchema clone() { + EntrySchema entrySchema = new EntrySchema(); + entrySchema.setDescription(this.getDescription()); + entrySchema.setType(this.getType()); + entrySchema.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints())); + return entrySchema; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java index 30516aaad9..53deafc92b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,36 +17,35 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; public class EventFilter { - private String node; - private String requirement; - private String capability; + private String node; + private String requirement; + private String capability; - public String getNode() { - return node; - } + public String getNode() { + return node; + } - public void setNode(String node) { - this.node = node; - } + public void setNode(String node) { + this.node = node; + } - public String getRequirement() { - return requirement; - } + public String getRequirement() { + return requirement; + } - public void setRequirement(String requirement) { - this.requirement = requirement; - } + public void setRequirement(String requirement) { + this.requirement = requirement; + } - public String getCapability() { - return capability; - } + public String getCapability() { + return capability; + } - public void setCapability(String capability) { - this.capability = capability; - } + public void setCapability(String capability) { + this.capability = capability; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java index e2002bf22e..599c5e3002 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,69 +17,65 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Map; - - public class GroupDefinition { - private String type; - private String description; - private Map<String, String> metadata; - private Map<String, Object> properties; - private List<String> members; - private Map<String, Object> interfaces; + private String type; + private String description; + private Map<String, String> metadata; + private Map<String, Object> properties; + private List<String> members; + private Map<String, Object> interfaces; - public String getType() { - return type; - } + public String getType() { + return type; + } - public void setType(String type) { - this.type = type; - } + public void setType(String type) { + this.type = type; + } - public String getDescription() { - return description; - } + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - public Map<String, Object> getProperties() { - return properties; - } + public Map<String, Object> getProperties() { + return properties; + } - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } - public List<String> getMembers() { - return members; - } + public List<String> getMembers() { + return members; + } - public void setMembers(List<String> members) { - this.members = members; - } + public void setMembers(List<String> members) { + this.members = members; + } - public Map<String, String> getMetadata() { - return metadata; - } + public Map<String, String> getMetadata() { + return metadata; + } - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } - public Map<String, Object> getInterfaces() { - return interfaces; - } + public Map<String, Object> getInterfaces() { + return interfaces; + } - public void setInterfaces( - Map<String, Object> interfaces) { - this.interfaces = interfaces; - } + public void setInterfaces(Map<String, Object> interfaces) { + this.interfaces = interfaces; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java index 611b1bf447..751a829b33 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,97 +17,92 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Map; - - public class GroupType { - private String derived_from; - private String version; - private Map<String, String> metadata; - private String description; - private Map<String, PropertyDefinition> properties; - private List<String> members; - private List<Map<String, RequirementDefinition>> requirements; - private Map<String, CapabilityDefinition> capabilities; - private Map<String, Object> interfaces; - - public String getDerived_from() { - return derived_from; - } - - public void setDerived_from(String derived_from) { - this.derived_from = derived_from; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public Map<String, String> getMetadata() { - return metadata; - } - - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - public List<Map<String, RequirementDefinition>> getRequirements() { - return requirements; - } - - public void setRequirements( - List<Map<String, RequirementDefinition>> requirements) { - this.requirements = requirements; - } - - public Map<String, CapabilityDefinition> getCapabilities() { - return capabilities; - } - - public void setCapabilities( - Map<String, CapabilityDefinition> capabilities) { - this.capabilities = capabilities; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map<String, PropertyDefinition> getProperties() { - return properties; - } - - public void setProperties(Map<String, PropertyDefinition> properties) { - this.properties = properties; - } - - public List<String> getMembers() { - return members; - } - - public void setMembers(List<String> members) { - this.members = members; - } - - public Map<String, Object> getInterfaces() { - return interfaces; - } - - public void setInterfaces(Map<String, Object> interfaces) { - this.interfaces = interfaces; - } + private String derived_from; + private String version; + private Map<String, String> metadata; + private String description; + private Map<String, PropertyDefinition> properties; + private List<String> members; + private List<Map<String, RequirementDefinition>> requirements; + private Map<String, CapabilityDefinition> capabilities; + private Map<String, Object> interfaces; + + public String getDerived_from() { + return derived_from; + } + + public void setDerived_from(String derived_from) { + this.derived_from = derived_from; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public List<Map<String, RequirementDefinition>> getRequirements() { + return requirements; + } + + public void setRequirements(List<Map<String, RequirementDefinition>> requirements) { + this.requirements = requirements; + } + + public Map<String, CapabilityDefinition> getCapabilities() { + return capabilities; + } + + public void setCapabilities(Map<String, CapabilityDefinition> capabilities) { + this.capabilities = capabilities; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, PropertyDefinition> getProperties() { + return properties; + } + + public void setProperties(Map<String, PropertyDefinition> properties) { + this.properties = properties; + } + + public List<String> getMembers() { + return members; + } + + public void setMembers(List<String> members) { + this.members = members; + } + + public Map<String, Object> getInterfaces() { + return interfaces; + } + + public void setInterfaces(Map<String, Object> interfaces) { + this.interfaces = interfaces; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java index e771f4e5b9..6e05e39c18 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java @@ -14,15 +14,12 @@ * limitations under the License. * Modifications copyright (c) 2019 Nokia */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Objects; - import org.onap.sdc.tosca.services.DataModelCloneUtil; - public class Implementation implements Cloneable { private String primary; @@ -53,8 +50,7 @@ public class Implementation implements Cloneable { return false; } Implementation that = (Implementation) o; - return Objects.equals(primary, that.primary) - && Objects.equals(dependencies, that.dependencies); + return Objects.equals(primary, that.primary) && Objects.equals(dependencies, that.dependencies); } @Override diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java index 604607c11e..436c066566 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,47 +17,44 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; - - public class Import { - private String file; - private String repository; - private String namespace_uri; - private String namespace_prefix; + private String file; + private String repository; + private String namespace_uri; + private String namespace_prefix; - public String getFile() { - return file; - } + public String getFile() { + return file; + } - public void setFile(String file) { - this.file = file; - } + public void setFile(String file) { + this.file = file; + } - public String getRepository() { - return repository; - } + public String getRepository() { + return repository; + } - public void setRepository(String repository) { - this.repository = repository; - } + public void setRepository(String repository) { + this.repository = repository; + } - public String getNamespace_uri() { - return namespace_uri; - } + public String getNamespace_uri() { + return namespace_uri; + } - public void setNamespace_uri(String namespace_uri) { - this.namespace_uri = namespace_uri; - } + public void setNamespace_uri(String namespace_uri) { + this.namespace_uri = namespace_uri; + } - public String getNamespace_prefix() { - return namespace_prefix; - } + public String getNamespace_prefix() { + return namespace_prefix; + } - public void setNamespace_prefix(String namespace_prefix) { - this.namespace_prefix = namespace_prefix; - } + public void setNamespace_prefix(String namespace_prefix) { + this.namespace_prefix = namespace_prefix; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java index 2b230569cf..72303e339b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java @@ -13,12 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; - import com.fasterxml.jackson.databind.ObjectMapper; - import com.fasterxml.jackson.databind.SerializationFeature; import java.util.Map; import java.util.Objects; @@ -33,34 +30,31 @@ class Interface { private static final String COULD_NOT_CREATE_OPERATION = "Could not create Operation from ["; private static final String OPER = "operations"; - Optional<Map.Entry<String, ? extends OperationDefinition>> createOperation(String propertyName, - Object operationCandidate, Set<String> fieldNames, Class<? extends OperationDefinition> operationClass) { + Optional<Map.Entry<String, ? extends OperationDefinition>> createOperation(String propertyName, Object operationCandidate, Set<String> fieldNames, + Class<? extends OperationDefinition> operationClass) { if (!fieldNames.contains(propertyName)) { try { - Optional<? extends OperationDefinition> operationDefinition = - CommonUtil.createObjectUsingSetters(operationCandidate, operationClass); - Map.Entry<String, ? extends OperationDefinition> operation = - new Map.Entry<String, OperationDefinition>() { - @Override - public String getKey() { - return propertyName; - } + Optional<? extends OperationDefinition> operationDefinition = CommonUtil.createObjectUsingSetters(operationCandidate, operationClass); + Map.Entry<String, ? extends OperationDefinition> operation = new Map.Entry<String, OperationDefinition>() { + @Override + public String getKey() { + return propertyName; + } - @Override - public OperationDefinition getValue() { - if (operationDefinition.isPresent()) { - return operationDefinition.get(); - } - return null; - } + @Override + public OperationDefinition getValue() { + if (operationDefinition.isPresent()) { + return operationDefinition.get(); + } + return null; + } - @Override - public OperationDefinition setValue(OperationDefinition value) { - return null; - } - }; + @Override + public OperationDefinition setValue(OperationDefinition value) { + return null; + } + }; return Optional.of(operation); - } catch (Exception exc) { throw new ToscaRuntimeException(COULD_NOT_CREATE_OPERATION + propertyName + "]", exc); } @@ -72,17 +66,14 @@ class Interface { if (Objects.isNull(interfaceEntity)) { return Optional.empty(); } - Map<String, Object> interfaceAsMap = CommonUtil.getObjectAsMap(interfaceEntity); Map<String, Object> operations = (Map<String, Object>) interfaceAsMap.get(OPER); if (MapUtils.isNotEmpty(operations)) { interfaceAsMap.remove(OPER); interfaceAsMap.putAll(operations); } - ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); return Optional.of(objectMapper.convertValue(interfaceAsMap, Object.class)); } - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java index 9bb35d81eb..0936b753c5 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; @@ -24,38 +23,30 @@ import org.onap.sdc.tosca.services.CommonUtil; public abstract class InterfaceDefinition extends Interface { - protected static final String CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR = - "Could not create InterfaceDefinition from input object, input object - "; + protected static final String CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR = "Could not create InterfaceDefinition from input object, input object - "; protected InterfaceDefinition convertObjToInterfaceDefinition(Object toscaInterfaceObj) { try { - Optional<? extends InterfaceDefinition> interfaceDefinition = - CommonUtil.createObjectUsingSetters(toscaInterfaceObj, this.getClass()); + Optional<? extends InterfaceDefinition> interfaceDefinition = CommonUtil.createObjectUsingSetters(toscaInterfaceObj, this.getClass()); if (interfaceDefinition.isPresent()) { - updateInterfaceDefinitionOperations(CommonUtil.getObjectAsMap(toscaInterfaceObj), - interfaceDefinition.get()); + updateInterfaceDefinitionOperations(CommonUtil.getObjectAsMap(toscaInterfaceObj), interfaceDefinition.get()); return interfaceDefinition.get(); } else { - throw new ToscaRuntimeException( - CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR + toscaInterfaceObj.toString()); + throw new ToscaRuntimeException(CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR + toscaInterfaceObj.toString()); } } catch (Exception exc) { - throw new ToscaRuntimeException(CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR - + toscaInterfaceObj.toString(), exc); + throw new ToscaRuntimeException(CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR + toscaInterfaceObj.toString(), exc); } - } private <T extends OperationDefinition> void updateInterfaceDefinitionOperations(Map<String, Object> interfaceAsMap, - InterfaceDefinition interfaceDefinition) { + InterfaceDefinition interfaceDefinition) { Set<String> fieldNames = CommonUtil.getClassFieldNames(interfaceDefinition.getClass()); for (Map.Entry<String, Object> entry : interfaceAsMap.entrySet()) { - Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition = - createOperation(entry.getKey(), entry.getValue(), fieldNames, - interfaceDefinition instanceof InterfaceDefinitionType ? OperationDefinitionType.class - : OperationDefinitionTemplate.class); - operationDefinition - .ifPresent(operation -> interfaceDefinition.addOperation(operation.getKey(), operation.getValue())); + Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition = createOperation(entry.getKey(), entry.getValue(), + fieldNames, + interfaceDefinition instanceof InterfaceDefinitionType ? OperationDefinitionType.class : OperationDefinitionTemplate.class); + operationDefinition.ifPresent(operation -> interfaceDefinition.addOperation(operation.getKey(), operation.getValue())); } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java index 954fc63936..5e86c29ed2 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.HashMap; @@ -32,12 +31,10 @@ public class InterfaceDefinitionTemplate extends InterfaceDefinition { } public InterfaceDefinitionTemplate(Object toscaInterfaceDefTemplateObj) { - InterfaceDefinitionTemplate interfaceDefinitionTemplate = - (InterfaceDefinitionTemplate) convertObjToInterfaceDefinition(toscaInterfaceDefTemplateObj); + InterfaceDefinitionTemplate interfaceDefinitionTemplate = (InterfaceDefinitionTemplate) convertObjToInterfaceDefinition( + toscaInterfaceDefTemplateObj); this.setInputs(DataModelCloneUtil.cloneStringObjectMap(interfaceDefinitionTemplate.getInputs())); - this.setOperations( - DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionTemplate.getOperations())); - + this.setOperations(DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionTemplate.getOperations())); } public Map<String, Object> getInputs() { diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java index 3d691bed0f..b0fb06974b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java @@ -13,8 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.onap.sdc.tosca.datatypes.model; import java.util.HashMap; @@ -34,12 +32,10 @@ public class InterfaceDefinitionType extends InterfaceDefinition { } public InterfaceDefinitionType(Object toscaInterfaceDefinitionType) { - InterfaceDefinitionType interfaceDefinitionType = - (InterfaceDefinitionType) convertObjToInterfaceDefinition(toscaInterfaceDefinitionType); + InterfaceDefinitionType interfaceDefinitionType = (InterfaceDefinitionType) convertObjToInterfaceDefinition(toscaInterfaceDefinitionType); this.setType(interfaceDefinitionType.getType()); this.setInputs(DataModelCloneUtil.cloneStringPropertyDefinitionMap(interfaceDefinitionType.getInputs())); - this.setOperations( - DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionType.getOperations())); + this.setOperations(DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionType.getOperations())); } public String getType() { @@ -75,9 +71,7 @@ public class InterfaceDefinitionType extends InterfaceDefinition { return false; } InterfaceDefinitionType that = (InterfaceDefinitionType) o; - return Objects.equals(type, that.type) - && Objects.equals(inputs, that.inputs) - && Objects.equals(operations, that.operations); + return Objects.equals(type, that.type) && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations); } @Override @@ -100,5 +94,4 @@ public class InterfaceDefinitionType extends InterfaceDefinition { public Optional<Object> convertInterfaceDefinitionTypeToToscaObj() { return convertInterfaceToToscaInterfaceObj(this); } - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java index 07c4031b34..ffd9212701 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.HashMap; @@ -32,8 +31,7 @@ import org.onap.sdc.tosca.services.DataModelCloneUtil; public class InterfaceType extends Interface { - protected static final String CONVERT_INTERFACE_TYPE_OBJECT_ERROR = - "Could not create InterfaceType from input object, input object - "; + protected static final String CONVERT_INTERFACE_TYPE_OBJECT_ERROR = "Could not create InterfaceType from input object, input object - "; private String derived_from; private String version; private Map<String, String> metadata; @@ -56,8 +54,7 @@ public class InterfaceType extends Interface { protected InterfaceType convertObjToInterfaceType(Object toscaInterfaceTypeObj) { try { - Optional<InterfaceType> interfaceType = - CommonUtil.createObjectUsingSetters(toscaInterfaceTypeObj, this.getClass()); + Optional<InterfaceType> interfaceType = CommonUtil.createObjectUsingSetters(toscaInterfaceTypeObj, this.getClass()); if (interfaceType.isPresent()) { updateInterfaceTypeOperations(CommonUtil.getObjectAsMap(toscaInterfaceTypeObj), interfaceType.get()); return interfaceType.get(); @@ -67,17 +64,14 @@ public class InterfaceType extends Interface { } catch (Exception exc) { throw new ToscaRuntimeException(CONVERT_INTERFACE_TYPE_OBJECT_ERROR + toscaInterfaceTypeObj.toString(), exc); } - } private void updateInterfaceTypeOperations(Map<String, Object> interfaceAsMap, InterfaceType interfaceType) { - Set<String> fieldNames = CommonUtil.getClassFieldNames(interfaceType.getClass()); for (Map.Entry<String, Object> entry : interfaceAsMap.entrySet()) { - Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition = - createOperation(entry.getKey(), entry.getValue(), fieldNames, OperationDefinitionType.class); - operationDefinition - .ifPresent(operation -> interfaceType.addOperation(operation.getKey(), operation.getValue())); + Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition = createOperation(entry.getKey(), entry.getValue(), + fieldNames, OperationDefinitionType.class); + operationDefinition.ifPresent(operation -> interfaceType.addOperation(operation.getKey(), operation.getValue())); } } @@ -101,10 +95,18 @@ public class InterfaceType extends Interface { return description; } + public void setDescription(String description) { + this.description = description; + } + public Map<String, String> getMetadata() { return metadata; } + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public Map<String, PropertyDefinition> getInputs() { return inputs; } @@ -128,17 +130,8 @@ public class InterfaceType extends Interface { this.operations.put(operationName, operationDefinition); } - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - public void setDescription(String description) { - this.description = description; - } - @Override public int hashCode() { - return Objects.hash(derived_from, version, metadata, description, inputs, operations); } @@ -151,14 +144,11 @@ public class InterfaceType extends Interface { return false; } InterfaceType that = (InterfaceType) o; - return Objects.equals(derived_from, that.derived_from) && Objects.equals(version, that.version) - && Objects.equals(metadata, that.metadata) && Objects.equals(description, that.description) - && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations); + return Objects.equals(derived_from, that.derived_from) && Objects.equals(version, that.version) && Objects.equals(metadata, that.metadata) + && Objects.equals(description, that.description) && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations); } public Optional<Object> convertInterfaceTypeToToscaObj() { return convertInterfaceToToscaInterfaceObj(this); } - - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java index be34394e34..014eb620d5 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Map; import org.onap.sdc.tosca.services.DataModelNormalizeUtil; - public class NodeFilter { private List<Map<String, List<Constraint>>> properties; @@ -34,13 +32,11 @@ public class NodeFilter { this.capabilities = DataModelNormalizeUtil.getNormalizeCapabilitiesFilter(capabilities); } - public void setProperties(List<Map<String, List<Constraint>>> properties) { - this.properties = DataModelNormalizeUtil.getNormalizePropertiesFilter(properties); - } - public List<Map<String, List<Constraint>>> getProperties() { return properties; } - + public void setProperties(List<Map<String, List<Constraint>>> properties) { + this.properties = DataModelNormalizeUtil.getNormalizePropertiesFilter(properties); + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java index ae1ca01673..8e9b54c17b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.ArrayList; @@ -26,11 +25,9 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; - import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.onap.sdc.tosca.error.ToscaRuntimeException; @@ -38,7 +35,6 @@ import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; import org.onap.sdc.tosca.services.YamlUtil; import org.yaml.snakeyaml.constructor.ConstructorException; - @Getter @Setter @EqualsAndHashCode @@ -58,12 +54,7 @@ public class NodeTemplate implements Template, Cloneable { private NodeFilter node_filter; private String copy; - public void setRequirements(List requirementAssignmentObj) { - this.requirements = convertToscaRequirementAssignment(requirementAssignmentObj); - } - public static List<Map<String, RequirementAssignment>> convertToscaRequirementAssignment(List<?> requirementAssignmentObj) { - List<Map<String, RequirementAssignment>> convertedRequirements = new ArrayList<>(); if (CollectionUtils.isEmpty(requirementAssignmentObj)) { return null; @@ -74,10 +65,11 @@ public class NodeTemplate implements Template, Cloneable { return convertedRequirements; } - private static void convertToscaRequirementAssignmentEntry(List<Map<String, RequirementAssignment>> convertedRequirements, Object requirementEntry) { + private static void convertToscaRequirementAssignmentEntry(List<Map<String, RequirementAssignment>> convertedRequirements, + Object requirementEntry) { if (requirementEntry instanceof Map) { try { - Set<Map.Entry<String, RequirementAssignment>> requirementEntries = ((Map)requirementEntry).entrySet(); + Set<Map.Entry<String, RequirementAssignment>> requirementEntries = ((Map) requirementEntry).entrySet(); for (Map.Entry<String, RequirementAssignment> toscaRequirements : requirementEntries) { String key = toscaRequirements.getKey(); Object requirementValue = toscaRequirements.getValue(); @@ -85,20 +77,19 @@ public class NodeTemplate implements Template, Cloneable { RequirementAssignment requirementObject; try { YamlUtil yamlUtil = new YamlUtil(); - requirementObject = yamlUtil - .yamlToObject(yamlUtil.objectToYaml(requirementValue), RequirementAssignment.class); + requirementObject = yamlUtil.yamlToObject(yamlUtil.objectToYaml(requirementValue), RequirementAssignment.class); } catch (ConstructorException ex) { // The requirement might contains extended attribute, so try to parse it into RequirementAssignmentExt as well ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); requirementObject = toscaExtensionYamlUtil - .yamlToObject(toscaExtensionYamlUtil.objectToYaml(requirementValue), RequirementAssignment.class); + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(requirementValue), RequirementAssignment.class); } Map<String, RequirementAssignment> convertedToscaRequirement = new HashMap<>(); convertedToscaRequirement.put(key, requirementObject); convertedRequirements.add(convertedToscaRequirement); - } else if (requirementValue instanceof RequirementAssignment) { + } else if (requirementValue instanceof RequirementAssignment) { Map<String, RequirementAssignment> convertedToscaRequirement = new HashMap<>(); - convertedToscaRequirement.put(key, (RequirementAssignment)requirementValue); + convertedToscaRequirement.put(key, (RequirementAssignment) requirementValue); convertedRequirements.add(convertedToscaRequirement); } } @@ -108,6 +99,10 @@ public class NodeTemplate implements Template, Cloneable { } } + public void setRequirements(List requirementAssignmentObj) { + this.requirements = convertToscaRequirementAssignment(requirementAssignmentObj); + } + public void addRequirements(Map<String, RequirementAssignment> newRequirement) { if (CollectionUtils.isEmpty(this.requirements)) { this.requirements = new ArrayList<Map<String, RequirementAssignment>>(); @@ -121,8 +116,7 @@ public class NodeTemplate implements Template, Cloneable { } Map<String, InterfaceDefinitionTemplate> normativeInterfaceDefinition = new HashMap<>(); for (Map.Entry<String, Object> interfaceEntry : interfaces.entrySet()) { - InterfaceDefinitionTemplate interfaceDefinitionTemplate = - new InterfaceDefinitionTemplate(interfaceEntry.getValue()); + InterfaceDefinitionTemplate interfaceDefinitionTemplate = new InterfaceDefinitionTemplate(interfaceEntry.getValue()); normativeInterfaceDefinition.put(interfaceEntry.getKey(), interfaceDefinitionTemplate); } return normativeInterfaceDefinition; @@ -132,7 +126,6 @@ public class NodeTemplate implements Template, Cloneable { if (MapUtils.isEmpty(this.interfaces)) { this.interfaces = new HashMap<>(); } - Optional<Object> toscaInterfaceObj = interfaceDefinitionTemplate.convertInterfaceDefTemplateToToscaObj(); if (!toscaInterfaceObj.isPresent()) { throw new ToscaRuntimeException("Illegal Statement"); @@ -141,15 +134,11 @@ public class NodeTemplate implements Template, Cloneable { this.interfaces.remove(interfaceKey); } this.interfaces.put(interfaceKey, toscaInterfaceObj.get()); - } - @Override public NodeTemplate clone() { YamlUtil yamlUtil = new YamlUtil(); return yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class); } - - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java index 868a6f437a..eca056fa7a 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.HashMap; @@ -50,6 +49,10 @@ public class NodeType implements Cloneable { return capabilities; } + public void setCapabilities(Map<String, CapabilityDefinition> capabilities) { + this.capabilities = capabilities; + } + public String getDerived_from() { return derived_from; } @@ -70,6 +73,10 @@ public class NodeType implements Cloneable { return requirements; } + public void setRequirements(List<Map<String, RequirementDefinition>> requirements) { + this.requirements = requirements; + } + public String getDescription() { return description; } @@ -90,6 +97,10 @@ public class NodeType implements Cloneable { return interfaces; } + public void setInterfaces(Map<String, Object> interfaces) { + this.interfaces = interfaces; + } + public Map<String, InterfaceDefinitionType> getNormalizeInterfaces() { if (MapUtils.isEmpty(interfaces)) { return new HashMap<>(); @@ -118,18 +129,6 @@ public class NodeType implements Cloneable { this.artifacts = artifacts; } - public void setInterfaces(Map<String, Object> interfaces) { - this.interfaces = interfaces; - } - - public void setRequirements(List<Map<String, RequirementDefinition>> requirements) { - this.requirements = requirements; - } - - public void setCapabilities(Map<String, CapabilityDefinition> capabilities) { - this.capabilities = capabilities; - } - @Override public NodeType clone() { NodeType clone = new NodeType(); diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java index 8114686168..d8b5bd0530 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Objects; @@ -48,7 +47,6 @@ public class OperationDefinition implements Cloneable { @Override public int hashCode() { - return Objects.hash(description); } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java index 62f6a20d55..22f1151b43 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; @@ -55,12 +54,11 @@ public class OperationDefinitionTemplate extends OperationDefinition { @Override public int hashCode() { - return Objects.hash(implementation, inputs); } @Override - public OperationDefinitionTemplate clone() { + public OperationDefinitionTemplate clone() { OperationDefinition operationDefinition = super.clone(); OperationDefinitionTemplate operationDefinitionTemplate = new OperationDefinitionTemplate(); operationDefinitionTemplate.setDescription(operationDefinition.getDescription()); diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java index a40c91fdd6..0c46516287 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; @@ -55,7 +54,6 @@ public class OperationDefinitionType extends OperationDefinition { @Override public int hashCode() { - return Objects.hash(implementation, inputs); } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java index f667e8a2bf..841adc91fb 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; - public class ParameterDefinition extends DefinitionOfDataType { @Override @@ -33,5 +31,4 @@ public class ParameterDefinition extends DefinitionOfDataType { parameterDefinition.setValue(definitionOfDataType.getValue()); return parameterDefinition; } - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java index a9a45c4a3f..3d4311c8df 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; @@ -33,5 +32,4 @@ public class PolicyDefinition implements Template { private Map<String, Object> properties; private List<String> targets; private Map<String, Trigger> triggers; - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java index cd7da8614c..51680df5db 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java @@ -17,14 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Map; import lombok.Data; - @Data public class PolicyType { @@ -35,5 +33,4 @@ public class PolicyType { private Map<String, PropertyDefinition> properties; private List<String> targets; private Map<String, Trigger> triggers; - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java index aaff76dafc..efc24803be 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,15 +17,14 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; + import lombok.Data; @Data public class PreconditionDefinition { - private String target; - private String target_relationship; - private Constraint condition; - + private String target; + private String target_relationship; + private Constraint condition; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java index 331b7b0e64..a3ab24de9d 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,30 +33,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; public class PropertyDefinition extends DefinitionOfDataType { - public PropertyDefinition() { - setStatus(Status.SUPPORTED.getName()); - setRequired(true); - } - - @Override - public PropertyDefinition clone() { - DefinitionOfDataType definitionOfDataType = super.clone(); - PropertyDefinition propertyDefinition = new PropertyDefinition(); - propertyDefinition.set_default(definitionOfDataType.get_default()); - propertyDefinition.setConstraints(definitionOfDataType.getConstraints()); - propertyDefinition.setDescription(definitionOfDataType.getDescription()); - propertyDefinition.setEntry_schema(definitionOfDataType.getEntry_schema()); - propertyDefinition.setRequired(definitionOfDataType.getRequired()); - propertyDefinition.setType(definitionOfDataType.getType()); - propertyDefinition.setStatus(definitionOfDataType.getStatus()); - propertyDefinition.setValue(definitionOfDataType.getValue()); - return propertyDefinition; - } - + public PropertyDefinition() { + setStatus(Status.SUPPORTED.getName()); + setRequired(true); + } + @Override + public PropertyDefinition clone() { + DefinitionOfDataType definitionOfDataType = super.clone(); + PropertyDefinition propertyDefinition = new PropertyDefinition(); + propertyDefinition.set_default(definitionOfDataType.get_default()); + propertyDefinition.setConstraints(definitionOfDataType.getConstraints()); + propertyDefinition.setDescription(definitionOfDataType.getDescription()); + propertyDefinition.setEntry_schema(definitionOfDataType.getEntry_schema()); + propertyDefinition.setRequired(definitionOfDataType.getRequired()); + propertyDefinition.setType(definitionOfDataType.getType()); + propertyDefinition.setStatus(definitionOfDataType.getStatus()); + propertyDefinition.setValue(definitionOfDataType.getValue()); + return propertyDefinition; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java index 1b91ca96d2..3cec134b86 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Collections; @@ -27,61 +26,63 @@ import lombok.Getter; @AllArgsConstructor @Getter public enum PropertyType { + // @formatter:off + STRING("string"), + INTEGER("integer"), + FLOAT("float"), + BOOLEAN("boolean"), + TIMESTAMP("timestamp"), + NULL("null"), + MAP("map"), + LIST("list"), + SCALAR_UNIT_SIZE("scalar-unit.size"), + SCALAR_UNIT_TIME("scalar-unit.time"), + SCALAR_UNIT_FREQUENCY("scalar-unit.frequency"); + // @formatter:on - STRING("string"), - INTEGER("integer"), - FLOAT("float"), - BOOLEAN("boolean"), - TIMESTAMP("timestamp"), - NULL("null"), - MAP("map"), - LIST("list"), - SCALAR_UNIT_SIZE("scalar-unit.size"), - SCALAR_UNIT_TIME("scalar-unit.time"), - SCALAR_UNIT_FREQUENCY("scalar-unit.frequency"); - - private static final Map<String, PropertyType> M_MAP = Collections.unmodifiableMap(initializeMapping()); - private static final Set<String> SIMPLE_PROPERTY_TYPES = Collections.unmodifiableSet(initializeSimplePropertyTypes()); - private String displayName; + private static final Map<String, PropertyType> M_MAP = Collections.unmodifiableMap(initializeMapping()); + private static final Set<String> SIMPLE_PROPERTY_TYPES = Collections.unmodifiableSet(initializeSimplePropertyTypes()); + private String displayName; - /** - * Initilize property type display name mapping. - * @return Map - */ - public static Map<String, PropertyType> initializeMapping() { - final Map<String, PropertyType> typeMap = new HashMap<>(); - for (final PropertyType propertyType : PropertyType.values()) { - typeMap.put(propertyType.displayName, propertyType); + /** + * Initilize property type display name mapping. + * + * @return Map + */ + public static Map<String, PropertyType> initializeMapping() { + final Map<String, PropertyType> typeMap = new HashMap<>(); + for (final PropertyType propertyType : PropertyType.values()) { + typeMap.put(propertyType.displayName, propertyType); + } + return typeMap; } - return typeMap; - } - /** - * Get Property type by display name. - * @param displayName - * @return PropertyType - */ - public static PropertyType getPropertyTypeByDisplayName(final String displayName) { - if (M_MAP.containsKey(displayName)) { - return M_MAP.get(displayName); + /** + * Get Property type by display name. + * + * @param displayName + * @return PropertyType + */ + public static PropertyType getPropertyTypeByDisplayName(final String displayName) { + if (M_MAP.containsKey(displayName)) { + return M_MAP.get(displayName); + } + return null; } - return null; - } - - private static Set<String> initializeSimplePropertyTypes() { - final Set<String> simplePropertyTypes = new HashSet<>(); - simplePropertyTypes.add(STRING.getDisplayName().toLowerCase()); - simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase()); - simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase()); - simplePropertyTypes.add(BOOLEAN.getDisplayName().toLowerCase()); - simplePropertyTypes.add(SCALAR_UNIT_SIZE.getDisplayName().toLowerCase()); - simplePropertyTypes.add(SCALAR_UNIT_TIME.getDisplayName().toLowerCase()); - simplePropertyTypes.add(SCALAR_UNIT_FREQUENCY.getDisplayName().toLowerCase()); - return simplePropertyTypes; - } - public static Set<String> getSimplePropertyTypes() { - return SIMPLE_PROPERTY_TYPES; - } + private static Set<String> initializeSimplePropertyTypes() { + final Set<String> simplePropertyTypes = new HashSet<>(); + simplePropertyTypes.add(STRING.getDisplayName().toLowerCase()); + simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase()); + simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase()); + simplePropertyTypes.add(BOOLEAN.getDisplayName().toLowerCase()); + simplePropertyTypes.add(SCALAR_UNIT_SIZE.getDisplayName().toLowerCase()); + simplePropertyTypes.add(SCALAR_UNIT_TIME.getDisplayName().toLowerCase()); + simplePropertyTypes.add(SCALAR_UNIT_FREQUENCY.getDisplayName().toLowerCase()); + return simplePropertyTypes; + } + public static Set<String> getSimplePropertyTypes() { + return SIMPLE_PROPERTY_TYPES; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java index 17a3ae383a..4fa1f72ff4 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,24 +17,21 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Map; - import lombok.Data; @Data public class RelationshipTemplate implements Template { - private String type; - private String description; - private Map<String, String> metadata; - private Map<String, Object> properties; - private Map<String, Object> attributes; - private Map<String, RequirementAssignment> requirements; - private Map<String, CapabilityAssignment> capabilities; - private Map<String, Object> interfaces; - private String copy; - + private String type; + private String description; + private Map<String, String> metadata; + private Map<String, Object> properties; + private Map<String, Object> attributes; + private Map<String, RequirementAssignment> requirements; + private Map<String, CapabilityAssignment> capabilities; + private Map<String, Object> interfaces; + private String copy; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java index b2ff1a3e41..4ba5dee885 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java @@ -17,13 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; -import lombok.Data; - import java.util.List; import java.util.Map; +import lombok.Data; @Data public class RelationshipType { @@ -37,6 +35,6 @@ public class RelationshipType { private Map<String, Object> interfaces; private List<String> valid_target_types; //An optional list of one or more names of Capability Types that are valid targets - // for this relationship + // for this relationship } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java index d71731742f..1fad6b8407 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import lombok.Data; diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java index 177b8c4a6a..6dd986614c 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import lombok.Data; @@ -25,11 +24,9 @@ import lombok.Data; @Data public class RequirementAssignment { - private String capability; - private String node; - private String relationship; - private NodeFilter node_filter; - private Object[] occurrences; - - + private String capability; + private String node; + private String relationship; + private NodeFilter node_filter; + private Object[] occurrences; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java index 48c9faad27..ae99f9325e 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,67 +17,63 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; - public class RequirementDefinition implements Cloneable { - private String capability; - private String node; - private String relationship; - private Object[] occurrences; - - /** - * Instantiates a new Requirement definition. - */ - public RequirementDefinition() { - occurrences = new Object[2]; - occurrences[0] = 1; - occurrences[1] = 1; - } + private String capability; + private String node; + private String relationship; + private Object[] occurrences; - public String getCapability() { - return capability; - } + /** + * Instantiates a new Requirement definition. + */ + public RequirementDefinition() { + occurrences = new Object[2]; + occurrences[0] = 1; + occurrences[1] = 1; + } - public void setCapability(String capability) { - this.capability = capability; - } + public String getCapability() { + return capability; + } - public String getNode() { - return node; - } + public void setCapability(String capability) { + this.capability = capability; + } - public void setNode(String node) { - this.node = node; - } + public String getNode() { + return node; + } - public String getRelationship() { - return relationship; - } + public void setNode(String node) { + this.node = node; + } - public void setRelationship(String relationship) { - this.relationship = relationship; - } + public String getRelationship() { + return relationship; + } - public Object[] getOccurrences() { - return occurrences; - } + public void setRelationship(String relationship) { + this.relationship = relationship; + } - public void setOccurrences(Object[] occurrences) { - this.occurrences = occurrences; - } + public Object[] getOccurrences() { + return occurrences; + } - @Override - public RequirementDefinition clone() { - RequirementDefinition requirementDefinition = new RequirementDefinition(); - requirementDefinition.setNode(this.getNode()); - requirementDefinition.setRelationship(this.getRelationship()); - requirementDefinition.setCapability(this.getCapability()); - requirementDefinition - .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]}); - return requirementDefinition; - } + public void setOccurrences(Object[] occurrences) { + this.occurrences = occurrences; + } + @Override + public RequirementDefinition clone() { + RequirementDefinition requirementDefinition = new RequirementDefinition(); + requirementDefinition.setNode(this.getNode()); + requirementDefinition.setRelationship(this.getRelationship()); + requirementDefinition.setCapability(this.getCapability()); + requirementDefinition.setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]}); + return requirementDefinition; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java index 302ba4808c..13d3fe8daa 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,20 +17,17 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; - - public class Scalar { - private Float value; + private Float value; - public Float getValue() { - return value; - } + public Float getValue() { + return value; + } - public void setValue(Float value) { - this.value = value; - } + public void setValue(Float value) { + this.value = value; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java index 5e2e2e5ee7..d5a99044e8 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java @@ -16,7 +16,6 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Arrays; @@ -29,11 +28,10 @@ import org.apache.commons.lang3.StringUtils; public class ScalarUnitValidator { private static final ScalarUnitValidator scalarUnitValidator = new ScalarUnitValidator(); - /** - * Tosca Scalar Unit Types structure. - * - * At least positive integers, no single white space, 1 to 3 chars + * Tosca Scalar Unit Types structure. + * <p> + * At least positive integers, no single white space, 1 to 3 chars */ private final Pattern pattern = Pattern.compile("\\d+\\s*[a-zA-Z]{1,3}"); @@ -54,23 +52,21 @@ public class ScalarUnitValidator { if (value == null || value.isEmpty()) { return true; } - return pattern.matcher(value).matches(); } /** * Validates if the given String has a Recognized Tosca unit. * - * @param value String to be validated + * @param value String to be validated * @param enumClass Enum that represents a Tosca Scalar Unit Type. * @param <E> * @return an Enum that represents the Tosca Scalar Unit Type. */ public <E extends Enum<E>> boolean isValueScalarUnit(final Object value, final Class<E> enumClass) { final String stringToValidate = String.valueOf(value); - return isScalarUnit(stringToValidate) && Arrays.stream(StringUtils.split(stringToValidate)) - .anyMatch(strValue -> Arrays.stream(enumClass.getEnumConstants()) - .anyMatch(scalarUnit -> - scalarUnit.name().equalsIgnoreCase(strValue) || strValue.endsWith(scalarUnit.name()))); + return isScalarUnit(stringToValidate) && Arrays.stream(StringUtils.split(stringToValidate)).anyMatch( + strValue -> Arrays.stream(enumClass.getEnumConstants()) + .anyMatch(scalarUnit -> scalarUnit.name().equalsIgnoreCase(strValue) || strValue.endsWith(scalarUnit.name()))); } -}
\ No newline at end of file +} diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java index becd34a8ef..758786dad5 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model; import static org.onap.sdc.tosca.services.DataModelConvertUtil.convertToscaImports; @@ -22,12 +21,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; - import org.apache.commons.collections4.MapUtils; import org.onap.sdc.tosca.datatypes.model.heatextend.AnnotationType; import org.onap.sdc.tosca.error.ToscaRuntimeException; - public class ServiceTemplate implements Template { private String tosca_definitions_version; @@ -167,7 +164,6 @@ public class ServiceTemplate implements Template { if (MapUtils.isEmpty(this.interface_types)) { this.interface_types = new HashMap<>(); } - Optional<Object> toscaInterfaceObj = interfaceType.convertInterfaceTypeToToscaObj(); if (!toscaInterfaceObj.isPresent()) { throw new ToscaRuntimeException("Illegal Statement"); @@ -201,6 +197,4 @@ public class ServiceTemplate implements Template { public void setAnnotation_types(Map<String, AnnotationType> annotationTypes) { this.annotation_types = annotationTypes; } - - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java index c25a6adbaa..a52968afbc 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import lombok.AllArgsConstructor; @@ -26,11 +25,6 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum Status { - SUPPORTED("supported"), - UNSUPPORTED("unsupported"), - EXPERIMENTAL("experimental"), - DEPRECATED("deprecated"); - - private final String name; - + SUPPORTED("supported"), UNSUPPORTED("unsupported"), EXPERIMENTAL("experimental"), DEPRECATED("deprecated"); + private final String name; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java index a20d398011..eef2b8a32d 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,75 +17,73 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; public class StepDefinition { - private String target; - private String target_relationship; - private String operation_host; - private List<Constraint> filter; - private List<ActivityDefinition> activities; - private String on_success; - private String on_failure; - - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getTarget_relationship() { - return target_relationship; - } - - public void setTarget_relationship(String target_relationship) { - this.target_relationship = target_relationship; - } - - public String getOperation_host() { - return operation_host; - } - - public void setOperation_host(String operation_host) { - this.operation_host = operation_host; - } - - public List<Constraint> getFilter() { - return filter; - } - - public void setFilter(List<Constraint> filter) { - this.filter = filter; - } - - public List<ActivityDefinition> getActivities() { - return activities; - } - - public void setActivities(List<ActivityDefinition> activities) { - this.activities = activities; - } - - public String getOn_success() { - return on_success; - } - - public void setOn_success(String on_success) { - this.on_success = on_success; - } - - public String getOn_failure() { - return on_failure; - } - - public void setOn_failure(String on_failure) { - this.on_failure = on_failure; - } + private String target; + private String target_relationship; + private String operation_host; + private List<Constraint> filter; + private List<ActivityDefinition> activities; + private String on_success; + private String on_failure; + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public String getTarget_relationship() { + return target_relationship; + } + + public void setTarget_relationship(String target_relationship) { + this.target_relationship = target_relationship; + } + + public String getOperation_host() { + return operation_host; + } + + public void setOperation_host(String operation_host) { + this.operation_host = operation_host; + } + + public List<Constraint> getFilter() { + return filter; + } + + public void setFilter(List<Constraint> filter) { + this.filter = filter; + } + + public List<ActivityDefinition> getActivities() { + return activities; + } + + public void setActivities(List<ActivityDefinition> activities) { + this.activities = activities; + } + + public String getOn_success() { + return on_success; + } + + public void setOn_success(String on_success) { + this.on_success = on_success; + } + + public String getOn_failure() { + return on_failure; + } + + public void setOn_failure(String on_failure) { + this.on_failure = on_failure; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java index a8d0718c4e..f6794a7b19 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java index 490881688e..43abc0c65f 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,8 +17,8 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; public interface Template { + } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java index 13332c9faf..330367270b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.sql.Timestamp; @@ -27,7 +26,7 @@ import lombok.Setter; @Getter @Setter public class TimeInterval { - private Timestamp start_time; - private Timestamp end_time; + private Timestamp start_time; + private Timestamp end_time; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java index fde5f41bd2..b0e5e3eaa9 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.HashMap; @@ -27,98 +26,98 @@ import java.util.Objects; public class TopologyTemplate { - private String description; - private Map<String, ParameterDefinition> inputs; - private Map<String, NodeTemplate> node_templates; - private Map<String, RelationshipTemplate> relationship_templates; - private Map<String, GroupDefinition> groups; - private Map<String, ParameterDefinition> outputs; - private SubstitutionMapping substitution_mappings; - private Map<String, PolicyDefinition> policies; - private List<WorkflowDefinition> workflows; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map<String, ParameterDefinition> getInputs() { - return inputs; - } - - public void setInputs(Map<String, ParameterDefinition> inputs) { - this.inputs = inputs; - } - - public Map<String, NodeTemplate> getNode_templates() { - return node_templates; - } - - public void setNode_templates(Map<String, NodeTemplate> node_templates) { - this.node_templates = node_templates; - } - - public Map<String, RelationshipTemplate> getRelationship_templates() { - return relationship_templates; - } - - public void setRelationship_templates(Map<String, RelationshipTemplate> relationship_templates) { - this.relationship_templates = relationship_templates; - } - - public Map<String, GroupDefinition> getGroups() { - return groups; - } - - public void setGroups(Map<String, GroupDefinition> groups) { - this.groups = groups; - } - - /** - * Add group. - * - * @param groupKey the group key - * @param groupDefinition the group definition - */ - public void addGroup(String groupKey, GroupDefinition groupDefinition) { - if (Objects.isNull(this.groups)) { - this.groups = new HashMap<>(); - } - this.groups.put(groupKey, groupDefinition); - } - - public Map<String, ParameterDefinition> getOutputs() { - return outputs; - } - - public void setOutputs(Map<String, ParameterDefinition> outputs) { - this.outputs = outputs; - } - - public SubstitutionMapping getSubstitution_mappings() { - return substitution_mappings; - } - - public void setSubstitution_mappings(SubstitutionMapping substitution_mappings) { - this.substitution_mappings = substitution_mappings; - } - - public Map<String, PolicyDefinition> getPolicies() { - return policies; - } - - public void setPolicies(Map<String, PolicyDefinition> policies) { - this.policies = policies; - } - - public List<WorkflowDefinition> getWorkflows() { - return workflows; - } - - public void setWorkflows(List<WorkflowDefinition> workflows) { - this.workflows = workflows; - } + private String description; + private Map<String, ParameterDefinition> inputs; + private Map<String, NodeTemplate> node_templates; + private Map<String, RelationshipTemplate> relationship_templates; + private Map<String, GroupDefinition> groups; + private Map<String, ParameterDefinition> outputs; + private SubstitutionMapping substitution_mappings; + private Map<String, PolicyDefinition> policies; + private List<WorkflowDefinition> workflows; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, ParameterDefinition> getInputs() { + return inputs; + } + + public void setInputs(Map<String, ParameterDefinition> inputs) { + this.inputs = inputs; + } + + public Map<String, NodeTemplate> getNode_templates() { + return node_templates; + } + + public void setNode_templates(Map<String, NodeTemplate> node_templates) { + this.node_templates = node_templates; + } + + public Map<String, RelationshipTemplate> getRelationship_templates() { + return relationship_templates; + } + + public void setRelationship_templates(Map<String, RelationshipTemplate> relationship_templates) { + this.relationship_templates = relationship_templates; + } + + public Map<String, GroupDefinition> getGroups() { + return groups; + } + + public void setGroups(Map<String, GroupDefinition> groups) { + this.groups = groups; + } + + /** + * Add group. + * + * @param groupKey the group key + * @param groupDefinition the group definition + */ + public void addGroup(String groupKey, GroupDefinition groupDefinition) { + if (Objects.isNull(this.groups)) { + this.groups = new HashMap<>(); + } + this.groups.put(groupKey, groupDefinition); + } + + public Map<String, ParameterDefinition> getOutputs() { + return outputs; + } + + public void setOutputs(Map<String, ParameterDefinition> outputs) { + this.outputs = outputs; + } + + public SubstitutionMapping getSubstitution_mappings() { + return substitution_mappings; + } + + public void setSubstitution_mappings(SubstitutionMapping substitution_mappings) { + this.substitution_mappings = substitution_mappings; + } + + public Map<String, PolicyDefinition> getPolicies() { + return policies; + } + + public void setPolicies(Map<String, PolicyDefinition> policies) { + this.policies = policies; + } + + public List<WorkflowDefinition> getWorkflows() { + return workflows; + } + + public void setWorkflows(List<WorkflowDefinition> workflows) { + this.workflows = workflows; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java index 440429461b..c1ab123a5d 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.Objects; @@ -72,7 +71,6 @@ public class Trigger { } public Object getAction() { - return action; } @@ -94,11 +92,8 @@ public class Trigger { return false; } Trigger trigger = (Trigger) o; - return Objects.equals(description, trigger.description) - && Objects.equals(event_type, trigger.event_type) - && Objects.equals(schedule, trigger.schedule) - && Objects.equals(target_filter, trigger.target_filter) - && Objects.equals(condition, trigger.condition) - && Objects.equals(action, trigger.action); + return Objects.equals(description, trigger.description) && Objects.equals(event_type, trigger.event_type) && Objects + .equals(schedule, trigger.schedule) && Objects.equals(target_filter, trigger.target_filter) && Objects + .equals(condition, trigger.condition) && Objects.equals(action, trigger.action); } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java index af5b61771c..e16cd3edb3 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,59 +17,56 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model; import java.util.List; import java.util.Map; public class WorkflowDefinition { - private String description; - private Map<String, String> metadata; - private Map<String, PropertyDefinition> inputs; - private List<PreconditionDefinition> preconditions; - private Map<String, StepDefinition> steps; - public String getDescription() { - return description; - } + private String description; + private Map<String, String> metadata; + private Map<String, PropertyDefinition> inputs; + private List<PreconditionDefinition> preconditions; + private Map<String, StepDefinition> steps; + + public String getDescription() { + return description; + } - public void setDescription(String description) { - this.description = description; - } + public void setDescription(String description) { + this.description = description; + } - public Map<String, String> getMetadata() { - return metadata; - } + public Map<String, String> getMetadata() { + return metadata; + } - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } - public Map<String, PropertyDefinition> getInputs() { - return inputs; - } + public Map<String, PropertyDefinition> getInputs() { + return inputs; + } - public void setInputs( - Map<String, PropertyDefinition> inputs) { - this.inputs = inputs; - } + public void setInputs(Map<String, PropertyDefinition> inputs) { + this.inputs = inputs; + } - public List<PreconditionDefinition> getPreconditions() { - return preconditions; - } + public List<PreconditionDefinition> getPreconditions() { + return preconditions; + } - public void setPreconditions( - List<PreconditionDefinition> preconditions) { - this.preconditions = preconditions; - } + public void setPreconditions(List<PreconditionDefinition> preconditions) { + this.preconditions = preconditions; + } - public Map<String, StepDefinition> getSteps() { - return steps; - } + public Map<String, StepDefinition> getSteps() { + return steps; + } - public void setSteps( - Map<String, StepDefinition> steps) { - this.steps = steps; - } + public void setSteps(Map<String, StepDefinition> steps) { + this.steps = steps; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java index f32efe435e..b05c895c94 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model.extension; import lombok.EqualsAndHashCode; @@ -27,6 +26,4 @@ import org.onap.sdc.tosca.datatypes.model.RequirementAssignment; public class RequirementAssignmentExt extends RequirementAssignment { private ServiceFilter service_filter; - - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java index 572af3d16c..be1d1d9a7c 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model.extension; import org.onap.sdc.tosca.datatypes.model.NodeFilter; - public class ServiceFilter extends NodeFilter { private Object tosca_id; @@ -39,9 +37,7 @@ public class ServiceFilter extends NodeFilter { if (!(o instanceof ServiceFilter)) { return false; } - ServiceFilter that = (ServiceFilter) o; - return getTosca_id() != null ? getTosca_id().equals(that.getTosca_id()) : that.getTosca_id() == null; } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java index 8734dbcf07..bc1420de26 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java @@ -13,30 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model.heatextend; import java.util.Map; public class AnnotationDefinition { - private String type; - private Map<String, Object> properties; - - public String getType() { - return type; - } + private String type; + private Map<String, Object> properties; - public void setType(String type) { - this.type = type; - } + public String getType() { + return type; + } - public Map<String, Object> getProperties() { - return properties; - } + public void setType(String type) { + this.type = type; + } - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } + public Map<String, Object> getProperties() { + return properties; + } + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java index f0eef519a9..2f64da87e1 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java @@ -13,41 +13,38 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.onap.sdc.tosca.datatypes.model.heatextend; - -import org.onap.sdc.tosca.datatypes.model.PropertyDefinition; +package org.onap.sdc.tosca.datatypes.model.heatextend; import java.util.Map; +import org.onap.sdc.tosca.datatypes.model.PropertyDefinition; - public class AnnotationType { +public class AnnotationType { - private String version; - private String description; - private Map<String, PropertyDefinition> properties; + private String version; + private String description; + private Map<String, PropertyDefinition> properties; - public String getVersion() { + public String getVersion() { return version; - } + } - public void setVersion(String version) { + public void setVersion(String version) { this.version = version; - } + } - public String getDescription() { + public String getDescription() { return description; - } + } - public void setDescription(String description) { + public void setDescription(String description) { this.description = description; - } + } - public Map<String, PropertyDefinition> getProperties() { + public Map<String, PropertyDefinition> getProperties() { return properties; - } + } - public void setProperties(Map<String, PropertyDefinition> properties) { + public void setProperties(Map<String, PropertyDefinition> properties) { this.properties = properties; - } - } +} diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java index ae3cc35986..41895dd5b4 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java @@ -13,50 +13,47 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.datatypes.model.heatextend; -import org.onap.sdc.tosca.datatypes.model.ParameterDefinition; - import java.util.Map; +import org.onap.sdc.tosca.datatypes.model.ParameterDefinition; public class ParameterDefinitionExt extends ParameterDefinition { - private String label; - private Boolean hidden; - private Boolean immutable; - private Map<String, AnnotationDefinition> annotations; - - public String getLabel() { - return label; - } + private String label; + private Boolean hidden; + private Boolean immutable; + private Map<String, AnnotationDefinition> annotations; - public void setLabel(String label) { - this.label = label; - } + public String getLabel() { + return label; + } - public Boolean getHidden() { - return hidden; - } + public void setLabel(String label) { + this.label = label; + } - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } + public Boolean getHidden() { + return hidden; + } - public Boolean getImmutable() { - return immutable; - } + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } - public void setImmutable(Boolean immutable) { - this.immutable = immutable; - } + public Boolean getImmutable() { + return immutable; + } - public Map<String, AnnotationDefinition> getAnnotations() { - return annotations; - } + public void setImmutable(Boolean immutable) { + this.immutable = immutable; + } - public void setAnnotations(Map<String, AnnotationDefinition> annotations) { - this.annotations = annotations; - } + public Map<String, AnnotationDefinition> getAnnotations() { + return annotations; + } + public void setAnnotations(Map<String, AnnotationDefinition> annotations) { + this.annotations = annotations; + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java index 60f26501e0..1ead5a69cc 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.datatypes.model.heatextend; import java.util.Collections; @@ -28,14 +27,11 @@ import java.util.Map; * The enum Property type ext. */ public enum PropertyTypeExt { - /** * Json property type ext. */ JSON("json"); - - private static final Map<String, PropertyTypeExt> M_MAP = - Collections.unmodifiableMap(initializeMapping()); + private static final Map<String, PropertyTypeExt> M_MAP = Collections.unmodifiableMap(initializeMapping()); private String displayName; PropertyTypeExt(String displayName) { @@ -63,6 +59,4 @@ public enum PropertyTypeExt { public String getDisplayName() { return displayName; } - - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java index 10c67bc4df..e2295dd771 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.error; public class ToscaRuntimeException extends RuntimeException { - public ToscaRuntimeException(String message) { - super(message); - } + public ToscaRuntimeException(String message) { + super(message); + } - public ToscaRuntimeException(String message, Throwable cause) { - super(message, cause); - } + public ToscaRuntimeException(String message, Throwable cause) { + super(message, cause); + } - public ToscaRuntimeException(Throwable cause) { - super(cause); - } + public ToscaRuntimeException(Throwable cause) { + super(cause); + } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java index eb60d95889..d6ff22c501 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java @@ -18,6 +18,8 @@ */ package org.onap.sdc.tosca.services; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableSet; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -27,42 +29,34 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; -import com.google.common.collect.ImmutableSet; - -import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.beanutils.BeanUtils; public class CommonUtil { public static final String DEFAULT = "default"; public static final String UNDERSCORE_DEFAULT = "_default"; - private static ImmutableSet<Class<?>> complexClassType = ImmutableSet.of(Map.class, String.class, Integer.class, Float.class, - Double.class, Set.class, Object.class, List.class); + private static ImmutableSet<Class<?>> complexClassType = ImmutableSet + .of(Map.class, String.class, Integer.class, Float.class, Double.class, Set.class, Object.class, List.class); private CommonUtil() { throw new IllegalStateException("Utility class"); } - public static <T> Optional<T> createObjectUsingSetters(Object objectCandidate, Class<? extends T> classToCreate) - throws Exception { + public static <T> Optional<T> createObjectUsingSetters(Object objectCandidate, Class<? extends T> classToCreate) throws Exception { if (Objects.isNull(objectCandidate)) { return Optional.empty(); } Map<String, Object> objectAsMap = getObjectAsMap(objectCandidate); - Field[] declaredFields = classToCreate.getDeclaredFields(); createSubObjectsUsingSetters(objectAsMap, declaredFields); T result = populateBean(objectAsMap, classToCreate); - return Optional.of(result); } - public static void createSubObjectsUsingSetters(Map<String, Object> objectAsMap, Field[] declaredFields) - throws Exception { + public static void createSubObjectsUsingSetters(Map<String, Object> objectAsMap, Field[] declaredFields) throws Exception { for (Field field : declaredFields) { if (isComplexClass(field)) { - Optional<?> objectUsingSetters = - createObjectUsingSetters(objectAsMap.get(field.getName()), field.getType()); + Optional<?> objectUsingSetters = createObjectUsingSetters(objectAsMap.get(field.getName()), field.getType()); if (objectUsingSetters.isPresent()) { objectAsMap.remove(field.getName()); objectAsMap.put(field.getName(), objectUsingSetters.get()); @@ -79,9 +73,7 @@ public class CommonUtil { } public static Map<String, Object> getObjectAsMap(Object obj) { - Map<String, Object> objectAsMap = - obj instanceof Map ? (Map<String, Object>) obj : new ObjectMapper().convertValue(obj, Map.class); - + Map<String, Object> objectAsMap = obj instanceof Map ? (Map<String, Object>) obj : new ObjectMapper().convertValue(obj, Map.class); if (objectAsMap.containsKey(DEFAULT)) { Object defaultValue = objectAsMap.get(DEFAULT); objectAsMap.remove(DEFAULT); diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java index c41282ff0d..c31c5bd85b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.services; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -42,7 +40,6 @@ public class DataModelCloneUtil { * @return the list */ public static List<Constraint> cloneConstraints(List<Constraint> constraints) { - if (constraints == null) { return null; } @@ -55,8 +52,7 @@ public class DataModelCloneUtil { * @param propertyDefinitions the property definitions * @return the map */ - public static Map<String, PropertyDefinition> clonePropertyDefinitions( - Map<String, PropertyDefinition> propertyDefinitions) { + public static Map<String, PropertyDefinition> clonePropertyDefinitions(Map<String, PropertyDefinition> propertyDefinitions) { if (propertyDefinitions == null) { return null; } @@ -64,7 +60,6 @@ public class DataModelCloneUtil { for (Map.Entry<String, PropertyDefinition> propertyDefinitionEntry : propertyDefinitions.entrySet()) { clonedProperties.put(propertyDefinitionEntry.getKey(), propertyDefinitionEntry.getValue().clone()); } - return clonedProperties; } @@ -74,18 +69,14 @@ public class DataModelCloneUtil { * @param attributeDefinitions the attribute definitions * @return the map */ - public static Map<String, AttributeDefinition> cloneAttributeDefinitions( - Map<String, AttributeDefinition> attributeDefinitions) { - + public static Map<String, AttributeDefinition> cloneAttributeDefinitions(Map<String, AttributeDefinition> attributeDefinitions) { if (attributeDefinitions == null) { return null; } Map<String, AttributeDefinition> clonedAttributeDefinitions = new HashMap<>(); for (Map.Entry<String, AttributeDefinition> attributeDefinitionEntry : attributeDefinitions.entrySet()) { - clonedAttributeDefinitions - .put(attributeDefinitionEntry.getKey(), attributeDefinitionEntry.getValue().clone()); + clonedAttributeDefinitions.put(attributeDefinitionEntry.getKey(), attributeDefinitionEntry.getValue().clone()); } - return clonedAttributeDefinitions; } @@ -108,17 +99,15 @@ public class DataModelCloneUtil { * @param stringPropertyDefinitionMap the map that will be cloned * @return the cloned map */ - public static Map<String, PropertyDefinition> cloneStringPropertyDefinitionMap( - Map<String, PropertyDefinition> stringPropertyDefinitionMap) { + public static Map<String, PropertyDefinition> cloneStringPropertyDefinitionMap(Map<String, PropertyDefinition> stringPropertyDefinitionMap) { if (Objects.isNull(stringPropertyDefinitionMap)) { return null; } - Map<String, PropertyDefinition> cloneMap = new HashMap<>(); ToscaExtensionYamlUtil toscaExtYamlUtil = new ToscaExtensionYamlUtil(); for (Map.Entry<String, PropertyDefinition> mapEntry : stringPropertyDefinitionMap.entrySet()) { - PropertyDefinition propertyDefinition = toscaExtYamlUtil.yamlToObject( - toscaExtYamlUtil.objectToYaml(mapEntry.getValue()), PropertyDefinition.class); + PropertyDefinition propertyDefinition = toscaExtYamlUtil + .yamlToObject(toscaExtYamlUtil.objectToYaml(mapEntry.getValue()), PropertyDefinition.class); cloneMap.put(mapEntry.getKey(), propertyDefinition.clone()); } return cloneMap; @@ -130,18 +119,14 @@ public class DataModelCloneUtil { * @param input the map that will be cloned * @return the cloned map */ - public static <T extends OperationDefinition> Map<String, T> cloneStringOperationDefinitionMap( - Map<String, T> input) { - + public static <T extends OperationDefinition> Map<String, T> cloneStringOperationDefinitionMap(Map<String, T> input) { if (Objects.isNull(input)) { return null; } - Map<String, OperationDefinition> cloneMap = new HashMap<>(); for (Map.Entry<String, T> mapEntry : input.entrySet()) { cloneMap.put(mapEntry.getKey(), Objects.isNull(mapEntry.getValue()) ? null : mapEntry.getValue().clone()); } - return (Map<String, T>) cloneMap; } @@ -155,7 +140,6 @@ public class DataModelCloneUtil { if (Objects.isNull(stringObjectMap)) { return null; } - Map<String, Object> cloneMap = new HashMap<>(); for (Map.Entry<String, Object> mapEntry : stringObjectMap.entrySet()) { YamlUtil yamlUtil = new YamlUtil(); @@ -186,6 +170,4 @@ public class DataModelCloneUtil { } return new ArrayList<>(listString); } - - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java index 0a2437588f..1d9befb6ca 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.services; import java.util.ArrayList; @@ -27,7 +26,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; - import org.apache.commons.collections4.CollectionUtils; import org.onap.sdc.tosca.datatypes.model.Import; import org.onap.sdc.tosca.error.ToscaRuntimeException; @@ -53,9 +51,10 @@ public class DataModelConvertUtil { } private static void convertToscaImportEntry(List<Map<String, Import>> convertedImport, Object importEntry, - ToscaExtensionYamlUtil toscaExtensionYamlUtil) { + ToscaExtensionYamlUtil toscaExtensionYamlUtil) { if (importEntry instanceof String) { //Support for import short notation + /* imports: - <file_URI_1> @@ -68,12 +67,11 @@ public class DataModelConvertUtil { } private static void handleImportMultiLineGrammar(List<Map<String, Import>> convertedImport, Object importEntry, - ToscaExtensionYamlUtil toscaExtensionYamlUtil) { + ToscaExtensionYamlUtil toscaExtensionYamlUtil) { try { if (((Map) importEntry).containsKey("file")) { //Support for import entry of the format - file: <file_uri> or - file: <import object> - Import importObject = toscaExtensionYamlUtil - .yamlToObject(toscaExtensionYamlUtil.objectToYaml(importEntry), Import.class); + Import importObject = toscaExtensionYamlUtil.yamlToObject(toscaExtensionYamlUtil.objectToYaml(importEntry), Import.class); convertImportExtendedNotation(convertedImport, importObject); } else { convertImportMultiLineGrammar(convertedImport, (Map) importEntry, toscaExtensionYamlUtil); @@ -97,8 +95,7 @@ public class DataModelConvertUtil { namespace_uri: http://test.xyz/uri namespace_prefix: pref */ - Import importObject = toscaExtensionYamlUtil - .yamlToObject(toscaExtensionYamlUtil.objectToYaml(importValue), Import.class); + Import importObject = toscaExtensionYamlUtil.yamlToObject(toscaExtensionYamlUtil.objectToYaml(importValue), Import.class); Map<String, Import> convertedToscaImport = new HashMap<>(); convertedToscaImport.put(key, importObject); convertedImport.add(convertedToscaImport); @@ -111,8 +108,7 @@ public class DataModelConvertUtil { private static void convertImportExtendedNotation(List<Map<String, Import>> convertedImport, Import importEntry) { Map<String, Import> importMap = new HashMap<>(); - Optional<String> fileNameWithoutExtension = - getFileNameWithoutExtension(getFileName(importEntry.getFile()).replaceAll("/", "_")); + Optional<String> fileNameWithoutExtension = getFileNameWithoutExtension(getFileName(importEntry.getFile()).replaceAll("/", "_")); if (fileNameWithoutExtension.isPresent()) { importMap.put(fileNameWithoutExtension.get(), importEntry); convertedImport.add(importMap); @@ -134,11 +130,9 @@ public class DataModelConvertUtil { if (Objects.isNull(fileName)) { return Optional.empty(); } - return !fileName.contains(".") ? Optional.of(fileName) - : Optional.of(fileName.substring(0, fileName.lastIndexOf('.'))); + return !fileName.contains(".") ? Optional.of(fileName) : Optional.of(fileName.substring(0, fileName.lastIndexOf('.'))); } - private static String getFileName(String relativeFileName) { if (relativeFileName.contains("../")) { return relativeFileName.replace("../", ""); diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java index b8a950cd85..dfa7451948 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.services; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -31,8 +29,7 @@ public class DataModelNormalizeUtil { throw new IllegalStateException("Utility class"); } - public static List<Map<String, CapabilityFilter>> getNormalizeCapabilitiesFilter( - List<Map<String, CapabilityFilter>> capabilitiesFilter) { + public static List<Map<String, CapabilityFilter>> getNormalizeCapabilitiesFilter(List<Map<String, CapabilityFilter>> capabilitiesFilter) { if (CollectionUtils.isEmpty(capabilitiesFilter)) { return capabilitiesFilter; } @@ -44,8 +41,7 @@ public class DataModelNormalizeUtil { return normalizeCapabilities; } - private static Map<String, CapabilityFilter> getNormalizeCapabilityFilterEntry( - Map<String, CapabilityFilter> capabilityFilterEntry) { + private static Map<String, CapabilityFilter> getNormalizeCapabilityFilterEntry(Map<String, CapabilityFilter> capabilityFilterEntry) { Map<String, CapabilityFilter> normalizeCapabilityEntry = new HashMap<>(); String capabilityKey = capabilityFilterEntry.keySet().iterator().next(); //only one entry exist in the map Object capabilityFilterObj = capabilityFilterEntry.get(capabilityKey); @@ -56,15 +52,13 @@ public class DataModelNormalizeUtil { private static CapabilityFilter getNormalizeCapabilityFilter(Object capabilityFilterObj) { ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); - CapabilityFilter capabilityFilter = toscaExtensionYamlUtil.yamlToObject( - toscaExtensionYamlUtil.objectToYaml(capabilityFilterObj), CapabilityFilter.class); + CapabilityFilter capabilityFilter = toscaExtensionYamlUtil + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(capabilityFilterObj), CapabilityFilter.class); capabilityFilter.setProperties(getNormalizePropertiesFilter(capabilityFilter.getProperties())); - return capabilityFilter; } - public static List<Map<String, List<Constraint>>> getNormalizePropertiesFilter( - List<Map<String, List<Constraint>>> properties) { + public static List<Map<String, List<Constraint>>> getNormalizePropertiesFilter(List<Map<String, List<Constraint>>> properties) { if (CollectionUtils.isEmpty(properties)) { return properties; } @@ -74,11 +68,9 @@ public class DataModelNormalizeUtil { normalizeProperties.add(normalizePropertyEntry); } return normalizeProperties; - } - private static Map<String, List<Constraint>> getNormalizePropertyFilterEntry( - Map<String, List<Constraint>> propertyFilterEntry) { + private static Map<String, List<Constraint>> getNormalizePropertyFilterEntry(Map<String, List<Constraint>> propertyFilterEntry) { Map<String, List<Constraint>> normalizePropertyEntry = new HashMap<>(); String propertyKey = propertyFilterEntry.keySet().iterator().next(); //only one entry exist in the map List<Constraint> constraints = propertyFilterEntry.get(propertyKey); @@ -92,8 +84,7 @@ public class DataModelNormalizeUtil { List<Constraint> normalizeConstraints = new ArrayList<>(); for (Object constraintObj : constraints) { Constraint normalizeConstraint = toscaExtensionYamlUtil - .yamlToObject(toscaExtensionYamlUtil.objectToYaml(constraintObj), - Constraint.class); + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(constraintObj), Constraint.class); normalizeConstraints.add(normalizeConstraint); } return normalizeConstraints; diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java index 466d669ad9..5115d0575b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java @@ -17,22 +17,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.services; +import java.util.LinkedHashSet; +import java.util.Set; import org.yaml.snakeyaml.introspector.BeanAccess; import org.yaml.snakeyaml.introspector.Property; import org.yaml.snakeyaml.introspector.PropertyUtils; -import java.util.LinkedHashSet; -import java.util.Set; - public class MyPropertyUtils extends PropertyUtils { + //Unsorted properties @Override protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess bnAccess) { - return new LinkedHashSet<>(getPropertiesMap(type, - BeanAccess.FIELD).values()); + return new LinkedHashSet<>(getPropertiesMap(type, BeanAccess.FIELD).values()); } @Override @@ -43,5 +41,4 @@ public class MyPropertyUtils extends PropertyUtils { } return super.getProperty(type, updatedName); } - } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java index 7babd428c8..678ba00724 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java @@ -17,18 +17,17 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.tosca.services; -import org.yaml.snakeyaml.constructor.Constructor; -import org.yaml.snakeyaml.nodes.MappingNode; -import org.yaml.snakeyaml.parser.ParserException; - import java.util.AbstractMap; import java.util.Map; import java.util.Set; +import org.yaml.snakeyaml.constructor.Constructor; +import org.yaml.snakeyaml.nodes.MappingNode; +import org.yaml.snakeyaml.parser.ParserException; public class StrictMapAppenderConstructor extends Constructor { + /** * Instantiates a new Strict map appender constructor. * @@ -62,9 +61,7 @@ public class StrictMapAppenderConstructor extends Constructor { try { return super.constructMapping(node); } catch (IllegalStateException exception) { - throw new ParserException("while parsing MappingNode", - node.getStartMark(), exception.getMessage(), - node.getEndMark()); + throw new ParserException("while parsing MappingNode", node.getStartMark(), exception.getMessage(), node.getEndMark()); } } } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java index 37d8411d9b..995ff94ffb 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.services; -import java.beans.IntrospectionException; import org.onap.sdc.tosca.error.ToscaRuntimeException; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.introspector.Property; @@ -24,19 +22,13 @@ import org.yaml.snakeyaml.introspector.PropertyUtils; import org.yaml.snakeyaml.nodes.MappingNode; import org.yaml.snakeyaml.nodes.NodeId; - public class ToscaExtensionYamlUtil extends YamlUtil { - public static final String TOSCA_MODEL_PARAMETER_DEFINITION = - "org.onap.sdc.tosca.datatypes.model.ParameterDefinition"; - public static final String TOSCA_MODEL_EXT_PARAMETER_DEFINITION = - "org.onap.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt"; - public static final String TOSCA_MODEL_REQUIREMENT_ASSIGNMENT = - "org.onap.sdc.tosca.datatypes.model.RequirementAssignment"; - public static final String TOSCA_MODEL_EXT_REQUIREMENT_ASSIGNMENT = - "org.onap.sdc.tosca.datatypes.model.extension.RequirementAssignmentExt"; - public static final String TOSCA_MODEL_SUBSTITUTION_MAPPING = - "org.onap.sdc.tosca.datatypes.model.SubstitutionMapping"; + public static final String TOSCA_MODEL_PARAMETER_DEFINITION = "org.onap.sdc.tosca.datatypes.model.ParameterDefinition"; + public static final String TOSCA_MODEL_EXT_PARAMETER_DEFINITION = "org.onap.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt"; + public static final String TOSCA_MODEL_REQUIREMENT_ASSIGNMENT = "org.onap.sdc.tosca.datatypes.model.RequirementAssignment"; + public static final String TOSCA_MODEL_EXT_REQUIREMENT_ASSIGNMENT = "org.onap.sdc.tosca.datatypes.model.extension.RequirementAssignmentExt"; + public static final String TOSCA_MODEL_SUBSTITUTION_MAPPING = "org.onap.sdc.tosca.datatypes.model.SubstitutionMapping"; @Override public <T> Constructor getConstructor(Class<T> typClass) { @@ -51,7 +43,7 @@ public class ToscaExtensionYamlUtil extends YamlUtil { public class ToscaPropertyUtilsWithHeatExtension extends MyPropertyUtils { @Override - public Property getProperty(Class<? extends Object> type, String name) { + public Property getProperty(Class<? extends Object> type, String name) { Class<? extends Object> classType = type; try { if (type.equals(Class.forName(TOSCA_MODEL_PARAMETER_DEFINITION))) { diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java index 8530846fae..d8e592d353 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java @@ -13,9 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.onap.sdc.tosca.services; +import java.io.IOException; +import java.io.InputStream; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.DumperOptions; @@ -30,19 +36,43 @@ import org.yaml.snakeyaml.nodes.NodeTuple; import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.representer.Representer; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; - /** * The type Yaml util. */ @SuppressWarnings("unchecked") public class YamlUtil { - private static final Logger LOGGER = LoggerFactory.getLogger(YamlUtil.class.getName()); static final String DEFAULT = "default"; static final String DEFAULT_STR = "_default"; + private static final Logger LOGGER = LoggerFactory.getLogger(YamlUtil.class.getName()); + + /** + * Parse a YAML file to List + * + * @param yamlFileInputStream the YAML file input stream + * @return The YAML casted as a list + */ + public static Optional<List<Object>> yamlToList(final InputStream yamlFileInputStream) { + List<Object> yamlList = null; + try { + yamlList = (List<Object>) read(yamlFileInputStream); + } catch (final ClassCastException ex) { + if (LOGGER.isWarnEnabled()) { + LOGGER.warn("Could not parse YAML to List.", ex); + } + } + return Optional.ofNullable(yamlList); + } + + /** + * Parse a YAML file to Object + * + * @param yamlFileInputStream the YAML file input stream + * @return The YAML Object + */ + public static Object read(final InputStream yamlFileInputStream) { + return new Yaml().load(yamlFileInputStream); + } /** * Yaml to object t. @@ -57,7 +87,8 @@ public class YamlUtil { constructor.setPropertyUtils(getPropertyUtils()); TypeDescription yamlFileDescription = new TypeDescription(typClass); constructor.addTypeDescription(yamlFileDescription); - T yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), getLoaderOptions()).load(yamlContent);; + T yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), getLoaderOptions()).load(yamlContent); + ; //noinspection ResultOfMethodCallIgnored yamlObj.toString(); return yamlObj; @@ -111,7 +142,6 @@ public class YamlUtil { return options; } - /** * Gets constructor. * @@ -132,7 +162,6 @@ public class YamlUtil { return new MyPropertyUtils(); } - /** * Yaml to map map. * @@ -143,35 +172,6 @@ public class YamlUtil { return new Yaml().load(yamlContent); } - - /** - * Parse a YAML file to List - * - * @param yamlFileInputStream the YAML file input stream - * @return The YAML casted as a list - */ - public static Optional<List<Object>> yamlToList(final InputStream yamlFileInputStream) { - List<Object> yamlList = null; - try { - yamlList = (List<Object>) read(yamlFileInputStream); - } catch (final ClassCastException ex) { - if (LOGGER.isWarnEnabled()) { - LOGGER.warn("Could not parse YAML to List.", ex); - } - } - return Optional.ofNullable(yamlList); - } - - /** - * Parse a YAML file to Object - * - * @param yamlFileInputStream the YAML file input stream - * @return The YAML Object - */ - public static Object read(final InputStream yamlFileInputStream) { - return new Yaml().load(yamlFileInputStream); - } - /** * Object to yaml string. * @@ -185,7 +185,6 @@ public class YamlUtil { Representer representer = new CustomRepresenter(); representer.addClassTag(obj.getClass(), Tag.MAP); representer.setPropertyUtils(new MyPropertyUtils()); - Yaml yaml = new Yaml(representer, options); return yaml.dump(obj); } @@ -204,30 +203,24 @@ public class YamlUtil { } } - private class CustomRepresenter extends Representer { + @Override protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) { //remove the bean type from the output yaml (!! ...) if (!classTags.containsKey(javaBean.getClass())) { addClassTag(javaBean.getClass(), Tag.MAP); } - return super.representJavaBean(properties, javaBean); } @Override - protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, - Object propertyValue, Tag customTag) { + protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (propertyValue == null) { return null; } else { - NodeTuple defaultNode = - super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); - - return DEFAULT_STR.equals(property.getName()) - ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode()) - : defaultNode; + NodeTuple defaultNode = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); + return DEFAULT_STR.equals(property.getName()) ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode()) : defaultNode; } } } |