aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao/src')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java3
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java5
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactTypeData.java75
3 files changed, 82 insertions, 1 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java
index 800fc679c6..1862f85a47 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java
@@ -126,7 +126,8 @@ public enum ActionStatus {
ABSTRACT, NORMAL,
//including default imports in CSAR related
CSAR_TOSCA_IMPORTS_ERROR,
+ //ArtifactType
+ ARTIFACT_TYPE_ALREADY_EXIST, FAILED_CREATE_ARTIFACTS_TYPES,
//TOSCA node types
INVALID_NODE_TYPES_YAML
-
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java
index 1c500e722d..11de2a3f25 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.be.dao.graph;
import java.util.Map;
+
import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
@@ -29,6 +30,7 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.resources.data.AdditionalInfoParameterData;
import org.openecomp.sdc.be.resources.data.AnnotationTypeData;
import org.openecomp.sdc.be.resources.data.ArtifactData;
+import org.openecomp.sdc.be.resources.data.ArtifactTypeData;
import org.openecomp.sdc.be.resources.data.AttributeData;
import org.openecomp.sdc.be.resources.data.AttributeValueData;
import org.openecomp.sdc.be.resources.data.CapabilityData;
@@ -260,6 +262,9 @@ public class GraphElementFactory {
case Model:
element = clazz.cast(new ModelData(properties));
break;
+ case ArtifactType:
+ element = clazz.cast(new ArtifactTypeData(properties));
+ break;
default:
break;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactTypeData.java
new file mode 100644
index 0000000000..e138016d10
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactTypeData.java
@@ -0,0 +1,75 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.be.resources.data;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
+import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactTypeDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
+
+public class ArtifactTypeData extends GraphNode {
+
+ private ArtifactTypeDataDefinition artifactTypeDefinition;
+
+ public ArtifactTypeData() {
+ super(NodeTypeEnum.Interface);
+ artifactTypeDefinition = new ArtifactTypeDataDefinition();
+ }
+
+ public ArtifactTypeData(ArtifactTypeDataDefinition artifactTypeDefinition) {
+ super(NodeTypeEnum.ArtifactType);
+ this.artifactTypeDefinition = artifactTypeDefinition;
+ }
+
+ public ArtifactTypeData(Map<String, Object> properties) {
+ this();
+ artifactTypeDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
+ artifactTypeDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()));
+ artifactTypeDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty()));
+ artifactTypeDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
+ artifactTypeDefinition.setLastUpdated((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
+ }
+
+ public ArtifactTypeDataDefinition getArtifactTypeDataDefinition() {
+ return artifactTypeDefinition;
+ }
+
+ public void setArtifactTypeDataDefinition(ArtifactTypeDataDefinition artifactTypeDefinition) {
+ this.artifactTypeDefinition = artifactTypeDefinition;
+ }
+
+ @Override
+ public String getUniqueId() {
+ return artifactTypeDefinition.getUniqueId();
+ }
+
+ @Override
+ public Map<String, Object> toGraphMap() {
+ Map<String, Object> map = new HashMap<>();
+ addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, artifactTypeDefinition.getUniqueId());
+ addIfExists(map, GraphPropertiesDictionary.TYPE, artifactTypeDefinition.getType());
+ addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, artifactTypeDefinition.getCreationDate());
+ addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, artifactTypeDefinition.getLastUpdated());
+ addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, artifactTypeDefinition.getDescription());
+ return map;
+ }
+}