diff options
author | talio <tali.orenbach@amdocs.com> | 2018-02-18 11:52:25 +0200 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-03-15 09:14:51 +0000 |
commit | 704247137bdba671e55c0ebde7e226fff422b608 (patch) | |
tree | ad4124c20d60e37917376ebca977ac8f04cb2ec8 /common | |
parent | 9c40f569b817e0886d95ad8b1ac235d8644873da (diff) |
Change Tosca structure
change Tosca Service Template according to Tosca-spec-1.1
Change-Id: I8f689b02e0349fc8c787868661f498d7d530d445
Issue-ID: SDC-1043
Signed-off-by: talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'common')
25 files changed, 857 insertions, 12 deletions
diff --git a/common/openecomp-tosca-datatype/pom.xml b/common/openecomp-tosca-datatype/pom.xml index 7fbedef7cd..27a13c6a21 100644 --- a/common/openecomp-tosca-datatype/pom.xml +++ b/common/openecomp-tosca-datatype/pom.xml @@ -20,5 +20,10 @@ <artifactId>snakeyaml</artifactId> <version>1.17</version> </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + <version>${commons.collections.version}</version> + </dependency> </dependencies> </project> diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ActivityDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ActivityDefinition.java new file mode 100644 index 0000000000..47800a4c2a --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ActivityDefinition.java @@ -0,0 +1,41 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +public class ActivityDefinition { + + private String delegate; + private String set_state; + private String call_operation; + private String inline; + + public String getDelegate() { + return delegate; + } + + public void setDelegate(String delegate) { + this.delegate = delegate; + } + + public String getSet_state() { + return set_state; + } + + public void setSet_state(String set_state) { + this.set_state = set_state; + } + + public String getCall_operation() { + return call_operation; + } + + public void setCall_operation(String call_operation) { + this.call_operation = call_operation; + } + + public String getInline() { + return inline; + } + + public void setInline(String inline) { + this.inline = inline; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java index 873796445d..64428d3920 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java @@ -29,6 +29,7 @@ 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; @@ -51,6 +52,14 @@ public class ArtifactType { this.version = version; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public String getDescription() { return description; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Credential.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Credential.java new file mode 100644 index 0000000000..19138ca69f --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Credential.java @@ -0,0 +1,55 @@ +package org.openecomp.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"; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getToken_type() { + return token_type; + } + + public void setToken_type(String token_type) { + this.token_type = token_type; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public Map<String, String> getKeys() { + return keys; + } + + public void setKeys(Map<String, String> keys) { + this.keys = keys; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java index 7a3732e9ad..84ec4cb030 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java @@ -27,6 +27,7 @@ public class DataType { private String derived_from; private String version; + Map<String, String> metadata; private String description; private List<Constraint> constraints; private Map<String, PropertyDefinition> properties; @@ -67,6 +68,14 @@ public class DataType { this.version = version; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + /** * Gets description. * diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EventFilter.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EventFilter.java new file mode 100644 index 0000000000..794997050f --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EventFilter.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +public class EventFilter { + + private String node; + private String requirement; + private String capability; + + public String getNode() { + return node; + } + + public void setNode(String node) { + this.node = node; + } + + public String getRequirement() { + return requirement; + } + + public void setRequirement(String requirement) { + this.requirement = requirement; + } + + public String getCapability() { + return capability; + } + + public void setCapability(String capability) { + this.capability = capability; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java index 00eebbf273..0da5207479 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java @@ -29,8 +29,10 @@ 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; public String getType() { return type; @@ -63,4 +65,21 @@ public class GroupDefinition { public void setMembers(List<String> members) { this.members = members; } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public Map<String, Object> getInterfaces() { + return interfaces; + } + + public void setInterfaces( + Map<String, Object> interfaces) { + this.interfaces = interfaces; + } } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java index 9f857e1fcc..81badd2af9 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java @@ -29,9 +29,12 @@ 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() { @@ -50,6 +53,32 @@ public class GroupType { 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; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java index ecfbbaff21..745f49dcfa 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.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. @@ -20,7 +20,62 @@ package org.openecomp.sdc.tosca.datatypes.model; +import org.apache.commons.collections4.MapUtils; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; public class InterfaceDefinition { + + private String type; + private Map<String, PropertyDefinition> inputs; + private Map<String, OperationDefinition> operations; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Map<String, PropertyDefinition> getInputs() { + return inputs; + } + + public void setInputs( + Map<String, PropertyDefinition> inputs) { + this.inputs = inputs; + } + + public Map<String, OperationDefinition> getOperations() { + return operations; + } + + public void addOperation(String operationName, OperationDefinition operationDefinition) { + if (MapUtils.isEmpty(this.operations)) { + this.operations = new HashMap<>(); + } + this.operations.put(operationName, operationDefinition); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof InterfaceDefinition)) { + return false; + } + InterfaceDefinition that = (InterfaceDefinition) o; + return Objects.equals(type, that.type) && + Objects.equals(inputs, that.inputs) && + Objects.equals(operations, that.operations); + } + + @Override + public int hashCode() { + return Objects.hash(type, inputs, operations); + } } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java index a9f0b2d917..22d8e7c6ff 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java @@ -20,7 +20,118 @@ package org.openecomp.sdc.tosca.datatypes.model; +import org.apache.commons.collections4.MapUtils; +import java.util.HashMap; +import java.util.Map; public class InterfaceType { + private String derived_from; + private String version; + private Map<String, String> metadata; + private String description; + private Map<String, PropertyDefinition> inputs; + private Map<String, OperationDefinition> operations; + + public Map<String, PropertyDefinition> getInputs() { + return inputs; + } + + public void setInputs( + Map<String, PropertyDefinition> inputs) { + this.inputs = inputs; + } + + 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 String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, OperationDefinition> getOperations() { + return operations; + } + + public void setOperations( + Map<String, OperationDefinition> operations) { + this.operations = operations; + } + + public void addOperation(String operationName, OperationDefinition operationDefinition) { + if(MapUtils.isEmpty(this.operations)){ + this.operations = new HashMap<>(); + } + this.operations.put(operationName, operationDefinition); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof InterfaceType)) { + return false; + } + + InterfaceType that = (InterfaceType) o; + + if (getDerived_from() != null ? !getDerived_from().equals(that.getDerived_from()) + : that.getDerived_from() != null) { + return false; + } + if (getVersion() != null ? !getVersion().equals(that.getVersion()) + : that.getVersion() != null) { + return false; + } + if (getMetadata() != null ? !getMetadata().equals(that.getMetadata()) + : that.getMetadata() != null) { + return false; + } + if (getDescription() != null ? !getDescription().equals(that.getDescription()) + : that.getDescription() != null) { + return false; + } + if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) { + return false; + } + return getOperations() != null ? getOperations().equals(that.getOperations()) + : that.getOperations() == null; + } + + @Override + public int hashCode() { + int result = getDerived_from() != null ? getDerived_from().hashCode() : 0; + result = 31 * result + (getVersion() != null ? getVersion().hashCode() : 0); + result = 31 * result + (getMetadata() != null ? getMetadata().hashCode() : 0); + result = 31 * result + (getDescription() != null ? getDescription().hashCode() : 0); + result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0); + result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0); + return result; + } } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java index bfbf343e6d..01b1c6a959 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java @@ -30,12 +30,13 @@ public class NodeTemplate implements Template { private String type; private String description; + private Map<String, String> metadata; private List<String> directives; private Map<String, Object> properties; private Map<String, Object> attributes; private List<Map<String, RequirementAssignment>> requirements; private Map<String, CapabilityAssignment> capabilities; - private Map<String, InterfaceDefinition> interfaces; + private Map<String, Object> interfaces; private Map<String, ArtifactDefinition> artifacts; private NodeFilter node_filter; private String copy; @@ -56,6 +57,14 @@ public class NodeTemplate implements Template { this.description = description; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public List<String> getDirectives() { return directives; } @@ -96,11 +105,11 @@ public class NodeTemplate implements Template { this.capabilities = capabilities; } - public Map<String, InterfaceDefinition> getInterfaces() { + public Map<String, Object> getInterfaces() { return interfaces; } - public void setInterfaces(Map<String, InterfaceDefinition> interfaces) { + public void setInterfaces(Map<String, Object> interfaces) { this.interfaces = interfaces; } @@ -131,8 +140,7 @@ public class NodeTemplate implements Template { @Override public NodeTemplate clone() { YamlUtil yamlUtil = new YamlUtil(); - NodeTemplate clone = yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class); - return clone; + return yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class); } @Override diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java index f1eb5acc24..f12345e1f4 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java @@ -27,6 +27,7 @@ public class NodeType { private String derived_from; private String version; + private Map<String, String> metadata; private String description; private Map<String, PropertyDefinition> properties; private Map<String, AttributeDefinition> attributes; @@ -52,6 +53,14 @@ public class NodeType { this.version = version; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public String getDescription() { return description; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinition.java new file mode 100644 index 0000000000..591e94ee1d --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinition.java @@ -0,0 +1,65 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +import java.util.Map; + +public class OperationDefinition { + + private String description; + private String implementation; + private Map<String, PropertyDefinition> inputs; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getImplementation() { + return implementation; + } + + public void setImplementation(String implementation) { + this.implementation = implementation; + } + + public Map<String, PropertyDefinition> getInputs() { + return inputs; + } + + public void setInputs( + Map<String, PropertyDefinition> inputs) { + this.inputs = inputs; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof OperationDefinition)) { + return false; + } + + OperationDefinition that = (OperationDefinition) o; + + if (getDescription() != null ? !getDescription().equals(that.getDescription()) + : that.getDescription() != null) { + return false; + } + if (getImplementation() != null ? !getImplementation().equals(that.getImplementation()) + : that.getImplementation() != null) { + return false; + } + return getInputs() != null ? getInputs().equals(that.getInputs()) : that.getInputs() == null; + } + + @Override + public int hashCode() { + int result = getDescription() != null ? getDescription().hashCode() : 0; + result = 31 * result + (getImplementation() != null ? getImplementation().hashCode() : 0); + result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0); + return result; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java index 90f44ae36a..6907ea6480 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java @@ -26,6 +26,7 @@ import java.util.Map; public class PolicyDefinition implements Template { private String type; private String description; + private Map<String, String> metadata; private Map<String, Object> properties; private List<String> targets; @@ -45,6 +46,14 @@ public class PolicyDefinition implements Template { this.description = description; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public Map<String, Object> getProperties() { return properties; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java index 3c3b931e06..55a13d5a6c 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java @@ -29,9 +29,11 @@ public class PolicyType { private String derived_from; private String version; + private Map<String, String> metadata; private String description; private Map<String, PropertyDefinition> properties; private List<String> targets; + private List<Trigger> triggers; public String getDerived_from() { return derived_from; @@ -72,4 +74,21 @@ public class PolicyType { public void setTargets(List<String> targets) { this.targets = targets; } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public List<Trigger> getTriggers() { + return triggers; + } + + public void setTriggers( + List<Trigger> triggers) { + this.triggers = triggers; + } } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PreconditionDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PreconditionDefinition.java new file mode 100644 index 0000000000..adbb335f6a --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PreconditionDefinition.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +public class PreconditionDefinition { + + private String target; + private String target_relationship; + private Constraint condition; + + 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 Constraint getCondition() { + return condition; + } + + public void setCondition(Constraint condition) { + this.condition = condition; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java index 5ba748dcee..d354807c2f 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java @@ -28,11 +28,12 @@ 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, InterfaceDefinition> interfaces; + private Map<String, Object> interfaces; private String copy; public String getType() { @@ -51,6 +52,14 @@ public class RelationshipTemplate implements Template { this.description = description; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public Map<String, Object> getProperties() { return properties; } @@ -83,11 +92,11 @@ public class RelationshipTemplate implements Template { this.capabilities = capabilities; } - public Map<String, InterfaceDefinition> getInterfaces() { + public Map<String, Object> getInterfaces() { return interfaces; } - public void setInterfaces(Map<String, InterfaceDefinition> interfaces) { + public void setInterfaces(Map<String, Object> interfaces) { this.interfaces = interfaces; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java index 2d113775a1..463d3d2364 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java @@ -27,6 +27,7 @@ public class RelationshipType { private String derived_from; private String version; + private Map<String, String> metadata; private String description; private Map<String, PropertyDefinition> properties; private Map<String, AttributeDefinition> attributes; @@ -51,6 +52,14 @@ public class RelationshipType { this.version = version; } + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + public String getDescription() { return description; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Repository.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Repository.java new file mode 100644 index 0000000000..3d3a5924d1 --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Repository.java @@ -0,0 +1,32 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +public class Repository { + + private String description; + private String url; + private Credential credential; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public Credential getCredential() { + return credential; + } + + public void setCredential(Credential credential) { + this.credential = credential; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java index 297a2498bb..c02679d2af 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2017 European Support Limited + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,20 @@ package org.openecomp.sdc.tosca.datatypes.model; +import org.apache.commons.collections4.MapUtils; import org.openecomp.sdc.tosca.datatypes.model.heatextend.AnnotationType; + +import java.util.HashMap; import java.util.List; import java.util.Map; - public class ServiceTemplate implements Template { private String tosca_definitions_version; private Map<String, String> metadata; + private Object dsl_definitions; + private Map<String, Repository> repositories; private String description; private List<Map<String, Import>> imports; private Map<String, ArtifactType> artifact_types; @@ -55,6 +59,23 @@ public class ServiceTemplate implements Template { this.metadata = metadata; } + public Object getDsl_definitions() { + return dsl_definitions; + } + + public void setDsl_definitions(Object dsl_definitions) { + this.dsl_definitions = dsl_definitions; + } + + public Map<String, Repository> getRepositories() { + return repositories; + } + + public void setRepositories( + Map<String, Repository> repositories) { + this.repositories = repositories; + } + public String getDescription() { return description; } @@ -128,6 +149,14 @@ public class ServiceTemplate implements Template { this.interface_types = interface_types; } + public void addInterfaceType(String interfaceKey, InterfaceType interfaceType) { + if (MapUtils.isEmpty(this.interface_types)) { + this.interface_types = new HashMap<>(); + } + + this.interface_types.put(interfaceKey, interfaceType); + } + public Map<String, PolicyType> getPolicy_types() { return policy_types; } diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/StepDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/StepDefinition.java new file mode 100644 index 0000000000..7a5c7b7884 --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/StepDefinition.java @@ -0,0 +1,71 @@ +package org.openecomp.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; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TimeInterval.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TimeInterval.java new file mode 100644 index 0000000000..efce557fd5 --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TimeInterval.java @@ -0,0 +1,24 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +import java.sql.Timestamp; + +public class TimeInterval { + private Timestamp start_time; + private Timestamp end_time; + + public Timestamp getStart_time() { + return start_time; + } + + public void setStart_time(Timestamp start_time) { + this.start_time = start_time; + } + + public Timestamp getEnd_time() { + return end_time; + } + + public void setEnd_time(Timestamp end_time) { + this.end_time = end_time; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java index 88c76e59d4..fe1b2ea313 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.tosca.datatypes.model; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -34,6 +35,7 @@ public class TopologyTemplate { private Map<String, ParameterDefinition> outputs; private SubstitutionMapping substitution_mappings; private Map<String, PolicyDefinition> policies; + private List<WorkflowDefinition> workflows; public String getDescription() { return description; @@ -111,4 +113,12 @@ public class TopologyTemplate { 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/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Trigger.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Trigger.java new file mode 100644 index 0000000000..615630fa88 --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Trigger.java @@ -0,0 +1,99 @@ +package org.openecomp.sdc.tosca.datatypes.model; + +import java.sql.Time; + +public class Trigger { + + private String description; + private String event_type; + private TimeInterval schedule; + private EventFilter target_filter; + private Constraint condition; + private Constraint constraint; + private String period; + private int evaluations; + private String method; + //action - String or operation? + private Object action; + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getEvent_type() { + return event_type; + } + + public void setEvent_type(String event_type) { + this.event_type = event_type; + } + + public TimeInterval getSchedule() { + return schedule; + } + + public void setSchedule(TimeInterval schedule) { + this.schedule = schedule; + } + + public EventFilter getTarget_filter() { + return target_filter; + } + + public void setTarget_filter(EventFilter target_filter) { + this.target_filter = target_filter; + } + + public Constraint getCondition() { + return condition; + } + + public void setCondition(Constraint condition) { + this.condition = condition; + } + + public Constraint getConstraint() { + return constraint; + } + + public void setConstraint(Constraint constraint) { + this.constraint = constraint; + } + + public String getPeriod() { + return period; + } + + public void setPeriod(String period) { + this.period = period; + } + + public int getEvaluations() { + return evaluations; + } + + public void setEvaluations(int evaluations) { + this.evaluations = evaluations; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public Object getAction() { + return action; + } + + public void setAction(Object action) { + this.action = action; + } +} diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/WorkflowDefinition.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/WorkflowDefinition.java new file mode 100644 index 0000000000..20f0863d2e --- /dev/null +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/WorkflowDefinition.java @@ -0,0 +1,55 @@ +package org.openecomp.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; + } + + 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; + } + + public void setInputs( + Map<String, PropertyDefinition> inputs) { + this.inputs = inputs; + } + + public List<PreconditionDefinition> getPreconditions() { + return preconditions; + } + + public void setPreconditions( + List<PreconditionDefinition> preconditions) { + this.preconditions = preconditions; + } + + public Map<String, StepDefinition> getSteps() { + return steps; + } + + public void setSteps( + Map<String, StepDefinition> steps) { + this.steps = steps; + } +} |