diff options
author | Tal Gitelman <tg851x@intl.att.com> | 2017-12-10 18:55:03 +0200 |
---|---|---|
committer | Tal Gitelman <tg851x@intl.att.com> | 2017-12-10 19:33:38 +0200 |
commit | 51d50f0ef642e0f996a1c8b8d2ef4838bdfec892 (patch) | |
tree | 3ac236a864d74d19b0f5c9020891a7a7e5c31b44 /catalog-dao/src/main | |
parent | b5cc2e0695f195716d6ccdc65e73807a6632ec70 (diff) |
Final commit to master merge from
Change-Id: Ib464f9a8828437c86fe6def8af238aaf83473507
Issue-ID: SDC-714
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-dao/src/main')
36 files changed, 120 insertions, 80 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ActionStatus.java index 4ae3e61841..3b440df653 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 @@ -26,6 +26,7 @@ public enum ActionStatus { USER_ALREADY_EXIST, USER_INACTIVE, USER_NOT_FOUND, USER_HAS_ACTIVE_ELEMENTS, INVALID_EMAIL_ADDRESS, INVALID_ROLE, DELETE_USER_ADMIN_CONFLICT, UPDATE_USER_ADMIN_CONFLICT, CANNOT_DELETE_USER_WITH_ACTIVE_ELEMENTS, CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS, INVALID_USER_ID, // 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, + CAPABILITY_OF_INSTANCE_NOT_FOUND_ON_CONTAINER, REQUIREMENT_OF_INSTANCE_NOT_FOUND_ON_CONTAINER, RELATION_NOT_FOUND, // Resource related 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,INVALID_RESOURCE_TYPE, TOSCA_PARSE_ERROR, // Service related @@ -89,6 +90,5 @@ public enum ActionStatus { // Inputs INPUT_IS_NOT_CHILD_OF_COMPONENT, CFVC_LOOP_DETECTED, - ; } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactAccessor.java index 61e23b8de2..871374eae9 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactAccessor.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactAccessor.java @@ -1,11 +1,9 @@ package org.openecomp.sdc.be.dao.cassandra; import com.datastax.driver.core.ResultSet; -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; -import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; /** 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 5b37d3df2c..df107787e7 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 @@ -22,7 +22,6 @@ package org.openecomp.sdc.be.dao.cassandra; import javax.annotation.PostConstruct; -import com.datastax.driver.core.ResultSet; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.resources.data.ESArtifactData; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; @@ -30,6 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import com.datastax.driver.mapping.MappingManager; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java index 10b9b0578c..38606d00e9 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraClient.java @@ -24,7 +24,6 @@ import java.util.List; import javax.annotation.PreDestroy; -import com.datastax.driver.core.policies.*; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.config.ConfigurationManager; import org.slf4j.Logger; @@ -33,6 +32,11 @@ import org.springframework.stereotype.Component; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; +import com.datastax.driver.core.policies.ConstantReconnectionPolicy; +import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy; +import com.datastax.driver.core.policies.DefaultRetryPolicy; +import com.datastax.driver.core.policies.LoadBalancingPolicy; +import com.datastax.driver.core.policies.TokenAwarePolicy; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java index 1d2eb15354..5ff2917c27 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/CassandraDao.java @@ -20,17 +20,18 @@ package org.openecomp.sdc.be.dao.cassandra; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.Statement; -import com.datastax.driver.core.querybuilder.QueryBuilder; -import fj.data.Either; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; +import com.datastax.driver.core.Statement; +import com.datastax.driver.core.querybuilder.QueryBuilder; import com.datastax.driver.mapping.MappingManager; +import fj.data.Either; + public abstract class CassandraDao { private static Logger logger = LoggerFactory.getLogger(CassandraDao.class.getName()); 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 f9dc9b22a4..fa5c4acaf3 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 @@ -20,21 +20,29 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import com.datastax.driver.core.*; -import com.datastax.driver.core.schemabuilder.Alter; -import com.datastax.driver.core.schemabuilder.Create; -import com.datastax.driver.core.schemabuilder.SchemaBuilder; -import com.datastax.driver.core.schemabuilder.SchemaStatement; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + 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.config.ConfigurationManager; 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 java.util.*; -import java.util.stream.Collectors; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.DataType; +import com.datastax.driver.core.KeyspaceMetadata; +import com.datastax.driver.core.Session; +import com.datastax.driver.core.schemabuilder.Alter; +import com.datastax.driver.core.schemabuilder.Create; +import com.datastax.driver.core.schemabuilder.SchemaBuilder; +import com.datastax.driver.core.schemabuilder.SchemaStatement; public class SdcSchemaBuilder { 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 index 56cf32a152..e1e33871b1 100644 --- 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 @@ -20,12 +20,14 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import com.datastax.driver.core.*; +import java.util.List; + import org.openecomp.sdc.be.config.ConfigurationManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.Session; public class SdcSchemaUtils { 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 f6fd29bd1f..5cbe2508b1 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 @@ -20,7 +20,25 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -import org.openecomp.sdc.be.dao.cassandra.schema.tables.*; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ArtifactTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.AuthEventTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.CategoryEventTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ComponentCacheTableDescription; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ConsumerEventTableDefinition; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribDeployEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribDownloadEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribEngineEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribNotifEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.DistribStatusEventTableDesc; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.ExternalApiEventTableDesc; +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.MigrationTasksTableDescription; +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; public enum Table { 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 c49651e548..facbd5209a 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 @@ -26,12 +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.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; -import com.datastax.driver.mapping.annotations.Column; public class CategoryEventTableDescription implements ITableDescription { @Override 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 611138efa0..1d60bec1cc 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 @@ -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; 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 68ec5620ba..46664c6df8 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 @@ -27,7 +27,6 @@ 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.dao.cassandra.schema.tables.GetUebClusterEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; 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 32c2365b95..a233110f9e 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 @@ -27,7 +27,6 @@ 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.dao.cassandra.schema.tables.DistribDownloadEventTableDesc.DSEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; 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 d1c73bf46e..fe5bb465c3 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 @@ -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/cassandra/schema/tables/ExternalApiEventTableDesc.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/ExternalApiEventTableDesc.java index cb659b9a8a..e35acc3790 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 @@ -24,6 +24,7 @@ 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; 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 3858b7d8f6..4e44bd2975 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 @@ -27,7 +27,6 @@ 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.dao.cassandra.schema.tables.GetUsersListEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; 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 40a1827e36..92b10772e6 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 @@ -27,7 +27,6 @@ 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.dao.cassandra.schema.tables.DistribEngineEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; 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 4bd3e296ef..cdb603de6c 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 @@ -27,7 +27,6 @@ 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.dao.cassandra.schema.tables.GetUebClusterEventTableDesc.DEEFieldsDescription; import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java index 885a7a7ce3..2e8c5ff024 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java @@ -1,9 +1,7 @@ package org.openecomp.sdc.be.dao.cassandra.schema.tables; -import com.datastax.driver.core.DataType; -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 static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MAJOR_VERSION; +import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MINOR_VERSION; import java.util.Arrays; import java.util.Collections; @@ -11,8 +9,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MAJOR_VERSION; -import static org.openecomp.sdc.be.dao.cassandra.schema.tables.MigrationTasksTableDescription.SdcRepoFieldsDescription.MINOR_VERSION; +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 MigrationTasksTableDescription implements ITableDescription { 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 index 7459a4b5d9..ec2dd368e3 100644 --- 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 @@ -24,6 +24,7 @@ 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; 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 e928982127..f6c5689973 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 @@ -26,12 +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.resources.data.auditing.AuditingTypesConstants; import com.datastax.driver.core.DataType; -import com.datastax.driver.mapping.annotations.Column; public class ResAdminEventTableDescription implements ITableDescription { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescription.java index dd8df08cdd..0cfdc2e462 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescription.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/UserAdminEventTableDescription.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/graph/datatype/GraphEdge.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/datatype/GraphEdge.java index 4555f9f9ea..2858a81a60 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/datatype/GraphEdge.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/graph/datatype/GraphEdge.java @@ -22,9 +22,7 @@ package org.openecomp.sdc.be.dao.graph.datatype; import java.util.Map; -import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; public class GraphEdge { 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 bdd1a2fb47..252240b164 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 @@ -35,8 +35,8 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.sort.SortBuilder; -import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig.IndicesTimeFrequencyEntry; +import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.es.ElasticSearchClient; import org.openecomp.sdc.common.api.Constants; 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 index 6966abb1c9..d38e9c03df 100644 --- 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 @@ -30,7 +30,6 @@ 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; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java index c3e88c85bf..08652ba171 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/types/VertexTypeEnum.java @@ -20,7 +20,20 @@ package org.openecomp.sdc.be.dao.jsongraph.types; -import org.openecomp.sdc.be.datatypes.elements.*; +import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; +import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListCapabiltyDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; public enum VertexTypeEnum { 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 index f4aff17ce6..7b0719e063 100644 --- 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 @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.dao.jsongraph.utils; import java.util.UUID; + import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; public class IdBuilderUtils { 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 2af909ee0d..6bba5dac9d 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 @@ -23,8 +23,6 @@ package org.openecomp.sdc.be.dao.neo4j; import java.util.ArrayList; import java.util.List; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - public enum GraphEdgePropertiesDictionary { // field name class type 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 91a984b7f2..563129937e 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 @@ -27,7 +27,6 @@ import java.util.Properties; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; -import org.apache.http.HttpStatus; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; 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 8445d58873..8bd190f932 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 @@ -29,15 +29,12 @@ import java.util.Map.Entry; import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import javax.annotation.Resource; - import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutableTriple; 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.T; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; import org.openecomp.sdc.be.config.ConfigurationManager; @@ -47,7 +44,6 @@ 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; 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 07030472a4..edcf70f093 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 @@ -21,11 +21,7 @@ package org.openecomp.sdc.be.dao.titan; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -37,23 +33,13 @@ import java.util.concurrent.TimeUnit; import javax.annotation.PostConstruct; import org.apache.commons.configuration.BaseConfiguration; -import org.apache.tinkerpop.gremlin.structure.Edge; 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; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.dao.utils.UserStatusEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.resources.data.CategoryData; -import org.openecomp.sdc.be.resources.data.ResourceCategoryData; -import org.openecomp.sdc.be.resources.data.ServiceCategoryData; -import org.openecomp.sdc.be.resources.data.UserData; import org.openecomp.sdc.common.config.EcompErrorName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,7 +53,6 @@ import com.thinkaurelius.titan.core.SchemaViolationException; import com.thinkaurelius.titan.core.TitanConfigurationException; import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanGraphQuery; import com.thinkaurelius.titan.core.TitanVertex; import com.thinkaurelius.titan.core.TitanVertexProperty; import com.thinkaurelius.titan.core.schema.ConsistencyModifier; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/MapUtil.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/MapUtil.java index 84802ce293..e8b2e0c9ad 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/MapUtil.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/MapUtil.java @@ -20,8 +20,14 @@ package org.openecomp.sdc.be.dao.utils; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; /** * Utility class to ease map manipulation. @@ -63,6 +69,38 @@ public final class MapUtil { } /** + * + * @param valuesToMap the list of values to group + * @param groupingFunction the function to group the list values by + * @return a map of list of values grouped by a key, as specified in the {@code groupingFunction} + */ + public static <K,V> Map<K,List<V>> groupListBy(Collection<V> valuesToMap, Function<V,K> groupingFunction) { + return valuesToMap.stream().collect(Collectors.groupingBy(groupingFunction)); + } + + /** + * + * @param valuesToMap list of values to map + * @param mappingFunction a function which specifies how to map each element on the list + * @return a map created by mapping each element from the {@code valuesToMap} as specified in the {@code mappingFunction} + */ + public static <K,V> Map<K,V> toMap(Collection<V> valuesToMap, Function<V,K> mappingFunction) { + return Optional.ofNullable(valuesToMap).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(mappingFunction, Function.identity())); + } + + /** + * + * @param map the map of which it keys to convert + * @param keyMappingFunction a function which converts the key object + * @return a map with converted keys. + */ + public static <K,U, V> Map<U, List<V>> convertMapKeys(Map<K, List<V>> map, Function<K,U> keyMappingFunction) { + return map.entrySet().stream() + .collect(Collectors.toMap(entry -> keyMappingFunction.apply(entry.getKey()), + Map.Entry::getValue)); + } + + /** * Create a new hash map and fills it from the given keys and values * (keys[index] -> values[index]. * diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/api/IResourceUploader.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/api/IResourceUploader.java index 9eea2962e1..46599ed2d8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/api/IResourceUploader.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/api/IResourceUploader.java @@ -20,13 +20,8 @@ package org.openecomp.sdc.be.resources.api; -import java.util.List; -import java.util.Map; - import org.openecomp.sdc.be.dao.api.ResourceUploadStatus; import org.openecomp.sdc.be.resources.data.ESArtifactData; -import org.openecomp.sdc.be.resources.data.ServiceArtifactsDataCollection; -import org.openecomp.sdc.be.resources.exception.ResourceDAOException; import fj.data.Either; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java index 4c9bf6767e..0b5da1217d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.resources.data; import java.lang.reflect.Type; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; 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 7e084eb021..fb58e9abff 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,8 +28,6 @@ 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; 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 index 7138fe5f72..88f7ad9342 100644 --- 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 @@ -25,10 +25,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.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 { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java index b64ef201dd..be3ace6420 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java @@ -1,13 +1,12 @@ package org.openecomp.sdc.be.resources.data; +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; -import java.math.BigInteger; -import java.util.Date; - @Table(keyspace = "sdcrepository", name = "migrationTasks") public class MigrationTaskEntry { |