summaryrefslogtreecommitdiffstats
path: root/catalog-dao
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao')
-rw-r--r--catalog-dao/pom.xml193
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java12
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java7
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java19
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/BasicDao.java3
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java6
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDao.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/AuditAccessor.java20
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java29
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java14
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java118
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java180
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java90
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/Table.java10
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ArtifactTableDescription.java9
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/AuthEventTableDescription.java16
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescription.java17
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ComponentCacheTableDescription.java8
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ConsumerEventTableDefinition.java10
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDeployEventTableDesc.java17
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDownloadEventTableDesc.java11
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribEngineEventTableDesc.java19
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribNotifEventTableDesc.java21
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java17
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ExternalApiEventTableDesc.java27
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetCatHierEventTableDesc.java9
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUebClusterEventTableDesc.java10
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUsersListEventTableDesc.java9
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/OldExternalApiEventTableDesc.java94
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescription.java55
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/SdcSchemaFilesTableDescription.java83
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAccessEventTableDescription.java1
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java34
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/es/ElasticSearchClient.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/GraphElementFactory.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESCatalogDAO.java5
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESTimeBasedDao.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jPropertyDAO.java47
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jResourceDAO.java103
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jUsersDAO.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java153
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java890
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java50
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java25
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java19
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java9
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java62
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java23
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/JsonParserUtils.java66
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java44
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java12
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java26
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jClient.java47
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jGraphBatchBuilder.java7
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/rest/HttpRestClient.java30
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java170
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java565
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java74
-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/CapabilityData.java7
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java25
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java59
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java19
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESArtifactData.java10
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java127
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java12
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java8
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java42
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java114
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java8
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java96
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/impl/ResourceUploader.java4
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ArtifactDaoTest.java8
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ESUsersDAOTest.java64
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JsonParserUtilsTests.java56
-rw-r--r--catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java40
-rw-r--r--catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml24
79 files changed, 2865 insertions, 1487 deletions
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index 7648b695f9..7d10b3f4e1 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -5,178 +5,80 @@
<groupId>org.openecomp.sdc.be</groupId>
<artifactId>catalog-dao</artifactId>
-
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>sdc-main</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
-
- <properties>
- <aspectj.version>1.7.4</aspectj.version>
- <hibernate-validator.version>5.3.4.Final</hibernate-validator.version>
- <groovy.version>2.3.5</groovy.version>
- <lucene.version>4.10.2</lucene.version>
- <mockito.version>1.9.0</mockito.version>
- <regex.version>3.0.3</regex.version>
- </properties>
-
-
<dependencies>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>6.9.10</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.2.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>2.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- <scope>provided</scope>
- </dependency>
-
+
+ <!-- Common of SDC -->
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${spring.version}</version>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>common-app-api</artifactId>
+ <version>${project.version}</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
+ <groupId>org.openecomp.sdc.be</groupId>
+ <artifactId>common-be</artifactId>
+ <version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context-support</artifactId>
- <version>${spring.version}</version>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-messaging</artifactId>
- <version>${spring.version}</version>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>${logback.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
+ <groupId>org.elasticsearch</groupId>
+ <artifactId>elasticsearch</artifactId>
+ <version>${elastic-search.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- <version>${spring.version}</version>
+ <groupId>org.elasticsearch.plugin</groupId>
+ <artifactId>shield</artifactId>
+ <version>${elastic-search.version}</version>
<scope>provided</scope>
</dependency>
+ <!-- SPRING -->
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
+ <artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-aspects</artifactId>
+ <artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
+ <artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Common of SD&C -->
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>common-app-api</artifactId>
- <version>${common-app-api.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.be</groupId>
- <artifactId>common-be</artifactId>
- <version>${common-be.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>${logback.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <version>${logback.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.elasticsearch</groupId>
- <artifactId>elasticsearch</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.elasticsearch.plugin</groupId>
- <artifactId>shield</artifactId>
- <version>${elastic-search.version}</version>
- <scope>provided</scope>
- </dependency>
-
-
- <!-- Elasticsearch delete by query was extracted to plugin: adding this
- plugin requires updating elasticsearch.yml with: plugin.types: "DeleteByQueryPlugin"
- and installing the plugin in the server -->
- <!-- <dependency> -->
- <!-- <groupId>org.elasticsearch.plugin</groupId> -->
- <!-- <artifactId>delete-by-query</artifactId> -->
- <!-- <scope>provided</scope> -->
- <!-- </dependency> -->
-
-
- <!-- SPRING -->
-
- <dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
@@ -198,15 +100,16 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.10</version>
+ <version>${slf4j-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
+ <version>${json-simple.version}</version>
<scope>provided</scope>
-
</dependency>
+
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-regex</artifactId>
@@ -216,29 +119,28 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
- <!--<version>${mockito.version}</version>&lt;!&ndash;$NO-MVN-MAN-VER$ &ndash;&gt;-->
- <version>1.10.19</version>
+ <version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.14</version>
+ <version>${snakeyaml.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
- <version>2.3.1</version>
+ <version>${gson.version}</version>
<scope>provided</scope>
</dependency>
-
<dependency>
<groupId>org.functionaljava</groupId>
<artifactId>functionaljava</artifactId>
+ <version>${functionaljava.version}</version>
<scope>provided</scope>
</dependency>
@@ -246,7 +148,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
- <version>${httpclient.version}</version>
+ <version>${httpclient.version}</version>
<scope>provided</scope>
</dependency>
@@ -260,22 +162,36 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>${guava.version}</version><!--$NO-MVN-MAN-VER$ -->
+ <version>${guava.version}</version>
<scope>provided</scope>
</dependency>
<!-- TEST -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${spring.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.12</version>
+ <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jci-core</artifactId>
+ <version>${commons-jci-core.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-expression</artifactId>
+ <version>${spring.version}</version>
<scope>test</scope>
</dependency>
@@ -306,10 +222,9 @@
<dependency>
<groupId>com.thinkaurelius.titan</groupId>
- <artifactId>titan-cassandra</artifactId>
- <!--<artifactId>asdc-titan-cassandra</artifactId> -->
+ <artifactId>titan-cassandra</artifactId>
+ <!--<artifactId>asdc-titan-cassandra</artifactId>-->
<version>${titan.version}</version>
- <!--<version>1.0.0-snapshot</version> -->
<scope>provided</scope>
<exclusions>
<exclusion>
@@ -325,7 +240,6 @@
<version>${lang3.version}</version>
<scope>provided</scope>
</dependency>
-
<!-- TITAN END -->
<!-- CASSANDRA -->
@@ -343,11 +257,8 @@
</dependency>
<!-- CASSANDRA END -->
-
</dependencies>
-
-
<build>
<pluginManagement>
@@ -390,8 +301,6 @@
</pluginManagement>
</build>
-
-
<profiles>
<profile>
<id>Fortify</id>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java
new file mode 100644
index 0000000000..c005192f71
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/DAOTitanStrategy.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.be.dao;
+
+import org.openecomp.sdc.be.config.ConfigurationManager;
+
+public class DAOTitanStrategy implements TitanClientStrategy {
+
+ @Override
+ public String getConfigFile() {
+ return ConfigurationManager.getConfigurationManager().getConfiguration().getTitanCfgFile();
+ }
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java
new file mode 100644
index 0000000000..772211ca58
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/TitanClientStrategy.java
@@ -0,0 +1,7 @@
+package org.openecomp.sdc.be.dao;
+
+public interface TitanClientStrategy {
+
+ String getConfigFile();
+
+}
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 9ab528ca1d..0a7a009ad4 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
@@ -27,7 +27,7 @@ public enum ActionStatus {
// CapabilityType related
CAPABILITY_TYPE_ALREADY_EXIST, MISSING_CAPABILITY_TYPE, REQ_CAP_NOT_SATISFIED_BEFORE_CERTIFICATION, IMPORT_DUPLICATE_REQ_CAP_NAME, IMPORT_REQ_CAP_NAME_EXISTS_IN_DERIVED,
// Resource related
- RESOURCE_NOT_FOUND, MISSING_DERIVED_FROM_TEMPLATE, PARENT_RESOURCE_NOT_FOUND, INVALID_DEFAULT_VALUE, INVALID_COMPLEX_DEFAULT_VALUE, MULTIPLE_PARENT_RESOURCE_FOUND, INVALID_RESOURCE_PAYLOAD, INVALID_TOSCA_FILE_EXTENSION, INVALID_YAML_FILE, INVALID_TOSCA_TEMPLATE, NOT_RESOURCE_TOSCA_TEMPLATE, NOT_SINGLE_RESOURCE, INVALID_RESOURCE_NAMESPACE, RESOURCE_ALREADY_EXISTS, INVALID_RESOURCE_CHECKSUM, RESOURCE_CANNOT_CONTAIN_RESOURCE_INSTANCES, NO_ASSETS_FOUND,
+ RESOURCE_NOT_FOUND, MISSING_DERIVED_FROM_TEMPLATE, PARENT_RESOURCE_NOT_FOUND, PARENT_RESOURCE_DOES_NOT_EXTEND, INVALID_DEFAULT_VALUE, INVALID_COMPLEX_DEFAULT_VALUE, MULTIPLE_PARENT_RESOURCE_FOUND, INVALID_RESOURCE_PAYLOAD, INVALID_TOSCA_FILE_EXTENSION, INVALID_YAML_FILE, INVALID_TOSCA_TEMPLATE, NOT_RESOURCE_TOSCA_TEMPLATE, NOT_SINGLE_RESOURCE, INVALID_RESOURCE_NAMESPACE, RESOURCE_ALREADY_EXISTS, INVALID_RESOURCE_CHECKSUM, RESOURCE_CANNOT_CONTAIN_RESOURCE_INSTANCES, NO_ASSETS_FOUND, GENERIC_TYPE_NOT_FOUND, TOSCA_PARSE_ERROR,
// Component name related
COMPONENT_NAME_ALREADY_EXIST, COMPONENT_NAME_EXCEEDS_LIMIT, MISSING_COMPONENT_NAME, INVALID_COMPONENT_NAME,
// Component description related
@@ -36,7 +36,7 @@ public enum ActionStatus {
COMPONENT_MISSING_ICON, COMPONENT_INVALID_ICON, COMPONENT_ICON_EXCEEDS_LIMIT,
// Tag related
COMPONENT_MISSING_TAGS, COMPONENT_TAGS_EXCEED_LIMIT, COMPONENT_SINGLE_TAG_EXCEED_LIMIT, INVALID_FIELD_FORMAT, COMPONENT_INVALID_TAGS_NO_COMP_NAME,
- // user contact related
+ // contactId related
COMPONENT_MISSING_CONTACT, COMPONENT_INVALID_CONTACT,
// Vendor related
VENDOR_NAME_EXCEEDS_LIMIT, VENDOR_RELEASE_EXCEEDS_LIMIT, INVALID_VENDOR_NAME, INVALID_VENDOR_RELEASE, MISSING_VENDOR_NAME, MISSING_VENDOR_RELEASE,
@@ -49,9 +49,9 @@ public enum ActionStatus {
// Attribute related
ATTRIBUTE_ALREADY_EXIST, ATTRIBUTE_NOT_FOUND,
// State related
- COMPONENT_IN_CHECKOUT_STATE, ILLEGAL_COMPONENT_STATE, COMPONENT_IN_CERT_IN_PROGRESS_STATE, COMPONENT_SENT_FOR_CERTIFICATION, COMPONENT_VERSION_ALREADY_EXIST, COMPONENT_ALREADY_CHECKED_IN, COMPONENT_CHECKOUT_BY_ANOTHER_USER, COMPONENT_IN_USE, COMPONENT_HAS_NEWER_VERSION, COMPONENT_ALREADY_CERTIFIED, COMPONENT_NOT_READY_FOR_CERTIFICATION, COMPONENT_ARTIFACT_NOT_FOUND, COMPONENT_INSTANCE_NOT_FOUND, COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, SERVICE_NOT_FOUND, SERVICE_CATEGORY_CANNOT_BE_CHANGED, SERVICE_NAME_CANNOT_BE_CHANGED, SERVICE_ICON_CANNOT_BE_CHANGED, COMPONENT_TOO_MUCH_CATEGORIES, SERVICE_CANNOT_CONTAIN_SUBCATEGORY, RESOURCE_CATEGORY_CANNOT_BE_CHANGED, RESOURCE_NAME_CANNOT_BE_CHANGED, RESOURCE_ICON_CANNOT_BE_CHANGED, RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED, RESOURCE_DERIVED_FROM_CANNOT_BE_CHANGED, RESOURCE_TOO_MUCH_SUBCATEGORIES, SERVICE_ICON_EXCEEDS_LIMIT, RESOURCE_INSTANCE_NOT_FOUND, RESOURCE_INSTANCE_BAD_REQUEST, RESOURCE_INSTANCE_MATCH_NOT_FOUND, RESOURCE_INSTANCE_ALREADY_EXIST, RESOURCE_INSTANCE_RELATION_NOT_FOUND, COMPONENT_MISSING_SUBCATEGORY, ARTIFACT_TYPE_NOT_SUPPORTED, MISSING_ARTIFACT_TYPE, ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED, ARTIFACT_EXIST, ARTIFACT_NOT_FOUND, ARTIFACT_INVALID_MD5, MISSING_ARTIFACT_NAME, MISSING_PROJECT_CODE, INVALID_PROJECT_CODE, COMPONENT_MISSING_MANDATORY_ARTIFACTS, LIFECYCLE_TYPE_ALREADY_EXIST, SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, MISSING_LIFECYCLE_TYPE,
+ COMPONENT_IN_CHECKOUT_STATE, ILLEGAL_COMPONENT_STATE, COMPONENT_IN_CERT_IN_PROGRESS_STATE, COMPONENT_SENT_FOR_CERTIFICATION, COMPONENT_VERSION_ALREADY_EXIST, COMPONENT_ALREADY_CHECKED_IN, COMPONENT_CHECKOUT_BY_ANOTHER_USER, COMPONENT_IN_USE, COMPONENT_HAS_NEWER_VERSION, COMPONENT_ALREADY_CERTIFIED, COMPONENT_NOT_READY_FOR_CERTIFICATION, COMPONENT_ARTIFACT_NOT_FOUND, COMPONENT_INSTANCE_NOT_FOUND, COMPONENT_INSTANCE_NOT_FOUND_ON_CONTAINER, SERVICE_NOT_FOUND, SERVICE_CATEGORY_CANNOT_BE_CHANGED, SERVICE_NAME_CANNOT_BE_CHANGED, SERVICE_ICON_CANNOT_BE_CHANGED, COMPONENT_TOO_MUCH_CATEGORIES, SERVICE_CANNOT_CONTAIN_SUBCATEGORY, RESOURCE_CATEGORY_CANNOT_BE_CHANGED, RESOURCE_NAME_CANNOT_BE_CHANGED, RESOURCE_ICON_CANNOT_BE_CHANGED, RESOURCE_VENDOR_NAME_CANNOT_BE_CHANGED, RESOURCE_TOO_MUCH_SUBCATEGORIES, SERVICE_ICON_EXCEEDS_LIMIT, RESOURCE_INSTANCE_NOT_FOUND, RESOURCE_INSTANCE_BAD_REQUEST, RESOURCE_INSTANCE_MATCH_NOT_FOUND, RESOURCE_INSTANCE_ALREADY_EXIST, RESOURCE_INSTANCE_RELATION_NOT_FOUND, COMPONENT_MISSING_SUBCATEGORY, COMPONENT_INVALID_SUBCATEGORY, ARTIFACT_TYPE_NOT_SUPPORTED, MISSING_ARTIFACT_TYPE, ARTIFACT_LOGICAL_NAME_CANNOT_BE_CHANGED, ARTIFACT_EXIST, ARTIFACT_NOT_FOUND, ARTIFACT_INVALID_MD5, MISSING_ARTIFACT_NAME, MISSING_PROJECT_CODE, INVALID_PROJECT_CODE, COMPONENT_MISSING_MANDATORY_ARTIFACTS, LIFECYCLE_TYPE_ALREADY_EXIST, SERVICE_NOT_AVAILABLE_FOR_DISTRIBUTION, MISSING_LIFECYCLE_TYPE,RESOURCE_VFCMT_LIFECYCLE_STATE_NOT_VALID,
// Distribution
- MISSING_X_ECOMP_INSTANCE_ID, MISSING_PUBLIC_KEY, MISSING_ENV_NAME, DISTRIBUTION_ENV_DOES_NOT_EXIST, MISSING_BODY, ECOMP_RESEND_WITH_BASIC_AUTHENTICATION_CREDENTIALS, ECOMP_COMPONENT_NOT_AUTHORIZED, METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT, REGISTRATION_FAILED, DISTRIBUTION_ENVIRONMENT_NOT_AVAILABLE, DISTRIBUTION_ENVIRONMENT_NOT_FOUND, DISTRIBUTION_ENVIRONMENT_INVALID, DISTRIBUTION_ARTIFACT_NOT_FOUND, DISTRIBUTION_REQUESTED_NOT_FOUND, DISTRIBUTION_REQUESTED_FAILED, DISTRIBUTION_NOT_FOUND, ADDITIONAL_INFORMATION_ALREADY_EXISTS, COMPONENT_VERSION_NOT_FOUND, ADDITIONAL_INFORMATION_MAX_NUMBER_REACHED, ADDITIONAL_INFORMATION_EMPTY_STRING_NOT_ALLOWED, ADDITIONAL_INFORMATION_EXCEEDS_LIMIT, ADDITIONAL_INFORMATION_KEY_NOT_ALLOWED_CHARACTERS, ADDITIONAL_INFORMATION_VALUE_NOT_ALLOWED_CHARACTERS, ADDITIONAL_INFORMATION_NOT_FOUND, SDC_VERSION_NOT_FOUND, MISSING_DATA, EXCEEDS_LIMIT, UNSUPPORTED_ERROR, ARTIFACT_INVALID_TIMEOUT, SERVICE_IS_VNF_CANNOT_BE_CHANGED, RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, WRONG_ARTIFACT_FILE_EXTENSION, INVALID_YAML, INVALID_XML, INVALID_JSON, INVALID_DEPLOYMENT_ARTIFACT_HEAT, INVALID_HEAT_PARAMETER_TYPE, INVALID_HEAT_PARAMETER_VALUE, DEPLOYMENT_ARTIFACT_OF_TYPE_ALREADY_EXISTS, DEPLOYMENT_ARTIFACT_NAME_ALREADY_EXISTS, MISSING_HEAT, MISMATCH_HEAT_VS_HEAT_ENV, CORRUPTED_FORMAT, MISMATCH_BETWEEN_ARTIFACT_TYPE_AND_COMPONENT_TYPE, INVALID_PARAMS_IN_HEAT_ENV_FILE,
+ MISSING_USER_ID, MISSING_X_ECOMP_INSTANCE_ID, MISSING_PUBLIC_KEY, MISSING_ENV_NAME, DISTRIBUTION_ENV_DOES_NOT_EXIST, MISSING_BODY, ECOMP_RESEND_WITH_BASIC_AUTHENTICATION_CREDENTIALS, ECOMP_COMPONENT_NOT_AUTHORIZED, METHOD_NOT_ALLOWED_TO_DOWNLOAD_ARTIFACT, REGISTRATION_FAILED, DISTRIBUTION_ENVIRONMENT_NOT_AVAILABLE, DISTRIBUTION_ENVIRONMENT_NOT_FOUND, DISTRIBUTION_ENVIRONMENT_INVALID, DISTRIBUTION_ARTIFACT_NOT_FOUND, DISTRIBUTION_REQUESTED_NOT_FOUND, DISTRIBUTION_REQUESTED_FAILED, DISTRIBUTION_NOT_FOUND, ADDITIONAL_INFORMATION_ALREADY_EXISTS, COMPONENT_VERSION_NOT_FOUND, ADDITIONAL_INFORMATION_MAX_NUMBER_REACHED, ADDITIONAL_INFORMATION_EMPTY_STRING_NOT_ALLOWED, ADDITIONAL_INFORMATION_EXCEEDS_LIMIT, ADDITIONAL_INFORMATION_KEY_NOT_ALLOWED_CHARACTERS, ADDITIONAL_INFORMATION_VALUE_NOT_ALLOWED_CHARACTERS, ADDITIONAL_INFORMATION_NOT_FOUND, ASDC_VERSION_NOT_FOUND, MISSING_DATA, EXCEEDS_LIMIT, UNSUPPORTED_ERROR, ARTIFACT_INVALID_TIMEOUT, SERVICE_IS_VNF_CANNOT_BE_CHANGED, RESOURCE_INSTANCE_NOT_FOUND_ON_SERVICE, WRONG_ARTIFACT_FILE_EXTENSION, INVALID_YAML, INVALID_XML, INVALID_JSON, INVALID_DEPLOYMENT_ARTIFACT_HEAT, INVALID_HEAT_PARAMETER_TYPE, INVALID_HEAT_PARAMETER_VALUE, DEPLOYMENT_ARTIFACT_OF_TYPE_ALREADY_EXISTS, DEPLOYMENT_ARTIFACT_NAME_ALREADY_EXISTS, MISSING_HEAT, MISMATCH_HEAT_VS_HEAT_ENV, CORRUPTED_FORMAT, MISMATCH_BETWEEN_ARTIFACT_TYPE_AND_COMPONENT_TYPE, INVALID_PARAMS_IN_HEAT_ENV_FILE,
// auth
AUTH_FAILED_INVALIDE_HEADER, AUTH_FAILED, AUTH_REQUIRED, CONSUMER_ALREADY_EXISTS, INVALID_LENGTH, ECOMP_USER_NOT_FOUND, INVALID_CONTENT_PARAM, INVALID_FILTER_KEY, SERVICE_DEPLOYMENT_ARTIFACT_NOT_FOUND, VALIDATED_RESOURCE_NOT_FOUND, FOUND_ALREADY_VALIDATED_RESOURCE, FOUND_LIST_VALIDATED_RESOURCES,
@@ -71,18 +71,21 @@ 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,
+ 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_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,
-
+ 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,
+
+ // Group instance
+ GROUP_INSTANCE_NOT_FOUND_ON_COMPONENT_INSTANCE, INVALID_GROUP_MIN_MAX_INSTANCES_PROPERTY_VALUE, INVALID_GROUP_INITIAL_COUNT_PROPERTY_VALUE, INVALID_GROUP_PROPERTY_VALUE_LOWER_HIGHER,
+
ARTIFACT_NOT_FOUND_IN_CSAR, ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR, FAILED_RETRIVE_ARTIFACTS_TYPES, ARTIFACT_ALRADY_EXIST_IN_MASTER_IN_CSAR, ARTIFACT_NOT_VALID_IN_MASTER, ARTIFACT_NOT_VALID_ENV,
// cache
CONVERT_COMPONENT_ERROR, COMPONENT_NOT_FOUND,
// Inputs
- INPUT_IS_NOT_CHILD_OF_COMPONENT
+ INPUT_IS_NOT_CHILD_OF_COMPONENT,
;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/BasicDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/BasicDao.java
index c61956313d..3e6e7706cb 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/BasicDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/BasicDao.java
@@ -76,7 +76,8 @@ public abstract class BasicDao implements IBasicDAO {
for (List<GraphElement> listOfElements : listOfResults) {
if (listOfElements != null && false == listOfElements.isEmpty()) {
for (GraphElement element : listOfElements) {
- logger.debug("element {} was returned after running batch operation {}", element, batchBuilder);
+ logger.debug("element {} was returned after running batch operation {}",
+ element, batchBuilder);
if (element instanceof GraphNode) {
GraphNode neo4jNode = (GraphNode) element;
if (NodeTypeEnum.getByName(neo4jNode.getLabel()) == nodeType) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java
index ae2b236de1..fb0b160b09 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java
@@ -130,7 +130,7 @@ public abstract class ESGenericIdDAO implements IGenericIdDAO {
protected void saveResourceData(String typeName, Object data, String id) throws JsonProcessingException {
String indexName = getIndexForType(typeName);
- log.debug("ESGenericIdDAO saveResourceData resource indexName: {} typeName is: {}", indexName, typeName);
+ log.debug("ESGenericIdDAO saveResourceData resource indexName: {} | typeName is: {}", indexName, typeName);
String json = getJsonMapper().writeValueAsString(data);
log.debug("ESGenericIdDAO saveResourceData resource id is: {}", id);
@@ -138,7 +138,7 @@ public abstract class ESGenericIdDAO implements IGenericIdDAO {
getClient().prepareIndex(indexName, typeName, id).setSource(json).setRefresh(true).execute().actionGet();
} catch (Exception e) {
log.error("failed to write data with id {} to elasticsearch type {}. error: {}", id, typeName,
- e.getMessage());
+ e.getMessage(), e);
throw e;
}
}
@@ -160,7 +160,7 @@ public abstract class ESGenericIdDAO implements IGenericIdDAO {
private void assertIdNotNullFor(String id, String operation) {
if (id == null || id.trim().isEmpty()) {
- log.error("Null or empty Id is not allowed for operation <" + operation + ">.");
+ log.error("Null or empty Id is not allowed for operation <{}>.", operation);
throw new IndexingServiceException("Null or empty Id is not allowed for operation <" + operation + ">.");
}
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDao.java
index 36d9b60eb5..a9a4a99de1 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDao.java
@@ -85,7 +85,7 @@ public class ArtifactCassandraDao extends CassandraDao {
*/
public CassandraOperationStatus deleteAllArtifacts() {
logger.info("cleaning all artifacts.");
- String query = "truncate sdcArtifact.resources;";
+ String query = "truncate sdcartifact.resources;";
try {
session.execute(query);
} catch (Exception e) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/AuditAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/AuditAccessor.java
index c9262909bf..72c3b9656d 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/AuditAccessor.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/AuditAccessor.java
@@ -34,41 +34,41 @@ import com.datastax.driver.mapping.annotations.Query;
public interface AuditAccessor {
// ***** distributionstatusevent table
- @Query("SELECT * FROM sdcAudit.distributionstatusevent WHERE DID = :did AND ACTION = 'DStatus' ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.distributionstatusevent WHERE DID = :did AND ACTION = 'DStatus' ALLOW FILTERING")
Result<DistributionStatusEvent> getListOfDistributionStatuses(@Param("did") String did);
// ***** resourceadminevent table
- @Query("SELECT * FROM sdcAudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND ACTION = 'DRequest' ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND ACTION = 'DRequest' ALLOW FILTERING")
Result<ResourceAdminEvent> getServiceDistributionStatus(@Param("serviceInstanceId") String serviceInstanceId);
- @Query("SELECT * FROM sdcAudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId ")
+ @Query("SELECT * FROM sdcaudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId ")
Result<ResourceAdminEvent> getByServiceInstanceId(@Param("serviceInstanceId") String serviceInstanceId);
- @Query("SELECT * FROM sdcAudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND PREV_VERSION = :prevVersion ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND PREV_VERSION = :prevVersion ALLOW FILTERING")
Result<ResourceAdminEvent> getAuditByServiceIdAndPrevVersion(@Param("serviceInstanceId") String serviceInstanceId,
@Param("prevVersion") String prevVersion);
- @Query("SELECT * FROM sdcAudit.resourceadminevent WHERE DID = :did AND ACTION = :action ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.resourceadminevent WHERE DID = :did AND ACTION = :action ALLOW FILTERING")
Result<ResourceAdminEvent> getDistributionRequest(@Param("did") String did, @Param("action") String action);
- @Query("SELECT * FROM sdcAudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND CURR_VERSION = :currVersion ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.resourceadminevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND CURR_VERSION = :currVersion ALLOW FILTERING")
Result<ResourceAdminEvent> getAuditByServiceIdAndCurrVersion(@Param("serviceInstanceId") String serviceInstanceId,
@Param("currVersion") String currVersion);
// ***** distributiondeployevent table
- @Query("SELECT * FROM sdcAudit.distributiondeployevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND ACTION = 'DResult' ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.distributiondeployevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND ACTION = 'DResult' ALLOW FILTERING")
Result<DistributionDeployEvent> getServiceDistributionDeploy(@Param("serviceInstanceId") String serviceInstanceId);
- @Query("SELECT * FROM sdcAudit.distributiondeployevent WHERE DID = :did AND ACTION = :action AND STATUS = :status ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.distributiondeployevent WHERE DID = :did AND ACTION = :action AND STATUS = :status ALLOW FILTERING")
Result<DistributionDeployEvent> getDistributionDeployByStatus(@Param("did") String did,
@Param("action") String action, @Param("status") String status);
// ***** distributionnotificationevent table
- @Query("SELECT * FROM sdcAudit.distributionnotificationevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND ACTION = 'DNotify' ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.distributionnotificationevent WHERE SERVICE_INSTANCE_ID = :serviceInstanceId AND ACTION = 'DNotify' ALLOW FILTERING")
Result<DistributionNotificationEvent> getServiceDistributionNotify(
@Param("serviceInstanceId") String serviceInstanceId);
- @Query("SELECT * FROM sdcAudit.distributionnotificationevent WHERE DID = :did AND ACTION = :action ALLOW FILTERING")
+ @Query("SELECT * FROM sdcaudit.distributionnotificationevent WHERE DID = :did AND ACTION = :action ALLOW FILTERING")
Result<DistributionNotificationEvent> getDistributionNotify(@Param("did") String did,
@Param("action") String action);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java
index 546dff855e..211cb6716c 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java
@@ -186,35 +186,6 @@ public class ComponentCassandraDao extends CassandraDao {
}
/**
- * ---------for use in JUnit only--------------- the method deletes all the
- * tables in the audit keyspace
- *
- * @return the status of the last failed operation or ok if all the deletes
- * were successful
- */
- // public CassandraOperationStatus
- // deleteAllPartialComponents(ComponentTypeEnum componentTypeEnum) {
- // logger.info("cleaning all partial components of " + componentTypeEnum);
- //
- // String tableName = getTableName(componentTypeEnum);
- // if (tableName == null) {
- // BeEcompErrorManager.getInstance().logInvalidInputError("DeletePartialComponentData",
- // "input type not found " + componentTypeEnum, ErrorSeverity.INFO);
- // return CassandraOperationStatus.NOT_FOUND;
- // }
- // String query = "truncate " + AuditingTypesConstants.COMPONENT_KEYSPACE +
- // "." + tableName;
- // try {
- // session.execute(query);
- // } catch (Exception e) {
- // logger.debug("Failed to clean partial components", e);
- // return CassandraOperationStatus.GENERAL_ERROR;
- // }
- // logger.info("cleaning all partial components finished succsesfully.");
- // return CassandraOperationStatus.OK;
- // }
-
- /**
* the method checks if the given table is empty in the artifact keyspace
*
* @param tableName
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
new file mode 100644
index 0000000000..1168bf4edf
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java
@@ -0,0 +1,14 @@
+package org.openecomp.sdc.be.dao.cassandra;
+
+import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData;
+
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Param;
+import com.datastax.driver.mapping.annotations.Query;
+
+@Accessor
+public interface SdcSchemaFilesAccessor {
+ @Query("SELECT * FROM sdcartifact.sdcschemafiles WHERE SDCRELEASENUM = :sdcreleasenum AND CONFORMANCELEVEL = :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
new file mode 100644
index 0000000000..d292c1ddeb
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java
@@ -0,0 +1,118 @@
+package org.openecomp.sdc.be.dao.cassandra;
+
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+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;
+import org.springframework.stereotype.Component;
+
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+import com.datastax.driver.mapping.Result;
+
+import fj.data.Either;
+
+@Component("sdc-schema-files-cassandra-dao")
+public class SdcSchemaFilesCassandraDao extends CassandraDao {
+
+ private static Logger logger = LoggerFactory.getLogger(SdcSchemaFilesCassandraDao.class.getName());
+ private SdcSchemaFilesAccessor sdcSchemaFilesAccessor;
+
+ public SdcSchemaFilesCassandraDao() {
+ super();
+ }
+
+ @PostConstruct
+ public void init() {
+ String keyspace = AuditingTypesConstants.ARTIFACT_KEYSPACE;
+ if (client.isConnected()) {
+ Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> result = client.connect(keyspace);
+ if (result.isLeft()) {
+ session = result.left().value().left;
+ manager = result.left().value().right;
+ sdcSchemaFilesAccessor = manager.createAccessor(SdcSchemaFilesAccessor.class);
+ logger.info("** SdcSchemaFilesCassandraDao created");
+ } else {
+ logger.info("** SdcSchemaFilesCassandraDao failed");
+ throw new RuntimeException("Artifact keyspace [" + keyspace + "] failed to connect with error : "
+ + result.right().value());
+ }
+ } else {
+ logger.info("** Cassandra client isn't connected");
+ logger.info("** SdcSchemaFilesCassandraDao created, but not connected");
+ }
+ }
+
+ public CassandraOperationStatus saveSchemaFile(SdcSchemaFilesData schemaFileData) {
+ return client.save(schemaFileData, SdcSchemaFilesData.class, manager);
+ }
+
+ public Either<SdcSchemaFilesData, CassandraOperationStatus> getSchemaFile(String schemaFileId) {
+ return client.getById(schemaFileId, SdcSchemaFilesData.class, manager);
+ }
+
+ public CassandraOperationStatus deleteSchemaFile(String schemaFileId) {
+ return client.delete(schemaFileId, SdcSchemaFilesData.class, manager);
+ }
+
+ 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.right(CassandraOperationStatus.NOT_FOUND);
+ }
+
+ List<SdcSchemaFilesData> list = specificSdcSchemaFiles.all();
+ if(logger.isDebugEnabled()){
+ for (SdcSchemaFilesData esSdcSchemaFilesData : list) {
+ logger.trace(esSdcSchemaFilesData.toString());
+ }
+ }
+
+ return Either.left(list);
+ }
+
+ /**
+ * ---------for use in JUnit only--------------- the method deletes all the
+ * tables in the audit keyspace
+ *
+ * @return the status of the last failed operation or ok if all the deletes
+ * were successful
+ */
+ public CassandraOperationStatus deleteAllArtifacts() {
+ logger.info("cleaning all artifacts.");
+ String query = "truncate sdcartifact.resources;";
+ try {
+ session.execute(query);
+ } catch (Exception e) {
+ logger.debug("Failed to clean artifacts", e);
+ return CassandraOperationStatus.GENERAL_ERROR;
+ }
+ logger.info("cleaning all artifacts finished succsesfully.");
+ return CassandraOperationStatus.OK;
+ }
+
+ /**
+ * the method checks if the given table is empty in the artifact keyspace
+ *
+ * @param tableName
+ * the name of the table we want to check
+ * @return true if the table is empty
+ */
+ public Either<Boolean, CassandraOperationStatus> isTableEmpty(String tableName) {
+ return super.isTableEmpty(tableName);
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
index 0f54a25c14..f9dc9b22a4 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaBuilder.java
@@ -28,12 +28,11 @@ import com.datastax.driver.core.schemabuilder.SchemaStatement;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.openecomp.sdc.be.config.*;
import org.openecomp.sdc.be.config.Configuration;
+import org.openecomp.sdc.be.dao.cassandra.schema.tables.OldExternalApiEventTableDesc;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.net.ssl.SSLContext;
-import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.stream.Collectors;
@@ -50,11 +49,19 @@ public class SdcSchemaBuilder {
private static Logger log = LoggerFactory.getLogger(SdcSchemaBuilder.class.getName());
+ //TODO remove after 1707_OS migration
+ private static void handle1707OSMigration(Map<String, Map<String, List<String>>> cassndraMetadata, Map<String, List<ITableDescription>> schemeData){
+ if(cassndraMetadata.containsKey("attaudit")){
+ List<ITableDescription> list = new ArrayList<>();
+ list.add(new OldExternalApiEventTableDesc());
+ schemeData.put("attaudit", list);
+ }
+
+ }
/**
* the method creates all keyspaces, tables and indexes in case they do not
* already exist. the method can be run multiple times. the method uses the
- * internal enums and external configuration for its operation
- *
+ * internal enums and external configuration for its operation *
* @return true if the create operation was successful
*/
public static boolean createSchema() {
@@ -62,7 +69,7 @@ public class SdcSchemaBuilder {
Session session = null;
try {
log.info("creating Schema for Cassandra.");
- cluster = createCluster();
+ cluster = SdcSchemaUtils.createCluster();
if (cluster == null) {
return false;
}
@@ -73,17 +80,18 @@ public class SdcSchemaBuilder {
return false;
}
log.debug("retrived Cassndra metadata.");
- Map<String, Map<String, List<String>>> cassndraMetadata = parseKeyspaceMetadata(
- keyspacesMetadateFromCassandra);
+ Map<String, Map<String, List<String>>> cassndraMetadata = parseKeyspaceMetadata(keyspacesMetadateFromCassandra);
+ Map<String, Map<String, List<String>>> metadataTablesStructure = getMetadataTablesStructure(keyspacesMetadateFromCassandra);
Map<String, List<ITableDescription>> schemeData = getSchemeData();
+ //TODO remove after 1707_OS migration
+ handle1707OSMigration(cassndraMetadata, schemeData);
log.info("creating Keyspaces.");
for (String keyspace : schemeData.keySet()) {
if (!createKeyspace(keyspace, cassndraMetadata, session)) {
return false;
}
Map<String, List<String>> keyspaceMetadate = cassndraMetadata.get(keyspace);
- createTables(schemeData.get(keyspace), keyspaceMetadate, session);
-
+ createTables(schemeData.get(keyspace), keyspaceMetadate, session,metadataTablesStructure.get(keyspace));
}
return true;
} catch (Exception e) {
@@ -106,7 +114,7 @@ public class SdcSchemaBuilder {
Session session = null;
try {
log.info("delete Data from Cassandra.");
- cluster = createCluster();
+ cluster = SdcSchemaUtils.createCluster();
if (cluster == null) {
return false;
}
@@ -117,11 +125,9 @@ public class SdcSchemaBuilder {
return false;
}
log.debug("retrived Cassndra metadata.");
- Map<String, Map<String, List<String>>> cassndraMetadata = parseKeyspaceMetadata(
- keyspacesMetadateFromCassandra);
+ Map<String, Map<String, List<String>>> cassndraMetadata = parseKeyspaceMetadata(keyspacesMetadateFromCassandra);
cassndraMetadata.forEach((k, v) -> {
if (AuditingTypesConstants.TITAN_KEYSPACE.equals(k)) {
-
// session.execute("")
} else if (AuditingTypesConstants.ARTIFACT_KEYSPACE.equals(k)) {
@@ -147,54 +153,7 @@ public class SdcSchemaBuilder {
return false;
}
- /**
- * the method creates the cluster object using the supplied cassandra nodes
- * in the configuration
- *
- * @return cluster object our null in case of an invalid configuration
- */
- private static Cluster createCluster() {
- List<String> nodes = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
- .getCassandraHosts();
- if (nodes == null) {
- log.info("no nodes were supplied in configuration.");
- return null;
- }
- log.info("connecting to node:{}.", nodes);
- Cluster.Builder clusterBuilder = Cluster.builder();
- nodes.forEach(host -> clusterBuilder.addContactPoint(host));
-
- clusterBuilder.withMaxSchemaAgreementWaitSeconds(60);
-
- boolean authenticate = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
- .isAuthenticate();
- if (authenticate) {
- String username = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
- .getUsername();
- String password = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
- .getPassword();
- if (username == null || password == null) {
- log.info("authentication is enabled but username or password were not supplied.");
- return null;
- }
- clusterBuilder.withCredentials(username, password);
- }
- boolean ssl = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().isSsl();
- if (ssl) {
- String truststorePath = ConfigurationManager.getConfigurationManager().getConfiguration()
- .getCassandraConfig().getTruststorePath();
- String truststorePassword = ConfigurationManager.getConfigurationManager().getConfiguration()
- .getCassandraConfig().getTruststorePassword();
- if (truststorePath == null || truststorePassword == null) {
- log.info("ssl is enabled but truststorePath or truststorePassword were not supplied.");
- return null;
- }
- System.setProperty("javax.net.ssl.trustStore", truststorePath);
- System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
- clusterBuilder.withSSL();
- }
- return clusterBuilder.build();
- }
+
/**
* the method prcess the metadata retrieved from the cassandra for the
@@ -206,8 +165,7 @@ public class SdcSchemaBuilder {
* cassndra mmetadata
* @return a map of maps of lists holding parsed info
*/
- private static Map<String, Map<String, List<String>>> parseKeyspaceMetadata(
- List<KeyspaceMetadata> keyspacesMetadata) {
+ private static Map<String, Map<String, List<String>>> parseKeyspaceMetadata(List<KeyspaceMetadata> keyspacesMetadata) {
Map<String, Map<String, List<String>>> cassndraMetadata = keyspacesMetadata.stream()
.collect(Collectors.toMap(keyspaceMetadata -> keyspaceMetadata.getName(),
keyspaceMetadata -> keyspaceMetadata.getTables().stream()
@@ -217,16 +175,25 @@ public class SdcSchemaBuilder {
.collect(Collectors.toList())))));
return cassndraMetadata;
}
+
+ private static Map<String, Map<String, List<String>>> getMetadataTablesStructure(
+ List<KeyspaceMetadata> keyspacesMetadata) {
+ return keyspacesMetadata.stream().collect(
+ Collectors.toMap(keyspaceMetadata -> keyspaceMetadata.getName(),
+ keyspaceMetadata -> keyspaceMetadata.getTables().stream().collect(
+ Collectors.toMap(tableMetadata -> tableMetadata.getName(),
+ tableMetadata -> tableMetadata.getColumns().stream().map(
+ columnMetadata -> columnMetadata.getName().toLowerCase()).collect(
+ Collectors.toList())))));
+ }
/**
* the method builds an index name according to a defined logic
* <table>
* _<column>_idx
*
- * @param table
- * table name
- * @param column
- * column name
+ * @param table: table name
+ * @param column: column name
* @return string name of the index
*/
private static String createIndexName(String table, String column) {
@@ -236,24 +203,21 @@ public class SdcSchemaBuilder {
/**
* the method creats all the tables and indexes thet do not already exist
*
- * @param iTableDescriptions
- * a list of table description we want to create
- * @param keyspaceMetadate
- * the current tables that exist in the cassandra under this
+ * @param iTableDescriptions: a list of table description we want to create
+ * @param keyspaceMetadate: the current tables that exist in the cassandra under this keyspace
+ * @param session: the session object used for the execution of the query.
+ * @param existingTablesMetadata
+ * the current tables columns that exist in the cassandra under this
* keyspace
- * @param session
- * the session object used for the execution of the query.
*/
- private static void createTables(List<ITableDescription> iTableDescriptions,
- Map<String, List<String>> keyspaceMetadate, Session session) {
-
+ private static void createTables(List<ITableDescription> iTableDescriptions, Map<String, List<String>> keyspaceMetadate, Session session,
+ Map<String, List<String>> existingTablesMetadata) {
for (ITableDescription tableDescription : iTableDescriptions) {
String tableName = tableDescription.getTableName().toLowerCase();
Map<String, ImmutablePair<DataType, Boolean>> columnDescription = tableDescription.getColumnDescription();
log.info("creating tables:{}.", tableName);
if (keyspaceMetadate == null || !keyspaceMetadate.keySet().contains(tableName)) {
- Create create = SchemaBuilder.createTable(tableDescription.getKeyspace(),
- tableDescription.getTableName());
+ Create create = SchemaBuilder.createTable(tableDescription.getKeyspace(),tableDescription.getTableName());
for (ImmutablePair<String, DataType> key : tableDescription.primaryKeys()) {
create.addPartitionKey(key.getLeft(), key.getRight());
}
@@ -267,12 +231,14 @@ public class SdcSchemaBuilder {
create.addColumn(columnName, columnDescription.get(columnName).getLeft());
}
log.trace("exacuting :{}", create.toString());
- ResultSet result = session.execute(create);
+ session.execute(create);
log.info("table:{} created succsesfully.", tableName);
} else {
log.info("table:{} already exists skiping.", tableName);
+ alterTable(session, existingTablesMetadata, tableDescription, tableName, columnDescription);
}
- List<String> indexNames = (keyspaceMetadate != null ? keyspaceMetadate.get(tableName) : new ArrayList<>());
+ log.info("keyspacemetdata{}",keyspaceMetadate);
+ List<String> indexNames = (keyspaceMetadate != null && keyspaceMetadate.get(tableName) != null ? keyspaceMetadate.get(tableName) : new ArrayList<>());
log.info("table:{} creating indexes.", tableName);
for (String columnName : columnDescription.keySet()) {
String indexName = createIndexName(tableName, columnName).toLowerCase();
@@ -293,25 +259,44 @@ public class SdcSchemaBuilder {
}
/**
+ * check if there are new columns that were added to definition but don't exist in DB
+ * @param session
+ * @param existingTablesMetadata
+ * @param tableDescription
+ * @param tableName
+ * @param columnDescription
+ */
+ private static void alterTable(Session session, Map<String, List<String>> existingTablesMetadata,
+ ITableDescription tableDescription, String tableName,
+ Map<String, ImmutablePair<DataType, Boolean>> columnDescription) {
+ List<String> definedTableColumns = existingTablesMetadata.get(tableName);
+ //add column to casandra if was added to table definition
+ for (Map.Entry<String, ImmutablePair<DataType, Boolean>> column : columnDescription.entrySet()) {
+ String columnName = column.getKey();
+ if (!definedTableColumns.contains(columnName.toLowerCase())){
+ log.info("Adding new column {} to the table {}", columnName,tableName);
+ Alter alter = SchemaBuilder.alterTable(tableDescription.getKeyspace(),tableDescription.getTableName());
+ SchemaStatement addColumn = alter.addColumn(columnName).type(column.getValue().getLeft());
+ log.trace("exacuting :{}", addColumn.toString());
+ session.execute(addColumn);
+ }
+ }
+ }
+
+ /**
* the method create the keyspace in case it does not already exists the
* method uses configurtion to select the needed replication strategy
*
- * @param keyspace
- * name of the keyspace we want to create
- * @param cassndraMetadata
- * cassndra metadata
- * @param session
- * the session object used for the execution of the query.
+ * @param keyspace: name of the keyspace we want to create
+ * @param cassndraMetadata: cassndra metadata
+ * @param session: the session object used for the execution of the query.
* @return true in case the operation was successful
*/
- private static boolean createKeyspace(String keyspace, Map<String, Map<String, List<String>>> cassndraMetadata,
- Session session) {
- List<Configuration.CassandrConfig.KeyspaceConfig> keyspaceConfigList = ConfigurationManager
- .getConfigurationManager().getConfiguration().getCassandraConfig().getKeySpaces();
+ private static boolean createKeyspace(String keyspace, Map<String, Map<String, List<String>>> cassndraMetadata, Session session) {
+ List<Configuration.CassandrConfig.KeyspaceConfig> keyspaceConfigList = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getKeySpaces();
log.info("creating keyspace:{}.", keyspace);
if (!cassndraMetadata.keySet().contains(keyspace)) {
- Optional<Configuration.CassandrConfig.KeyspaceConfig> keyspaceConfig = keyspaceConfigList.stream()
- .filter(keyspaceInfo -> keyspace.equalsIgnoreCase(keyspaceInfo.getName())).findFirst();
+ Optional<Configuration.CassandrConfig.KeyspaceConfig> keyspaceConfig = keyspaceConfigList.stream().filter(keyspaceInfo -> keyspace.equalsIgnoreCase(keyspaceInfo.getName())).findFirst();
if (keyspaceConfig.isPresent()) {
Configuration.CassandrConfig.KeyspaceConfig keyspaceInfo = keyspaceConfig.get();
String createKeyspaceQuery = createKeyspaceQuereyString(keyspace, keyspaceInfo);
@@ -356,7 +341,7 @@ public class SdcSchemaBuilder {
}
/**
- * the methoed creates the query string for the given keyspace the methoed
+ * the methoed creates the query string for the given keyspace the methoed
* valides the given data according the the requirments of the replication
* strategy SimpleStrategy: "CREATE KEYSPACE IF NOT EXISTS
* <keyspaceName></keyspaceName> WITH replication =
@@ -370,11 +355,9 @@ public class SdcSchemaBuilder {
* configuration info regurding the replication of the keyspace
* @return a querey string for the creation of the keyspace
*/
- private static String createKeyspaceQuereyString(String keyspace,
- Configuration.CassandrConfig.KeyspaceConfig keyspaceInfo) {
+ private static String createKeyspaceQuereyString(String keyspace, Configuration.CassandrConfig.KeyspaceConfig keyspaceInfo) {
String query = null;
- if (ReplicationStrategy.NETWORK_TOPOLOGY_STRATEGY.getName()
- .equalsIgnoreCase(keyspaceInfo.getReplicationStrategy())) {
+ if (ReplicationStrategy.NETWORK_TOPOLOGY_STRATEGY.getName().equalsIgnoreCase(keyspaceInfo.getReplicationStrategy())) {
List<String> dcList = keyspaceInfo.getReplicationInfo();
if (dcList.size() % 2 != 0) {
log.error("the supplied replication info is in valid expected dc1,2,dc2,2 etc received:{}", dcList);
@@ -389,8 +372,7 @@ public class SdcSchemaBuilder {
}
query = String.format(CREATE_KEYSPACE_NETWORK_TOPOLOGY_STRATEGY, keyspace, sb.toString());
- } else if (ReplicationStrategy.SIMPLE_STRATEGY.getName()
- .equalsIgnoreCase(keyspaceInfo.getReplicationStrategy())) {
+ } else if (ReplicationStrategy.SIMPLE_STRATEGY.getName().equalsIgnoreCase(keyspaceInfo.getReplicationStrategy())) {
List<String> dcList = keyspaceInfo.getReplicationInfo();
if (dcList.size() != 1) {
log.error("the supplied replication info is in valid expected <number> etc received:{}", dcList);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java
new file mode 100644
index 0000000000..f52faa5886
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/SdcSchemaUtils.java
@@ -0,0 +1,90 @@
+package org.openecomp.sdc.be.dao.cassandra.schema;
+
+import com.datastax.driver.core.*;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class SdcSchemaUtils {
+
+ private static Logger log = LoggerFactory.getLogger(SdcSchemaUtils.class.getName());
+
+ /**
+ * the method creates the cluster object using the supplied cassandra nodes
+ * in the configuration
+ *
+ * @return cluster object our null in case of an invalid configuration
+ */
+ public static Cluster createCluster() {
+ List<String> nodes = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getCassandraHosts();
+ if (nodes == null) {
+ log.info("no nodes were supplied in configuration.");
+ return null;
+ }
+ log.info("connecting to node:{}.", nodes);
+ Cluster.Builder clusterBuilder = Cluster.builder();
+ nodes.forEach(host -> clusterBuilder.addContactPoint(host));
+
+ clusterBuilder.withMaxSchemaAgreementWaitSeconds(60);
+
+ boolean authenticate = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().isAuthenticate();
+ if (authenticate) {
+ String username = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getUsername();
+ String password = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getPassword();
+ if (username == null || password == null) {
+ log.info("authentication is enabled but username or password were not supplied.");
+ return null;
+ }
+ clusterBuilder.withCredentials(username, password);
+ }
+ boolean ssl = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().isSsl();
+ if (ssl) {
+ String truststorePath = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getTruststorePath();
+ String truststorePassword = ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().getTruststorePassword();
+ if (truststorePath == null || truststorePassword == null) {
+ log.info("ssl is enabled but truststorePath or truststorePassword were not supplied.");
+ return null;
+ }
+ System.setProperty("javax.net.ssl.trustStore", truststorePath);
+ System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
+ clusterBuilder.withSSL();
+ }
+ return clusterBuilder.build();
+ }
+
+ public static boolean executeStatement(String statement) {
+ return executeStatements(statement);
+ }
+
+ public static boolean executeStatements(String ... statements) {
+ Cluster cluster = null;
+ Session session = null;
+ try {
+ cluster = createCluster();
+ if (cluster == null) {
+ return false;
+ }
+ session = cluster.connect();
+ for (String statement : statements) {
+ session.execute(statement);
+ }
+ return true;
+ } catch (RuntimeException e) {
+ log.error(String.format("could not execute statements"), e);
+ return false;
+ } finally {
+ if (session != null) {
+ session.close();
+ }
+ if (cluster != null) {
+ cluster.close();
+ }
+
+ }
+ }
+
+
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/Table.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/Table.java
index 6de40a7117..8fb594f2ff 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/Table.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/Table.java
@@ -35,6 +35,7 @@ import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetCatHierEventTableDesc
import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUebClusterEventTableDesc;
import org.openecomp.sdc.be.dao.cassandra.schema.tables.GetUsersListEventTableDesc;
import org.openecomp.sdc.be.dao.cassandra.schema.tables.ResAdminEventTableDescription;
+import org.openecomp.sdc.be.dao.cassandra.schema.tables.SdcSchemaFilesTableDescription;
import org.openecomp.sdc.be.dao.cassandra.schema.tables.UserAccessEventTableDescription;
import org.openecomp.sdc.be.dao.cassandra.schema.tables.UserAdminEventTableDescription;
@@ -46,17 +47,18 @@ public enum Table {
RESOURCE_ADMIN_EVENT(new ResAdminEventTableDescription()),
DISTRIBUTION_DOWNLOAD_EVENT(new DistribDownloadEventTableDesc()),
DISTRIBUTION_ENGINE_EVENT(new DistribEngineEventTableDesc()),
- DISTRIBUTION_NOTIFICATION_EVENT(new DistribNotifEventTableDesc()),
+ DISTRIBUTION_NOTIFICATION_EVENT(new DistribNotifEventTableDesc()),
DISTRIBUTION_STATUS_EVENT(new DistribStatusEventTableDesc()),
DISTRIBUTION_DEPLOY_EVENT(new DistribDeployEventTableDesc()),
- DISTRIBUTION_GET_UEB_CLUSTER_EVENT(new GetUebClusterEventTableDesc()),
+ DISTRIBUTION_GET_UEB_CLUSTER_EVENT(new GetUebClusterEventTableDesc()),
AUTH_EVENT(new AuthEventTableDescription()),
CONSUMER_EVENT(new ConsumerEventTableDefinition()),
CATEGORY_EVENT(new CategoryEventTableDescription()),
GET_USERS_LIST_EVENT(new GetUsersListEventTableDesc()),
GET_CATEGORY_HIERARCHY_EVENT(new GetCatHierEventTableDesc()),
- EXTERNAL_API_EVENT(new ExternalApiEventTableDesc()),
- COMPONENT_CACHE(new ComponentCacheTableDescription());
+ EXTERNAL_API_EVENT(new ExternalApiEventTableDesc()),
+ COMPONENT_CACHE(new ComponentCacheTableDescription()),
+ SDC_SCHEMA_FILES(new SdcSchemaFilesTableDescription());
ITableDescription tableDescription;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ArtifactTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ArtifactTableDescription.java
index 2e26bd2675..ad7cffaa63 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ArtifactTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ArtifactTableDescription.java
@@ -20,11 +20,12 @@
package org.openecomp.sdc.be.dao.cassandra.schema.tables;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.config.Configuration;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
@@ -32,8 +33,6 @@ import com.datastax.driver.core.DataType;
public class ArtifactTableDescription implements ITableDescription {
- private static final String keyspaceType = "artifact";
-
@Override
public List<ImmutablePair<String, DataType>> primaryKeys() {
List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/AuthEventTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/AuthEventTableDescription.java
index ef7be5deb7..ab2b207888 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/AuthEventTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/AuthEventTableDescription.java
@@ -26,13 +26,10 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
-import org.openecomp.sdc.be.dao.cassandra.schema.tables.UserAdminEventTableDescription.UAEFieldsDescription;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
import com.datastax.driver.core.DataType;
-import com.datastax.driver.mapping.annotations.Column;
public class AuthEventTableDescription implements ITableDescription {
@Override
@@ -71,11 +68,14 @@ public class AuthEventTableDescription implements ITableDescription {
}
enum AEFieldsDescription {
-
- URL("url", DataType.varchar(), false), REQUEST_ID("request_id", DataType.varchar(), true), USER("user",
- DataType.varchar(), false), AUTH_STATUS("auth_status", DataType.varchar(), false), REALM("realm",
- DataType.varchar(), false), ACTION("action", DataType.varchar(), true), STATUS("status",
- DataType.varchar(), false), DESC("description", DataType.varchar(), false);
+ URL("url", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), true),
+ USER("user", DataType.varchar(), false),
+ AUTH_STATUS("auth_status", DataType.varchar(), false),
+ REALM("realm", DataType.varchar(), false),
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESC("description", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescription.java
index efefac57b6..c49651e548 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/CategoryEventTableDescription.java
@@ -71,13 +71,16 @@ public class CategoryEventTableDescription implements ITableDescription {
enum CEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESC("description",
- DataType.varchar(), false), CATEGORY_NAME("category_Name", DataType.varchar(),
- false), SUB_CATEGORY_NAME("sub_Category_Name", DataType.varchar(), false), GROUPING_NAME(
- "grouping_name", DataType.varchar(), false), MODIFIER("modifier", DataType.varchar(),
- false), REQUEST_ID("request_id", DataType.varchar(), false), RESOURCE_TYPE(
- "resource_type", DataType.varchar(), false), SERVICE_INSTANCE_ID(
- "service_instance_id", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESC("description", DataType.varchar(), false),
+ CATEGORY_NAME("category_Name", DataType.varchar(), false),
+ SUB_CATEGORY_NAME("sub_Category_Name", DataType.varchar(), false),
+ GROUPING_NAME("grouping_name", DataType.varchar(), false),
+ MODIFIER("modifier", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ RESOURCE_TYPE("resource_type", DataType.varchar(), false),
+ SERVICE_INSTANCE_ID("service_instance_id", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ComponentCacheTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ComponentCacheTableDescription.java
index 6396da5c32..611138efa0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ComponentCacheTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ComponentCacheTableDescription.java
@@ -61,9 +61,11 @@ public class ComponentCacheTableDescription implements ITableDescription {
}
enum PartialComponentFieldsDescription {
- DATA("data", DataType.blob(), false), MODIFICATION_TIME("modification_time", DataType.timestamp(), false), TYPE(
- "type", DataType.varchar(), false), IS_DIRTY("is_dirty", DataType.cboolean(),
- false), IS_ZIPPED("is_zipped", DataType.cboolean(), false),;
+ DATA("data", DataType.blob(), false),
+ MODIFICATION_TIME("modification_time", DataType.timestamp(), false),
+ TYPE("type", DataType.varchar(), false),
+ IS_DIRTY("is_dirty", DataType.cboolean(), false),
+ IS_ZIPPED("is_zipped", DataType.cboolean(), false),;
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ConsumerEventTableDefinition.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ConsumerEventTableDefinition.java
index 554a7a7a51..68ec5620ba 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ConsumerEventTableDefinition.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ConsumerEventTableDefinition.java
@@ -70,10 +70,12 @@ public class ConsumerEventTableDefinition implements ITableDescription {
}
enum DEEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(),
- false), ECOMP_USER("ecomp_user", DataType.varchar(), false), MODIFIER("modifier", DataType.varchar(),
- false), REQUEST_ID("request_id", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ ECOMP_USER("ecomp_user", DataType.varchar(), false),
+ MODIFIER("modifier", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDeployEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDeployEventTableDesc.java
index 5fc1dc8bd4..32c2365b95 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDeployEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDeployEventTableDesc.java
@@ -70,13 +70,16 @@ public class DistribDeployEventTableDesc implements ITableDescription {
}
enum DSEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), true), DESCRIPTION(
- "description", DataType.varchar(), false), REQUEST_ID("request_id", DataType.varchar(),
- false), SERVICE_INST_ID("service_instance_id", DataType.varchar(), true), MODIFIER("modifier",
- DataType.varchar(), false), CURR_VERSION("curr_version", DataType.varchar(),
- false), DID("did", DataType.varchar(), true), RESOURCE_NAME("resource_name",
- DataType.varchar(),
- false), RESOURCE_TYPE("resource_type", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), true),
+ DESCRIPTION("description", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ SERVICE_INST_ID("service_instance_id", DataType.varchar(), true),
+ MODIFIER("modifier", DataType.varchar(), false),
+ CURR_VERSION("curr_version", DataType.varchar(), false),
+ DID("did", DataType.varchar(), true),
+ RESOURCE_NAME("resource_name", DataType.varchar(), false),
+ RESOURCE_TYPE("resource_type", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDownloadEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDownloadEventTableDesc.java
index 0ed4f55a7b..0ac31352f2 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDownloadEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribDownloadEventTableDesc.java
@@ -69,10 +69,13 @@ public class DistribDownloadEventTableDesc implements ITableDescription {
}
enum DSEFieldsDescription {
- REQUEST_ID("request_Id", DataType.varchar(), false), SERVICE_INST_ID("service_Instance_Id", DataType.varchar(),
- false), ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(),
- false), DESCRIPTION("description", DataType.varchar(), false), CONSUMER_ID("consumer_Id",
- DataType.varchar(), false), RESOURCE_URL("resource_URL", DataType.varchar(), false);
+ REQUEST_ID("request_Id", DataType.varchar(), false),
+ SERVICE_INST_ID("service_Instance_Id", DataType.varchar(),false),
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ CONSUMER_ID("consumer_Id", DataType.varchar(), false),
+ RESOURCE_URL("resource_URL", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribEngineEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribEngineEventTableDesc.java
index 5ce5bffb7c..16d9af084f 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribEngineEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribEngineEventTableDesc.java
@@ -68,14 +68,17 @@ public class DistribEngineEventTableDesc implements ITableDescription {
}
enum DEEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(),
- false), CONSUMER_ID("consumer_id", DataType.varchar(), false), REQUEST_ID("request_id",
- DataType.varchar(), true), SERVICE_INST_ID("service_instance_id", DataType.varchar(),
- false), ROLE("role", DataType.varchar(), false), D_ENV("d_env", DataType.varchar(),
- false), API_KEY("api_key", DataType.varchar(), false), DSTATUS_TOPIC(
- "dstatus_topic", DataType.varchar(),
- false), DNOTIF_TOPIC("dnotif_topic", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ CONSUMER_ID("consumer_id", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), true),
+ SERVICE_INST_ID("service_instance_id", DataType.varchar(), false),
+ ROLE("role", DataType.varchar(), false),
+ D_ENV("d_env", DataType.varchar(), false),
+ API_KEY("api_key", DataType.varchar(), false),
+ DSTATUS_TOPIC("dstatus_topic", DataType.varchar(), false),
+ DNOTIF_TOPIC("dnotif_topic", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribNotifEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribNotifEventTableDesc.java
index 96fab66701..371b5c4886 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribNotifEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribNotifEventTableDesc.java
@@ -68,15 +68,18 @@ public class DistribNotifEventTableDesc implements ITableDescription {
}
enum DNEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(),
- false), REQUEST_ID("request_id", DataType.varchar(), false), SERVICE_INST_ID("service_instance_id",
- DataType.varchar(), true), TOPIC_NAME("topic_name", DataType.varchar(), false), MODIFIER(
- "modifier", DataType.varchar(), false), CURR_STATE("curr_state", DataType.varchar(),
- false), CURR_VERSION("curr_version", DataType.varchar(), false), DID("did",
- DataType.varchar(), true), RESOURCE_NAME("resource_name",
- DataType.varchar(), false), RESOURCE_TYPE("resource_type",
- DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ SERVICE_INST_ID("service_instance_id", DataType.varchar(), true),
+ TOPIC_NAME("topic_name", DataType.varchar(), false),
+ MODIFIER("modifier", DataType.varchar(), false),
+ CURR_STATE("curr_state", DataType.varchar(), false),
+ CURR_VERSION("curr_version", DataType.varchar(), false),
+ DID("did", DataType.varchar(), true),
+ RESOURCE_NAME("resource_name", DataType.varchar(), false),
+ RESOURCE_TYPE("resource_type", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java
index bc564e3743..d1c73bf46e 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/DistribStatusEventTableDesc.java
@@ -69,13 +69,16 @@ public class DistribStatusEventTableDesc implements ITableDescription {
}
enum DSEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(),
- false), DID("did", DataType.varchar(), true), CONSUMER_ID("consumer_id", DataType.varchar(),
- false), REQUEST_ID("request_id", DataType.varchar(), false), RESOURCE_URL("resoure_URL",
- DataType.varchar(), false), SERVICE_INST_ID("service_instance_id", DataType.varchar(),
- false), TOPIC_NAME("topic_name", DataType.varchar(),
- false), STATUS_TIME("status_time", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ DID("did", DataType.varchar(), true),
+ CONSUMER_ID("consumer_id", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ RESOURCE_URL("resoure_URL", DataType.varchar(), false),
+ SERVICE_INST_ID("service_instance_id", DataType.varchar(), false),
+ TOPIC_NAME("topic_name", DataType.varchar(), false),
+ STATUS_TIME("status_time", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ExternalApiEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ExternalApiEventTableDesc.java
index a67c9ef4ef..cb659b9a8a 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ExternalApiEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ExternalApiEventTableDesc.java
@@ -67,16 +67,23 @@ public class ExternalApiEventTableDesc implements ITableDescription {
}
enum EGAEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(), false), CONSUMER_ID("consumer_id", DataType.varchar(),
- false), RESOURCE_URL("resource_URL", DataType.varchar(), false), RESOURCE_NAME("resource_name",
- DataType.varchar(),
- false), RESOURCE_TYPE("resource_type", DataType.varchar(), false), SERVICE_INST_ID(
- "service_instance_id", DataType.varchar(),
- true), MODIFIER("modifier", DataType.varchar(), false), PREV_ARTIFACT_UUID(
- "prev_artifact_uuid", DataType.varchar(), false), CURR_ARTIFACT_UUID(
- "curr_artifact_uuid", DataType.varchar(), false), ARTIFACT_DATA(
- "artifact_data", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION( "description", DataType.varchar(), false),
+ CONSUMER_ID("consumer_id", DataType.varchar(), false),
+ RESOURCE_URL("resource_URL", DataType.varchar(), false),
+ RESOURCE_NAME("resource_name", DataType.varchar(), false),
+ RESOURCE_TYPE("resource_type", DataType.varchar(), false),
+ SERVICE_INST_ID( "service_instance_id", DataType.varchar(), true),
+ INVARIANT_UUID("invariant_uuid", DataType.varchar(), true),
+ MODIFIER("modifier", DataType.varchar(), false),
+ PREV_VERSION( "prev_version", DataType.varchar(), false),
+ CURR_VERSION("curr_version", DataType.varchar(), false),
+ PREV_STATE("prev_state", DataType.varchar(), false),
+ CURR_STATE( "curr_state", DataType.varchar(), false),
+ PREV_ARTIFACT_UUID( "prev_artifact_uuid", DataType.varchar(), false),
+ CURR_ARTIFACT_UUID( "curr_artifact_uuid", DataType.varchar(), false),
+ ARTIFACT_DATA( "artifact_data", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetCatHierEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetCatHierEventTableDesc.java
index 2d1a5c3c75..3858b7d8f6 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetCatHierEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetCatHierEventTableDesc.java
@@ -69,9 +69,12 @@ public class GetCatHierEventTableDesc implements ITableDescription {
}
enum DEEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(), false), DETAILS("details", DataType.varchar(), false), REQUEST_ID(
- "request_id", DataType.varchar(), false), MODIFIER("modifier", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ DETAILS("details", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ MODIFIER("modifier", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUebClusterEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUebClusterEventTableDesc.java
index 8ef1f01186..40a1827e36 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUebClusterEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUebClusterEventTableDesc.java
@@ -70,10 +70,12 @@ public class GetUebClusterEventTableDesc implements ITableDescription {
}
enum DEEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(),
- false), CONSUMER_ID("consumer_Id", DataType.varchar(), false), REQUEST_ID("request_Id",
- DataType.varchar(), false), SERVICE_INST_ID("service_Instance_Id", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ CONSUMER_ID("consumer_Id", DataType.varchar(), false),
+ REQUEST_ID("request_Id", DataType.varchar(), false),
+ SERVICE_INST_ID("service_Instance_Id", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUsersListEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUsersListEventTableDesc.java
index 5d94bd3f4d..4bd3e296ef 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUsersListEventTableDesc.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/GetUsersListEventTableDesc.java
@@ -69,9 +69,12 @@ public class GetUsersListEventTableDesc implements ITableDescription {
}
enum DEEFieldsDescription {
- ACTION("action", DataType.varchar(), true), STATUS("status", DataType.varchar(), false), DESCRIPTION(
- "description", DataType.varchar(), false), DETAILS("details", DataType.varchar(), false), REQUEST_ID(
- "request_id", DataType.varchar(), false), MODIFIER("modifier", DataType.varchar(), false);
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
+ DETAILS("details", DataType.varchar(), false),
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ MODIFIER("modifier", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/OldExternalApiEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/OldExternalApiEventTableDesc.java
new file mode 100644
index 0000000000..b075f0ef4e
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/OldExternalApiEventTableDesc.java
@@ -0,0 +1,94 @@
+package org.openecomp.sdc.be.dao.cassandra.schema.tables;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
+
+import com.datastax.driver.core.DataType;
+
+public class OldExternalApiEventTableDesc implements ITableDescription {
+ @Override
+ public List<ImmutablePair<String, DataType>> primaryKeys() {
+ List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
+ keys.add(new ImmutablePair<String, DataType>(TIMEBASED_UUID_FIELD, DataType.timeuuid()));
+ return keys;
+ }
+
+ @Override
+ public List<ImmutablePair<String, DataType>> clusteringKeys() {
+ List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
+ keys.add(new ImmutablePair<String, DataType>(TIMESTAMP_FIELD, DataType.timestamp()));
+ return keys;
+ }
+
+ @Override
+ public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() {
+ Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>();
+
+ for (EGAEFieldsDescription field : EGAEFieldsDescription.values()) {
+ columns.put(field.getName(), new ImmutablePair<DataType, Boolean>(field.type, field.indexed));
+ }
+
+ return columns;
+ }
+
+ @Override
+ public String getKeyspace() {
+ return AuditingTypesConstants.AUDIT_KEYSPACE.replace("sdc", "att");
+ }
+
+
+
+ @Override
+ public String getTableName() {
+ return AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE;
+ }
+
+ enum EGAEFieldsDescription {
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION( "description", DataType.varchar(), false),
+ CONSUMER_ID("consumer_id", DataType.varchar(), false),
+ RESOURCE_URL("resource_URL", DataType.varchar(), false),
+ RESOURCE_NAME("resource_name", DataType.varchar(), false),
+ RESOURCE_TYPE("resource_type", DataType.varchar(), false),
+ SERVICE_INST_ID( "service_instance_id", DataType.varchar(), true),
+ INVARIANT_UUID("invariant_uuid", DataType.varchar(), true),
+ MODIFIER("modifier", DataType.varchar(), false),
+ PREV_VERSION( "prev_version", DataType.varchar(), false),
+ CURR_VERSION("curr_version", DataType.varchar(), false),
+ PREV_STATE("prev_state", DataType.varchar(), false),
+ CURR_STATE( "curr_state", DataType.varchar(), false),
+ PREV_ARTIFACT_UUID( "prev_artifact_uuid", DataType.varchar(), false),
+ CURR_ARTIFACT_UUID( "curr_artifact_uuid", DataType.varchar(), false),
+ ARTIFACT_DATA( "artifact_data", DataType.varchar(), false);
+
+ private String name;
+ private DataType type;
+ private boolean indexed;
+
+ EGAEFieldsDescription(String name, DataType type, boolean indexed) {
+ this.name = name;
+ this.type = type;
+ this.indexed = indexed;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public DataType getType() {
+ return type;
+ }
+
+ public boolean isIndexed() {
+ return indexed;
+ }
+ }
+
+}
+
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescription.java
index a6f0ba905d..e928982127 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ResAdminEventTableDescription.java
@@ -71,40 +71,27 @@ public class ResAdminEventTableDescription implements ITableDescription {
}
enum AEFieldsDescription {
- REQUEST_ID("request_id", DataType.varchar(), false), SERVICE_INST_ID("service_instance_id", DataType.varchar(),
- true), INVARIANT_UUID("invariant_UUID", DataType.varchar(), true), ACTION("action", DataType.varchar(),
- true), STATUS("status", DataType.varchar(), false), DESCRIPTION("description",
- DataType.varchar(),
- false), RESOURCE_TYPE("resource_type", DataType.varchar(), false), PREV_VERSION(
- "prev_version", DataType.varchar(),
- true), PREV_STATE("prev_state", DataType.varchar(), true), CURR_STATE(
- "curr_state", DataType.varchar(), false), RESOURCE_NAME("resource_name",
- DataType.varchar(), false), CURR_VERSION("curr_version",
- DataType.varchar(), true), MODIFIER("modifier",
- DataType.varchar(),
- false), PREV_ARTIFACT_UUID("prev_artifact_UUID",
- DataType.varchar(),
- false), CURR__ARTIFACT_UUID(
- "curr_artifact_UUID",
- DataType.varchar(),
- false), ARTIFACT_DATA(
- "artifact_data",
- DataType.varchar(),
- false), DID("did",
- DataType.varchar(),
- true), DPREV_STATUS(
- "dprev_status",
- DataType.varchar(),
- false), DCURR_STATUS(
- "dcurr_status",
- DataType.varchar(),
- false), TOSCA_NODE_TYPE(
- "tosca_node_type",
- DataType.varchar(),
- false), COMMENT(
- "comment",
- DataType.varchar(),
- false);
+ REQUEST_ID("request_id", DataType.varchar(), false),
+ SERVICE_INST_ID("service_instance_id", DataType.varchar(), true),
+ INVARIANT_UUID("invariant_UUID", DataType.varchar(), true),
+ ACTION("action", DataType.varchar(), true),
+ STATUS("status", DataType.varchar(), false),
+ DESCRIPTION("description",DataType.varchar(), false),
+ RESOURCE_TYPE("resource_type", DataType.varchar(), false),
+ PREV_VERSION( "prev_version", DataType.varchar(), true),
+ PREV_STATE("prev_state", DataType.varchar(), true),
+ CURR_STATE("curr_state", DataType.varchar(), false),
+ RESOURCE_NAME("resource_name", DataType.varchar(), false),
+ CURR_VERSION("curr_version", DataType.varchar(), true),
+ MODIFIER("modifier", DataType.varchar(), false),
+ PREV_ARTIFACT_UUID("prev_artifact_UUID", DataType.varchar(), false),
+ CURR__ARTIFACT_UUID("curr_artifact_UUID", DataType.varchar(), false),
+ ARTIFACT_DATA("artifact_data", DataType.varchar(), false),
+ DID("did", DataType.varchar(), true),
+ DPREV_STATUS("dprev_status", DataType.varchar(), false),
+ DCURR_STATUS("dcurr_status", DataType.varchar(), false),
+ TOSCA_NODE_TYPE("tosca_node_type", DataType.varchar(), false),
+ COMMENT("comment", DataType.varchar(), false);
private String name;
private DataType type;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/SdcSchemaFilesTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/SdcSchemaFilesTableDescription.java
new file mode 100644
index 0000000000..09a01fb962
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/SdcSchemaFilesTableDescription.java
@@ -0,0 +1,83 @@
+package org.openecomp.sdc.be.dao.cassandra.schema.tables;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
+import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
+
+import com.datastax.driver.core.DataType;
+
+public class SdcSchemaFilesTableDescription implements ITableDescription {
+
+ private static final String SDC_RELEASE_NUM = "sdcReleaseNum";
+ private static final String TIMESTAMP = "timestamp";
+ private static final String CONFORMANCE_LEVEL = "conformanceLevel";
+
+ @Override
+ public List<ImmutablePair<String, DataType>> primaryKeys() {
+ List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
+ keys.add(new ImmutablePair<String, DataType>(SDC_RELEASE_NUM, DataType.varchar()));
+ keys.add(new ImmutablePair<String, DataType>(CONFORMANCE_LEVEL, DataType.varchar()));
+ return keys;
+ }
+
+ @Override
+ public List<ImmutablePair<String, DataType>> clusteringKeys() {
+ List<ImmutablePair<String, DataType>> keys = new ArrayList<>();
+ keys.add(new ImmutablePair<String, DataType>(TIMESTAMP, DataType.timestamp()));
+ return keys;
+ }
+
+ @Override
+ public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() {
+ Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>();
+
+ for (SdcSchemaFilesFieldsDescription field : SdcSchemaFilesFieldsDescription.values()) {
+ columns.put(field.getName(), new ImmutablePair<DataType, Boolean>(field.type, field.indexed));
+ }
+
+ return columns;
+ }
+
+ @Override
+ public String getKeyspace() {
+ return AuditingTypesConstants.ARTIFACT_KEYSPACE;
+ }
+
+ @Override
+ public String getTableName() {
+ return "sdcSchemaFiles";
+ }
+
+ enum SdcSchemaFilesFieldsDescription {
+ FILE_NAME("fileName", DataType.varchar(), false),
+ PAYLOAD("payload", DataType.blob(), false),
+ CHECKSUM("checksum", DataType.varchar(), false);
+
+ private String name;
+ private DataType type;
+ private boolean indexed;
+
+ SdcSchemaFilesFieldsDescription(String name, DataType type, boolean indexed) {
+ this.name = name;
+ this.type = type;
+ this.indexed = indexed;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public DataType getType() {
+ return type;
+ }
+
+ public boolean isIndexed() {
+ return indexed;
+ }
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAccessEventTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAccessEventTableDescription.java
index 7f482ae3ac..93f5640c30 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAccessEventTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAccessEventTableDescription.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.cassandra.schema.ITableDescription;
import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java
new file mode 100644
index 0000000000..d9c6829079
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/DAOSpringConfig.java
@@ -0,0 +1,34 @@
+package org.openecomp.sdc.be.dao.config;
+
+import org.openecomp.sdc.be.dao.DAOTitanStrategy;
+import org.openecomp.sdc.be.dao.TitanClientStrategy;
+import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
+import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+
+@Configuration
+public class DAOSpringConfig {
+
+ @Bean(name = "titan-generic-dao")
+ @Primary
+ public TitanGenericDao titanGenericDao(@Qualifier("titan-client") TitanGraphClient titanGraphClient) {
+ return new TitanGenericDao(titanGraphClient);
+ }
+
+ @Bean(name = "titan-client", initMethod = "createGraph")
+ @Primary
+ public TitanGraphClient titanGraphClient(@Qualifier("dao-client-strategy") TitanClientStrategy titanClientStrategy) {
+ return new TitanGraphClient(titanClientStrategy);
+ }
+
+ @Bean(name = "dao-client-strategy")
+ public TitanClientStrategy titanClientStrategy() {
+ return new DAOTitanStrategy();
+ }
+
+
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/es/ElasticSearchClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/es/ElasticSearchClient.java
index 1c3ba1107f..4bc1afc80e 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/es/ElasticSearchClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/es/ElasticSearchClient.java
@@ -154,7 +154,7 @@ public class ElasticSearchClient {
if (node != null) {
node.close();
}
- log.info("Closed ElasticSearch client for cluster <" + this.clusterName + ">");
+ log.info("Closed ElasticSearch client for cluster <{}>", this.clusterName);
}
/**
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 bf93c23afc..38648e69db 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
@@ -39,6 +39,7 @@ import org.openecomp.sdc.be.resources.data.ConsumerData;
import org.openecomp.sdc.be.resources.data.DataTypeData;
import org.openecomp.sdc.be.resources.data.GraphNodeLock;
import org.openecomp.sdc.be.resources.data.GroupData;
+import org.openecomp.sdc.be.resources.data.GroupInstanceData;
import org.openecomp.sdc.be.resources.data.GroupTypeData;
import org.openecomp.sdc.be.resources.data.HeatParameterData;
import org.openecomp.sdc.be.resources.data.HeatParameterValueData;
@@ -253,6 +254,9 @@ public class GraphElementFactory {
case PolicyType:
element = clazz.cast(new PolicyTypeData(properties));
break;
+ case GroupInstance:
+ element = clazz.cast(new GroupInstanceData(properties));
+ break;
default:
break;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESCatalogDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESCatalogDAO.java
index 87cd8a5f3e..0efff500d0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESCatalogDAO.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESCatalogDAO.java
@@ -74,9 +74,8 @@ public class ESCatalogDAO extends ESGenericSearchDAO implements ICatalogDAO {
try {
healthStatus = isInitCompleted() ? checkHealth() : HealthCheckStatus.DOWN;
} catch (Exception e) {
- log.error("Error while trying to connect to elasticsearch. host: " + getEsClient().getServerHost()
- + " port: " + getEsClient().getServerPort(), e.getMessage());
- log.trace("Error while trying to connect to elasticsearch", e);
+ log.error("Error while trying to connect to elasticsearch. host: {} | port: {} | error: {}",
+ getEsClient().getServerHost(), getEsClient().getServerPort(), e.getMessage(), e);
healthStatus = HealthCheckStatus.DOWN;
}
healthCheckLogger.trace("Executed ELASTICSEARCH Health Check Task - Status = {}", healthStatus);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESTimeBasedDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESTimeBasedDao.java
index b7666392aa..bdd1a2fb47 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESTimeBasedDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/ESTimeBasedDao.java
@@ -99,7 +99,7 @@ public abstract class ESTimeBasedDao {
res = ActionStatus.GENERAL_ERROR;
}
} catch (Exception e) {
- log.error("Couldn't serialize object of type " + typeName + " , error:", e);
+ log.error("Couldn't serialize object of type {} | error:", typeName, e);
res = ActionStatus.GENERAL_ERROR;
}
return res;
@@ -236,7 +236,7 @@ public abstract class ESTimeBasedDao {
hits.add(event);
} catch (JSONException e) {
log.warn("failed to parse hit from audit index. error: {}", e.getMessage());
- log.debug("failed to parse hit from audit. hit = {} {}", hit, e);
+ log.debug("failed to parse hit from audit. hit = {}", hit, e);
}
}
return hits;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jPropertyDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jPropertyDAO.java
index c3a7c50803..c9fcbab0de 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jPropertyDAO.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jPropertyDAO.java
@@ -49,51 +49,4 @@ public class Neo4jPropertyDAO extends BasicDao implements IPropertyDAO {
public void init() {
setNeo4jClient(neo4jClient);
}
-
- // @Override
- // public Either<PropertyData, Neo4jOperationStatus> createPropertyData(
- // GraphNeighbourTable graphNeighbourTable) {
- //
- // Either<BatchBuilder, Neo4jOperationStatus> bbResult = graphBatchBuilder
- // .buildBatchBuilderFromTable(graphNeighbourTable);
- //
- // if (bbResult.isLeft()) {
- //
- // BatchBuilder batchBuilder = bbResult.left().value();
- // //Neo4jOperationStatus neo4jOperationStatus =
- // neo4jClient.execute(batchBuilder);
- // Either<List<List<Neo4jElement>>, Neo4jOperationStatus> executeResult =
- // neo4jClient.execute(batchBuilder);
- //
- // if (executeResult.isRight()) {
- // return Either.right(executeResult.right().value());
- // }
- //
- // PropertyData propertyData = null;
- // List<List<Neo4jElement>> listOfResults = executeResult.left().value();
- // if (listOfResults != null) {
- // for (List<Neo4jElement> listOfElements : listOfResults) {
- // if (listOfElements != null && false == listOfElements.isEmpty()) {
- // for (Neo4jElement element : listOfElements) {
- // logger.debug("element {} was returned after running batch operation {}", element, batchBuilder);
- // if (element instanceof Neo4jNode) {
- // Neo4jNode neo4jNode = (Neo4jNode) element;
- // if (NodeTypeEnum.getByName(neo4jNode.getLabel()) ==
- // NodeTypeEnum.Property) {
- // propertyData = (PropertyData)neo4jNode;
- // }
- // }
- // }
- // }
- // }
- // }
- //
- // return Either.left(propertyData);
- //
- // } else {
- // return Either.right(bbResult.right().value());
- // }
- //
- // }
-
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jResourceDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jResourceDAO.java
index 1647a656f3..8d961b10ec 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jResourceDAO.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jResourceDAO.java
@@ -66,64 +66,6 @@ public class Neo4jResourceDAO extends BasicDao implements IResourceDAO {
super.setNeo4jClient(neo4jClient);
}
- // public Either<ResourceData, Neo4jOperationStatus> createResourceData(
- // GraphNeighbourTable graphNeighbourTable) {
- //
- // if (graphNeighbourTable != null) {
- //
- // String resourceId = findResourceDataIdFromNodes(graphNeighbourTable
- // .getNodes());
- // if (resourceId == null || resourceId.isEmpty()) {
- // logger.error("Cannot find resource id in the graph table");
- // return Either.right(Neo4jOperationStatus.BAD_REQUEST);
- // }
- //
- // Either<BatchBuilder, Neo4jOperationStatus> bbResult = graphBatchBuilder
- // .buildBatchBuilderFromTable(graphNeighbourTable);
- //
- // if (bbResult.isLeft()) {
- //
- // BatchBuilder batchBuilder = bbResult.left().value();
- // //Neo4jOperationStatus neo4jOperationStatus =
- // neo4jClient.execute(batchBuilder);
- // Either<List<List<Neo4jElement>>, Neo4jOperationStatus> executeResult =
- // neo4jClient.execute(batchBuilder);
- //
- // if (executeResult.isRight()) {
- // return Either.right(executeResult.right().value());
- // }
- //
- // ResourceData resourceData = null;
- // List<List<Neo4jElement>> listOfResults = executeResult.left().value();
- // if (listOfResults != null) {
- // for (List<Neo4jElement> listOfElements : listOfResults) {
- // if (listOfElements != null && false == listOfElements.isEmpty()) {
- // for (Neo4jElement element : listOfElements) {
- // logger.debug("element {} was returned after running batch operation {}", element, batchBuilder);
- // if (element instanceof Neo4jNode) {
- // Neo4jNode neo4jNode = (Neo4jNode) element;
- // if (NodeTypeEnum.getByName(neo4jNode.getLabel()) ==
- // NodeTypeEnum.Resource) {
- // resourceData = (ResourceData)neo4jNode;
- // }
- // }
- // }
- // }
- // }
- // }
- //
- // return Either.left(resourceData);
- //
- // } else {
- // return Either.right(bbResult.right().value());
- // }
- //
- // } else {
- // logger.error("The table sent in order to create resource is empty.");
- // return Either.right(Neo4jOperationStatus.BAD_REQUEST);
- // }
- // }
-
private String findResourceDataIdFromNodes(List<GraphNode> nodes) {
if (nodes != null) {
@@ -237,6 +179,51 @@ public class Neo4jResourceDAO extends BasicDao implements IResourceDAO {
}
return Either.right(null);
+ /*
+ * MatchFilter filter = new MatchFilter(); if(propertiesToMatch !=
+ * null){ for (Entry<String,Object> propertie :
+ * propertiesToMatch.entrySet()){ filter.addToMatch(propertie.getKey(),
+ * propertie.getValue()); } } Either<List<GraphElement>,
+ * Neo4jOperationStatus> status =
+ * neo4jClient.getByFilter(GraphElementTypeEnum.Node,
+ * NodeTypeEnum.Resource.getName(), filter); if (status.isRight()) {
+ * return Either.right(status.right().value()); } else {
+ * List<GraphElement> value = status.left().value(); if (value == null
+ * || value.isEmpty()) { return
+ * Either.right(Neo4jOperationStatus.NOT_FOUND); } else {
+ * List<ResourceData> result=new ArrayList<>(); for(GraphElement element
+ * : value ){ result.add((ResourceData)element); } return
+ * Either.left(result); } }
+ */
}
+ // @Override
+ // public ActionStatus updateUserData(UserData userData) {
+ // UpdateFilter filter = new UpdateFilter();
+ // filter.addToMatch("userId", userData.getUserId());
+ // filter.setToUpdate(userData.toMap());
+ // Neo4jOperationStatus status =
+ // neo4jClient.updateElement(Neo4JElementTypeEnum.Node,
+ // NodeTypeEnum.User.getName(), filter);
+ // if (status.equals(Neo4jOperationStatus.OK)) {
+ // return ActionStatus.OK;
+ // } else {
+ // return ActionStatus.GENERAL_ERROR;
+ // }
+ // }
+ //
+ // @Override
+ // public ActionStatus deleteUserData(String id) {
+ // MatchFilter filter = new MatchFilter();
+ // filter.addToMatch("userId", id);
+ // Neo4jOperationStatus status =
+ // neo4jClient.deleteElement(Neo4JElementTypeEnum.Node,
+ // NodeTypeEnum.User.getName(), filter);
+ // if (status.equals(Neo4jOperationStatus.OK)) {
+ // return ActionStatus.OK;
+ // } else {
+ // return ActionStatus.GENERAL_ERROR;
+ // }
+ // }
+
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jUsersDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jUsersDAO.java
index 25a77f1ff1..14489ef04b 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jUsersDAO.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/impl/Neo4jUsersDAO.java
@@ -89,12 +89,12 @@ public class Neo4jUsersDAO implements IUsersDAO {
if (createUniquenessStatus.equals(Neo4jOperationStatus.OK)) {
logger.info("Users constraints creatyed in Neo4j");
} else {
- logger.error("Failed to create constraints in Neo4j graph [" + createUniquenessStatus + "]");
+ logger.error("Failed to create constraints in Neo4j graph [{}]", createUniquenessStatus);
throw new RuntimeException(
"Failed to initialize Neo4jUsersDAO - Failed to create constraints in Neo4j graph");
}
} else {
- logger.error("Failed to create indexes in Neo4j graph [" + createIndexStatus + "]");
+ logger.error("Failed to create indexes in Neo4j graph [{}]", createIndexStatus);
throw new RuntimeException(
"Failed to initialize Neo4jUsersDAO - Failed to create indexes in Neo4j graph");
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java
new file mode 100644
index 0000000000..67cbd258f4
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/GraphVertex.java
@@ -0,0 +1,153 @@
+package org.openecomp.sdc.be.dao.jsongraph;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+
+import com.thinkaurelius.titan.core.TitanVertex;
+
+public class GraphVertex {
+ private String uniqueId;
+
+ private TitanVertex vertex;
+ private VertexTypeEnum label;
+
+ private Map<String, ? extends ToscaDataDefinition> json;
+ private Map<String, Object> metadataJson;
+ private Map<GraphPropertyEnum, Object> metadataProperties;
+
+ public GraphVertex() {
+
+ }
+
+ public GraphVertex(VertexTypeEnum label) {
+ super();
+ this.label = label;
+ }
+
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ public void setUniqueId(String uniqueId) {
+ this.uniqueId = uniqueId;
+ }
+
+ public Map<String, ? extends ToscaDataDefinition> getJson() {
+ return json;
+ }
+
+ public void setJson(Map<String, ? extends ToscaDataDefinition> json) {
+ this.json = json;
+ }
+
+ public TitanVertex getVertex() {
+ return vertex;
+ }
+
+ public void setVertex(TitanVertex vertex) {
+ this.vertex = vertex;
+ }
+
+ public VertexTypeEnum getLabel() {
+ return label;
+ }
+
+ public void setLabel(VertexTypeEnum label) {
+ this.label = label;
+ }
+
+ public ComponentTypeEnum getType() {
+ ComponentTypeEnum type = ComponentTypeEnum.valueOf((String) getMetadataProperty(GraphPropertyEnum.COMPONENT_TYPE));
+ return type;
+ }
+
+ public void setType(ComponentTypeEnum type) {
+ addMetadataProperty(GraphPropertyEnum.COMPONENT_TYPE, type.name());
+ }
+
+ public void addMetadataProperty(GraphPropertyEnum propName, Object propValue) {
+ if (metadataProperties == null) {
+ metadataProperties = new HashMap<>();
+ }
+ if (propValue != null) {
+ metadataProperties.put(propName, propValue);
+ }
+ }
+
+ public Object getMetadataProperty(GraphPropertyEnum metadataProperty) {
+ if (metadataProperties != null) {
+ return metadataProperties.get(metadataProperty);
+ }
+ return null;
+ }
+
+ public Map<GraphPropertyEnum, Object> getMetadataProperties() {
+ return metadataProperties;
+ }
+
+ public void setMetadataProperties(Map<GraphPropertyEnum, Object> metadataProperties) {
+ this.metadataProperties = metadataProperties;
+ }
+
+ public Map<String, Object> getMetadataJson() {
+ return metadataJson;
+ }
+
+ public void setMetadataJson(Map<String, Object> metadataJson) {
+ this.metadataJson = metadataJson;
+ }
+
+ /**
+ * used for clone vertex in case of copy on update
+ *
+ * @param other
+ */
+ public void cloneData(GraphVertex other) {
+ // need to be deep copy???
+ json = other.getJson();
+ metadataJson = other.getMetadataJson();
+ metadataProperties = other.getMetadataProperties();
+ }
+
+ public void setJsonMetadataField(JsonPresentationFields field, Object value) {
+ if (metadataJson == null) {
+ metadataJson = new HashMap<>();
+ }
+ metadataJson.put(field.getPresentation(), value);
+ }
+
+ public Object getJsonMetadataField(JsonPresentationFields field) {
+ if (metadataJson != null) {
+ return metadataJson.get(field.getPresentation());
+ }
+ return null;
+ }
+
+ /**
+ * Updates metadata json with current metadataProperties. Note that already existing property containing in metadata json can be overrided by new value if metadataProperties contains the same property (by key). Note that metadata json can contain
+ * a property that is not presented in metadataProperties. In such case the property will be put in metadata json.
+ */
+ public void updateMetadataJsonWithCurrentMetadataProperties() {
+ if (!MapUtils.isEmpty(metadataProperties)) {
+ if (metadataJson == null) {
+ metadataJson = new HashMap<>();
+ }
+ for (Entry<GraphPropertyEnum, Object> entry : metadataProperties.entrySet()) {
+ String propertyName = JsonPresentationFields.getPresentationByGraphProperty(entry.getKey());
+ if (StringUtils.isNotEmpty(propertyName) && entry.getValue() != null) {
+ metadataJson.put(propertyName, entry.getValue());
+ }
+ }
+ }
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java
new file mode 100644
index 0000000000..61e1b40d46
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/TitanDao.java
@@ -0,0 +1,890 @@
+package org.openecomp.sdc.be.dao.jsongraph;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
+import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
+import org.openecomp.sdc.be.dao.titan.TitanGraphClient;
+import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import org.openecomp.sdc.common.jsongraph.util.CommonUtility;
+import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import com.thinkaurelius.titan.core.PropertyKey;
+import com.thinkaurelius.titan.core.TitanEdge;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.thinkaurelius.titan.core.TitanGraphQuery;
+import com.thinkaurelius.titan.core.TitanVertex;
+import com.thinkaurelius.titan.core.TitanVertexQuery;
+
+import fj.data.Either;
+
+@Component("titan-dao")
+public class TitanDao {
+ TitanGraphClient titanClient;
+
+ private static Logger logger = LoggerFactory.getLogger(TitanDao.class.getName());
+
+ public TitanDao(@Qualifier("titan-client") TitanGraphClient titanClient) {
+ this.titanClient = titanClient;
+ logger.info("** TitanDao created");
+ }
+
+ public TitanOperationStatus commit() {
+ logger.debug("doing commit.");
+ return titanClient.commit();
+ }
+
+ public TitanOperationStatus rollback() {
+ return titanClient.rollback();
+ }
+
+ public Either<TitanGraph, TitanOperationStatus> getGraph() {
+ return titanClient.getGraph();
+ }
+
+ /**
+ *
+ * @param graphVertex
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> createVertex(GraphVertex graphVertex) {
+ logger.trace("try to create vertex for ID [{}]", graphVertex.getUniqueId());
+ Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ if (graph.isLeft()) {
+ try {
+ TitanGraph tGraph = graph.left().value();
+
+ TitanVertex vertex = tGraph.addVertex();
+
+ setVertexProperties(vertex, graphVertex);
+
+ graphVertex.setVertex(vertex);
+
+ return Either.left(graphVertex);
+
+ } catch (Exception e) {
+ logger.debug("Failed to create Node for ID [{}]", graphVertex.getUniqueId(), e);
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+ } else {
+ logger.debug("Failed to create vertex for ID [{}] {}", graphVertex.getUniqueId(), graph.right().value());
+ return Either.right(graph.right().value());
+ }
+ }
+
+ /**
+ *
+ * @param name
+ * @param value
+ * @param label
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label) {
+ return getVertexByPropertyAndLabel(name, value, label, JsonParseFlagEnum.ParseAll);
+ }
+
+ /**
+ *
+ * @param name
+ * @param value
+ * @param label
+ * @param parseFlag
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> getVertexByPropertyAndLabel(GraphPropertyEnum name, Object value, VertexTypeEnum label, JsonParseFlagEnum parseFlag) {
+
+ Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ if (graph.isLeft()) {
+ try {
+ TitanGraph tGraph = graph.left().value();
+
+ @SuppressWarnings("unchecked")
+ Iterable<TitanVertex> vertecies = tGraph.query().has(name.getProperty(), value).has(GraphPropertyEnum.LABEL.getProperty(), label.getName()).vertices();
+
+ java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
+ if (iterator.hasNext()) {
+ TitanVertex vertex = iterator.next();
+ GraphVertex graphVertex = createAndFill(vertex, parseFlag);
+
+ return Either.left(graphVertex);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("No vertex in graph for key = {} and value = {} label = {}" + name, value, label);
+ }
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed to get vertex in graph for key ={} and value = {} label = {}", name, value, label);
+ }
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("No vertex in graph for key ={} and value = {} label = {} error :{}", name, value, label, graph.right().value());
+ }
+ return Either.right(graph.right().value());
+ }
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> getVertexById(String id) {
+ return getVertexById(id, JsonParseFlagEnum.ParseAll);
+ }
+
+ /**
+ *
+ * @param id
+ * @param parseFlag
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> getVertexById(String id, JsonParseFlagEnum parseFlag) {
+
+ Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ if (id == null) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("No vertex in graph for id = {} ", id);
+ }
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+ if (graph.isLeft()) {
+ try {
+ TitanGraph tGraph = graph.left().value();
+
+ @SuppressWarnings("unchecked")
+ Iterable<TitanVertex> vertecies = tGraph.query().has(GraphPropertyEnum.UNIQUE_ID.getProperty(), id).vertices();
+
+ java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
+ if (iterator.hasNext()) {
+ TitanVertex vertex = iterator.next();
+ GraphVertex graphVertex = createAndFill(vertex, parseFlag);
+ return Either.left(graphVertex);
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("No vertex in graph for id = {}", id);
+ }
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed to get vertex in graph for id {} ", id);
+ }
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("No vertex in graph for id {} error : {}", id, graph.right().value());
+ }
+ return Either.right(graph.right().value());
+ }
+ }
+
+ private void setVertexProperties(TitanVertex vertex, GraphVertex graphVertex) throws IOException {
+
+ if (graphVertex.getMetadataProperties() != null) {
+ for (Map.Entry<GraphPropertyEnum, Object> entry : graphVertex.getMetadataProperties().entrySet()) {
+ if (entry.getValue() != null) {
+ vertex.property(entry.getKey().getProperty(), entry.getValue());
+ }
+ }
+ }
+ vertex.property(GraphPropertyEnum.LABEL.getProperty(), graphVertex.getLabel().getName());
+
+ Map<String, ? extends ToscaDataDefinition> json = graphVertex.getJson();
+ if (json != null) {
+ String jsonStr = JsonParserUtils.jsonToString(json);
+ vertex.property(GraphPropertyEnum.JSON.getProperty(), jsonStr);
+
+ }
+ Map<String, Object> jsonMetadata = graphVertex.getMetadataJson();
+ if (jsonMetadata != null) {
+ String jsonMetadataStr = JsonParserUtils.jsonToString(jsonMetadata);
+ vertex.property(GraphPropertyEnum.METADATA.getProperty(), jsonMetadataStr);
+ }
+ }
+
+ public void setVertexProperties(Vertex vertex, Map<String, Object> properties) throws IOException {
+ for (Map.Entry<String, Object> entry : properties.entrySet()) {
+ if (entry.getValue() != null) {
+ vertex.property(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ private GraphVertex createAndFill(TitanVertex vertex, JsonParseFlagEnum parseFlag) {
+ GraphVertex graphVertex = new GraphVertex();
+ graphVertex.setVertex(vertex);
+ parseVertexProperties(graphVertex, parseFlag);
+ return graphVertex;
+ }
+
+ public void parseVertexProperties(GraphVertex graphVertex, JsonParseFlagEnum parseFlag ) {
+ TitanVertex vertex = graphVertex.getVertex();
+ Map<GraphPropertyEnum, Object> properties = getVertexProperties(vertex);
+ VertexTypeEnum label = VertexTypeEnum.getByName((String) (properties.get(GraphPropertyEnum.LABEL)));
+ for (Map.Entry<GraphPropertyEnum, Object> entry : properties.entrySet()) {
+ GraphPropertyEnum key = entry.getKey();
+ switch (key) {
+ case UNIQUE_ID:
+ graphVertex.setUniqueId((String) entry.getValue());
+ break;
+ case LABEL:
+ graphVertex.setLabel(VertexTypeEnum.getByName((String) entry.getValue()));
+ break;
+ case COMPONENT_TYPE:
+ String type = (String) entry.getValue();
+ if (type != null) {
+ graphVertex.setType(ComponentTypeEnum.valueOf(type));
+ }
+ break;
+ case JSON:
+ if (parseFlag == JsonParseFlagEnum.ParseAll || parseFlag == JsonParseFlagEnum.ParseJson) {
+ String json = (String) entry.getValue();
+ Map<String, ? extends ToscaDataDefinition> jsonObj = JsonParserUtils.parseToJson(json, label.getClassOfJson());
+ graphVertex.setJson(jsonObj);
+ }
+ break;
+ case METADATA:
+ if (parseFlag == JsonParseFlagEnum.ParseAll || parseFlag == JsonParseFlagEnum.ParseMetadata) {
+ String json = (String) entry.getValue();
+ Map<String, Object> metadatObj = JsonParserUtils.parseToJson(json);
+ graphVertex.setMetadataJson(metadatObj);
+ }
+ break;
+ default:
+ graphVertex.addMetadataProperty(key, entry.getValue());
+ break;
+ }
+ }
+ }
+
+ public TitanOperationStatus createEdge(GraphVertex from, GraphVertex to, EdgeLabelEnum label, Map<EdgePropertyEnum, Object> properties) {
+ return createEdge(from.getVertex(), to.getVertex(), label, properties);
+ }
+
+ public TitanOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Map<EdgePropertyEnum, Object> properties) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Try to connect {} with {} label {} properties {}", from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), to.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), label, properties);
+ }
+ if (from == null || to == null) {
+ logger.trace("No Titan vertex for id from {} or id to {}", from.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), to.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
+ return TitanOperationStatus.NOT_FOUND;
+ }
+ Edge edge = from.addEdge(label.name(), to);
+ setEdgeProperties(edge, properties);
+ return TitanOperationStatus.OK;
+ }
+
+ public Map<GraphPropertyEnum, Object> getVertexProperties(Element element) {
+
+ Map<GraphPropertyEnum, Object> result = new HashMap<GraphPropertyEnum, Object>();
+
+ if (element != null && element.keys() != null && element.keys().size() > 0) {
+ Map<String, Property> propertyMap = ElementHelper.propertyMap(element, element.keys().toArray(new String[element.keys().size()]));
+
+ for (Entry<String, Property> entry : propertyMap.entrySet()) {
+ String key = entry.getKey();
+ Object value = entry.getValue().value();
+
+ GraphPropertyEnum valueOf = GraphPropertyEnum.getByProperty(key);
+ if (valueOf != null) {
+ result.put(valueOf, value);
+ }
+ }
+ }
+ return result;
+ }
+
+ public Map<EdgePropertyEnum, Object> getEdgeProperties(Element element) {
+
+ Map<EdgePropertyEnum, Object> result = new HashMap<EdgePropertyEnum, Object>();
+
+ if (element != null && element.keys() != null && element.keys().size() > 0) {
+ Map<String, Property> propertyMap = ElementHelper.propertyMap(element, element.keys().toArray(new String[element.keys().size()]));
+
+ for (Entry<String, Property> entry : propertyMap.entrySet()) {
+ String key = entry.getKey();
+ Object value = entry.getValue().value();
+
+ EdgePropertyEnum valueOf = EdgePropertyEnum.getByProperty(key);
+ if (valueOf != null) {
+ result.put(valueOf, value);
+ }
+ }
+ }
+ return result;
+ }
+
+ public void setEdgeProperties(Element element, Map<EdgePropertyEnum, Object> properties) {
+
+ if (properties != null && !properties.isEmpty()) {
+
+ Object[] propertyKeyValues = new Object[properties.size() * 2];
+ int i = 0;
+ for (Entry<EdgePropertyEnum, Object> entry : properties.entrySet()) {
+ propertyKeyValues[i++] = entry.getKey().getProperty();
+ propertyKeyValues[i++] = entry.getValue();
+ }
+
+ ElementHelper.attachProperties(element, propertyKeyValues);
+
+ }
+
+ }
+
+ public Either<List<GraphVertex>, TitanOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props) {
+ return getByCriteria(type, props, JsonParseFlagEnum.ParseAll);
+ }
+
+ public Either<List<GraphVertex>, TitanOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props, JsonParseFlagEnum parseFlag) {
+ Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ if (graph.isLeft()) {
+ try {
+ TitanGraph tGraph = graph.left().value();
+
+ TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ if (type != null) {
+ query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName());
+ }
+
+ if (props != null && !props.isEmpty()) {
+ for (Map.Entry<GraphPropertyEnum, Object> entry : props.entrySet()) {
+ query = query.has(entry.getKey().getProperty(), entry.getValue());
+ }
+ }
+ Iterable<TitanVertex> vertices = query.vertices();
+ if (vertices == null) {
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+
+ Iterator<TitanVertex> iterator = vertices.iterator();
+ List<GraphVertex> result = new ArrayList<GraphVertex>();
+
+ while (iterator.hasNext()) {
+ TitanVertex vertex = iterator.next();
+
+ Map<GraphPropertyEnum, Object> newProp = getVertexProperties(vertex);
+ GraphVertex graphVertex = createAndFill(vertex, parseFlag);
+
+ result.add(graphVertex);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size());
+ }
+ if (result.size() == 0) {
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+
+ return Either.left(result);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
+ }
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed get by criteria for type ={} and properties = {} error : {}", type, props, graph.right().value());
+ }
+ return Either.right(graph.right().value());
+ }
+ }
+ public Either<List<GraphVertex>, TitanOperationStatus> getByCriteria(VertexTypeEnum type, Map<GraphPropertyEnum, Object> props, Map<GraphPropertyEnum, Object> hasNotProps, JsonParseFlagEnum parseFlag) {
+ Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
+ if (graph.isLeft()) {
+ try {
+ TitanGraph tGraph = graph.left().value();
+
+ TitanGraphQuery<? extends TitanGraphQuery> query = tGraph.query();
+ if (type != null) {
+ query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName());
+ }
+
+ if (props != null && !props.isEmpty()) {
+ for (Map.Entry<GraphPropertyEnum, Object> entry : props.entrySet()) {
+ query = query.has(entry.getKey().getProperty(), entry.getValue());
+ }
+ }
+ if (hasNotProps != null && !hasNotProps.isEmpty()) {
+ for (Map.Entry<GraphPropertyEnum, Object> entry : hasNotProps.entrySet()) {
+ query = query.hasNot(entry.getKey().getProperty(), entry.getValue());
+ }
+ }
+ Iterable<TitanVertex> vertices = query.vertices();
+ if (vertices == null) {
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+
+ Iterator<TitanVertex> iterator = vertices.iterator();
+ List<GraphVertex> result = new ArrayList<GraphVertex>();
+
+ while (iterator.hasNext()) {
+ TitanVertex vertex = iterator.next();
+
+ Map<GraphPropertyEnum, Object> newProp = getVertexProperties(vertex);
+ GraphVertex graphVertex = createAndFill(vertex, parseFlag);
+
+ result.add(graphVertex);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size());
+ }
+ if (result.size() == 0) {
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+
+ return Either.left(result);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
+ }
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Failed get by criteria for type ={} and properties = {} error : {}", type, props, graph.right().value());
+ }
+ return Either.right(graph.right().value());
+ }
+ }
+
+
+ /**
+ *
+ * @param parentVertex
+ * @param edgeLabel
+ * @param parseFlag
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> getChildVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies = getChildrenVertecies(parentVertex, edgeLabel, parseFlag);
+ if (childrenVertecies.isRight()) {
+ return Either.right(childrenVertecies.right().value());
+ }
+ return Either.left(childrenVertecies.left().value().get(0));
+ }
+
+ public Either<GraphVertex, TitanOperationStatus> getParentVertex(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ Either<List<GraphVertex>, TitanOperationStatus> childrenVertecies = getParentVertecies(parentVertex, edgeLabel, parseFlag);
+ if (childrenVertecies.isRight()) {
+ return Either.right(childrenVertecies.right().value());
+ }
+ return Either.left(childrenVertecies.left().value().get(0));
+ }
+
+ /**
+ *
+ * @param parentVertex
+ * @param edgeLabel
+ * @param parseFlag
+ * @return
+ */
+ public Either<List<GraphVertex>, TitanOperationStatus> getChildrenVertecies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ return getAdjacentVerticies(parentVertex, edgeLabel, parseFlag, Direction.OUT);
+ }
+
+ public Either<List<GraphVertex>, TitanOperationStatus> getParentVertecies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag) {
+ return getAdjacentVerticies(parentVertex, edgeLabel, parseFlag, Direction.IN);
+ }
+
+ private Either<List<GraphVertex>, TitanOperationStatus> getAdjacentVerticies(GraphVertex parentVertex, EdgeLabelEnum edgeLabel, JsonParseFlagEnum parseFlag, Direction direction) {
+ List<GraphVertex> list = new ArrayList<GraphVertex>();
+
+ try {
+ Either<TitanGraph, TitanOperationStatus> graphRes = titanClient.getGraph();
+ if (graphRes.isRight()) {
+ logger.error("Failed to retrieve graph. status is {}", graphRes);
+ return Either.right(graphRes.right().value());
+ }
+ Iterator<Edge> edgesCreatorIterator = parentVertex.getVertex().edges(direction, edgeLabel.name());
+ if (edgesCreatorIterator != null) {
+ while (edgesCreatorIterator.hasNext()) {
+ Edge edge = edgesCreatorIterator.next();
+ TitanVertex vertex;
+ if (direction == Direction.IN) {
+ vertex = (TitanVertex) edge.outVertex();
+ } else {
+ vertex = (TitanVertex) edge.inVertex();
+ }
+ GraphVertex graphVertex = createAndFill(vertex, parseFlag);
+
+ list.add(graphVertex);
+ }
+ }
+ if (true == list.isEmpty()) {
+ return Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+ } catch (Exception e) {
+ logger.error("Failed to perform graph operation ", e);
+ Either.right(TitanGraphClient.handleTitanException(e));
+ }
+
+ return Either.left(list);
+ }
+
+ /**
+ * Searches Edge by received label and criteria
+ *
+ * @param vertex
+ * @param label
+ * @param properties
+ * @return found edge or TitanOperationStatus
+ */
+ public Either<Edge, TitanOperationStatus> getBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+
+ Either<Edge, TitanOperationStatus> result = null;
+ Edge matchingEdge = null;
+ String notFoundMsg = "No edges in graph for criteria";
+ try {
+ TitanVertexQuery<?> query = vertex.getVertex().query().labels(label.name());
+
+ if (properties != null && !properties.isEmpty()) {
+ for (Map.Entry<GraphPropertyEnum, Object> entry : properties.entrySet()) {
+ query = query.has(entry.getKey().getProperty(), entry.getValue());
+ }
+ }
+
+ Iterable<TitanEdge> edges = query.edges();
+ if (edges == null) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg);
+ result = Either.right(TitanOperationStatus.NOT_FOUND);
+ } else {
+ Iterator<TitanEdge> eIter = edges.iterator();
+ if (eIter.hasNext()) {
+ matchingEdge = eIter.next();
+ } else {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, notFoundMsg);
+ result = Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+ }
+ if (result == null) {
+ result = Either.left(matchingEdge);
+ }
+ } catch (Exception e) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during getting edge by criteria for component with id {}. {}", vertex.getUniqueId(), e);
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+ return result;
+ }
+
+ /**
+ * Deletes Edge by received label and criteria
+ *
+ * @param vertex
+ * @param label
+ * @param properties
+ * @return
+ */
+ public Either<Edge, TitanOperationStatus> deleteBelongingEdgeByCriteria(GraphVertex vertex, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+ Either<Edge, TitanOperationStatus> result = null;
+ try {
+ result = getBelongingEdgeByCriteria(vertex, label, properties);
+ if (result.isLeft()) {
+ Edge edge = result.left().value();
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to delete an edge with the label {} belonging to the vertex {} ", label.name(), vertex.getUniqueId());
+ edge.remove();
+ result = Either.left(edge);
+ } else {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to find an edge with the label {} belonging to the vertex {} ", label.name(), vertex.getUniqueId());
+ }
+ } catch (Exception e) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge by criteria for the component with id {}. {}", vertex.getUniqueId(), e);
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ /**
+ * Deletes an edge between vertices fromVertex and toVertex according to received label
+ *
+ * @param fromVertex
+ * @param toVertex
+ * @param label
+ * @return
+ */
+ public Either<Edge, TitanOperationStatus> deleteEdge(GraphVertex fromVertex, GraphVertex toVertex, EdgeLabelEnum label) {
+ Either<Edge, TitanOperationStatus> result = null;
+ try {
+ Iterable<TitanEdge> edges = fromVertex.getVertex().query().labels(label.name()).edges();
+ Iterator<TitanEdge> eIter = edges.iterator();
+ while (eIter.hasNext()) {
+ Edge edge = eIter.next();
+ String currVertexUniqueId = edge.inVertex().value(GraphPropertyEnum.UNIQUE_ID.getProperty());
+ if (currVertexUniqueId != null && currVertexUniqueId.equals(toVertex.getUniqueId())) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to delete an edge with the label {} between vertices {} and {}. ", label.name(), fromVertex.getUniqueId(), toVertex.getUniqueId());
+ edge.remove();
+ result = Either.left(edge);
+ break;
+ }
+ }
+ if (result == null) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to delete an edge with the label {} between vertices {} and {}. ", label.name(), fromVertex.getUniqueId(), toVertex.getUniqueId());
+ result = Either.right(TitanOperationStatus.NOT_FOUND);
+ }
+ } catch (Exception e) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge with the label {} between vertices {} and {}. {}", label.name(), fromVertex.getUniqueId(), toVertex.getUniqueId(), e);
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+ return result;
+ }
+
+ public TitanOperationStatus deleteEdgeByDirection(GraphVertex fromVertex, Direction direction, EdgeLabelEnum label) {
+ try {
+ Iterator<Edge> edges = fromVertex.getVertex().edges(direction, label.name());
+
+ while (edges.hasNext()) {
+ Edge edge = edges.next();
+ edge.remove();
+ }
+ } catch (Exception e) {
+ logger.debug("Failed to remove from vertex {} edges {} by direction {} ", fromVertex.getUniqueId(), label, direction, e);
+ return TitanGraphClient.handleTitanException(e);
+ }
+ return TitanOperationStatus.OK;
+ }
+
+ /**
+ * Updates vertex properties. Note that graphVertex argument should contain updated data
+ *
+ * @param graphVertex
+ * @return
+ */
+ public Either<GraphVertex, TitanOperationStatus> updateVertex(GraphVertex graphVertex) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId());
+ try {
+ graphVertex.updateMetadataJsonWithCurrentMetadataProperties();
+ setVertexProperties(graphVertex.getVertex(), graphVertex);
+
+ } catch (Exception e) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to update metadata of vertex with uniqueId {}. ", graphVertex.getUniqueId(), e);
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+ return Either.left(graphVertex);
+ }
+
+ /**
+ * Fetches vertices by uniqueId according to received parse flag
+ *
+ * @param verticesToGet
+ * @return
+ */
+ public Either<Map<String, GraphVertex>, TitanOperationStatus> getVerticesByUniqueIdAndParseFlag(Map<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> verticesToGet) {
+
+ Either<Map<String, GraphVertex>, TitanOperationStatus> result = null;
+ Map<String, GraphVertex> vertices = new HashMap<>();
+ TitanOperationStatus titatStatus;
+ Either<GraphVertex, TitanOperationStatus> getVertexRes = null;
+ for (Map.Entry<String, ImmutablePair<GraphPropertyEnum, JsonParseFlagEnum>> entry : verticesToGet.entrySet()) {
+ if (entry.getValue().getKey() == GraphPropertyEnum.UNIQUE_ID) {
+ getVertexRes = getVertexById(entry.getKey(), entry.getValue().getValue());
+ } else if (entry.getValue().getKey() == GraphPropertyEnum.USERID) {
+ getVertexRes = getVertexByPropertyAndLabel(entry.getValue().getKey(), entry.getKey(), VertexTypeEnum.USER, entry.getValue().getValue());
+ }
+ if (getVertexRes == null) {
+ titatStatus = TitanOperationStatus.ILLEGAL_ARGUMENT;
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Invalid vertex type label {} has been received. ", entry.getValue().getKey(), titatStatus);
+ result = Either.right(titatStatus);
+ }
+ if (getVertexRes.isRight()) {
+ titatStatus = getVertexRes.right().value();
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to get vertex by id {} . Status is {}. ", entry.getKey(), titatStatus);
+ result = Either.right(titatStatus);
+ break;
+ } else {
+ vertices.put(entry.getKey(), getVertexRes.left().value());
+ }
+ }
+ if (result == null) {
+ result = Either.left(vertices);
+ }
+ return result;
+ }
+
+ /**
+ * Creates edge between "from" and "to" vertices with specified label and properties extracted from received edge
+ *
+ * @param from
+ * @param to
+ * @param label
+ * @param edgeToCopy
+ * @return
+ */
+ public TitanOperationStatus createEdge(Vertex from, Vertex to, EdgeLabelEnum label, Edge edgeToCopy) {
+ return createEdge(from, to, label, getEdgeProperties(edgeToCopy));
+ }
+
+ public TitanOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, Edge prevEdge, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) {
+
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Going to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel, fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
+ toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
+ TitanOperationStatus result = createEdge(fromVertex, toVertex, newLabel, prevEdge);
+ if (result == TitanOperationStatus.OK) {
+ prevEdge.remove();
+ }
+ return result;
+ }
+
+ /**
+ * Replaces previous label of edge with new label
+ *
+ * @param fromVertex
+ * @param toVertex
+ * @param prevLabel
+ * @param newLabel
+ * @return
+ */
+ public TitanOperationStatus replaceEdgeLabel(Vertex fromVertex, Vertex toVertex, EdgeLabelEnum prevLabel, EdgeLabelEnum newLabel) {
+
+ TitanOperationStatus result = null;
+ Iterator<Edge> prevEdgeIter = toVertex.edges(Direction.IN, prevLabel.name());
+ if (prevEdgeIter == null || !prevEdgeIter.hasNext()) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Failed to replace edge with label {} to {} between vertices {} and {}", prevLabel, newLabel, fromVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()),
+ toVertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()));
+ result = TitanOperationStatus.NOT_FOUND;
+ }
+ if (result == null) {
+ result = replaceEdgeLabel(fromVertex, toVertex, prevEdgeIter.next(), prevLabel, newLabel);
+ }
+ return result;
+ }
+
+ /**
+ * Updates metadata properties of vertex on graph. Json metadata property of the vertex will be updated with received properties too.
+ *
+ *
+ * @param vertex
+ * @param properties
+ * @return
+ */
+ public TitanOperationStatus updateVertexMetadataPropertiesWithJson(Vertex vertex, Map<GraphPropertyEnum, Object> properties) {
+ try {
+ if (!MapUtils.isEmpty(properties)) {
+ String jsonMetadataStr = (String) vertex.property(GraphPropertyEnum.METADATA.getProperty()).value();
+ Map<String, Object> jsonMetadataMap = JsonParserUtils.parseToJson(jsonMetadataStr);
+ for (Map.Entry<GraphPropertyEnum, Object> property : properties.entrySet()) {
+ vertex.property(property.getKey().getProperty(), property.getValue());
+ jsonMetadataMap.put(property.getKey().getProperty(), property.getValue());
+ }
+ vertex.property(GraphPropertyEnum.METADATA.getProperty(), JsonParserUtils.jsonToString(jsonMetadataMap));
+ }
+ } catch (Exception e) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during update vertex metadata properties with json{}. {}", vertex.property(GraphPropertyEnum.UNIQUE_ID.getProperty()), e.getMessage());
+ return TitanGraphClient.handleTitanException(e);
+ }
+ return TitanOperationStatus.OK;
+ }
+
+ public TitanOperationStatus disassociateAndDeleteLast(GraphVertex vertex, Direction direction, EdgeLabelEnum label) {
+ try {
+ Iterator<Edge> edges = vertex.getVertex().edges(direction, label.name());
+
+ while (edges.hasNext()) {
+ Edge edge = edges.next();
+ Vertex secondVertex;
+ Direction reverseDirection;
+ if (direction == Direction.IN) {
+ secondVertex = edge.outVertex();
+ reverseDirection = Direction.OUT;
+ } else {
+ secondVertex = edge.inVertex();
+ reverseDirection = Direction.IN;
+ }
+ edge.remove();
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "Edge {} with direction {} was removed from {}", label.name(), direction, vertex.getVertex());
+
+ Iterator<Edge> restOfEdges = secondVertex.edges(reverseDirection, label.name());
+ if (restOfEdges.hasNext() == false) {
+ secondVertex.remove();
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.TRACE, "This was last edge . Vertex {} was removed ", vertex.getUniqueId());
+ }
+ }
+ } catch (Exception e) {
+ CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "Exception occured during deleting an edge with the label {} direction {} from vertex {}. {}", label.name(), direction, vertex.getUniqueId(), e);
+ return TitanGraphClient.handleTitanException(e);
+ }
+ return TitanOperationStatus.OK;
+ }
+
+ public Object getProperty(TitanVertex vertex, String key) {
+ PropertyKey propertyKey = titanClient.getGraph().left().value().getPropertyKey(key);
+ Object value = vertex.valueOrNull(propertyKey);
+ return value;
+ }
+
+ public Object getProperty(Edge edge, EdgePropertyEnum key) {
+ Object value = null;
+ try {
+ Property<Object> property = edge.property(key.getProperty());
+ if (property != null) {
+ return property.orElse(null);
+ }
+ } catch (Exception e) {
+
+ }
+ return value;
+ }
+ /**
+ *
+ * @param vertexA
+ * @param vertexB
+ * @param label
+ * @param direction
+ * @return
+ */
+ public TitanOperationStatus moveEdge(GraphVertex vertexA, GraphVertex vertexB, EdgeLabelEnum label, Direction direction) {
+ TitanOperationStatus result = deleteEdgeByDirection(vertexA, direction, label);
+ if ( result != TitanOperationStatus.OK ){
+ logger.error("Failed to diassociate {} from element {}. error {} ", label, vertexA.getUniqueId(), result);
+ return result;
+ }
+ TitanOperationStatus createRelation;
+ if (direction == Direction.IN ){
+ createRelation = createEdge(vertexB, vertexA, label, null);
+ }else{
+ createRelation = createEdge(vertexA, vertexB, label, null);
+ }
+ if (createRelation != TitanOperationStatus.OK) {
+ return createRelation;
+ }
+ return TitanOperationStatus.OK;
+ }
+
+ public Either<Edge, TitanOperationStatus> getBelongingEdgeByCriteria(String parentId, EdgeLabelEnum label, Map<GraphPropertyEnum, Object> properties) {
+ Either<GraphVertex, TitanOperationStatus> getVertexRes = getVertexById(parentId, JsonParseFlagEnum.NoParse);
+ if(getVertexRes.isRight()){
+ return Either.right(getVertexRes.right().value());
+ }
+ return getBelongingEdgeByCriteria(getVertexRes.left().value(), label, properties);
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java
new file mode 100644
index 0000000000..6f5910f581
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgeLabelEnum.java
@@ -0,0 +1,50 @@
+package org.openecomp.sdc.be.dao.jsongraph.types;
+
+public enum EdgeLabelEnum {
+ ARTIFACTS,
+ DEPLOYMENT_ARTIFACTS,
+ INST_DEPLOYMENT_ARTIFACTS,
+ INSTANCE_ARTIFACTS,
+ INTERFACE_ARTIFACTS,
+ TOSCA_ARTIFACTS,
+ PROPERTIES,
+ CAPABILITIES,
+ CAPABILITIES_PROPERTIES,
+ REQUIREMENTS,
+ ATTRIBUTES,
+ ADDITIONAL_INFORMATION,
+ CATEGORY,
+ DERIVED_FROM,
+ STATE,
+ LAST_STATE,
+ LAST_MODIFIER,
+ VERSION,
+ CREATOR,
+ SUB_CATEGORY,
+ INPUTS,
+ GROUPS,
+ INST_PROPERTIES,
+ INST_INPUTS,
+ INST_ATTRIBUTES,
+ INST_GROUPS,
+ SERVICE_API_ARTIFACTS,
+ CALCULATED_CAPABILITIES,
+ FULLFILLED_CAPABILITIES,
+ CALCULATED_REQUIREMENTS,
+ FULLFILLED_REQUIREMENTS,
+ LAST_DISTRIBUTION_STATE_MODIFIER,
+ CALCULATED_CAP_PROPERTIES;
+ /**
+ * Returns EdgeLabelEnum according received name
+ * @param name
+ * @return
+ */
+ public static EdgeLabelEnum getEdgeLabelEnum(String name){
+ for(EdgeLabelEnum currLabel : EdgeLabelEnum.values()){
+ if (currLabel.name().equals(name)){
+ return currLabel;
+ }
+ }
+ return null;
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java
new file mode 100644
index 0000000000..df2f52040d
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/EdgePropertyEnum.java
@@ -0,0 +1,25 @@
+package org.openecomp.sdc.be.dao.jsongraph.types;
+
+public enum EdgePropertyEnum {
+
+ STATE ("state");
+
+ private String property;
+
+ public String getProperty() {
+ return property;
+ }
+
+ EdgePropertyEnum (String property){
+ this.property = property;
+ }
+
+ public static EdgePropertyEnum getByProperty(String property){
+ for ( EdgePropertyEnum inst : EdgePropertyEnum.values() ){
+ if ( inst.getProperty().equals(property) ){
+ return inst;
+ }
+ }
+ return null;
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java
new file mode 100644
index 0000000000..c54825a39e
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/GraphJsonProperty.java
@@ -0,0 +1,19 @@
+package org.openecomp.sdc.be.dao.jsongraph.types;
+
+import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
+
+public enum GraphJsonProperty {
+ METADATA (GraphPropertyEnum.METADATA),
+ JSON (GraphPropertyEnum.JSON);
+
+ private GraphPropertyEnum propInGraph;
+
+ GraphJsonProperty (GraphPropertyEnum propInGraph){
+ this.propInGraph = propInGraph;
+ }
+
+ public GraphPropertyEnum getPropInGraph() {
+ return propInGraph;
+ }
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java
new file mode 100644
index 0000000000..aea488e086
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/JsonParseFlagEnum.java
@@ -0,0 +1,9 @@
+package org.openecomp.sdc.be.dao.jsongraph.types;
+
+public enum JsonParseFlagEnum {
+
+ NoParse,
+ ParseAll,
+ ParseJson,
+ ParseMetadata
+}
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
new file mode 100644
index 0000000000..cb9c7207d2
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java
@@ -0,0 +1,62 @@
+package org.openecomp.sdc.be.dao.jsongraph.types;
+
+import org.openecomp.sdc.be.datatypes.elements.*;
+
+
+public enum VertexTypeEnum {
+ NODE_TYPE ("node_type", null),
+ TOPOLOGY_TEMPLATE ("topology_template", CompositionDataDefinition.class),
+ ARTIFACTS ("artifacts", ArtifactDataDefinition.class),
+ TOSCA_ARTIFACTS ("tosca_artifacts", ArtifactDataDefinition.class),
+ DEPLOYMENT_ARTIFACTS ("deployment_artifacts", ArtifactDataDefinition.class),
+ INST_DEPLOYMENT_ARTIFACTS ("inst_deployment_artifacts", MapArtifactDataDefinition.class),
+ INTERFACE_ARTIFACTS ("interface_artifacts", InterfaceDataDefinition.class),
+ INSTANCE_ARTIFACTS ("instance_artifacts", MapArtifactDataDefinition.class),
+ PROPERTIES ("properties", PropertyDataDefinition.class),
+ CAPABILTIES ("capabilities", ListCapabilityDataDefinition.class),
+ CAPABILITIES_PROPERTIES ("capabilities_properties", MapPropertiesDataDefinition.class),
+ REQUIREMENTS ("requirements", ListRequirementDataDefinition.class),
+ ATTRIBUTES ("attributes", PropertyDataDefinition.class),
+ RESOURCE_CATEGORY ("resourceNewCategory", null),
+ RESOURCE_SUBCATEGORY ("resourceSubcategory", null),
+ SERVICE_CATEGORY ("serviceNewCategory", null),
+ ADDITIONAL_INFORMATION ("additional_information", AdditionalInfoParameterDataDefinition.class),
+ USER ("user", null),
+ INPUTS ("inputs", PropertyDataDefinition.class),
+ GROUPS ("groups", GroupDataDefinition.class),
+ INST_ATTRIBUTES ("instAttributes", MapPropertiesDataDefinition.class),
+ INST_PROPERTIES ("instProperties", MapPropertiesDataDefinition.class),
+ INST_INPUTS ("instInputs", MapPropertiesDataDefinition.class),
+ INST_GROUPS ("instGroups", MapGroupsDataDefinition.class),
+ SERVICE_API_ARTIFACTS ("serviceApiArtifacts", ArtifactDataDefinition.class),
+ CALCULATED_CAPABILITIES ("calculatedCapabilities", MapListCapabiltyDataDefinition.class),
+ FULLFILLED_CAPABILITIES ("fullfilledCapabilities", MapListCapabiltyDataDefinition.class),
+ CALCULATED_REQUIREMENTS ("calculatedRequirements", MapListRequirementDataDefinition.class),
+ FULLFILLED_REQUIREMENTS ("fullfilledRequirements", MapListRequirementDataDefinition.class),
+ CALCULATED_CAP_PROPERTIES ("calculatedCapProperties", MapCapabiltyProperty.class)
+;
+
+ private String name;
+ private Class classOfJson;
+ VertexTypeEnum(String name, Class clazz){
+ this.name = name;
+ classOfJson = clazz;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class getClassOfJson() {
+ return classOfJson;
+ }
+
+ public static VertexTypeEnum getByName(String name){
+ for ( VertexTypeEnum inst : VertexTypeEnum.values() ){
+ if ( inst.getName().equals(name) ){
+ return inst;
+ }
+ }
+ return null;
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java
new file mode 100644
index 0000000000..dfff258840
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/IdBuilderUtils.java
@@ -0,0 +1,23 @@
+package org.openecomp.sdc.be.dao.jsongraph.utils;
+
+import java.util.UUID;
+import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
+
+public class IdBuilderUtils {
+ private static String DOT = ".";
+
+ public static String generateChildId(String componentId, VertexTypeEnum type){
+ StringBuffer sb = new StringBuffer(componentId);
+ sb.append(DOT).append(type.getName());
+ return sb.toString();
+ }
+
+ public static String generateUUID(){
+ return UUID.randomUUID().toString();
+ }
+
+ public static String generateUniqueId(){
+ return UUID.randomUUID().toString();
+ }
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/JsonParserUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/JsonParserUtils.java
new file mode 100644
index 0000000000..a7fe34071d
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/utils/JsonParserUtils.java
@@ -0,0 +1,66 @@
+package org.openecomp.sdc.be.dao.jsongraph.utils;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig.Feature;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.codehaus.jackson.type.JavaType;
+import org.codehaus.jackson.type.TypeReference;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class JsonParserUtils {
+ private static ObjectMapper mapper = new ObjectMapper();
+ private static Logger logger = LoggerFactory.getLogger(JsonParserUtils.class.getName());
+
+
+ public static <T> String jsonToString(T elementToRepresent) throws IOException, JsonGenerationException, JsonMappingException {
+
+
+ mapper.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
+ return mapper.writeValueAsString(elementToRepresent);
+ }
+
+ public static Map<String, Object> parseToJson(String json) {
+ Map<String, Object> object = null;
+ if (json == null || json.isEmpty()) {
+ return null;
+ }
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
+ TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {
+ };
+
+ try {
+ object = mapper.readValue(json, typeRef);
+ } catch (Exception e) {
+ logger.debug("Failed to parse json {}", json, e);
+ }
+ return object;
+ }
+ public static <T extends ToscaDataDefinition> Map<String, T> parseToJson(String json, Class <T> clazz) {
+ Map<String, T> object = null;
+ if (json == null || json.isEmpty()) {
+ return null;
+ }
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(Feature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
+ JavaType type = mapper.getTypeFactory().constructMapType(Map.class, String.class, clazz);
+
+ try {
+ object = mapper.readValue(json, type);
+ } catch (Exception e) {
+ logger.debug("Failed to parse json {}", json, e);
+ }
+ return object;
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java
index 917bcbb986..1b5222c0a0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgeLabels.java
@@ -27,43 +27,17 @@ public enum GraphEdgeLabels {
// field name
//
- STATE("STATE"), LAST_STATE("LAST_STATE"), CREATOR("CREATOR"), LAST_MODIFIER("LAST_MODIFIER"), ATTRIBUTE(
- "EDGE_ATTRIBUTE"), PROPERTY("EDGE_PROPERTY"), CATEGORY("CATEGORY"), DERIVED_FROM(
- "DERIVED_FROM"), REQUIREMENT("REQUIREMENT"), CAPABILITY_TYPE("CAPABILITY_TYPE"), RELATIONSHIP_TYPE(
- "RELATIONSHIP_TYPE"), CAPABILITY("CAPABILITY"), INSTANCE_OF("INSTANCE_OF"), INTERFACE(
- "INTERFACE"), INTERFACE_OPERATION("INTERFACE_OPERATION"), ARTIFACT_REF(
- "ARTIFACT_REF"), INPUTS("INPUTS"), REQUIREMENT_IMPL(
- "REQUIREMENT_IMPL"), NODE_IMPL("NODE_IMPL"), IMPLEMENTATION_OF(
- "IMPLEMENTATION_OF"), ATTRIBUTE_VALUE(
- "ATTRIBUTE_VALUE"), INPUT_VALUE(
- "INPUT_VALUE"), PROPERTY_VALUE(
- "PROPERTY_VALUE"), CAPABILITY_INST(
- "CAPABILITY_INST"), TYPE_OF(
- "TYPE_OF"), RESOURCE_INST(
- "RESOURCE_INST"), RELATIONSHIP_INST(
- "RELATIONSHIP_INST"), CAPABILITY_NODE(
- "CAPABILITY_NODE"), LAST_DISTRIBUTION_STATE_MODIFAIER(
- "LAST_DISTRIBUTION_STATE_MODIFAIER"), ATTRIBUTE_IMPL(
- "ATTRIBUTE_IMPL"), INPUT_IMPL(
- "INPUT_IMPL"), PROPERTY_IMPL(
- "PROPERTY_IMPL"), ADDITIONAL_INFORMATION(
- "ADDITIONAL_INFORMATION"), HEAT_PARAMETER(
- "HEAT_PARAMETER"), SUB_CATEGORY(
- "SUB_CATEGORY"), GROUPING(
- "GROUPING"), CATEGORIZED_TO(
- "CATEGORIZED_TO"), GENERATED_FROM(
- "GENERATED_FROM"), PARAMETER_VALUE(
- "PARAMETER_VALUE"), PARAMETER_IMPL(
- "PARAMETER_IMPL"),
+ STATE("STATE"), LAST_STATE("LAST_STATE"), CREATOR("CREATOR"), LAST_MODIFIER("LAST_MODIFIER"), ATTRIBUTE("EDGE_ATTRIBUTE"), PROPERTY("EDGE_PROPERTY"), CATEGORY("CATEGORY"), DERIVED_FROM("DERIVED_FROM"), REQUIREMENT("REQUIREMENT"),
+ CAPABILITY_TYPE("CAPABILITY_TYPE"), RELATIONSHIP_TYPE("RELATIONSHIP_TYPE"), CAPABILITY("CAPABILITY"), INSTANCE_OF("INSTANCE_OF"), INTERFACE("INTERFACE"), INTERFACE_OPERATION("INTERFACE_OPERATION"), ARTIFACT_REF("ARTIFACT_REF"),
+ INPUTS("INPUTS"), REQUIREMENT_IMPL("REQUIREMENT_IMPL"), NODE_IMPL("NODE_IMPL"), IMPLEMENTATION_OF("IMPLEMENTATION_OF"), ATTRIBUTE_VALUE("ATTRIBUTE_VALUE"), INPUT_VALUE("INPUT_VALUE"), PROPERTY_VALUE("PROPERTY_VALUE"),
+ CAPABILITY_INST("CAPABILITY_INST"), TYPE_OF("TYPE_OF"), RESOURCE_INST("RESOURCE_INST"), RELATIONSHIP_INST("RELATIONSHIP_INST"), CAPABILITY_NODE("CAPABILITY_NODE"), LAST_DISTRIBUTION_STATE_MODIFAIER("LAST_DISTRIBUTION_STATE_MODIFAIER"),
+ ATTRIBUTE_IMPL("ATTRIBUTE_IMPL"), INPUT_IMPL("INPUT_IMPL"), PROPERTY_IMPL("PROPERTY_IMPL"), ADDITIONAL_INFORMATION("ADDITIONAL_INFORMATION"), HEAT_PARAMETER("HEAT_PARAMETER"), SUB_CATEGORY("SUB_CATEGORY"), GROUPING("GROUPING"),
+ CATEGORIZED_TO("CATEGORIZED_TO"), GENERATED_FROM("GENERATED_FROM"), PARAMETER_VALUE("PARAMETER_VALUE"), PARAMETER_IMPL("PARAMETER_IMPL"),
// VF additions
- CALCULATED_REQUIREMENT("CALCULATED_REQUIREMENT"), CALCULATED_CAPABILITY(
- "CALCULATED_CAPABILITY"), RELATIONSHIP_ORIGIN("RELATIONSHIP_ORIGIN"), CAPABILITY_ORIGIN(
- "CAPABILITY_ORIGIN"), CALCULATED_REQUIREMENT_FULLFILLED(
- "CALCULATED_REQUIREMENT_FULLFILLED"), CALCULATED_CAPABILITY_FULLFILLED(
- "CALCULATED_CAPABILITY_FULLFILLED"),
+ CALCULATED_REQUIREMENT("CALCULATED_REQUIREMENT"), CALCULATED_CAPABILITY("CALCULATED_CAPABILITY"), RELATIONSHIP_ORIGIN("RELATIONSHIP_ORIGIN"), CAPABILITY_ORIGIN("CAPABILITY_ORIGIN"),
+ CALCULATED_REQUIREMENT_FULLFILLED("CALCULATED_REQUIREMENT_FULLFILLED"), CALCULATED_CAPABILITY_FULLFILLED("CALCULATED_CAPABILITY_FULLFILLED"),
// Group
- GROUP("GROUP"), GROUP_ARTIFACT_REF("GROUP_ARTIFACT_REF"), GROUP_MEMBER("GROUP_MEMBER"), INPUT(
- "EDGE_INPUT"), GET_INPUT("GET_INPUT"),;
+ GROUP("GROUP"), GROUP_ARTIFACT_REF("GROUP_ARTIFACT_REF"), GROUP_MEMBER("GROUP_MEMBER"), INPUT("EDGE_INPUT"), GET_INPUT("GET_INPUT"), GROUP_INST("GROUP_INST");
private String property;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java
index 18c9ecb6f7..2af909ee0d 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphEdgePropertiesDictionary.java
@@ -29,10 +29,14 @@ public enum GraphEdgePropertiesDictionary {
// field name class type
// stored in graph
- STATE("state", String.class), NAME("name", String.class), GROUP_TYPE("groupType", String.class), SOURCE("source",
- String.class), OWNER_ID("ownerId", String.class), REQUIRED_OCCURRENCES("requiredOccurrences",
- String.class), LEFT_OCCURRENCES("leftOccurrences",
- String.class), GET_INPUT_INDEX("get_input_index", String.class);
+ STATE("state", String.class),
+ NAME("name", String.class),
+ GROUP_TYPE("groupType", String.class),
+ SOURCE("source", String.class),
+ OWNER_ID("ownerId", String.class),
+ REQUIRED_OCCURRENCES("requiredOccurrences", String.class),
+ LEFT_OCCURRENCES("leftOccurrences", String.class),
+ GET_INPUT_INDEX("get_input_index", String.class);
private String property;
private Class clazz;
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 a042ab510e..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
@@ -1,23 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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.openecomp.sdc.be.dao.neo4j;
import java.util.ArrayList;
@@ -49,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),
@@ -64,7 +45,7 @@ public enum GraphPropertiesDictionary {
IMPORTED_TOSCA_CHECKSUM ("importedToscaChecksum", String.class, false, true),
GENERATED ("generated", Boolean.class, false, false),
// User
- USER_ID ("userId", String.class, true, true),
+ USERID ("userId", String.class, true, true),
EMAIL ("email", String.class, false, false),
FIRST_NAME ("firstName", String.class, false, false),
LAST_NAME ("lastName", String.class, false, false),
@@ -83,7 +64,7 @@ public enum GraphPropertiesDictionary {
ARTIFACT_REPOSITORY ("artifactRepository", String.class, false, false),
ARTIFACT_CHECKSUM ("artifactChecksum", String.class, false, false),
CREATOR ("creator", String.class, false, false),
- ATT_CREATOR ("attCreator", String.class, false, false),
+ CREATOR_ID ("creatorId", String.class, false, false),
LAST_UPDATER ("lastUpdater", String.class, false, false),
CREATOR_FULL_NAME ("creatorFullName", String.class, false, false),
UPDATER_FULL_NAME ("updaterFullName", String.class, false, false),
@@ -147,6 +128,7 @@ public enum GraphPropertiesDictionary {
STATUS ("status", String.class, false, false),
FUNCTIONAL_MENU ("functionalMenu", String.class, false, false),
REQUIRED_ARTIFACTS ("requiredArtifacts", String.class, false, false),
+ CUSTOMIZATION_UUID ("customizationUUID", String.class, false, false),
;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jClient.java
index 8bab8d8a8f..eb279cda3d 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jClient.java
@@ -130,7 +130,7 @@ public class Neo4jClient {
public Either<List<List<GraphElement>>, Neo4jOperationStatus> execute(BatchBuilder builder) {
String json = cypherTranslator.translate(builder);
- logger.debug("Try to execute cypher request [ {} ]", json);
+ logger.debug("Try to execute cypher request [{}]", json);
Either<String, Neo4jOperationStatus> result = sendPostCypher(json);
if (result.isRight()) {
@@ -149,7 +149,7 @@ public class Neo4jClient {
public Either<List<List<GraphElement>>, Neo4jOperationStatus> executeGet(RecursiveFilter filter) {
String json = cypherTranslator.translateGet(filter);
- logger.debug("Try to execute cypher request [ {} ]", json);
+ logger.debug("Try to execute cypher request [{}]", json);
Either<String, Neo4jOperationStatus> result = sendPostCypher(json);
if (result.isRight()) {
@@ -264,7 +264,7 @@ public class Neo4jClient {
String filterStr = CypherTranslator.prepareFilterBody(filter);
requestJson = requestJson.replace("$filter$", filterStr);
}
- logger.debug("Try to perform request [ {} ]", requestJson);
+ logger.debug("Try to perform request []", requestJson);
Either<String, Neo4jOperationStatus> status = sendPostCypher(requestJson);
if (status.isRight()) {
@@ -320,7 +320,7 @@ public class Neo4jClient {
String props = preparePropertiesInStatement(toUpdate.getToUpdate());
requestJson = requestJson.replace("$props$", props);
- logger.debug("Try to perform request [ {} ]", requestJson);
+ logger.debug("Try to perform request [{}]", requestJson);
Either<String, Neo4jOperationStatus> result = sendPostCypher(requestJson);
if (result.isRight()) {
@@ -493,7 +493,7 @@ public class Neo4jClient {
GraphNode node = (GraphNode) element;
String json = prepareCreateNodeBody(node);
- logger.debug("Try to save Node [ {} ]", json);
+ logger.debug("Try to save Node [{}] on graph", json);
status = sendPostCypher(json);
@@ -528,10 +528,10 @@ public class Neo4jClient {
int status = response.getStatusLine().getStatusCode();
String responseString;
responseString = new BasicResponseHandler().handleResponse(response);
- logger.debug("response [ {} ]", responseString);
+ logger.debug("response [{}]", responseString);
if (status == 200 || status == 201) {
- logger.debug("cypher request [ {} ]", json);
+ logger.debug("cypher request [{}] was succeeded", json);
Neo4jOperationStatus responseStatus = checkResponse(responseString);
if (Neo4jOperationStatus.OK.equals(responseStatus)) {
return Either.left(responseString);
@@ -539,22 +539,22 @@ public class Neo4jClient {
return Either.right(responseStatus);
}
} else {
- logger.debug("cypher request [ {} ] was failed: [ {} ]", json, responseString);
+ logger.debug("cypher request [{}] was failed : [{}]", json, responseString);
return Either.right(Neo4jOperationStatus.GENERAL_ERROR);
}
} catch (HttpResponseException e) {
- logger.debug("failed to perform cypher request [ {} ], {}", json, e);
+ logger.debug("failed to perform cypher request [{}]", json, e);
if (e.getStatusCode() == 401) {
return Either.right(Neo4jOperationStatus.NOT_AUTHORIZED);
} else {
return Either.right(Neo4jOperationStatus.GENERAL_ERROR);
}
} catch (ClientProtocolException e) {
- logger.debug("failed to perform cypher request [ {} ] {}", json, e);
+ logger.debug("failed to perform cypher request [{}]", json, e);
return Either.right(Neo4jOperationStatus.HTTP_PROTOCOL_ERROR);
} catch (IOException e) {
- logger.debug("failed to perform cypher request [ {} ] {}", json, e);
+ logger.debug("failed to perform cypher request [{}]", json, e);
return Either.right(Neo4jOperationStatus.NOT_CONNECTED);
} finally {
releaseResource(response);
@@ -722,7 +722,7 @@ public class Neo4jClient {
response = httpClient.execute(get, context);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
- logger.error("failed to get indexes requeste returned " + statusCode);
+ logger.error("failed to get indexes requeste returned {}", statusCode);
return Either.right(Neo4jOperationStatus.GENERAL_ERROR);
} else {
Map<String, List<String>> labels = getLeablesFromJson(response);
@@ -793,14 +793,13 @@ public class Neo4jClient {
response = httpClient.execute(post, context);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
- logger.error("failed to create index for label [" + label + "] with properties:" + propertyNames
- + " requeste returned " + statusCode);
+ logger.error("failed to create index for label [{}] with properties:{} requeste returned {}",label,propertyNames,statusCode);
result = Neo4jOperationStatus.GENERAL_ERROR;
} else {
- logger.debug("index for label [ {} ] with properties {} created", label, propertyNames);
+ logger.debug("index for label [{}] with properties: {} created", label, propertyNames);
}
} catch (Exception e) {
- logger.debug("failed to create index for label [ {} ] with properties {}", label, propertyNames);
+ logger.debug("failed to create index for label [{}] with properties: {}", label, propertyNames);
result = Neo4jOperationStatus.GENERAL_ERROR;
} finally {
@@ -811,7 +810,7 @@ public class Neo4jClient {
}
else {
- logger.debug("no index was created for label: {}, the received propertyNames list: {} is invalid", label, propertyNames);
+ logger.debug("no index was created for label :{} the recived propertyNames list: {} is invalide",label,propertyNames);
return Neo4jOperationStatus.WRONG_INPUT;
}
@@ -850,14 +849,14 @@ public class Neo4jClient {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 200) {
- logger.error("failed to create uniqueness constraint for label [" + label + "] on properties:"
- + propertyNames + ". request returned " + statusCode);
+ logger.error("failed to create uniqueness constraint for label [{}] on properties:{}. request returned ",
+ label,propertyNames,statusCode);
result = Neo4jOperationStatus.GENERAL_ERROR;
} else {
- logger.debug("uniqueness constraint for label [ {} ] on properties {} created", label, propertyNames);
+ logger.debug("uniqueness constraint for label [{}] on properties:{} created",label,propertyNames);
}
} catch (Exception e) {
- logger.error("failed to create uniqueness constraint [ {} ] with properties {}, error: {}",label, propertyNames, e);
+ logger.error("failed to create uniqueness constraint [{}] with properties:{}",label,propertyNames,e);
result = Neo4jOperationStatus.GENERAL_ERROR;
} finally {
releaseResource(response);
@@ -866,7 +865,7 @@ public class Neo4jClient {
}
else {
- logger.debug("no index was created for label: {} the received propertyNames list: {} is invalid", label, propertyNames);
+ logger.debug("no index was created for label :{} the recived propertyNames list: {} is invalide",label,propertyNames);
return Neo4jOperationStatus.WRONG_INPUT;
}
@@ -886,11 +885,11 @@ public class Neo4jClient {
throw new RuntimeException(" delete on type " + type + " is not yet supported");
}
- logger.debug("Try to perform request [ {} ]", requestJson);
+ logger.debug("Try to perform request [{}]", requestJson);
Either<String, Neo4jOperationStatus> status = sendPostCypher(requestJson);
if (status.isRight()) {
- logger.error(" delete request failed with {}", status.right());
+ logger.error(" delete request failed with: {}", status.right());
return Neo4jOperationStatus.GENERAL_ERROR;
} else {
return Neo4jOperationStatus.OK;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jGraphBatchBuilder.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jGraphBatchBuilder.java
index 831fb001be..5a6a8fdade 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jGraphBatchBuilder.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/Neo4jGraphBatchBuilder.java
@@ -48,11 +48,6 @@ public class Neo4jGraphBatchBuilder {
List<GraphNode> nodes = graphNeighbourTable.getNodes();
if (nodes != null && nodes.size() > 0) {
- // String resourceId = findResourceDataIdFromNodes(nodes);
- // if (resourceId == null || resourceId.isEmpty()) {
- // logger.error("Cannot find resource id in the graph table");
- // return Either.right(ActionStatus.INVALID_CONTENT);
- // }
List<NodeRelation> directedEdges = graphNeighbourTable.getDirectedEdges();
List<RelationEndPoint> relationEndPoints = new ArrayList<RelationEndPoint>(nodes.size());
@@ -72,7 +67,7 @@ public class Neo4jGraphBatchBuilder {
if (directedEdges != null) {
for (NodeRelation nodeRelation : directedEdges) {
GraphRelation relation = buildNeo4jRelation(relationEndPoints, nodeRelation);
- logger.debug("Goint to add relation {} to catch builder.", relation);
+ logger.debug("Goint to add relation {} to batch builder.", relation);
batchBuilder.add(relation);
}
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/rest/HttpRestClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/rest/HttpRestClient.java
index fb09131b42..91a984b7f2 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/rest/HttpRestClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/rest/HttpRestClient.java
@@ -98,7 +98,6 @@ public class HttpRestClient {
//
//
// } catch (RestClientServiceExeption e) {
- // // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
@@ -116,23 +115,11 @@ public class HttpRestClient {
public boolean init(RestConfigurationInfo restConfigurationInfo) {
- logger.debug("create HttpRestClient: restConfigurationInfo={}", restConfigurationInfo);
+ logger.debug("create HttpRestClient: restConfigurationInfo= {}", restConfigurationInfo);
boolean result = false;
- // try {
createHttpClient(restConfigurationInfo);
result = true;
- // } catch (KeyManagementException e) {
- // String msg = "Failed creating client config for rest. "
- // + e.getMessage();
- // logger.debug(msg, e);
- // //TODO: log. error
- // } catch (NoSuchAlgorithmException e) {
- // String msg = "Failed creating client config for rest. "
- // + e.getMessage();
- // logger.debug(msg, e);
- // //TODO: log. error
- // }
-
+
logger.debug("Finish creating HttpRestClient. Result is {}", result);
return result;
}
@@ -225,7 +212,7 @@ public class HttpRestClient {
public RestResponse doPUT(String uri, Properties headers, String body) {
- logger.debug("Before executing uri {}. headers = {}. body = ", uri, headers, body);
+ logger.debug("Before executing uri {}. headers = {}.body = {}", uri, headers, body);
HttpPut httpPut = new HttpPut(uri);
StringEntity data = new StringEntity(body, ContentType.APPLICATION_JSON);
@@ -237,7 +224,7 @@ public class HttpRestClient {
public RestResponse doPOST(String uri, Properties headers, String body) {
- logger.debug("Before executing uri {}. headers = {}. body = {}", uri, headers, body);
+ logger.debug("Before executing uri {}. headers = {}.body = {}", uri, headers, body);
HttpPost httpPost = new HttpPost(uri);
StringEntity data = new StringEntity(body, ContentType.APPLICATION_JSON);
@@ -249,7 +236,7 @@ public class HttpRestClient {
public RestResponseAsByteArray doGetAsByteArray(String uri, Properties headers) {
- logger.debug("Before executing uri {}. headers = {}.", uri, headers);
+ logger.debug("Before executing uri {}. headers = {}", uri, headers);
HttpGet httpGet = new HttpGet(uri);
@@ -282,7 +269,8 @@ public class HttpRestClient {
restResponse = buildRestResponseFromResult(httpResponse);
- logger.debug("After executing uri {}. response = {}.", httpRequestBase.getURI().toString(), restResponse);
+ logger.debug("After executing uri {}. response = {}", httpRequestBase.getURI().toString(), restResponse);
+
} catch (Exception exception) {
httpRequestBase.abort();
@@ -351,7 +339,7 @@ public class HttpRestClient {
restResponse = buildRestResponseByteArrayFromResult(httpResponse);
if (restResponse != null) {
- logger.debug("After executing uri {}. Response: {}.", httpRequestBase.getURI().toString(), restResponse.toPrettyString());
+ logger.debug("After executing uri {}. Response: {}", httpRequestBase.getURI().toString(), restResponse.toPrettyString());
}
} catch (Exception exception) {
@@ -379,7 +367,7 @@ public class HttpRestClient {
* name of method
*/
private void logResponse(String response, String method) {
- logger.trace(method + " response = " + response);
+ logger.trace("{} response = {}", method, response);
}
private void releaseResource(CloseableHttpResponse response) {
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java
index 535146d692..8445d58873 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGenericDao.java
@@ -26,6 +26,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.stream.Collectors;
+import java.util.stream.StreamSupport;
import javax.annotation.Resource;
@@ -45,6 +47,7 @@ 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;
import org.openecomp.sdc.be.dao.graph.datatype.RelationEndPoint;
+import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
@@ -62,17 +65,16 @@ import com.thinkaurelius.titan.core.TitanVertexQuery;
import com.thinkaurelius.titan.graphdb.query.TitanPredicate;
import fj.data.Either;
-
@Component("titan-generic-dao")
public class TitanGenericDao {
- @Resource
- TitanGraphClient titanClient;
+ private TitanGraphClient titanClient;
private static Logger logger = LoggerFactory.getLogger(TitanGenericDao.class.getName());
private static final String LOCK_NODE_PREFIX = "lock_";
- public TitanGenericDao() {
+ public TitanGenericDao(TitanGraphClient titanClient) {
+ this.titanClient = titanClient;
logger.info("** TitanGenericDao created");
}
@@ -231,14 +233,9 @@ public class TitanGenericDao {
}
}
- public TitanOperationStatus createEdge(TitanVertex vertexOut, TitanVertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
+ public TitanOperationStatus createEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
try {
- Edge edge = vertexOut.addEdge(type.getProperty(), vertexIn);
-
- if (properties != null) {
-
- setProperties(edge, properties);
- }
+ Edge edge = addEdge(vertexOut, vertexIn, type, properties);
} catch (Exception e) {
logger.debug("Failed to create edge from [{}] to [{}]", vertexOut, vertexIn, e);
return TitanGraphClient.handleTitanException(e);
@@ -246,6 +243,42 @@ public class TitanGenericDao {
return TitanOperationStatus.OK;
}
+
+ private Edge addEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
+ Edge edge = vertexOut.addEdge(type.getProperty(), vertexIn);
+
+ if (properties != null) {
+
+ setProperties(edge, properties);
+ }
+ return edge;
+ }
+
+ /**
+ * creates an identical edge in the graph
+ * @param edge
+ * @return the copy operation status
+ */
+ public Either<Edge, TitanOperationStatus> copyEdge(Vertex out, Vertex in, Edge edge) {
+ GraphEdgeLabels byName = GraphEdgeLabels.getByName(edge.label());
+ return this.saveEdge(out, in, byName, edgePropertiesToMap(edge));
+ }
+
+ private <V> Map<String, Object> edgePropertiesToMap(Edge edge) {
+ Iterable<Property<Object>> propertiesIterable = edge::properties;
+ return StreamSupport.stream(propertiesIterable.spliterator(), false).collect(Collectors.toMap(Property::key, Property::value));
+ }
+
+ public Either<Edge, TitanOperationStatus> saveEdge(Vertex vertexOut, Vertex vertexIn, GraphEdgeLabels type, Map<String, Object> properties) {
+ try {
+ Edge edge = addEdge(vertexOut, vertexIn, type, properties);
+ return Either.left(edge);
+ } catch (Exception e) {
+ logger.debug("Failed to create edge from [{}] to [{}]", vertexOut, vertexIn, e);
+ return Either.right(TitanGraphClient.handleTitanException(e));
+ }
+
+ }
public TitanOperationStatus createEdge(TitanVertex vertexOut, GraphNode to, GraphEdgeLabels type, Map<String, Object> properties) {
@@ -336,10 +369,7 @@ public class TitanGenericDao {
public Either<GraphRelation, TitanOperationStatus> getRelation(GraphNode from, GraphNode to, GraphEdgeLabels label) {
logger.debug("try to get relation from [{}] to [{}]", from.getKeyValueId(), to.getKeyValueId());
- ImmutablePair<String, Object> keyValueIdFrom = from.getKeyValueId();
- ImmutablePair<String, Object> keyValueIdTo = to.getKeyValueId();
-
- Either<Edge, TitanOperationStatus> edge = getEdgeByVerticies(keyValueIdFrom.getKey(), keyValueIdFrom.getValue(), keyValueIdTo.getKey(), keyValueIdTo.getValue(), label.getProperty());
+ Either<Edge, TitanOperationStatus> edge = getEdgeByNodes(from, to, label);
if (edge.isLeft()) {
try {
@@ -356,6 +386,13 @@ public class TitanGenericDao {
}
}
+ public Either<Edge, TitanOperationStatus> getEdgeByNodes(GraphNode from, GraphNode to, GraphEdgeLabels label) {
+ ImmutablePair<String, Object> keyValueIdFrom = from.getKeyValueId();
+ ImmutablePair<String, Object> keyValueIdTo = to.getKeyValueId();
+
+ return getEdgeByVerticies(keyValueIdFrom.getKey(), keyValueIdFrom.getValue(), keyValueIdTo.getKey(), keyValueIdTo.getValue(), label.getProperty());
+ }
+
public Either<GraphRelation, TitanOperationStatus> deleteIncomingRelationByCriteria(GraphNode to, GraphEdgeLabels label, Map<String, Object> props) {
Either<Edge, TitanOperationStatus> edgeByCriteria = getIncomingEdgeByCriteria(to, label, props);
@@ -445,7 +482,7 @@ public class TitanGenericDao {
return Either.left(matchingEdge);
}
- private Either<Edge, TitanOperationStatus> getEdgeByVerticies(String keyNameFrom, Object keyValueFrom, String keyNameTo, Object keyValueTo, String label) {
+ public Either<Edge, TitanOperationStatus> getEdgeByVerticies(String keyNameFrom, Object keyValueFrom, String keyNameTo, Object keyValueTo, String label) {
Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
if (graph.isLeft()) {
@@ -549,18 +586,18 @@ public class TitanGenericDao {
GraphRelation newRelation = GraphElementFactory.createRelation(edge.label(), getProperties(edge), nodeOut, nodeIn);
if (logger.isDebugEnabled()) {
- logger.debug("Relation was updated from [ {} ] to [ {} ]", from, to);
+ logger.debug("Relation was updated from [{}] to [{}] ", from, to);
}
return Either.left(newRelation);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to update relation from [ {} ] [ {} ] {}", from, to, e);
+ logger.debug("Failed to update relation from [{}] to [{}] ", from, to, e);
}
return Either.right(TitanGraphClient.handleTitanException(e));
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to update relation from [ {} ] [ {} ] {}", from, to, edgeS.right().value());
+ logger.debug("Failed to update relation from [{}] to [{}] {}", from, to, edgeS.right().value());
}
return Either.right(edgeS.right().value());
}
@@ -598,19 +635,19 @@ public class TitanGenericDao {
return Either.left(vertex);
}
if (logger.isDebugEnabled()) {
- logger.debug("No vertex in graph for key = {} and value = {} label = {}", name, value, label);
+ logger.debug("No vertex in graph for key =" + name + " and value = " + value + " label = " + label);
}
return Either.right(TitanOperationStatus.NOT_FOUND);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to get vertex in graph for key = {} and value = {} label = {}", name, value, label);
+ logger.debug("Failed to get vertex in graph for key ={} and value = {} label = {}",name,value,label);
}
return Either.right(TitanGraphClient.handleTitanException(e));
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("No vertex in graph for key = {} and value = {} label = {}. error : {}", name, value, label, graph.right().value());
+ logger.debug("No vertex in graph for key ={} and value = {} label = {} error : {}",name,value,label,graph.right().value());
}
return Either.right(graph.right().value());
}
@@ -847,75 +884,6 @@ public class TitanGenericDao {
}
}
- // public <T extends GraphNode> Either<List<T>, TitanOperationStatus>
- // getByCriteria_tx(NodeTypeEnum type, Map<String, Object> props, Class<T>
- // clazz) {
- // Either<TitanGraph, TitanOperationStatus> graph = titanClient.getGraph();
- // TitanTransaction tx=null;
- // if (graph.isLeft()) {
- // try {
- // TitanGraph tGraph = graph.left().value();
- // tx = tGraph.newTransaction();
- //
- // TitanGraphQuery<? extends TitanGraphQuery> query = tx.query();
- // query = query.has(GraphPropertiesDictionary.LABEL.getProperty(),
- // type.getName());
- //
- // if (props != null && !props.isEmpty()) {
- // for (Map.Entry<String, Object> entry : props.entrySet()) {
- // query = query.has(entry.getKey(), entry.getValue());
- // }
- // }
- // Iterable<TitanVertex> vertices = query.vertices();
- // if (vertices == null) {
- // tx.commit();
- // return Either.right(TitanOperationStatus.NOT_FOUND);
- // }
- //
- //
- // Iterator<TitanVertex> iterator = vertices.iterator();
- // List<T> result = new ArrayList<T>();
- //
- // while (iterator.hasNext()) {
- // Vertex vertex = iterator.next();
- //
- // Map<String, Object> newProp = getProperties(vertex);
- //
- // T element = GraphElementFactory.createElement(type.getName(),
- // GraphElementTypeEnum.Node, newProp, clazz);
- // result.add(element);
- // }
- // if (logger.isDebugEnabled()) {
- // logger.debug("Number of fetced nodes in graph for criteria : from type ="
- // + type + " and properties = " + props + " is " + result.size());
- // }
- // tx.commit();
- // if (result.size() == 0) {
- // return Either.right(TitanOperationStatus.NOT_FOUND);
- // }
- //
- // return Either.left(result);
- // } catch (Exception e) {
- // if (tx != null)
- // try {
- // tx.commit();
- // } catch (Exception e1) {
- // logger.debug("failed to commit after get", e);
- // }
- // if (logger.isDebugEnabled()) {
- // logger.debug("Failed get by criteria for type = {} and properties = {}. {}", type, props, e);
- // }
- // return Either.right(TitanGraphClient.handleTitanException(e));
- // }
- //
- // } else {
- // if (logger.isDebugEnabled()) {
- // logger.debug("Failed get by criteria for type = {} and properties {}. error : {}", type, props, graph.right().value());
- // }
- // return Either.right(graph.right().value());
- // }
- // }
-
private boolean vertexLeftContainsRightProps(Map<String, Object> leftProps, Map<String, Object> rightProps) {
if (rightProps != null) {
@@ -986,14 +954,14 @@ public class TitanGenericDao {
return Either.left(result);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug("Failed get by criteria for type = {} amd properties = {}. error: {}", type, props, e);
+ logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e);
}
return Either.right(TitanGraphClient.handleTitanException(e));
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("Failed get by criteria for type = {} and properties = {}. error : {}", type, props, graph.right().value());
+ logger.debug("Failed get by criteria for type = {} and properties = {} error : {}", type, props, graph.right().value());
}
return Either.right(graph.right().value());
}
@@ -1050,7 +1018,7 @@ public class TitanGenericDao {
}
- public TitanOperationStatus updateVertex(GraphNode node, TitanVertex vertex) {
+ public TitanOperationStatus updateVertex(GraphNode node, Vertex vertex) {
logger.debug("Try to update node for {}", node.getKeyValueId());
try {
@@ -1114,19 +1082,19 @@ public class TitanGenericDao {
return Either.left(node);
} else {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to delete node for {} = {}. Missing label property on node", keyName, keyValue);
+ logger.debug("Failed to delete node for {} = {} Missing label property on node", keyName, keyValue);
}
return Either.right(TitanOperationStatus.MISSING_NODE_LABEL);
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to delete node for {} = {}. Missing label property on node", keyName, keyValue);
+ logger.debug("Failed to delete node for {} = {} Missing label property on node", keyName, keyValue);
}
return Either.right(TitanOperationStatus.MISSING_NODE_LABEL);
}
} catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to delete node for {} = {}. error: {}", keyName, keyValue, e);
+ logger.debug("Failed to delete node for {} = {}", keyName, keyValue, e);
}
return Either.right(TitanGraphClient.handleTitanException(e));
}
@@ -1173,20 +1141,20 @@ public class TitanGenericDao {
;
} else {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to delete relation {} from {} to {}. error: {}", type, fromKeyId, toKeyId, graph.right().value());
+ logger.debug("Failed to delete relation {} from {} to {} error : {}",type,fromKeyId,toKeyId,graph.right().value());
}
return Either.right(graph.right().value());
}
return Either.left(newRelation);
} catch (Exception e) {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to delete relation {} from {} to {}. error: {}", type, fromKeyId, toKeyId, e);
+ logger.debug("Failed to delete relation {} from {} to {}", type, fromKeyId, toKeyId, e);
}
return Either.right(TitanGraphClient.handleTitanException(e));
}
} else {
if (logger.isDebugEnabled()) {
- logger.debug("Failed to delete relation {} from {} to {}. error: {}", type, fromKeyId, toKeyId, edgeS.right().value());
+ logger.debug("Failed to delete relation {} from {} to {} error : {}", type, fromKeyId, toKeyId, edgeS.right().value());
}
return Either.right(edgeS.right().value());
}
@@ -1624,7 +1592,7 @@ public class TitanGenericDao {
Either<Edge, TitanOperationStatus> outgoingEdgeByCriteria = getOutgoingEdgeByCriteria(key, uniqueId, edgeType, edgeProperties);
if (outgoingEdgeByCriteria.isRight()) {
TitanOperationStatus status = outgoingEdgeByCriteria.right().value();
- logger.debug("Cannot find outgoing edge from vertex {} with label {} and properties {}", uniqueId, edgeType, edgeProperties);
+ logger.debug("Cannot find outgoing edge from vertex {} with label {} and properties {}" + uniqueId, edgeType, edgeProperties);
return Either.right(status);
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java
index 68a05a91bf..07030472a4 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/titan/TitanGraphClient.java
@@ -42,6 +42,8 @@ import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.dao.DAOTitanStrategy;
+import org.openecomp.sdc.be.dao.TitanClientStrategy;
import org.openecomp.sdc.be.dao.graph.datatype.ActionEnum;
import org.openecomp.sdc.be.dao.graph.datatype.GraphElementTypeEnum;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgePropertiesDictionary;
@@ -76,9 +78,9 @@ import com.thinkaurelius.titan.diskstorage.ResourceUnavailableException;
import com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException;
import com.thinkaurelius.titan.graphdb.database.idassigner.IDPoolExhaustedException;
-
import fj.data.Either;
+
@Component("titan-client")
public class TitanGraphClient {
@@ -88,6 +90,9 @@ public class TitanGraphClient {
private static final String HEALTH_CHECK = GraphPropertiesDictionary.HEALTH_CHECK.getProperty();
private static final String OK = "GOOD";
+ public TitanGraphClient() {
+ }
+
private class HealthCheckTask implements Callable<Vertex> {
@Override
public Vertex call() {
@@ -126,7 +131,7 @@ public class TitanGraphClient {
public void run() {
logger.trace("Trying to reconnect to Titan...");
if (graph == null) {
- createGraph(titanCfgFile, true);
+ createGraph(titanCfgFile);
}
}
}
@@ -136,8 +141,7 @@ public class TitanGraphClient {
// Health Check Variables
/**
- * This executor will execute the health check task on a callable task that
- * can be executed with a timeout.
+ * This executor will execute the health check task on a callable task that can be executed with a timeout.
*/
ExecutorService healthCheckExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
@@ -159,9 +163,11 @@ public class TitanGraphClient {
private Future reconnectFuture;
private String titanCfgFile = null;
+ TitanClientStrategy titanClientStrategy;
- public TitanGraphClient() {
+ public TitanGraphClient(TitanClientStrategy titanClientStrategy) {
super();
+ this.titanClientStrategy = titanClientStrategy;
// Initialize a single threaded scheduler for health-check
this.healthCheckScheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
@@ -171,10 +177,8 @@ public class TitanGraphClient {
}
});
- healthCheckReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration()
- .getTitanHealthCheckReadTimeout(2);
- reconnectInterval = ConfigurationManager.getConfigurationManager().getConfiguration()
- .getTitanReconnectIntervalInSeconds(3);
+ healthCheckReadTimeout = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanHealthCheckReadTimeout(2);
+ reconnectInterval = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanReconnectIntervalInSeconds(3);
logger.info("** TitanGraphClient created");
}
@@ -188,13 +192,11 @@ public class TitanGraphClient {
BaseConfiguration conf = new BaseConfiguration();
conf.setProperty("storage.backend", "inmemory");
graph = TitanFactory.open(conf);
-
- createIndexesAndDefaults();
-
+ createTitanSchema();
logger.info("** in memory graph created");
return TitanOperationStatus.OK;
} else {
- this.titanCfgFile = ConfigurationManager.getConfigurationManager().getConfiguration().getTitanCfgFile();
+ this.titanCfgFile = titanClientStrategy.getConfigFile();
if (titanCfgFile == null || titanCfgFile.isEmpty()) {
titanCfgFile = "config/titan.properties";
}
@@ -217,8 +219,7 @@ public class TitanGraphClient {
}
/**
- * This method will be invoked ONLY on init time in case Titan storage is
- * down.
+ * This method will be invoked ONLY on init time in case Titan storage is down.
*/
private void startReconnectTask() {
this.reconnectTask = new ReconnectTask();
@@ -231,8 +232,7 @@ public class TitanGraphClient {
});
logger.info("Scheduling reconnect task {} with interval of {} seconds", reconnectTask, reconnectInterval);
- reconnectFuture = this.reconnectScheduler.scheduleAtFixedRate(this.reconnectTask, 0, this.reconnectInterval,
- TimeUnit.SECONDS);
+ reconnectFuture = this.reconnectScheduler.scheduleAtFixedRate(this.reconnectTask, 0, this.reconnectInterval, TimeUnit.SECONDS);
}
public void cleanupGraph() {
@@ -243,29 +243,28 @@ public class TitanGraphClient {
}
}
- public TitanOperationStatus createGraph(String titanCfgFile) {
- logger.info("** createGraph with " + titanCfgFile + " started");
- return createGraph(titanCfgFile, true);
+ private boolean graphInitialized(){
+ TitanManagement graphMgmt = graph.openManagement();
+ return graphMgmt.containsPropertyKey(HEALTH_CHECK) && graphMgmt.containsGraphIndex(HEALTH_CHECK);
}
+
- public TitanOperationStatus createGraph(String titanCfgFile, boolean initializeGraph) {
- logger.info("** createGraph with " + titanCfgFile + " and initializeGraph=" + initializeGraph + " started");
+ public TitanOperationStatus createGraph(String titanCfgFile) {
+ logger.info("** open graph with {} started", titanCfgFile);
try {
- logger.info("createGraph : try to load file " + titanCfgFile);
+ logger.info("openGraph : try to load file {}", titanCfgFile);
graph = TitanFactory.open(titanCfgFile);
- if (graph == null) {
+ if (graph.isClosed() || !graphInitialized()) {
+ logger.error("titan graph was not initialized");
return TitanOperationStatus.NOT_CREATED;
}
} catch (Exception e) {
this.graph = null;
- logger.info("createGraph : failed to open Titan graph with configuration file: " + titanCfgFile);
- logger.trace("createGraph : failed to open Titan graph. ", e);
+ logger.info("createGraph : failed to open Titan graph with configuration file: {}", titanCfgFile, e);
return TitanOperationStatus.NOT_CONNECTED;
}
- if (true == initializeGraph) {
- createIndexesAndDefaults();
- }
+
logger.info("** Titan graph created ");
// Do some post creation actions
@@ -294,12 +293,6 @@ public class TitanGraphClient {
this.startHealthCheckTask();
}
- private void createIndexesAndDefaults() {
- createVertexIndixes();
- createEdgeIndixes();
- createDefaultUsers();
- // createCategories();
- }
public Either<TitanGraph, TitanOperationStatus> getGraph() {
if (graph != null) {
@@ -309,76 +302,6 @@ public class TitanGraphClient {
}
}
- private TitanOperationStatus createVertexIndixes() {
- logger.info("** createVertexIndixes started");
- if (graph != null) {
- // TitanManagement graphMgt = graph.getManagementSystem();
- TitanManagement graphMgt = graph.openManagement();
- TitanGraphIndex index = null;
- for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
- PropertyKey propKey = null;
- if (!graphMgt.containsPropertyKey(prop.getProperty())) {
- Class<?> clazz = prop.getClazz();
- if (!ArrayList.class.getName().equals(clazz.getName())
- && !HashMap.class.getName().equals(clazz.getName())) {
- propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
- }
- } else {
- propKey = graphMgt.getPropertyKey(prop.getProperty());
- }
- if (prop.isIndexed()) {
- if (!graphMgt.containsGraphIndex(prop.getProperty())) {
- if (prop.isUnique()) {
- index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique()
- .buildCompositeIndex();
-
- graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures
- // only
- // one
- // name
- // per
- // vertex
- graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures
- // name
- // uniqueness
- // in
- // the
- // graph
-
- } else {
- graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
- }
- }
- }
- }
- graphMgt.commit();
- logger.info("** createVertexIndixes ended");
- return TitanOperationStatus.OK;
- }
- logger.info("** createVertexIndixes ended, no Indixes were created.");
- return TitanOperationStatus.NOT_CREATED;
- }
-
- private TitanOperationStatus createEdgeIndixes() {
- logger.info("** createEdgeIndixes started");
- if (graph != null) {
- // TitanManagement graphMgt = graph.getManagementSystem();
- TitanManagement graphMgt = graph.openManagement();
- for (GraphEdgePropertiesDictionary prop : GraphEdgePropertiesDictionary.values()) {
- if (!graphMgt.containsGraphIndex(prop.getProperty())) {
- PropertyKey propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
- graphMgt.buildIndex(prop.getProperty(), Edge.class).addKey(propKey).buildCompositeIndex();
-
- }
- }
- graphMgt.commit();
- logger.info("** createEdgeIndixes ended");
- return TitanOperationStatus.OK;
- }
- logger.info("** createEdgeIndixes ended, no Indixes were created.");
- return TitanOperationStatus.NOT_CREATED;
- }
-
public TitanOperationStatus commit() {
if (graph != null) {
try {
@@ -450,14 +373,14 @@ public class TitanGraphClient {
try {
Future<Vertex> future = healthCheckExecutor.submit(healthCallableTask);
v = future.get(this.healthCheckReadTimeout, TimeUnit.SECONDS);
- healthLogger.trace("Health Check Node Found... " + v.property(HEALTH_CHECK));
+ healthLogger.trace("Health Check Node Found... {}", v.property(HEALTH_CHECK));
graph.tx().commit();
} catch (Exception e) {
String message = e.getMessage();
if (message == null) {
message = e.getClass().getName();
}
- logger.error("Titan Health Check Failed. " + message);
+ logger.error("Titan Health Check Failed. {}", message);
return false;
}
return true;
@@ -466,386 +389,9 @@ public class TitanGraphClient {
}
}
- private TitanOperationStatus createCategories() {
- logger.info("** createCategories started");
- if (graph != null) {
- try {
- List<CategoryData> categoryDataList = getDefaultResourceCategoryList();
- generateGraphCategories(categoryDataList, NodeTypeEnum.ResourceCategory.getName());
- } catch (Exception e) {
- logger.error("createCategories : failed to load categories ", e);
- rollback();
- return TitanOperationStatus.GENERAL_ERROR;
- } finally {
- logger.info("** createCategories ended");
- commit();
- }
- }
- return TitanOperationStatus.OK;
- }
-
- private void generateGraphCategories(List<CategoryData> categoryDataList, String label) {
- for (CategoryData categoryData : categoryDataList) {
- Map<String, Object> properties = categoryData.toGraphMap();
- properties.put(GraphPropertiesDictionary.LABEL.getProperty(), label);
-
- // This is temporary for old mechnism of categories - they don;t
- // have the norm name
- properties.remove(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty());
-
- if (isVertexExist(properties)) {
- return;
- }
-
- Vertex vertex = graph.addVertex();
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- vertex.property(entry.getKey(), entry.getValue());
- }
- }
- }
-
- private List<CategoryData> getDefaultResourceCategoryList() {
- Map<String, List<String>> categories = new HashMap<String, List<String>>();
- categories.put("Network Layer 2-3", Arrays.asList("Router", "Gateway", "WAN Connectors", "LAN Connectors"));
- categories.put("Network Layer 4+", Arrays.asList("Common Network Resources"));
- categories.put("Application Layer 4+", Arrays.asList("Border Elements", "Application Servers", "Web Server",
- "Call Control", "Media Servers", "Load Balancer", "Database"));
- categories.put("Generic", Arrays.asList("Infrastructure", "Abstract", "Network Elements", "Database"));
-
- List<CategoryData> categoryDataList = new ArrayList<CategoryData>();
- CategoryData categoryData = null;
- for (Map.Entry<String, List<String>> entryList : categories.entrySet()) {
- for (String val : entryList.getValue()) {
- categoryData = new ResourceCategoryData(entryList.getKey(), val);
- categoryData.setAction(ActionEnum.Create);
- categoryData.setElementType(GraphElementTypeEnum.Node);
- // categoryData.setCategoryName();
- // categoryData.setName();
- categoryDataList.add(categoryData);
- }
- }
- return categoryDataList;
- }
-
- private List<CategoryData> getDefaultServiceCategoryList() {
- List<String> categories = new ArrayList<>();
- categories.add("Mobility");
- categories.add("Network L1-3");
- categories.add("Network L4");
- categories.add("VoIP Call Control");
-
- List<CategoryData> categoryDataList = new ArrayList<CategoryData>();
- CategoryData categoryData = null;
- for (String category : categories) {
- categoryData = new ServiceCategoryData(category);
- categoryData.setAction(ActionEnum.Create);
- categoryData.setElementType(GraphElementTypeEnum.Node);
- // categoryData.setCategoryName(entryList.getKey());
- // categoryData.setName(val);
- categoryDataList.add(categoryData);
- }
- return categoryDataList;
- }
-
- private void createDefaultUsers() {
- if (graph != null) {
- List<UserData> users = createUserList();
- for (UserData user : users) {
- String propertyName = GraphPropertiesDictionary.USER_ID.getProperty();
- String propertyValue = user.getUserId();
- Vertex vertex = null;
- Map<String, Object> properties = null;
- if (!isVertexExist(propertyName, propertyValue)) {
- vertex = graph.addVertex();
- vertex.property(GraphPropertiesDictionary.LABEL.getProperty(), NodeTypeEnum.User.getName());
- properties = user.toGraphMap();
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- vertex.property(entry.getKey(), entry.getValue());
- }
- }
- }
- graph.tx().commit();
- }
- }
-
- private List<UserData> createUserList() {
- LinkedList<UserData> users = new LinkedList<UserData>();
- users.add(getDefaultUserAdmin1());
- users.add(getDefaultUserAdmin2());
- users.add(getDefaultUserAdmin3());
- users.add(getDefaultUserDesigner1());
- users.add(getDefaultUserDesigner2());
- users.add(getDefaultUserDesigner3());
- users.add(getDefaultUserTester1());
- users.add(getDefaultUserTester2());
- users.add(getDefaultUserTester3());
- users.add(getDefaultUserGovernor1());
- users.add(getDefaultUserOps1());
- users.add(getDefaultUserProductManager1());
- users.add(getDefaultUserProductManager2());
- users.add(getDefaultUserProductStrategist1());
- users.add(getDefaultUserProductStrategist2());
- users.add(getDefaultUserProductStrategist3());
- return users;
- }
-
- private boolean isVertexExist(String propertyName, String propertyValue) {
- // Iterable<Vertex> vertecies = graph.getVertices(propertyName,
- // propertyValue);
- // java.util.Iterator<Vertex> iterator = vertecies.iterator();
-
- @SuppressWarnings("unchecked")
- Iterable<TitanVertex> vertecies = graph.query().has(HEALTH_CHECK, OK).vertices();
-
- java.util.Iterator<TitanVertex> iterator = vertecies.iterator();
- if (iterator.hasNext()) {
- return true;
- }
- return false;
- }
-
- private boolean isVertexExist(Map<String, Object> properties) {
- TitanGraphQuery query = graph.query();
-
- if (properties != null && !properties.isEmpty()) {
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- query = query.has(entry.getKey(), entry.getValue());
- }
- }
- Iterable<Vertex> vertecies = query.vertices();
- java.util.Iterator<Vertex> iterator = vertecies.iterator();
- if (iterator.hasNext()) {
- return true;
- }
- return false;
- }
-
- private UserData getDefaultUserAdmin1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("jh0003");
- userData.setEmail("admin@sdc.com");
- userData.setFirstName("Jimmy");
- userData.setLastName("Hendrix");
- userData.setRole("ADMIN");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserAdmin2() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("tr0001");
- userData.setEmail("admin@sdc.com");
- userData.setFirstName("Todd");
- userData.setLastName("Rundgren");
- userData.setRole("ADMIN");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserAdmin3() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("ah0002");
- userData.setEmail("admin@sdc.com");
- userData.setFirstName("Alex");
- userData.setLastName("Harvey");
- userData.setRole("ADMIN");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserDesigner1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("cs0008");
- userData.setEmail("designer@sdc.com");
- userData.setFirstName("Carlos");
- userData.setLastName("Santana");
- userData.setRole("DESIGNER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserDesigner2() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("me0009");
- userData.setEmail("designer@sdc.com");
- userData.setFirstName("Melissa");
- userData.setLastName("Etheridge");
- userData.setRole("DESIGNER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserDesigner3() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("af0006");
- userData.setEmail("designer@sdc.com");
- userData.setFirstName("Aretha");
- userData.setLastName("Franklin");
- userData.setRole("DESIGNER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserTester1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("jm0007");
- userData.setEmail("tester@sdc.com");
- userData.setFirstName("Joni");
- userData.setLastName("Mitchell");
- userData.setRole("TESTER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserTester2() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("kb0004");
- userData.setEmail("tester@sdc.com");
- userData.setFirstName("Kate");
- userData.setLastName("Bush");
- userData.setRole("TESTER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserTester3() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("jt0005");
- userData.setEmail("tester@sdc.com");
- userData.setFirstName("James");
- userData.setLastName("Taylor");
- userData.setRole("TESTER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserOps1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("op0001");
- userData.setEmail("ops@sdc.com");
- userData.setFirstName("Steve");
- userData.setLastName("Regev");
- userData.setRole("OPS");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserGovernor1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("gv0001");
- userData.setEmail("governor@sdc.com");
- userData.setFirstName("David");
- userData.setLastName("Shadmi");
- userData.setRole("GOVERNOR");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserProductManager1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("pm0001");
- userData.setEmail("pm1@sdc.com");
- userData.setFirstName("Teddy");
- userData.setLastName("Isashar");
- userData.setRole("PRODUCT_MANAGER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserProductManager2() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("pm0002");
- userData.setEmail("pm2@sdc.com");
- userData.setFirstName("Sarah");
- userData.setLastName("Bettens");
- userData.setRole("PRODUCT_MANAGER");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserProductStrategist1() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("ps0001");
- userData.setEmail("ps1@sdc.com");
- userData.setFirstName("Eden");
- userData.setLastName("Rozin");
- userData.setRole("PRODUCT_STRATEGIST");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserProductStrategist2() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("ps0002");
- userData.setEmail("ps2@sdc.com");
- userData.setFirstName("Ella");
- userData.setLastName("Kvetny");
- userData.setRole("PRODUCT_STRATEGIST");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
-
- private UserData getDefaultUserProductStrategist3() {
- UserData userData = new UserData();
- userData.setAction(ActionEnum.Create);
- userData.setElementType(GraphElementTypeEnum.Node);
- userData.setUserId("ps0003");
- userData.setEmail("ps3@sdc.com");
- userData.setFirstName("Geva");
- userData.setLastName("Alon");
- userData.setRole("PRODUCT_STRATEGIST");
- userData.setStatus(UserStatusEnum.ACTIVE.name());
- userData.setLastLoginTime(0L);
- return userData;
- }
public static void main(String[] args) throws InterruptedException {
- TitanGraphClient client = new TitanGraphClient();
+ TitanGraphClient client = new TitanGraphClient(new DAOTitanStrategy());
client.createGraph();
while (true) {
@@ -856,17 +402,58 @@ public class TitanGraphClient {
}
+
private static final String TITAN_HEALTH_CHECK_STR = "titanHealthCheck";
private void logAlarm() {
if (lastHealthState == true) {
- BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeHealthCheckRecovery,
- TITAN_HEALTH_CHECK_STR);
+ BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeHealthCheckRecovery, TITAN_HEALTH_CHECK_STR);
BeEcompErrorManager.getInstance().logBeHealthCheckTitanRecovery(TITAN_HEALTH_CHECK_STR);
} else {
- BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeHealthCheckError,
- TITAN_HEALTH_CHECK_STR);
+ BeEcompErrorManager.getInstance().processEcompError(EcompErrorName.BeHealthCheckError, TITAN_HEALTH_CHECK_STR);
BeEcompErrorManager.getInstance().logBeHealthCheckTitanError(TITAN_HEALTH_CHECK_STR);
}
}
+
+ private void createTitanSchema() {
+
+ TitanManagement graphMgt = graph.openManagement();
+ TitanGraphIndex index = null;
+ for (GraphPropertiesDictionary prop : GraphPropertiesDictionary.values()) {
+ PropertyKey propKey = null;
+ if (!graphMgt.containsPropertyKey(prop.getProperty())) {
+ Class<?> clazz = prop.getClazz();
+ if (!ArrayList.class.getName().equals(clazz.getName()) && !HashMap.class.getName().equals(clazz.getName())) {
+ propKey = graphMgt.makePropertyKey(prop.getProperty()).dataType(prop.getClazz()).make();
+ }
+ } else {
+ propKey = graphMgt.getPropertyKey(prop.getProperty());
+ }
+ if (prop.isIndexed()) {
+ if (!graphMgt.containsGraphIndex(prop.getProperty())) {
+ if (prop.isUnique()) {
+ index = graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).unique().buildCompositeIndex();
+
+ graphMgt.setConsistency(propKey, ConsistencyModifier.LOCK); // Ensures
+ // only
+ // one
+ // name
+ // per
+ // vertex
+ graphMgt.setConsistency(index, ConsistencyModifier.LOCK); // Ensures
+ // name
+ // uniqueness
+ // in
+ // the
+ // graph
+
+ } else {
+ graphMgt.buildIndex(prop.getProperty(), Vertex.class).addKey(propKey).buildCompositeIndex();
+ }
+ }
+ }
+ }
+ graphMgt.commit();
+ }
+
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java
index e4da028c60..84d9663e59 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java
@@ -51,56 +51,34 @@ public class ArtifactData extends GraphNode {
public ArtifactData(Map<String, Object> properties) {
this();
artifactDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
- artifactDataDefinition
- .setArtifactType((String) properties.get(GraphPropertiesDictionary.ARTIFACT_TYPE.getProperty()));
- artifactDataDefinition
- .setArtifactRef((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REF.getProperty()));
+ artifactDataDefinition.setArtifactType((String) properties.get(GraphPropertiesDictionary.ARTIFACT_TYPE.getProperty()));
+ artifactDataDefinition.setArtifactRef((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REF.getProperty()));
artifactDataDefinition.setArtifactName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty()));
- artifactDataDefinition.setArtifactRepository(
- (String) properties.get(GraphPropertiesDictionary.ARTIFACT_REPOSITORY.getProperty()));
- artifactDataDefinition.setArtifactChecksum(
- (String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
- artifactDataDefinition
- .setArtifactCreator((String) properties.get(GraphPropertiesDictionary.CREATOR.getProperty()));
- artifactDataDefinition
- .setUserIdCreator((String) properties.get(GraphPropertiesDictionary.ATT_CREATOR.getProperty()));
- artifactDataDefinition
- .setUserIdLastUpdater((String) properties.get(GraphPropertiesDictionary.LAST_UPDATER.getProperty()));
- artifactDataDefinition
- .setCreatorFullName((String) properties.get(GraphPropertiesDictionary.CREATOR_FULL_NAME.getProperty()));
- artifactDataDefinition
- .setUpdaterFullName((String) properties.get(GraphPropertiesDictionary.UPDATER_FULL_NAME.getProperty()));
- artifactDataDefinition
- .setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
- artifactDataDefinition
- .setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
- artifactDataDefinition
- .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty()));
+ artifactDataDefinition.setArtifactRepository((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REPOSITORY.getProperty()));
+ artifactDataDefinition.setArtifactChecksum((String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
+ artifactDataDefinition.setArtifactCreator((String) properties.get(GraphPropertiesDictionary.CREATOR.getProperty()));
+ artifactDataDefinition.setUserIdCreator((String) properties.get(GraphPropertiesDictionary.CREATOR_ID.getProperty()));
+ artifactDataDefinition.setUserIdLastUpdater((String) properties.get(GraphPropertiesDictionary.LAST_UPDATER.getProperty()));
+ artifactDataDefinition.setCreatorFullName((String) properties.get(GraphPropertiesDictionary.CREATOR_FULL_NAME.getProperty()));
+ artifactDataDefinition.setUpdaterFullName((String) properties.get(GraphPropertiesDictionary.UPDATER_FULL_NAME.getProperty()));
+ artifactDataDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
+ artifactDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
+ artifactDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty()));
artifactDataDefinition.setEsId((String) properties.get(GraphPropertiesDictionary.ES_ID.getProperty()));
- artifactDataDefinition
- .setArtifactLabel((String) properties.get(GraphPropertiesDictionary.ARTIFACT_LABEL.getProperty()));
- artifactDataDefinition
- .setMandatory((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty()));
- artifactDataDefinition.setArtifactChecksum(
- (String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
- artifactDataDefinition.setArtifactDisplayName(
- (String) properties.get(GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME.getProperty()));
+ artifactDataDefinition.setArtifactLabel((String) properties.get(GraphPropertiesDictionary.ARTIFACT_LABEL.getProperty()));
+ artifactDataDefinition.setMandatory((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty()));
+ artifactDataDefinition.setArtifactChecksum((String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty()));
+ artifactDataDefinition.setArtifactDisplayName((String) properties.get(GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME.getProperty()));
artifactDataDefinition.setApiUrl((String) properties.get(GraphPropertiesDictionary.API_URL.getProperty()));
- artifactDataDefinition
- .setServiceApi((Boolean) properties.get(GraphPropertiesDictionary.SERVICE_API.getProperty()));
- artifactDataDefinition
- .setArtifactVersion((String) properties.get(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty()));
- artifactDataDefinition
- .setArtifactUUID((String) properties.get(GraphPropertiesDictionary.ARTIFACT_UUID.getProperty()));
- artifactDataDefinition.setPayloadUpdateDate(
- (Long) properties.get(GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE.getProperty()));
- artifactDataDefinition.setHeatParamsUpdateDate(
- (Long) properties.get(GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE.getProperty()));
+ artifactDataDefinition.setServiceApi((Boolean) properties.get(GraphPropertiesDictionary.SERVICE_API.getProperty()));
+ artifactDataDefinition.setArtifactVersion((String) properties.get(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty()));
+ artifactDataDefinition.setArtifactUUID((String) properties.get(GraphPropertiesDictionary.ARTIFACT_UUID.getProperty()));
+ artifactDataDefinition.setPayloadUpdateDate((Long) properties.get(GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE.getProperty()));
+ artifactDataDefinition.setHeatParamsUpdateDate((Long) properties.get(GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE.getProperty()));
artifactDataDefinition.setGenerated((Boolean) properties.get(GraphPropertiesDictionary.GENERATED.getProperty()));
Type listType = new TypeToken<List<String>>() {
}.getType();
- List<String> requiredArtifactsfromJson = getGson().fromJson(
- (String) properties.get(GraphPropertiesDictionary.REQUIRED_ARTIFACTS.getProperty()), listType);
+ List<String> requiredArtifactsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.REQUIRED_ARTIFACTS.getProperty()), listType);
artifactDataDefinition.setRequiredArtifacts(requiredArtifactsfromJson);
String groupType = (String) properties.get(GraphPropertiesDictionary.ARTIFACT_GROUP_TYPE.getProperty());
@@ -141,7 +119,7 @@ public class ArtifactData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_REPOSITORY, artifactDataDefinition.getArtifactRepository());
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_CHECKSUM, artifactDataDefinition.getArtifactChecksum());
addIfExists(map, GraphPropertiesDictionary.CREATOR, artifactDataDefinition.getArtifactCreator());
- addIfExists(map, GraphPropertiesDictionary.ATT_CREATOR, artifactDataDefinition.getUserIdCreator());
+ addIfExists(map, GraphPropertiesDictionary.CREATOR_ID, artifactDataDefinition.getUserIdCreator());
addIfExists(map, GraphPropertiesDictionary.LAST_UPDATER, artifactDataDefinition.getUserIdLastUpdater());
addIfExists(map, GraphPropertiesDictionary.CREATOR_FULL_NAME, artifactDataDefinition.getCreatorFullName());
addIfExists(map, GraphPropertiesDictionary.UPDATER_FULL_NAME, artifactDataDefinition.getUpdaterFullName());
@@ -152,16 +130,14 @@ public class ArtifactData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_LABEL, artifactDataDefinition.getArtifactLabel());
addIfExists(map, GraphPropertiesDictionary.IS_ABSTRACT, artifactDataDefinition.getMandatory());
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_CHECKSUM, artifactDataDefinition.getArtifactChecksum());
- addIfExists(map, GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME,
- artifactDataDefinition.getArtifactDisplayName());
+ addIfExists(map, GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME, artifactDataDefinition.getArtifactDisplayName());
addIfExists(map, GraphPropertiesDictionary.API_URL, artifactDataDefinition.getApiUrl());
addIfExists(map, GraphPropertiesDictionary.SERVICE_API, artifactDataDefinition.getServiceApi());
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_TIMEOUT, artifactDataDefinition.getTimeout());
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_VERSION, artifactDataDefinition.getArtifactVersion());
addIfExists(map, GraphPropertiesDictionary.ARTIFACT_UUID, artifactDataDefinition.getArtifactUUID());
addIfExists(map, GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE, artifactDataDefinition.getPayloadUpdateDate());
- addIfExists(map, GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE,
- artifactDataDefinition.getHeatParamsUpdateDate());
+ addIfExists(map, GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE, artifactDataDefinition.getHeatParamsUpdateDate());
addIfExists(map, GraphPropertiesDictionary.REQUIRED_ARTIFACTS, artifactDataDefinition.getRequiredArtifacts());
addIfExists(map, GraphPropertiesDictionary.GENERATED, artifactDataDefinition.getGenerated());
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/CapabilityData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java
index 2582475c5c..9f04c56be2 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java
@@ -27,13 +27,12 @@ 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.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import com.google.gson.reflect.TypeToken;
public class CapabilityData extends GraphNode {
- public final static String MIN_OCCURRENCES = "1"; // occurrences
- public final static String MAX_OCCURRENCES = "UNBOUNDED";
public CapabilityData() {
super(NodeTypeEnum.Capability);
@@ -74,8 +73,8 @@ public class CapabilityData extends GraphNode {
private Long modificationTime;
- private String minOccurrences = MIN_OCCURRENCES;
- private String maxOccurrences = MAX_OCCURRENCES;
+ private String minOccurrences = CapabilityDataDefinition.MIN_OCCURRENCES;
+ private String maxOccurrences = CapabilityDataDefinition.MAX_OCCURRENCES;
public String getUniqueId() {
return uniqueId;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java
index c61b99a805..b55b208048 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java
@@ -32,15 +32,24 @@ import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
public class ComponentInstanceData extends GraphNode {
ComponentInstanceDataDefinition componentInstDataDefinition;
+ protected Integer groupInstanceCounter;
public ComponentInstanceData() {
super(NodeTypeEnum.ResourceInstance);
this.componentInstDataDefinition = new ComponentInstanceDataDefinition();
+ this.groupInstanceCounter = 0;
}
public ComponentInstanceData(ComponentInstanceDataDefinition componentInstDataDefinition) {
super(NodeTypeEnum.ResourceInstance);
this.componentInstDataDefinition = componentInstDataDefinition;
+ this.groupInstanceCounter = 0;
+ }
+
+ public ComponentInstanceData(ComponentInstanceDataDefinition componentInstDataDefinition, Integer groupInstanceCounter) {
+ super(NodeTypeEnum.ResourceInstance);
+ this.componentInstDataDefinition = componentInstDataDefinition;
+ this.groupInstanceCounter = groupInstanceCounter;
}
public ComponentInstanceData(Map<String, Object> properties) {
@@ -59,6 +68,8 @@ public class ComponentInstanceData extends GraphNode {
componentInstDataDefinition.setAttributeValueCounter((Integer) properties.get(GraphPropertiesDictionary.ATTRIBUTE_COUNTER.getProperty()));
componentInstDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()));
componentInstDataDefinition.setOriginType(OriginTypeEnum.findByValue((String) properties.get(GraphPropertiesDictionary.ORIGIN_TYPE.getProperty())));
+ componentInstDataDefinition.setCustomizationUUID((String) properties.get(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty()));
+ groupInstanceCounter = (Integer) properties.get(GraphPropertiesDictionary.INSTANCE_COUNTER.getProperty());
}
@Override
@@ -76,10 +87,12 @@ public class ComponentInstanceData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.NAME, componentInstDataDefinition.getName());
addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, componentInstDataDefinition.getPropertyValueCounter());
addIfExists(map, GraphPropertiesDictionary.ATTRIBUTE_COUNTER, componentInstDataDefinition.getAttributeValueCounter());
+ addIfExists(map, GraphPropertiesDictionary.INSTANCE_COUNTER, groupInstanceCounter);
addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, componentInstDataDefinition.getNormalizedName());
if (componentInstDataDefinition.getOriginType() != null) {
addIfExists(map, GraphPropertiesDictionary.ORIGIN_TYPE, componentInstDataDefinition.getOriginType().getValue());
}
+ addIfExists(map, GraphPropertiesDictionary.CUSTOMIZATION_UUID, componentInstDataDefinition.getCustomizationUUID());
return map;
}
@@ -111,4 +124,16 @@ public class ComponentInstanceData extends GraphNode {
return "ComponentInstanceData [componentInstDataDefinition=" + componentInstDataDefinition + "]";
}
+ public Integer getGroupInstanceCounter() {
+ return groupInstanceCounter;
+ }
+
+ public void setGroupInstanceCounter(Integer componentInstanceCounter) {
+ this.groupInstanceCounter = componentInstanceCounter;
+ }
+
+ public Integer increaseAndGetGroupInstanceCounter() {
+ return ++groupInstanceCounter;
+ }
+
}
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 e39dfe226f..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
@@ -28,6 +28,8 @@ 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.components.ComponentMetadataDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import com.google.gson.reflect.TypeToken;
@@ -43,44 +45,38 @@ public abstract class ComponentMetadataData extends GraphNode {
this.componentInstanceCounter = 0;
}
- public ComponentMetadataData(NodeTypeEnum label, ComponentMetadataDataDefinition metadataDataDefinition,
- Map<String, Object> properties) {
+ @SuppressWarnings("unchecked")
+ public ComponentMetadataData(NodeTypeEnum label, ComponentMetadataDataDefinition metadataDataDefinition, Map<String, Object> properties) {
this(label, metadataDataDefinition);
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.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()));
+ metadataDataDefinition.setHighestVersion((Boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()));
+ metadataDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
metadataDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty()));
metadataDataDefinition.setState((String) properties.get(GraphPropertiesDictionary.STATE.getProperty()));
- Type listType = new TypeToken<List<String>>() {
- }.getType();
- List<String> tagsFromJson = getGson()
- .fromJson((String) properties.get(GraphPropertiesDictionary.TAGS.getProperty()), listType);
+ List<String> tagsFromJson;
+ if(properties.get(GraphPropertiesDictionary.TAGS.getProperty()) instanceof List<?>){
+ tagsFromJson = (List<String>) properties.get(GraphPropertiesDictionary.TAGS.getProperty());
+ } else {
+ Type listType = new TypeToken<List<String>>() {}.getType();
+ tagsFromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.TAGS.getProperty()), listType);
+ }
metadataDataDefinition.setTags(tagsFromJson);
metadataDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty()));
- metadataDataDefinition
- .setContactId((String) properties.get(GraphPropertiesDictionary.CONTACT_ID.getProperty()));
+ metadataDataDefinition.setContactId((String) properties.get(GraphPropertiesDictionary.CONTACT_ID.getProperty()));
metadataDataDefinition.setUUID((String) properties.get(GraphPropertiesDictionary.UUID.getProperty()));
- metadataDataDefinition
- .setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()));
- metadataDataDefinition
- .setSystemName((String) properties.get(GraphPropertiesDictionary.SYSTEM_NAME.getProperty()));
- metadataDataDefinition
- .setIsDeleted((Boolean) properties.get(GraphPropertiesDictionary.IS_DELETED.getProperty()));
+ metadataDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()));
+ metadataDataDefinition.setSystemName((String) properties.get(GraphPropertiesDictionary.SYSTEM_NAME.getProperty()));
+ metadataDataDefinition.setIsDeleted((Boolean) properties.get(GraphPropertiesDictionary.IS_DELETED.getProperty()));
metadataDataDefinition.setProjectCode((String) properties.get(GraphPropertiesDictionary.PROJECT_CODE.getProperty()));
metadataDataDefinition.setCsarUUID((String) properties.get(GraphPropertiesDictionary.CSAR_UUID.getProperty()));
- metadataDataDefinition
- .setCsarVersion((String) properties.get(GraphPropertiesDictionary.CSAR_VERSION.getProperty()));
- metadataDataDefinition.setImportedToscaChecksum(
- (String) properties.get(GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM.getProperty()));
- metadataDataDefinition
- .setInvariantUUID((String) properties.get(GraphPropertiesDictionary.INVARIANT_UUID.getProperty()));
+ metadataDataDefinition.setCsarVersion((String) properties.get(GraphPropertiesDictionary.CSAR_VERSION.getProperty()));
+ metadataDataDefinition.setImportedToscaChecksum((String) properties.get(GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM.getProperty()));
+ metadataDataDefinition.setInvariantUUID((String) properties.get(GraphPropertiesDictionary.INVARIANT_UUID.getProperty()));
+// metadataDataDefinition.setComponentType(ComponentTypeEnum.valueOf((String) properties.get(GraphPropertyEnum.COMPONENT_TYPE.getProperty())));
componentInstanceCounter = (Integer) properties.get(GraphPropertiesDictionary.INSTANCE_COUNTER.getProperty());
}
@@ -92,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());
@@ -107,8 +104,7 @@ public abstract class ComponentMetadataData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.PROJECT_CODE, metadataDataDefinition.getProjectCode());
addIfExists(map, GraphPropertiesDictionary.CSAR_UUID, metadataDataDefinition.getCsarUUID());
addIfExists(map, GraphPropertiesDictionary.CSAR_VERSION, metadataDataDefinition.getCsarVersion());
- addIfExists(map, GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM,
- metadataDataDefinition.getImportedToscaChecksum());
+ addIfExists(map, GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM, metadataDataDefinition.getImportedToscaChecksum());
addIfExists(map, GraphPropertiesDictionary.INVARIANT_UUID, metadataDataDefinition.getInvariantUUID());
return map;
}
@@ -140,8 +136,7 @@ public abstract class ComponentMetadataData extends GraphNode {
@Override
public String toString() {
- return "ComponentMetadataData [metadataDataDefinition=" + metadataDataDefinition + ", componentInstanceCounter="
- + componentInstanceCounter + "]";
+ return "ComponentMetadataData [metadataDataDefinition=" + metadataDataDefinition + ", componentInstanceCounter=" + componentInstanceCounter + "]";
}
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java
index 1016930e2a..3fb085f3d2 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java
@@ -46,12 +46,19 @@ public class ConsumerData extends GraphNode {
public ConsumerData(Map<String, Object> properties) {
super(NodeTypeEnum.ConsumerCredentials);
consumerDataDefinition = new ConsumerDataDefinition();
- consumerDataDefinition.setConsumerDetailsLastupdatedtime((Long) properties.get(GraphPropertiesDictionary.CONSUMER_DETAILS_LAST_UPDATED_TIME.getProperty()));
- consumerDataDefinition.setConsumerLastAuthenticationTime((Long) properties.get(GraphPropertiesDictionary.CONSUMER_LAST_AUTHENTICATION_TIME.getProperty()));
- consumerDataDefinition.setConsumerName((String) properties.get(GraphPropertiesDictionary.CONSUMER_NAME.getProperty()));
- consumerDataDefinition.setConsumerPassword((String) properties.get(GraphPropertiesDictionary.CONSUMER_PASSWORD.getProperty()));
- consumerDataDefinition.setConsumerSalt((String) properties.get(GraphPropertiesDictionary.CONSUMER_SALT.getProperty()));
- consumerDataDefinition.setLastModfierAtuid((String) properties.get(GraphPropertiesDictionary.LAST_MODIFIER_USER_ID.getProperty()));
+ consumerDataDefinition.setConsumerDetailsLastupdatedtime(
+ (Long) properties.get(GraphPropertiesDictionary.CONSUMER_DETAILS_LAST_UPDATED_TIME.getProperty()));
+ consumerDataDefinition.setConsumerLastAuthenticationTime(
+ (Long) properties.get(GraphPropertiesDictionary.CONSUMER_LAST_AUTHENTICATION_TIME.getProperty()));
+ consumerDataDefinition
+ .setConsumerName((String) properties.get(GraphPropertiesDictionary.CONSUMER_NAME.getProperty()));
+ consumerDataDefinition.setConsumerPassword(
+ (String) properties.get(GraphPropertiesDictionary.CONSUMER_PASSWORD.getProperty()));
+ consumerDataDefinition
+ .setConsumerSalt((String) properties.get(GraphPropertiesDictionary.CONSUMER_SALT.getProperty()));
+ consumerDataDefinition.setLastModfierAtuid(
+ (String) properties.get(GraphPropertiesDictionary.LAST_MODIFIER_USER_ID.getProperty()));
+
}
@Override
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESArtifactData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESArtifactData.java
index 56101d031f..b198985b69 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESArtifactData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ESArtifactData.java
@@ -26,13 +26,13 @@ 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 = "resources")
+@Table(keyspace = "sdcartifact", name = "resources")
public class ESArtifactData {
- public final static String RRESOURCE_ID_FIELD = "resourceId";
+ public static final String RRESOURCE_ID_FIELD = "resourceId";
- public final static String SERVICE_NAME_FIELD = "serviceName";
- public final static String SERVICE_VERSION_FIELD = "serviceVersion";
- public final static String ARTIFACT_NAME_FIELD = "artifactName";
+ public static final String SERVICE_NAME_FIELD = "serviceName";
+ public static final String SERVICE_VERSION_FIELD = "serviceVersion";
+ public static final String ARTIFACT_NAME_FIELD = "artifactName";
public static String delim = ":";
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java
new file mode 100644
index 0000000000..7138fe5f72
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.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.ComponentInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
+
+
+public class GroupInstanceData extends GraphNode {
+
+ GroupInstanceDataDefinition groupDataDefinition;
+
+ public GroupInstanceData() {
+ super(NodeTypeEnum.GroupInstance);
+ this.groupDataDefinition = new GroupInstanceDataDefinition();
+ }
+
+ public GroupInstanceData(GroupInstanceDataDefinition groupDataDefinition) {
+ super(NodeTypeEnum.GroupInstance);
+ this.groupDataDefinition = groupDataDefinition;
+ }
+
+ public GroupInstanceData(Map<String, Object> properties) {
+
+ this();
+
+ groupDataDefinition
+ .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
+ groupDataDefinition
+ .setGroupUid((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()));
+ groupDataDefinition
+ .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
+ groupDataDefinition
+ .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
+
+ groupDataDefinition
+ .setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty()));
+ groupDataDefinition
+ .setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty()));
+ groupDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty()));
+ groupDataDefinition.setPropertyValueCounter(
+ (Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty()));
+
+ groupDataDefinition
+ .setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()));
+
+ groupDataDefinition
+ .setCustomizationUUID((String) properties.get(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty()));
+ }
+
+ @Override
+ public Map<String, Object> toGraphMap() {
+
+ Map<String, Object> map = new HashMap<String, Object>();
+
+ addIfExists(map, GraphPropertiesDictionary.TYPE, groupDataDefinition.getGroupUid());
+ addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, groupDataDefinition.getCreationTime());
+ addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, groupDataDefinition.getModificationTime());
+
+ addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupDataDefinition.getUniqueId());
+ addIfExists(map, GraphPropertiesDictionary.POSITION_X, groupDataDefinition.getPosX());
+ addIfExists(map, GraphPropertiesDictionary.POSITION_Y, groupDataDefinition.getPosY());
+ addIfExists(map, GraphPropertiesDictionary.NAME, groupDataDefinition.getName());
+ addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER,
+ groupDataDefinition.getPropertyValueCounter());
+
+ addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, groupDataDefinition.getNormalizedName());
+
+ addIfExists(map, GraphPropertiesDictionary.CUSTOMIZATION_UUID, groupDataDefinition.getCustomizationUUID());
+
+ return map;
+ }
+
+ @Override
+ public String getUniqueId() {
+ return groupDataDefinition.getUniqueId();
+ }
+
+ public String getName() {
+ return groupDataDefinition.getName();
+ }
+
+ @Override
+ public String getUniqueIdKey() {
+ return GraphPropertiesDictionary.UNIQUE_ID.getProperty();
+ }
+
+ public GroupInstanceDataDefinition getGroupDataDefinition() {
+ return groupDataDefinition;
+ }
+
+ public void setComponentInstDataDefinition(GroupInstanceDataDefinition groupDataDefinition) {
+ this.groupDataDefinition = groupDataDefinition;
+ }
+
+ @Override
+ public String toString() {
+ return "GroupInstanceData [groupInstDataDefinition=" + groupDataDefinition + "]";
+ }
+
+
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java
index 7ceecf7e21..2e434955e6 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.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.datatypes.elements.RelationshipTypeDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import com.google.gson.reflect.TypeToken;
public class RelationshipTypeData extends GraphNode {
- RelationshipTypeDataDefinition relationshipTypeDataDefinition;
+ RelationshipInstDataDefinition relationshipTypeDataDefinition;
public RelationshipTypeData() {
super(NodeTypeEnum.RelationshipType);
- relationshipTypeDataDefinition = new RelationshipTypeDataDefinition();
+ relationshipTypeDataDefinition = new RelationshipInstDataDefinition();
}
- public RelationshipTypeData(RelationshipTypeDataDefinition relationshipTypeDataDefinition) {
+ public RelationshipTypeData(RelationshipInstDataDefinition relationshipTypeDataDefinition) {
super(NodeTypeEnum.RelationshipType);
this.relationshipTypeDataDefinition = relationshipTypeDataDefinition;
}
@@ -107,11 +107,11 @@ public class RelationshipTypeData extends GraphNode {
return map;
}
- public RelationshipTypeDataDefinition getRelationshipTypeDataDefinition() {
+ public RelationshipInstDataDefinition getRelationshipTypeDataDefinition() {
return relationshipTypeDataDefinition;
}
- public void setRelationshipTypeDataDefinition(RelationshipTypeDataDefinition relationshipTypeDataDefinition) {
+ public void setRelationshipTypeDataDefinition(RelationshipInstDataDefinition relationshipTypeDataDefinition) {
this.relationshipTypeDataDefinition = relationshipTypeDataDefinition;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java
index 2b7e2d22b7..69fa9279c4 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java
@@ -25,12 +25,10 @@ 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.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
public class RequirementData extends GraphNode {
- public final static String MIN_OCCURRENCES = "1";
- public final static String MAX_OCCURRENCES = "UNBOUNDED";
- public final static String MAX_DEFAULT_OCCURRENCES = "1";
private String uniqueId;
@@ -41,8 +39,8 @@ public class RequirementData extends GraphNode {
private Long modificationTime;
private String relationshipType;
- private String minOccurrences = MIN_OCCURRENCES;
- private String maxOccurrences = MAX_DEFAULT_OCCURRENCES;
+ private String minOccurrences = RequirementDataDefinition.MIN_OCCURRENCES;
+ private String maxOccurrences = RequirementDataDefinition.MAX_DEFAULT_OCCURRENCES;
public RequirementData() {
super(NodeTypeEnum.Requirement);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java
index 9df3d7cfac..06e098ff4b 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java
@@ -40,40 +40,26 @@ public class ResourceMetadataData extends ComponentMetadataData {
public ResourceMetadataData(Map<String, Object> properties) {
super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition(), properties);
- ((ResourceMetadataDataDefinition) metadataDataDefinition)
- .setVendorName((String) properties.get(GraphPropertiesDictionary.VENDOR_NAME.getProperty()));
- ((ResourceMetadataDataDefinition) metadataDataDefinition)
- .setVendorRelease((String) properties.get(GraphPropertiesDictionary.VENDOR_RELEASE.getProperty()));
- ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(ResourceTypeEnum
- .valueOf((String) properties.get(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty())));
- ((ResourceMetadataDataDefinition) metadataDataDefinition)
- .setAbstract((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty()));
- ((ResourceMetadataDataDefinition) metadataDataDefinition)
- .setCost((String) properties.get(GraphPropertiesDictionary.COST.getProperty()));
- ((ResourceMetadataDataDefinition) metadataDataDefinition)
- .setLicenseType((String) properties.get(GraphPropertiesDictionary.LICENSE_TYPE.getProperty()));
- ((ResourceMetadataDataDefinition) metadataDataDefinition).setToscaResourceName(
- (String) properties.get(GraphPropertiesDictionary.TOSCA_RESOURCE_NAME.getProperty()));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorName((String) properties.get(GraphPropertiesDictionary.VENDOR_NAME.getProperty()));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorRelease((String) properties.get(GraphPropertiesDictionary.VENDOR_RELEASE.getProperty()));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(ResourceTypeEnum.valueOf((String) properties.get(GraphPropertiesDictionary.RESOURCE_TYPE.getProperty())));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setAbstract((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty()));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setCost((String) properties.get(GraphPropertiesDictionary.COST.getProperty()));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setLicenseType((String) properties.get(GraphPropertiesDictionary.LICENSE_TYPE.getProperty()));
+ ((ResourceMetadataDataDefinition) metadataDataDefinition).setToscaResourceName((String) properties.get(GraphPropertiesDictionary.TOSCA_RESOURCE_NAME.getProperty()));
}
@Override
public Map<String, Object> toGraphMap() {
Map<String, Object> graphMap = super.toGraphMap();
- addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorName());
- addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorRelease());
- addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).getResourceType().name());
- addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).isAbstract());
- addIfExists(graphMap, GraphPropertiesDictionary.COST,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).getCost());
- addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).getLicenseType());
- addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME,
- ((ResourceMetadataDataDefinition) metadataDataDefinition).getToscaResourceName());
+ addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorName());
+ addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorRelease());
+ addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getResourceType().name());
+ addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT, ((ResourceMetadataDataDefinition) metadataDataDefinition).isAbstract());
+ addIfExists(graphMap, GraphPropertiesDictionary.COST, ((ResourceMetadataDataDefinition) metadataDataDefinition).getCost());
+ addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getLicenseType());
+ addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getToscaResourceName());
return graphMap;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java
new file mode 100644
index 0000000000..96ab5aedc8
--- /dev/null
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java
@@ -0,0 +1,114 @@
+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 SdcSchemaFilesData {
+ @PartitionKey(0)
+ @Column(name = "sdcreleasenum")
+ private String sdcReleaseNum;
+
+ @ClusteringColumn
+ @Column(name = "timestamp")
+ private Date timestamp;
+
+ @PartitionKey(1)
+ @Column(name = "conformanceLevel")
+ private String conformanceLevel;
+
+ @Column(name = "fileName")
+ private String fileName;
+
+ @Column(name = "payload")
+ private ByteBuffer payload;
+
+ @Column(name = "checksum")
+ private String checksum;
+
+ public SdcSchemaFilesData() {
+
+ }
+
+ 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;
+ }
+
+ public void setSdcReleaseNum(String sdcReleaseNum) {
+ this.sdcReleaseNum = sdcReleaseNum;
+ }
+
+ public String getConformanceLevel() {
+ return conformanceLevel;
+ }
+
+ public void setConformanceLevel(String conformanceLevel) {
+ this.conformanceLevel = conformanceLevel;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public ByteBuffer getPayload() {
+ return payload;
+ }
+
+ public void setPayload(ByteBuffer payload) {
+ if(payload != null){
+ this.payload = payload.duplicate();
+ }
+ }
+
+ public void setPayloadAsArray(byte[] payload) {
+ if(payload != null){
+ this.payload = ByteBuffer.wrap(payload.clone());
+ }
+ }
+
+ public byte[] getPayloadAsArray() {
+ return payload != null ? payload.array() : null;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getChecksum() {
+ return checksum;
+ }
+
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ @Override
+ public String toString() {
+ return "SdcSchemaFilesData [sdcReleaseNum=" + sdcReleaseNum + ", timestamp=" + timestamp + ", conformanceLevel="
+ + conformanceLevel + ", fileName=" + fileName + ", checksum=" + checksum + "]";
+ }
+}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java
index d09caacabe..78974c4a77 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java
@@ -197,7 +197,7 @@ public class UserData extends GraphNode {
@Override
public Map<String, Object> toGraphMap() {
Map<String, Object> map = new HashMap<String, Object>();
- addIfExists(map, GraphPropertiesDictionary.USER_ID, userId);
+ addIfExists(map, GraphPropertiesDictionary.USERID, userId);
addIfExists(map, GraphPropertiesDictionary.EMAIL, email);
addIfExists(map, GraphPropertiesDictionary.FIRST_NAME, firstName);
addIfExists(map, GraphPropertiesDictionary.LAST_NAME, lastName);
@@ -209,7 +209,7 @@ public class UserData extends GraphNode {
@Override
public String getUniqueIdKey() {
- return GraphPropertiesDictionary.USER_ID.getProperty();
+ return GraphPropertiesDictionary.USERID.getProperty();
}
@Override
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java
index 8b0bd58d9e..cfc37f19e2 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java
@@ -46,14 +46,20 @@ public enum AuditingActionEnum {
UPDATE_RESOURCE_METADATA("UpdateResourceMetadata", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
UPDATE_SERVICE_METADATA("UpdateServiceMetadata", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
ARTIFACT_UPLOAD("ArtifactUpload", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
+ //External API
ARTIFACT_UPLOAD_BY_API("ArtifactUploadByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
ARTIFACT_UPDATE_BY_API("ArtifactUpdateByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
ARTIFACT_DELETE_BY_API("ArtifactDeleteByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
+ DOWNLOAD_ARTIFACT("DownloadArtifact",AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
+ CREATE_RESOURCE_BY_API("CreateResourceByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
+ CHANGE_LIFECYCLE_BY_API("ChangeLifecycleByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
+
+
ARTIFACT_PAYLOAD_UPDATE("ArtifactPayloadUpdate", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
ARTIFACT_METADATA_UPDATE("ArtifactMetadataUpdate", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
ARTIFACT_DELETE("ArtifactDelete", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
ARTIFACT_DOWNLOAD("ArtifactDownload", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE),
- DOWNLOAD_ARTIFACT("DownloadArtifact",AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE),
+
// Distribution
DISTRIBUTION_ARTIFACT_DOWNLOAD("DArtifactDownload", AuditingTypesConstants.DISTRIBUTION_DOWNLOAD_EVENT_TYPE),
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java
index 99a42e852e..5c8cded0db 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java
@@ -34,7 +34,7 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-@Table(keyspace = "sdcAudit", name = AuditingTypesConstants.AUTH_EVENT_TYPE)
+@Table(keyspace = "sdcaudit", name = AuditingTypesConstants.AUTH_EVENT_TYPE)
public class AuthEvent extends AuditingGenericEvent {
private static String AUTH_EVENT_TEMPLATE = "action=\"%s\" timestamp=\"%s\" "
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java
index 027c57c5c9..f32acc81c4 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java
@@ -34,6 +34,10 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+/**
+ * This class Represents the Audit for External API
+ *
+ */
@Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE)
public class ExternalApiEvent extends AuditingGenericEvent {
@PartitionKey
@@ -64,9 +68,24 @@ public class ExternalApiEvent extends AuditingGenericEvent {
@Column(name = "service_instance_id")
protected String serviceInstanceId;
+
+ @Column(name = "invariant_uuid")
+ protected String invariantUuid;
@Column(name = "modifier")
private String modifier;
+
+ @Column(name = "prev_version")
+ protected String prevVersion;
+
+ @Column(name = "curr_version")
+ private String currVersion;
+
+ @Column(name = "prev_state")
+ protected String prevState;
+
+ @Column(name = "curr_state")
+ protected String currState;
@Column(name = "prev_artifact_uuid")
private String prevArtifactUuid;
@@ -119,10 +138,35 @@ public class ExternalApiEvent extends AuditingGenericEvent {
if (value != null) {
setServiceInstanceId((String) value);
}
+ value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID);
+ if (value != null) {
+ setInvariantUuid((String) value);
+ }
value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID);
if (value != null) {
setModifier((String) value);
}
+
+ value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION);
+ if (value != null) {
+ setPrevVersion((String) value);
+ }
+
+ value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION);
+ if (value != null) {
+ setCurrVersion((String) value);
+ }
+
+ value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE);
+ if (value != null) {
+ setPrevState((String) value);
+ }
+
+ value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE);
+ if (value != null) {
+ setCurrState((String) value);
+ }
+
value = auditingFields.get(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID);
if (value != null) {
setPrevArtifactUuid((String) value);
@@ -140,6 +184,7 @@ public class ExternalApiEvent extends AuditingGenericEvent {
@Override
public void fillFields() {
fields.put(AuditingFieldsKeysEnum.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId());
+ fields.put(AuditingFieldsKeysEnum.AUDIT_INVARIANT_UUID.getDisplayName(), getInvariantUuid());
fields.put(AuditingFieldsKeysEnum.AUDIT_ACTION.getDisplayName(), getAction());
fields.put(AuditingFieldsKeysEnum.AUDIT_STATUS.getDisplayName(), getStatus());
fields.put(AuditingFieldsKeysEnum.AUDIT_DESC.getDisplayName(), getDesc());
@@ -151,6 +196,12 @@ public class ExternalApiEvent extends AuditingGenericEvent {
fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_NAME.getDisplayName(), getResourceName());
fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_TYPE.getDisplayName(), getResourceType());
fields.put(AuditingFieldsKeysEnum.AUDIT_MODIFIER_UID.getDisplayName(), getModifier());
+
+ fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_VERSION.getDisplayName(), getPrevVersion());
+ fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_VERSION.getDisplayName(), getCurrVersion());
+ fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_PREV_STATE.getDisplayName(), getPrevState());
+ fields.put(AuditingFieldsKeysEnum.AUDIT_RESOURCE_CURR_STATE.getDisplayName(), getCurrState());
+
fields.put(AuditingFieldsKeysEnum.AUDIT_PREV_ARTIFACT_UUID.getDisplayName(), getPrevArtifactUuid());
fields.put(AuditingFieldsKeysEnum.AUDIT_CURR_ARTIFACT_UUID.getDisplayName(), getCurrArtifactUuid());
fields.put(AuditingFieldsKeysEnum.AUDIT_ARTIFACT_DATA.getDisplayName(), getArtifactData());
@@ -235,6 +286,14 @@ public class ExternalApiEvent extends AuditingGenericEvent {
public void setServiceInstanceId(String serviceInstanceId) {
this.serviceInstanceId = serviceInstanceId;
}
+
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
public String getModifier() {
return modifier;
@@ -273,7 +332,42 @@ public class ExternalApiEvent extends AuditingGenericEvent {
return "ExternalApiEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", action=" + action
+ ", status=" + status + ", desc=" + desc + ", consumerId=" + consumerId + ", resourceURL="
+ resourceURL + ", resourceName=" + resourceName + ", resourceType=" + resourceType
- + ", serviceInstanceId=" + serviceInstanceId + ", modifier=" + modifier + ", prevArtifactUuid="
+ + ", serviceInstanceId=" + serviceInstanceId + ", invariantUuid=" + invariantUuid + ", modifier=" + modifier
+ + ", prevVersion=" + prevVersion+ ", currVersion=" + currVersion
+ + ", prevState=" + prevState + ", currState=" + currState
+ + ", prevArtifactUuid="
+ prevArtifactUuid + ", currArtifactUuid=" + currArtifactUuid + ", artifactData=" + artifactData + "]";
}
+
+ public String getPrevVersion() {
+ return prevVersion;
+ }
+
+ public void setPrevVersion(String prevVersion) {
+ this.prevVersion = prevVersion;
+ }
+
+ public String getCurrVersion() {
+ return currVersion;
+ }
+
+ public void setCurrVersion(String currVersion) {
+ this.currVersion = currVersion;
+ }
+
+ public String getPrevState() {
+ return prevState;
+ }
+
+ public void setPrevState(String prevState) {
+ this.prevState = prevState;
+ }
+
+ public String getCurrState() {
+ return currState;
+ }
+
+ public void setCurrState(String currState) {
+ this.currState = currState;
+ }
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/impl/ResourceUploader.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/impl/ResourceUploader.java
index 1570ff1ed1..a3c5218495 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/impl/ResourceUploader.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/impl/ResourceUploader.java
@@ -140,8 +140,8 @@ public class ResourceUploader implements IResourceUploader {
* getServiceArtifact(artifactUpdateData.getId());
*
* if(getServiceArtifactStatus.isRight()){
- * log.debug("ResourceUploadStatus:updateArtifactt artifact with id {} not exist.",
- * artifactUpdateData.getId()); status =
+ * log.debug("ResourceUploadStatus:updateArtifactt artifact with id " +
+ * artifactUpdateData.getId() + " not exist."); status =
* getServiceArtifactStatus.right().value(); }
* if(getServiceArtifactStatus.isLeft()){ status =
* updateServiceArtifact(artifactUpdateData,
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ArtifactDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ArtifactDaoTest.java
index aa9d30cb12..292ae08f0a 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ArtifactDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ArtifactDaoTest.java
@@ -98,7 +98,6 @@ public class ArtifactDaoTest {
// clearIndex(ICatalogDAO.RESOURCES_INDEX, ArtifactData.class);
// clearIndex(ICatalogDAO.RESOURCES_INDEX, ServiceArtifactData.class);
// } catch (InterruptedException e) {
- // TODO Auto-generated catch block
// e.printStackTrace();
// }
@@ -152,8 +151,7 @@ public class ArtifactDaoTest {
* imageData.setResourceCreator("Marina");
* imageData.setResourceLastUpdater("Marina"); ResourceUploadStatus status =
* daoUploader.saveImage(imageData, true); assertEquals(status,
- * ResourceUploadStatus.OK); } catch (IOException e) { // TODO
- * Auto-generated catch block e.printStackTrace(); }
+ * ResourceUploadStatus.OK); } catch (IOException e) { e.printStackTrace(); }
*
*
* }
@@ -456,7 +454,7 @@ public class ArtifactDaoTest {
* status = daoUploader.saveServiceArtifact(serviceArData1, true);
*
*
- * } catch (Exception e) { // TODO Auto-generated catch block
+ * } catch (Exception e) {
* e.printStackTrace(); }
*
* }
@@ -561,7 +559,7 @@ public class ArtifactDaoTest {
* status = daoUploader.saveServiceArtifact(serviceArData1, true);
*
*
- * } catch (Exception e) { // TODO Auto-generated catch block
+ * } catch (Exception e) {
* e.printStackTrace(); }
*
* }
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ESUsersDAOTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ESUsersDAOTest.java
deleted file mode 100644
index a99acbe2b7..0000000000
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/ESUsersDAOTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * 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.openecomp.sdc.be.resources;
-
-//@RunWith(SpringJUnit4ClassRunner.class)
-//@ContextConfiguration("classpath:application-context-test.xml")
-//@TestExecutionListeners(listeners = {DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class})
-public class ESUsersDAOTest {
-
- // @Resource
- // ElasticSearchClient esclient;
- //
- //// @Resource(name = "users-dao")
- // private IUsersDAO usersDao;
-
- // @Test
- public void testNewUserStub() {
-
- }
-
- // @Test
- public void testNewUser() {
- // if( usersDao == null ){
- // assertTrue(false);
- // }
- //
- // String id = "yhufksd57834601";
- // UserData userData = new UserData("Myname", "Mylastname", id, "email",
- // "Tester");
- //
- // ActionStatus saveUserData = usersDao.saveUserData(userData);
- // assertEquals(saveUserData, ActionStatus.OK);
- //
- // Either<UserData, ActionStatus> statusFromEs =
- // usersDao.getUserData(id);
- // assertTrue(statusFromEs.isLeft() );
- // UserData fromEs = statusFromEs.left().value();
- // assertNotNull(fromEs);
- // assertEquals(userData, fromEs);
- //
- //
- // usersDao.deleteUserData(id);
-
- }
-
-}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JsonParserUtilsTests.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JsonParserUtilsTests.java
new file mode 100644
index 0000000000..c0c49b7b13
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/JsonParserUtilsTests.java
@@ -0,0 +1,56 @@
+package org.openecomp.sdc.be.resources;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+import org.junit.Test;
+import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
+
+public class JsonParserUtilsTests {
+ @Test
+ public void testProperties() throws JsonGenerationException, JsonMappingException, IOException {
+
+ PropertyDataDefinition dataDefinition = new PropertyDataDefinition();
+ dataDefinition.setName("myName");
+ dataDefinition.setDescription("description");
+ dataDefinition.setDefaultValue("default11");
+ SchemaDefinition entrySchema = new SchemaDefinition();
+ PropertyDataDefinition property = new PropertyDataDefinition();
+ property.setName("name12");
+ property.setType("string");
+ entrySchema.setProperty(property);
+ Map<String, PropertyDataDefinition> properties = new HashMap<>();
+ properties.put("key1", property);
+ properties.put("key2", property);
+
+ entrySchema.setProperties(properties );
+ dataDefinition.setSchema(entrySchema);
+
+ Map<String, PropertyDataDefinition> map = new HashMap<>();
+ map.put("prop", dataDefinition);
+
+// String jsonstring = JsonParserUtils.jsonToString(map);
+
+// Map<String, PropertyDataDefinition> parseToJson = JsonParserUtils.parseToJson(jsonstring, PropertyDataDefinition.class);
+// Map<String, PropertyDataDefinition> parseToJson;
+// TypeReference<Map<String, PropertyDataDefinition>> typeRef = new TypeReference<Map<String, PropertyDataDefinition>>() {
+// };
+// ObjectMapper mapper = new ObjectMapper();
+// try {
+// parseToJson = mapper.readValue(jsonstring, typeRef);
+// } catch (Exception e) {
+//// logger.debug("Failed to parse json {}", json, e);
+// }
+
+// System.out.println(parseToJson);
+
+ }
+
+}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java
index a4110f5be3..97ccb43959 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/resources/TitanGenericDaoTest.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.be.resources;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -72,6 +73,8 @@ import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
import com.thinkaurelius.titan.core.TitanVertex;
import com.thinkaurelius.titan.core.attribute.Text;
+import com.thinkaurelius.titan.core.schema.ConsistencyModifier;
+import com.thinkaurelius.titan.core.schema.TitanGraphIndex;
import com.thinkaurelius.titan.core.schema.TitanManagement;
import fj.data.Either;
@@ -122,7 +125,7 @@ public class TitanGenericDaoTest {
@Test
public void testCrudNode() {
- String id = "user12345abc";
+ String id = "userId12345abc";
UserData userData = new UserData("Myname123", "Mylastname", id, "email123", "Tester",
UserStatusEnum.ACTIVE.name(), null);
@@ -163,7 +166,7 @@ public class TitanGenericDaoTest {
public void testGetByCategoryAndAll() {
// create 2 nodes
- String id = "user12345abc";
+ String id = "userId12345abc";
UserData userData1 = new UserData("Myname123", "Mylastname", id, "email123", "Tester",
UserStatusEnum.ACTIVE.name(), null);
@@ -171,7 +174,7 @@ public class TitanGenericDaoTest {
assertTrue(node1.isLeft());
log.debug("{}", node1.left().value());
- id = "userdfkoer45abc";
+ id = "userIddfkoer45abc";
UserData userData2 = new UserData("Mynadyhme123", "Mylasghtname", id, "emaighdl123", "Designer",
UserStatusEnum.ACTIVE.name(), null);
Either<UserData, TitanOperationStatus> node2 = titanDao.createNode(userData2, UserData.class);
@@ -216,7 +219,7 @@ public class TitanGenericDaoTest {
@Test
public void testGetEdgesForNode() {
- String id = "user12345abc";
+ String id = "userId12345abc";
UserData userData = new UserData("Myname123", "Mylastname", id, "email123", UserRoleEnum.ADMIN.name(),
UserStatusEnum.ACTIVE.name(), null);
titanDao.createNode(userData, UserData.class);
@@ -262,7 +265,7 @@ public class TitanGenericDaoTest {
@Test
public void testLockElement() {
-
+
ResourceMetadataData resourceData = new ResourceMetadataData();
resourceData.getMetadataDataDefinition().setName("resourceForLock");
@@ -307,7 +310,7 @@ public class TitanGenericDaoTest {
@Test
public void testReLockElement() throws InterruptedException {
-
+
ResourceMetadataData resourceData = new ResourceMetadataData();
resourceData.getMetadataDataDefinition().setName("resourceForReLock");
@@ -505,27 +508,6 @@ public class TitanGenericDaoTest {
@Test
public void testDuplicateResultDueToTitanBug() {
- // TitanGraph titanGraph = titanDao.getGraph().left().value();
- // TitanManagement managementSystem = titanGraph.getManagementSystem();
-
- // GraphPropertiesDictionary[] properties = {
- // GraphPropertiesDictionary.IS_ABSTRACT,
- // GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY,
- // GraphPropertiesDictionary.POSITION_X,
- // GraphPropertiesDictionary.ARTIFACT_TIMEOUT };
- //
- // for (GraphPropertiesDictionary property : properties) {
- // if (false ==
- // managementSystem.containsGraphIndex(property.getProperty())) {
- // PropertyKey propKey1 =
- // managementSystem.makePropertyKey(property.getProperty()).dataType(property.getClazz()).make();
- // managementSystem.buildIndex(property.getProperty(),
- // Vertex.class).addKey(propKey1).unique().buildCompositeIndex();
- // }
- // }
-
- // managementSystem.commit();
-
ResourceMetadataData resourceData1 = new ResourceMetadataData();
resourceData1.getMetadataDataDefinition().setUniqueId("A");
((ResourceMetadataDataDefinition) resourceData1.getMetadataDataDefinition()).setAbstract(true);
@@ -667,7 +649,7 @@ public class TitanGenericDaoTest {
@Test
public void testDuplicateResultUSeHasNotQueryDueToTitanBug() {
-
+
String name = "bbbb";
ResourceMetadataData resourceData1 = new ResourceMetadataData();
@@ -717,5 +699,5 @@ public class TitanGenericDaoTest {
titanDao.rollback();
}
-
+
}
diff --git a/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml b/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml
index 0b43e3b8c6..67c0ec7b20 100644
--- a/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml
+++ b/catalog-dao/src/test/resources/config/catalog-dao/configuration.yaml
@@ -7,8 +7,8 @@ identificationHeaderFields:
# catalog backend hostname
-beFqdn: 172.20.43.124:8080
-
+beFqdn: 0.0.0.0
+# sdccatalog.att.com
# catalog backend http port
beHttpPort: 8080
@@ -48,7 +48,7 @@ neo4j:
maxHttpPerRoute: 20
cassandraConfig:
- cassandraHosts: ['mtanjv9sdcg44']
+ cassandraHosts: ['000000000']
localDataCenter:
reconnectTimeout : 30000
authenticate: false
@@ -81,23 +81,23 @@ elasticSearch:
creationPeriod: month
switchoverDetector:
- gBeFqdn: AIO-BE.ecomp.idns.cip
- gFeFqdn: AIO-FE.ecomp.idns.cip
- beVip: 1.2.3.4
- feVip: 1.2.3.4
+ gBeFqdn: AIO-BE.ecomp.idns
+ gFeFqdn: AIO-FE.ecomp.idns
+ beVip: 0.0.0.0
+ feVip: 0.0.0.0
beResolveAttempts: 3
feResolveAttempts: 3
enabled: false
interval: 60
changePriorityUser: ecompasdc
changePriorityPassword: ecompasdc123
- publishNetworkUrl: "http://cora.web/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root"
+ publishNetworkUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/update_network?user=root"
publishNetworkBody: '{"note":"publish network"}'
groups:
- beSet: { changePriorityUrl: "http://cora.web/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.cip?user=root",
- changePriorityBody: '{"name":"AIO-BE.ecomp.idns.cip","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.cip","no_ad_redirection":false,"v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_be","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_be"],"failover_policy":["FAILALL"]},"comment":"AIO BE G-fqdn","intended_app_proto":"DNS"}'}
- feSet: { changePriorityUrl: "http://cora.web/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip?user=root",
- changePriorityBody: '{"comment":"AIO G-fqdn","name":"AIO-FE.ecomp.idns.cip","v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_fe","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_fe"],"failover_policy":["FAILALL"]},"no_ad_redirection":false,"intended_app_proto":"DNS","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.cip"}'}
+ beSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com?user=root",
+ changePriorityBody: '{"name":"AIO-BE.ecomp.idns.com","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-BE.ecomp.idns.com","no_ad_redirection":false,"v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_be","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_be"],"failover_policy":["FAILALL"]},"comment":"AIO BE G-fqdn","intended_app_proto":"DNS"}'}
+ feSet: { changePriorityUrl: "http://xxx.com/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.com?user=root",
+ changePriorityBody: '{"comment":"AIO G-fqdn","name":"AIO-FE.ecomp.idns.com","v4groups":{"failover_groups":["/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_mg_fe","/crt/CipDomain.ECOMP-ASDC-DEVST/config/groups/group_bs_fe"],"failover_policy":["FAILALL"]},"no_ad_redirection":false,"intended_app_proto":"DNS","uri":"/crt/CipDomain.ECOMP-ASDC-DEVST/config/sites/AIO-FE.ecomp.idns.com"}'}
applicationL1Cache:
datatypes: