diff options
author | 2018-07-10 14:20:54 +0300 | |
---|---|---|
committer | 2018-07-10 14:20:54 +0300 | |
commit | c72d565bb58226b20625b2bce5f0019046bee649 (patch) | |
tree | 8658e49595705b02e47ddc14afa20d6bb7123547 /vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca | |
parent | ef8a6b47847012fd59ea20da21d8d3d7c4a301ed (diff) |
Merge 1806 code of vid-common
Change-Id: I75d52abed4a24dfe3827d79edc4a2938726aa87a
Issue-ID: VID-208
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca')
6 files changed, 82 insertions, 480 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Capability.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Capability.java deleted file mode 100644 index 7aa13435..00000000 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Capability.java +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.vid.asdc.beans.tosca; - -import java.util.Collection; -import java.util.Map; - -/** - * The Class Capability. - */ -public class Capability { - - /** The type. */ - private String type; //FIXME: Make an enumeration? - - /** The description. */ - private String description; - - /** The occurrences. */ - private Collection<String> occurrences; //FIXME: Make an enumeration? - - /** The properties. */ - private Map<String, Property> properties; - - /** The valid source types. */ - private Collection<String> valid_source_types; //FIXME: Make an enumeration? - - /** - * Instantiates a new capability. - */ - public Capability() {} - - /** - * Gets the type. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the description. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the occurrences. - * - * @return the occurrences - */ - public Collection<String> getOccurrences() { - return occurrences; - } - - /** - * Gets the properties. - * - * @return the properties - */ - public Map<String, Property> getProperties() { - return properties; - } - - /** - * Gets the valid source types. - * - * @return the valid source types - */ - public Collection<String> getValid_source_types() { - return valid_source_types; - } - - /** - * Sets the type. - * - * @param type the new type - */ - public void setType(String type) { - this.type = type; - } - - /** - * Sets the description. - * - * @param description the new description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Sets the occurrences. - * - * @param occurrences the new occurrences - */ - public void setOccurrences(Collection<String> occurrences) { - this.occurrences = occurrences; - } - - /** - * Sets the properties. - * - * @param properties the properties - */ - public void setProperties(Map<String, Property> properties) { - this.properties = properties; - } - - /** - * Sets the valid source types. - * - * @param valid_source_types the new valid source types - */ - public void setValid_source_types(Collection<String> valid_source_types) { - this.valid_source_types = valid_source_types; - } -} diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Constraint.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Constraint.java deleted file mode 100644 index 118776ca..00000000 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Constraint.java +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.vid.asdc.beans.tosca; -import java.util.List; -import java.util.ArrayList; - -/** - * The Class Constraint. - */ - -public class Constraint { - private List<Object> valid_values; - private Object equal; - private Object greater_than; - private Object greater_or_equal; - private Object less_than; - private Object less_or_equal; - private List<Object> in_range; - private Object length; - private Object min_length; - private Object max_length; - - /** - * Instantiates a new Constraint. - */ - public Constraint() { - valid_values = new ArrayList<Object>(); - in_range = new ArrayList<Object>(); - } - - /** - * Gets the valid_values. - * - * @return the valid_values - */ - public List<Object> getvalid_values() { - return valid_values; - } - /** - * Gets equal. - * - * @return equal - */ - public Object getEqual() { - return equal; - } - /** - * Gets greater_than. - * - * @return greater_than - */ - public Object getGreater_than() { - return greater_than; - } - /** - * Gets greater_or_equal. - * - * @return greater_or_equal - */ - public Object getGreater_or_equal() { - return greater_or_equal; - } - /** - * Gets less_than. - * - * @return less_than - */ - public Object getLess_than() { - return less_than; - } - /** - * Gets less_or_equal. - * - * @return less_or_equal - */ - public Object getLess_or_equal() { - return less_or_equal; - } - /** - * Gets in_range. - * - * @return in_range - */ - public List<Object> getIn_range() { - return in_range; - } - /** - * Gets length. - * - * @return length - */ - public Object getLength() { - return length; - } - /** - * Gets min_length. - * - * @return min_length - */ - public Object getMin_length() { - return min_length; - } - /** - * Gets max_length. - * - * @return max_length - */ - public Object getMax_length() { - return max_length; - } - /** - * Sets the valid_values. - * - * @param op the new valid_values - */ - public void setvalid_values(List<Object> vlist) { - this.valid_values = vlist; - } - /** - * Sets equal. - * - * @param e the new equal - */ - public void setEqual(Object e) { - this.equal = e; - } - /** - * Sets greater_than. - * - * @param e the new greater_than - */ - public void setGreater_than(Object e) { - this.greater_than = e; - } - /** - * Sets less_than. - * - * @param e the new less_than - */ - public void setLess_than(Object e) { - this.less_than = e; - } - /** - * Sets in_range. - * - * @param e the new in_range - */ - public void setIn_range(List<Object> e) { - this.in_range = e; - } - /** - * Sets length. - * - * @param e the length - */ - public void setLength(Object e) { - this.length = e; - } - /** - * Sets min_length. - * - * @param e the min_length - */ - public void setMin_length(Object e) { - this.min_length = e; - } - /** - * Sets max_length. - * - * @param e the max_length - */ - public void setMax_length(Object e) { - this.max_length = e; - } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "valid_values=" + valid_values; - } -} diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java index 6b2f39ec..59028492 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Input.java @@ -20,7 +20,7 @@ package org.onap.vid.asdc.beans.tosca; -import org.onap.sdc.toscaparser.api.elements.constraints.*; +import org.onap.sdc.toscaparser.api.Property; import java.util.List; import java.util.ArrayList; @@ -31,6 +31,13 @@ import java.util.ArrayList; */ public class Input { + public Input(org.onap.sdc.toscaparser.api.parameters.Input input, List<Property> properties){ + this.type = input.getType(); + this.description = input.getDescription(); + this._default = input.getDefault(); + this.inputProperties = new InputProperties(properties); + } + /** The type. */ private String type; @@ -42,6 +49,8 @@ public class Input { /** The entry schema. */ private Input entry_schema; + + private InputProperties inputProperties; /** The constraints */ private List<org.onap.sdc.toscaparser.api.elements.constraints.Constraint> constraints; @@ -142,11 +151,18 @@ public class Input { /** * Sets the entry schema. * - * @param the entry schema */ public void setentry_schema(Input s) { this.entry_schema = s; } + + public InputProperties getInputProperties() { + return inputProperties; + } + + public void setInputProperties(InputProperties inputProperties) { + this.inputProperties = inputProperties; + } /** * Sets the constraints. * diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/InputProperties.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/InputProperties.java new file mode 100644 index 00000000..bc2513ea --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/InputProperties.java @@ -0,0 +1,63 @@ +package org.onap.vid.asdc.beans.tosca; + +import org.onap.sdc.toscaparser.api.Property; + +import java.util.List; + +public class InputProperties { + private String sourceType; + private String vfModuleLabel; + private String paramName; + + public InputProperties(){ + + } + + public InputProperties(List<Property> properties) { + for(Property property: properties) { + if (property.getName().equals("source_type")) { + this.sourceType = (String)property.getValue(); + continue; + } else if (property.getName().equals("param_name")) { + this.paramName = (String)property.getValue(); + continue; + } else if (property.getName().equals("vf_module_label")) { + this.vfModuleLabel = getPropertyValueAsString(property); + continue; + } + } + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + public String getVfModuleLabel() { + return vfModuleLabel; + } + + public void setVfModuleLabel(String vfModuleLabel) { + this.vfModuleLabel = vfModuleLabel; + } + + public String getParamName() { + return paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + private String getPropertyValueAsString(Property property) { + return property.getValue().toString().substring(1, property.getValue().toString().length()-1); + } + + + + + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Property.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Property.java index 4bebe8b8..74b00bdf 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Property.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Property.java @@ -73,15 +73,6 @@ public class Property { } /** - * Gets the default. - * - * @return the default - */ - public String get_default() { - return _default; - } - - /** * Sets the type. * * @param type the new type @@ -109,15 +100,6 @@ public class Property { } /** - * Sets the default. - * - * @param _default the new default - */ - public void set_default(String _default) { - this._default = _default; - } - - /** * Gets the default. * * @return the default @@ -125,7 +107,7 @@ public class Property { public String getDefault() { return _default; } - + /** * Checks if is required. * diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Requirement.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Requirement.java deleted file mode 100644 index 202e88f1..00000000 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/tosca/Requirement.java +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.vid.asdc.beans.tosca; - -import java.util.Collection; - -/** - * The Class Requirement. - */ -public class Requirement { - - /** The occurrences. */ - private Collection<String> occurrences; - - /** The capability. */ - private String capability; - - /** The node. */ - private String node; - - /** The relationship. */ - private String relationship; - - /** - * Instantiates a new requirement. - */ - Requirement() {} - - /** - * Gets the occurrences. - * - * @return the occurrences - */ - public Collection<String> getOccurrences() { - return occurrences; - } - - /** - * Gets the capability. - * - * @return the capability - */ - public String getCapability() { - return capability; - } - - /** - * Gets the node. - * - * @return the node - */ - public String getNode() { - return node; - } - - /** - * Gets the relationship. - * - * @return the relationship - */ - public String getRelationship() { - return relationship; - } - - /** - * Sets the occurrences. - * - * @param occurrences the new occurrences - */ - public void setOccurrences(Collection<String> occurrences) { - this.occurrences = occurrences; - } - - /** - * Sets the capability. - * - * @param capability the new capability - */ - public void setCapability(String capability) { - this.capability = capability; - } - - /** - * Sets the node. - * - * @param node the new node - */ - public void setNode(String node) { - this.node = node; - } - - /** - * Sets the relationship. - * - * @param relationship the new relationship - */ - public void setRelationship(String relationship) { - this.relationship = relationship; - } - - -} |