summaryrefslogtreecommitdiffstats
path: root/catalog-dao
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-11 14:22:02 +0300
committerMichael Lando <ml636r@att.com>2017-06-11 17:48:32 +0300
commitb3d4898d9e8452ea0b8d848c048e712d43b8d9a3 (patch)
tree0609319203be13f6c29ccbe24cb39c9d64f90095 /catalog-dao
parentaf9929df75604ce407d0ca542b200630164e0ae6 (diff)
[SDC-29] rebase continue work to align source
Change-Id: I218f1c5ee23fb2c8314f1c70921d3ad8682c10f4 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-dao')
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java36
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java1
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java12
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java (renamed from catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESSdcSchemaFilesData.java)26
8 files changed, 54 insertions, 33 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 acd8563878..ee74a468fc 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
@@ -71,7 +71,7 @@ public enum ActionStatus {
GROUP_MEMBER_EMPTY, GROUP_TYPE_ALREADY_EXIST,
// CSAR
- MISSING_CSAR_UUID, CSAR_INVALID, CSAR_INVALID_FORMAT, CSAR_NOT_FOUND, YAML_NOT_FOUND_IN_CSAR, VSP_ALREADY_EXISTS, RESOURCE_LINKED_TO_DIFFERENT_VSP, RESOURCE_FROM_CSAR_NOT_FOUND, AAI_ARTIFACT_GENERATION_FAILED, ASSET_NOT_FOUND_DURING_CSAR_CREATION, ARTIFACT_PAYLOAD_NOT_FOUND_DURING_CSAR_CREATION,
+ MISSING_CSAR_UUID, CSAR_INVALID, CSAR_INVALID_FORMAT, CSAR_NOT_FOUND, YAML_NOT_FOUND_IN_CSAR, VSP_ALREADY_EXISTS, RESOURCE_LINKED_TO_DIFFERENT_VSP, RESOURCE_FROM_CSAR_NOT_FOUND, AAI_ARTIFACT_GENERATION_FAILED, ASSET_NOT_FOUND_DURING_CSAR_CREATION, ARTIFACT_PAYLOAD_NOT_FOUND_DURING_CSAR_CREATION, TOSCA_SCHEMA_FILES_NOT_FOUND,
// Group
GROUP_HAS_CYCLIC_DEPENDENCY, GROUP_ALREADY_EXIST, GROUP_TYPE_IS_INVALID, GROUP_MISSING_GROUP_TYPE, GROUP_INVALID_COMPONENT_INSTANCE, GROUP_INVALID_TOSCA_NAME_OF_COMPONENT_INSTANCE, GROUP_IS_MISSING, GROUP_ARTIFACT_ALREADY_ASSOCIATED, GROUP_ARTIFACT_ALREADY_DISSOCIATED, GROUP_PROPERTY_NOT_FOUND, INVALID_VF_MODULE_NAME, INVALID_VF_MODULE_NAME_MODIFICATION, INVALID_VF_MODULE_TYPE,
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
index e6843eab2f..1168bf4edf 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
@@ -1,6 +1,6 @@
package org.openecomp.sdc.be.dao.cassandra;
-import org.openecomp.sdc.be.resources.data.ESSdcSchemaFilesData;
+import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
@@ -10,5 +10,5 @@ import com.datastax.driver.mapping.annotations.Query;
@Accessor
public interface SdcSchemaFilesAccessor {
@Query("SELECT * FROM sdcartifact.sdcschemafiles WHERE SDCRELEASENUM = :sdcreleasenum AND CONFORMANCELEVEL = :conformancelevel")
- Result<ESSdcSchemaFilesData> getSpecificSdcSchemaFiles(@Param("sdcreleasenum") String sdcreleasenum, @Param("conformancelevel") String conformancelevel);
+ Result<SdcSchemaFilesData> getSpecificSdcSchemaFiles(@Param("sdcreleasenum") String sdcreleasenum, @Param("conformancelevel") String conformancelevel);
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java
index 1bb0f05898..d292c1ddeb 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java
@@ -1,13 +1,11 @@
package org.openecomp.sdc.be.dao.cassandra;
-import java.util.LinkedList;
import java.util.List;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.dao.api.ActionStatus;
-import org.openecomp.sdc.be.resources.data.ESSdcSchemaFilesData;
+import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,33 +48,41 @@ public class SdcSchemaFilesCassandraDao extends CassandraDao {
}
}
- public CassandraOperationStatus saveArtifact(ESSdcSchemaFilesData artifact) {
- return client.save(artifact, ESSdcSchemaFilesData.class, manager);
+ public CassandraOperationStatus saveSchemaFile(SdcSchemaFilesData schemaFileData) {
+ return client.save(schemaFileData, SdcSchemaFilesData.class, manager);
}
- public Either<ESSdcSchemaFilesData, CassandraOperationStatus> getArtifact(String artifactId) {
- return client.getById(artifactId, ESSdcSchemaFilesData.class, manager);
+ public Either<SdcSchemaFilesData, CassandraOperationStatus> getSchemaFile(String schemaFileId) {
+ return client.getById(schemaFileId, SdcSchemaFilesData.class, manager);
}
- public CassandraOperationStatus deleteArtifact(String artifactId) {
- return client.delete(artifactId, ESSdcSchemaFilesData.class, manager);
+ public CassandraOperationStatus deleteSchemaFile(String schemaFileId) {
+ return client.delete(schemaFileId, SdcSchemaFilesData.class, manager);
}
- public Either<List<ESSdcSchemaFilesData>, ActionStatus> getSpecificSchemaFiles(String sdcreleasenum, String conformancelevel) {
- Result<ESSdcSchemaFilesData> specificSdcSchemaFiles = sdcSchemaFilesAccessor.getSpecificSdcSchemaFiles(sdcreleasenum, conformancelevel);
+ public Either<List<SdcSchemaFilesData>, CassandraOperationStatus> getSpecificSchemaFiles(String sdcreleasenum, String conformancelevel) {
+
+ Result<SdcSchemaFilesData> specificSdcSchemaFiles = null;
+ try {
+ specificSdcSchemaFiles = sdcSchemaFilesAccessor.getSpecificSdcSchemaFiles(sdcreleasenum, conformancelevel);
+ } catch (Exception e) {
+ logger.debug("getSpecificSchemaFiles failed with exception {}", e);
+ return Either.right(CassandraOperationStatus.GENERAL_ERROR);
+ }
if(specificSdcSchemaFiles == null) {
logger.debug("not found specific SdcSchemaFiles for sdcreleasenum {}, conformancelevel {}", sdcreleasenum, conformancelevel);
- return Either.left(new LinkedList<ESSdcSchemaFilesData>());
+ return Either.right(CassandraOperationStatus.NOT_FOUND);
}
+ List<SdcSchemaFilesData> list = specificSdcSchemaFiles.all();
if(logger.isDebugEnabled()){
- for (ESSdcSchemaFilesData esSdcSchemaFilesData : specificSdcSchemaFiles) {
- logger.debug(esSdcSchemaFilesData.toString());
+ for (SdcSchemaFilesData esSdcSchemaFilesData : list) {
+ logger.trace(esSdcSchemaFilesData.toString());
}
}
- return Either.left(specificSdcSchemaFiles.all());
+ return Either.left(list);
}
/**
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java
index c485b238f4..cb9c7207d2 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java
@@ -16,7 +16,7 @@ public enum VertexTypeEnum {
CAPABILTIES ("capabilities", ListCapabilityDataDefinition.class),
CAPABILITIES_PROPERTIES ("capabilities_properties", MapPropertiesDataDefinition.class),
REQUIREMENTS ("requirements", ListRequirementDataDefinition.class),
- ATTRIBUTES ("attributes", AttributeDataDefinition.class),
+ ATTRIBUTES ("attributes", PropertyDataDefinition.class),
RESOURCE_CATEGORY ("resourceNewCategory", null),
RESOURCE_SUBCATEGORY ("resourceSubcategory", null),
SERVICE_CATEGORY ("serviceNewCategory", null),
@@ -24,7 +24,7 @@ public enum VertexTypeEnum {
USER ("user", null),
INPUTS ("inputs", PropertyDataDefinition.class),
GROUPS ("groups", GroupDataDefinition.class),
- INST_ATTRIBUTES ("instAttributes", MapAttributesDataDefinition.class),
+ INST_ATTRIBUTES ("instAttributes", MapPropertiesDataDefinition.class),
INST_PROPERTIES ("instProperties", MapPropertiesDataDefinition.class),
INST_INPUTS ("instInputs", MapPropertiesDataDefinition.class),
INST_GROUPS ("instGroups", MapGroupsDataDefinition.class),
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java
index 3ec9d0d3b9..2ff1567928 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java
@@ -29,6 +29,7 @@ public enum GraphPropertiesDictionary {
CONTACT_ID ("contactId", String.class, false, false),
VENDOR_NAME ("vendorName", String.class, false, false),
VENDOR_RELEASE ("vendorRelease", String.class, false, false),
+ CONFORMANCE_LEVEL ("conformanceLevel", String.class, false, false),
ICON ("icon", String.class, false, false),
TAGS ("tags", String.class, false, false),
UUID ("uuid", String.class, false, true),
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java
index 16a8c8be60..a99529d950 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java
@@ -27,21 +27,21 @@ 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.dao.utils.Constants;
-import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import com.google.gson.reflect.TypeToken;
public class AttributeData extends GraphNode {
- AttributeDataDefinition attributeDataDefinition;
+ PropertyDataDefinition attributeDataDefinition;
public AttributeData() {
super(NodeTypeEnum.Attribute);
- attributeDataDefinition = new AttributeDataDefinition();
+ attributeDataDefinition = new PropertyDataDefinition();
}
- public AttributeData(AttributeDataDefinition attributeDataDefinition) {
+ public AttributeData(PropertyDataDefinition attributeDataDefinition) {
super(NodeTypeEnum.Attribute);
this.attributeDataDefinition = attributeDataDefinition;
}
@@ -56,11 +56,11 @@ public class AttributeData extends GraphNode {
return attributeDataDefinition.getUniqueId();
}
- public AttributeDataDefinition getAttributeDataDefinition() {
+ public PropertyDataDefinition getAttributeDataDefinition() {
return attributeDataDefinition;
}
- public void setAttributeDataDefinition(AttributeDataDefinition attributeDataDefinition) {
+ public void setAttributeDataDefinition(PropertyDataDefinition attributeDataDefinition) {
this.attributeDataDefinition = attributeDataDefinition;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java
index 0ad081832f..7e084eb021 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java
@@ -51,6 +51,7 @@ public abstract class ComponentMetadataData extends GraphNode {
metadataDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
metadataDataDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
metadataDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty()));
+ metadataDataDefinition.setConformanceLevel((String) properties.get(GraphPropertiesDictionary.CONFORMANCE_LEVEL.getProperty()));
metadataDataDefinition.setIcon((String) properties.get(GraphPropertiesDictionary.ICON.getProperty()));
metadataDataDefinition.setHighestVersion((Boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()));
metadataDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
@@ -87,6 +88,7 @@ public abstract class ComponentMetadataData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.VERSION, metadataDataDefinition.getVersion());
addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, metadataDataDefinition.getCreationDate());
addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, metadataDataDefinition.getDescription());
+ addIfExists(map, GraphPropertiesDictionary.CONFORMANCE_LEVEL, metadataDataDefinition.getConformanceLevel());
addIfExists(map, GraphPropertiesDictionary.ICON, metadataDataDefinition.getIcon());
addIfExists(map, GraphPropertiesDictionary.IS_HIGHEST_VERSION, metadataDataDefinition.isHighestVersion());
addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, metadataDataDefinition.getLastUpdateDate());
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESSdcSchemaFilesData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java
index c6ab13bb3d..96ab5aedc8 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESSdcSchemaFilesData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java
@@ -3,18 +3,22 @@ package org.openecomp.sdc.be.resources.data;
import java.nio.ByteBuffer;
import java.util.Date;
+import com.datastax.driver.mapping.annotations.ClusteringColumn;
import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
@Table(keyspace = "sdcartifact", name = "sdcschemafiles")
-public class ESSdcSchemaFilesData {
-
+public class SdcSchemaFilesData {
+ @PartitionKey(0)
@Column(name = "sdcreleasenum")
private String sdcReleaseNum;
-
+
+ @ClusteringColumn
@Column(name = "timestamp")
private Date timestamp;
-
+
+ @PartitionKey(1)
@Column(name = "conformanceLevel")
private String conformanceLevel;
@@ -27,19 +31,21 @@ public class ESSdcSchemaFilesData {
@Column(name = "checksum")
private String checksum;
- public ESSdcSchemaFilesData() {
+ public SdcSchemaFilesData() {
}
- public ESSdcSchemaFilesData(String sdcReleaseNum, String conformanceLevel, String fileName, byte[] payload){
+ public SdcSchemaFilesData(String sdcReleaseNum, Date timestamp, String conformanceLevel, String fileName, byte[] payload, String checksum){
this.sdcReleaseNum = sdcReleaseNum;
+ this.timestamp = timestamp;
this.conformanceLevel = conformanceLevel;
this.fileName = fileName;
if(payload != null) {
this.payload = ByteBuffer.wrap(payload.clone());
}
+ this.checksum = checksum;
}
-
+
public String getSdcReleaseNum() {
return sdcReleaseNum;
}
@@ -99,4 +105,10 @@ public class ESSdcSchemaFilesData {
public void setChecksum(String checksum) {
this.checksum = checksum;
}
+
+ @Override
+ public String toString() {
+ return "SdcSchemaFilesData [sdcReleaseNum=" + sdcReleaseNum + ", timestamp=" + timestamp + ", conformanceLevel="
+ + conformanceLevel + ", fileName=" + fileName + ", checksum=" + checksum + "]";
+ }
}