summaryrefslogtreecommitdiffstats
path: root/common/openecomp-tosca-datatype
diff options
context:
space:
mode:
Diffstat (limited to 'common/openecomp-tosca-datatype')
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java5
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java6
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java20
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java1
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java18
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java16
6 files changed, 47 insertions, 19 deletions
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java
index cb79691b21..b14e49a012 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Implementation.java
@@ -13,8 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.openecomp.sdc.tosca.datatypes.model;
+import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -50,12 +52,11 @@ public class Implementation {
}
Implementation that = (Implementation) o;
return Objects.equals(primary, that.primary) &&
- Objects.equals(dependencies, that.dependencies);
+ Objects.equals(new HashSet<>(dependencies), new HashSet<>(that.dependencies));
}
@Override
public int hashCode() {
-
return Objects.hash(primary, dependencies);
}
}
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 8d6ace2043..3a35b46907 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
@@ -15,7 +15,11 @@
*/
package org.openecomp.sdc.tosca.datatypes.model;
+import java.util.Map;
+
public abstract class InterfaceDefinition {
- public abstract void addOperation(String operationName, OperationDefinition operationDefinition);
+ protected Map<String, OperationDefinition> operations;
+
+ public abstract void addOperation(String operationName, OperationDefinition operationDefinition);
}
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
index 912e5a7b99..efa86f0ced 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
@@ -20,6 +20,7 @@ import org.apache.commons.collections4.MapUtils;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
public class InterfaceDefinitionTemplate extends InterfaceDefinition {
@@ -39,11 +40,6 @@ public class InterfaceDefinitionTemplate extends InterfaceDefinition {
return operations;
}
- public void setOperations(
- Map<String, OperationDefinitionTemplate> operations) {
- this.operations = operations;
- }
-
public void addOperation(String operationName, OperationDefinitionTemplate operation) {
if(MapUtils.isEmpty(this.operations)) {
this.operations = new HashMap<>();
@@ -60,21 +56,15 @@ public class InterfaceDefinitionTemplate extends InterfaceDefinition {
if (!(o instanceof InterfaceDefinitionTemplate)) {
return false;
}
-
InterfaceDefinitionTemplate that = (InterfaceDefinitionTemplate) o;
-
- if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
- return false;
- }
- return getOperations() != null ? getOperations().equals(that.getOperations())
- : that.getOperations() == null;
+ return Objects.equals(inputs, that.inputs) &&
+ Objects.equals(operations, that.operations);
}
@Override
public int hashCode() {
- int result = getInputs() != null ? getInputs().hashCode() : 0;
- result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);
- return result;
+
+ return Objects.hash(inputs, operations);
}
@Override
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
index 8bd1b26332..4860b3a2ac 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package org.openecomp.sdc.tosca.datatypes.model;
import org.apache.commons.collections4.MapUtils;
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
index 7b4be10236..6710e271b6 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
@@ -1,9 +1,25 @@
+/*
+ * 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.
+ * 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.
+ */
+
package org.openecomp.sdc.tosca.datatypes.model;
import java.util.Map;
import java.util.Objects;
-public class OperationDefinitionTemplate extends OperationDefinition{
+public class OperationDefinitionTemplate extends OperationDefinition {
private Implementation implementation;
private Map<String, Object> inputs;
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java
index 70c6a58041..7043812fc7 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/OperationDefinitionType.java
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ * 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.
+ */
+
package org.openecomp.sdc.tosca.datatypes.model;
import java.util.Map;