diff options
Diffstat (limited to 'catalog-dao')
32 files changed, 745 insertions, 85 deletions
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 index c005192f71..2452245616 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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; import org.openecomp.sdc.be.config.ConfigurationManager; 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 index 772211ca58..36aaec8684 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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; public interface TitanClientStrategy { 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 ee74a468fc..4ae3e61841 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,9 @@ 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, 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, + 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 + SERVICE_TYPE_EXCEEDS_LIMIT, INVALID_SERVICE_TYPE, SERVICE_ROLE_EXCEEDS_LIMIT, INVALID_SERVICE_ROLE, // Component name related COMPONENT_NAME_ALREADY_EXIST, COMPONENT_NAME_EXCEEDS_LIMIT, MISSING_COMPONENT_NAME, INVALID_COMPONENT_NAME, // Component description related @@ -39,7 +41,7 @@ public enum ActionStatus { // 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, + VENDOR_NAME_EXCEEDS_LIMIT, VENDOR_RELEASE_EXCEEDS_LIMIT, INVALID_VENDOR_NAME, INVALID_VENDOR_RELEASE, MISSING_VENDOR_NAME, MISSING_VENDOR_RELEASE, RESOURCE_VENDOR_MODEL_NUMBER_EXCEEDS_LIMIT, INVALID_RESOURCE_VENDOR_MODEL_NUMBER, // Category related COMPONENT_MISSING_CATEGORY, COMPONENT_INVALID_CATEGORY, COMPONENT_ELEMENT_INVALID_NAME_FORMAT, COMPONENT_ELEMENT_INVALID_NAME_LENGTH, COMPONENT_CATEGORY_ALREADY_EXISTS, COMPONENT_CATEGORY_NOT_FOUND, COMPONENT_SUB_CATEGORY_NOT_FOUND_FOR_CATEGORY, COMPONENT_SUB_CATEGORY_EXISTS_FOR_CATEGORY, COMPONENT_GROUPING_EXISTS_FOR_SUB_CATEGORY, // Service API URL @@ -71,7 +73,7 @@ public enum ActionStatus { GROUP_MEMBER_EMPTY, GROUP_TYPE_ALREADY_EXIST, // CSAR - MISSING_CSAR_UUID, CSAR_INVALID, CSAR_INVALID_FORMAT, CSAR_NOT_FOUND, YAML_NOT_FOUND_IN_CSAR, VSP_ALREADY_EXISTS, RESOURCE_LINKED_TO_DIFFERENT_VSP, RESOURCE_FROM_CSAR_NOT_FOUND, AAI_ARTIFACT_GENERATION_FAILED, ASSET_NOT_FOUND_DURING_CSAR_CREATION, ARTIFACT_PAYLOAD_NOT_FOUND_DURING_CSAR_CREATION, TOSCA_SCHEMA_FILES_NOT_FOUND, + 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, ARTIFACT_NAME_INVALID, // Group GROUP_HAS_CYCLIC_DEPENDENCY, GROUP_ALREADY_EXIST, GROUP_TYPE_IS_INVALID, GROUP_MISSING_GROUP_TYPE, GROUP_INVALID_COMPONENT_INSTANCE, GROUP_INVALID_TOSCA_NAME_OF_COMPONENT_INSTANCE, GROUP_IS_MISSING, GROUP_ARTIFACT_ALREADY_ASSOCIATED, GROUP_ARTIFACT_ALREADY_DISSOCIATED, GROUP_PROPERTY_NOT_FOUND, INVALID_VF_MODULE_NAME, INVALID_VF_MODULE_NAME_MODIFICATION, INVALID_VF_MODULE_TYPE, @@ -86,6 +88,7 @@ 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/api/ESGenericIdDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericIdDAO.java index fb0b160b09..1ab27fc930 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 @@ -36,7 +36,6 @@ import org.elasticsearch.action.get.MultiGetItemResponse; import org.elasticsearch.action.get.MultiGetResponse; import org.elasticsearch.client.Client; import org.openecomp.sdc.be.dao.es.ElasticSearchClient; -import org.openecomp.sdc.be.dao.utils.Exceptions; import org.openecomp.sdc.exception.IndexingServiceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,7 +94,7 @@ public abstract class ESGenericIdDAO implements IGenericIdDAO { try { ret = (T) jsonMapper.readValue(response.getSourceAsString(), clazz); } catch (IOException e) { - Exceptions.convertToRuntimeEx(e); + throw new RuntimeException(e); } return ret; } @@ -119,7 +118,7 @@ public abstract class ESGenericIdDAO implements IGenericIdDAO { val = jsonMapper.readValue(getItemResponse.getResponse().getSourceAsString(), clazz); result.add(val); } catch (IOException e) { - Exceptions.convertToRuntimeEx(e); + throw new RuntimeException(e); } } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericSearchDAO.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericSearchDAO.java index c24325aefb..77aac87427 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericSearchDAO.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/api/ESGenericSearchDAO.java @@ -31,7 +31,6 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.sort.SortBuilder; import org.openecomp.sdc.be.dao.es.ElasticSearchClient; -import org.openecomp.sdc.be.dao.utils.Exceptions; /** * Elastic search dao that manages search operations. @@ -83,7 +82,7 @@ public class ESGenericSearchDAO extends ESGenericIdDAO implements IGenericSearch try { result.add(getJsonMapper().readValue(searchResponse.getHits().getAt(i).getSourceAsString(), clazz)); } catch (IOException e) { - Exceptions.convertToRuntimeEx(e); + throw new RuntimeException(e); } } @@ -114,7 +113,7 @@ public class ESGenericSearchDAO extends ESGenericIdDAO implements IGenericSearch val = getJsonMapper().readValue(hit, clazz); result.add(val); } catch (IOException e) { - Exceptions.convertToRuntimeEx(e); + throw new RuntimeException(e); } } return result; 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 new file mode 100644 index 0000000000..61e23b8de2 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ArtifactAccessor.java @@ -0,0 +1,19 @@ +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; + + +/** + * Created by chaya on 7/5/2017. + */ +@Accessor +public interface ArtifactAccessor { + // ***** get the number of artifacts with a specific id + @Query("SELECT COUNT(*) FROM sdcartifact.resources WHERE ID = :uniqueId") + ResultSet getNumOfArtifactsById(@Param("uniqueId") String uniqueId); +} 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 a9a4a99de1..5b37d3df2c 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,6 +22,7 @@ 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; @@ -38,6 +39,7 @@ import fj.data.Either; public class ArtifactCassandraDao extends CassandraDao { private static Logger logger = LoggerFactory.getLogger(ArtifactCassandraDao.class.getName()); + private ArtifactAccessor artifactAccessor; public ArtifactCassandraDao() { super(); @@ -52,6 +54,7 @@ public class ArtifactCassandraDao extends CassandraDao { if (result.isLeft()) { session = result.left().value().left; manager = result.left().value().right; + artifactAccessor = manager.createAccessor(ArtifactAccessor.class); logger.info("** ArtifactCassandraDao created"); } else { logger.info("** ArtifactCassandraDao failed"); @@ -107,4 +110,12 @@ public class ArtifactCassandraDao extends CassandraDao { return super.isTableEmpty(tableName); } + public Either<Long, CassandraOperationStatus> getCountOfArtifactById(String uniqeId) { + ResultSet artifactCount = artifactAccessor.getNumOfArtifactsById(uniqeId); + if (artifactCount == null) { + return Either.right(CassandraOperationStatus.NOT_FOUND); + } + return Either.left(artifactCount.one().getLong(0)); + } + } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java new file mode 100644 index 0000000000..e548a594d9 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java @@ -0,0 +1,17 @@ +package org.openecomp.sdc.be.dao.cassandra; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Param; +import com.datastax.driver.mapping.annotations.Query; + +@Accessor +public interface MigrationTasksAccessor { + + @Query("SELECT minor_version FROM sdcrepository.migrationTasks WHERE major_version = :majorVersion order by minor_version desc limit 1") + ResultSet getLatestMinorVersion(@Param("majorVersion") Long majorVersion); + + @Query("DELETE FROM sdcrepository.migrationTasks WHERE major_version = :majorVersion") + void deleteTasksForMajorVersion(@Param("majorVersion") Long majorVersion); + +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java new file mode 100644 index 0000000000..89ad9662fa --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java @@ -0,0 +1,73 @@ +package org.openecomp.sdc.be.dao.cassandra; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.Row; +import com.datastax.driver.core.Session; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.MappingManager; +import fj.data.Either; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.resources.data.MigrationTaskEntry; +import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.math.BigInteger; + +@Component("sdc-migration-tasks-cassandra-dao") +public class MigrationTasksDao extends CassandraDao { + + private static Logger logger = LoggerFactory.getLogger(MigrationTasksDao.class.getName()); + private MigrationTasksAccessor migrationTasksAccessor; + private Mapper<MigrationTaskEntry> migrationTaskMapper; + + @PostConstruct + public void init() { + String keyspace = AuditingTypesConstants.REPO_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; + migrationTasksAccessor = manager.createAccessor(MigrationTasksAccessor.class); + migrationTaskMapper = manager.mapper(MigrationTaskEntry.class); + logger.info("** migrationTasksAccessor created"); + } else { + logger.info("** migrationTasksAccessor 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("** migrationTasksAccessor created, but not connected"); + } + } + + public BigInteger getLatestMinorVersion(BigInteger majorVersion) { + try { + ResultSet latestMinorVersion = migrationTasksAccessor.getLatestMinorVersion(majorVersion.longValue()); + Row minorVersionRow = latestMinorVersion.one(); + return minorVersionRow == null ? BigInteger.valueOf(Long.MIN_VALUE) : BigInteger.valueOf(minorVersionRow.getLong(0)); + } catch (RuntimeException e) { + logger.error("failed to get latest minor version for major version {}", majorVersion, e); + throw e; + } + } + + public void deleteAllTasksForVersion(BigInteger majorVersion) { + try { + migrationTasksAccessor.deleteTasksForMajorVersion(majorVersion.longValue()); + } catch (RuntimeException e) { + logger.error("failed to delete tasks for major version {}", majorVersion, e); + throw e; + } + } + + public void createMigrationTask(MigrationTaskEntry migrationTask) { + migrationTaskMapper.save(migrationTask); + } + + +} diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java index 1168bf4edf..f9505fc027 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesAccessor.java @@ -1,3 +1,23 @@ +/*- + * ============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.cassandra; import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java index d292c1ddeb..de14bac210 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDao.java @@ -1,3 +1,23 @@ +/*- + * ============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.cassandra; import java.util.List; 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 f52faa5886..56cf32a152 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 @@ -1,3 +1,23 @@ +/*- + * ============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.cassandra.schema; import com.datastax.driver.core.*; 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 8fb594f2ff..f6fd29bd1f 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,24 +20,7 @@ package org.openecomp.sdc.be.dao.cassandra.schema; -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.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; +import org.openecomp.sdc.be.dao.cassandra.schema.tables.*; public enum Table { @@ -58,8 +41,8 @@ public enum Table { GET_CATEGORY_HIERARCHY_EVENT(new GetCatHierEventTableDesc()), EXTERNAL_API_EVENT(new ExternalApiEventTableDesc()), COMPONENT_CACHE(new ComponentCacheTableDescription()), - SDC_SCHEMA_FILES(new SdcSchemaFilesTableDescription()); - + SDC_SCHEMA_FILES(new SdcSchemaFilesTableDescription()), + SDC_REPO(new MigrationTasksTableDescription()); ITableDescription tableDescription; Table(ITableDescription tableDescription) { 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 new file mode 100644 index 0000000000..f7506f77e1 --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java @@ -0,0 +1,81 @@ +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 java.util.Arrays; +import java.util.Collections; +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; + +public class MigrationTasksTableDescription implements ITableDescription { + + private static final String MIGRATION_TASKS_TABLE = "migrationTasks"; + + @Override + public List<ImmutablePair<String, DataType>> primaryKeys() { + return Collections.singletonList(ImmutablePair.of(MAJOR_VERSION.getFieldName(), MAJOR_VERSION.getFieldType())); + } + + @Override + public List<ImmutablePair<String, DataType>> clusteringKeys() { + return Collections.singletonList(ImmutablePair.of(MINOR_VERSION.getFieldName(), MINOR_VERSION.getFieldType())); + } + + @Override + public Map<String, ImmutablePair<DataType, Boolean>> getColumnDescription() { + Map<String, ImmutablePair<DataType, Boolean>> columns = new HashMap<>(); + Arrays.stream(SdcRepoFieldsDescription.values()) + .filter(column -> !column.equals(MAJOR_VERSION) && !column.equals(MINOR_VERSION)) + .forEach(column -> columns.put(column.getFieldName(), ImmutablePair.of(column.getFieldType(), column.isIndexed()))); + return columns; + } + + @Override + public String getKeyspace() { + return AuditingTypesConstants.REPO_KEYSPACE; + } + + @Override + public String getTableName() { + return MIGRATION_TASKS_TABLE; + } + + enum SdcRepoFieldsDescription { + MAJOR_VERSION("major_version", DataType.bigint(), true), + MINOR_VERSION("minor_version", DataType.bigint(), false), + TIMESTAMP("timestamp", DataType.timestamp(), false), + NAME("task_name", DataType.varchar(), false), + STATUS("task_status", DataType.varchar(), false), + MESSAGE("msg", DataType.varchar(), false), + EXECUTION_TIME("execution_time", DataType.cdouble(), false); + + private String fieldName; + private boolean isIndexed; + private DataType fieldType; + + SdcRepoFieldsDescription(String fieldName, DataType dataType, boolean indexed ) { + this.fieldName = fieldName; + this.fieldType = dataType; + this.isIndexed = indexed; + } + + public String getFieldName() { + return fieldName; + } + + public boolean isIndexed() { + return isIndexed; + } + + public DataType getFieldType() { + return fieldType; + } + } +} 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 b075f0ef4e..7459a4b5d9 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 @@ -1,3 +1,23 @@ +/*- + * ============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.cassandra.schema.tables; import java.util.ArrayList; 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 index 09a01fb962..6235fb7843 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.cassandra.schema.tables; import java.util.ArrayList; 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 index d9c6829079..c5f066bb4b 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.config; import org.openecomp.sdc.be.dao.DAOTitanStrategy; 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 67cbd258f4..6966abb1c9 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph; import java.util.HashMap; 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 index 61e1b40d46..387b413dd5 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph; import java.io.IOException; @@ -436,7 +456,11 @@ public class TitanDao { } if (hasNotProps != null && !hasNotProps.isEmpty()) { for (Map.Entry<GraphPropertyEnum, Object> entry : hasNotProps.entrySet()) { - query = query.hasNot(entry.getKey().getProperty(), entry.getValue()); + if(entry.getValue() instanceof List){ + buildMultipleNegateQueryFromList(entry, query); + }else{ + query = query.hasNot(entry.getKey().getProperty(), entry.getValue()); + } } } Iterable<TitanVertex> vertices = query.vertices(); @@ -479,6 +503,15 @@ public class TitanDao { } + + private void buildMultipleNegateQueryFromList(Map.Entry<GraphPropertyEnum, Object> entry, TitanGraphQuery query){ + List<Object> negateList = (List<Object>) entry.getValue(); + for (Object listItem : negateList) { + query.hasNot(entry.getKey().getProperty(), listItem); + } + } + + /** * * @param parentVertex 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 index 6f5910f581..3018915066 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.types; public enum EdgeLabelEnum { @@ -47,4 +67,8 @@ public enum EdgeLabelEnum { } return null; } + + public boolean isInstanceArtifactsLabel() { + return this.equals(INSTANCE_ARTIFACTS) || this.equals(INST_DEPLOYMENT_ARTIFACTS); + } } 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 index df2f52040d..e52c92e74b 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.types; public enum EdgePropertyEnum { 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 index c54825a39e..c9120bbcf7 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.types; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; 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 index aea488e086..485531aa52 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.types; public enum JsonParseFlagEnum { 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 cb9c7207d2..c3e88c85bf 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.types; import org.openecomp.sdc.be.datatypes.elements.*; 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 dfff258840..f4aff17ce6 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.utils; import java.util.UUID; 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 index a7fe34071d..da3d6530e4 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.jsongraph.utils; import java.io.IOException; 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 2ff1567928..86a171633d 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,3 +1,23 @@ +/*- + * ============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; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/Exceptions.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/Exceptions.java deleted file mode 100644 index fd0a6754ab..0000000000 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/Exceptions.java +++ /dev/null @@ -1,35 +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.dao.utils; - -public final class Exceptions { - private Exceptions() { - } - - public static RuntimeException convertToRuntimeEx(Throwable t) { - return Exceptions.<RuntimeException>convertToRTException(t); - } - - @SuppressWarnings("unchecked") - private static <T extends Throwable> T convertToRTException(Throwable t) throws T { - throw (T) t; - } -} 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 new file mode 100644 index 0000000000..08376b616f --- /dev/null +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java @@ -0,0 +1,92 @@ +package org.openecomp.sdc.be.resources.data; + +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 { + + @PartitionKey(0) + @Column(name = "major_version") + private Long majorVersion; + + @ClusteringColumn + @Column(name = "minor_version") + private Long minorVersion; + + @Column(name = "timestamp") + private Date timestamp; + + @Column(name = "task_name") + private String taskName; + + @Column(name = "execution_time") + private double executionTime; + + @Column(name = "task_status") + private String taskStatus; + + @Column(name = "msg") + private String message; + + public void setMajorVersion(Long majorVersion) { + this.majorVersion = majorVersion; + } + + public void setMinorVersion(Long minorVersion) { + this.minorVersion = minorVersion; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public void setTaskStatus(String taskStatus) { + this.taskStatus = taskStatus; + } + + public void setMessage(String message) { + this.message = message; + } + + public void setExecutionTime(double executionTime) { + this.executionTime = executionTime; + } + + public Long getMajorVersion() { + return majorVersion; + } + + public Long getMinorVersion() { + return minorVersion; + } + + public Date getTimestamp() { + return timestamp; + } + + public String getTaskName() { + return taskName; + } + + public String getTaskStatus() { + return taskStatus; + } + + public String getMessage() { + return message; + } + + public double getExecutionTime() { + return executionTime; + } +} 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 index 96ab5aedc8..3454a882d2 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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.nio.ByteBuffer; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java index 01774ca63f..9f25932b37 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java @@ -22,28 +22,29 @@ package org.openecomp.sdc.be.resources.data.auditing; public interface AuditingTypesConstants { - public static final String ARTIFACT_KEYSPACE = "sdcartifact"; - public static final String AUDIT_KEYSPACE = "sdcaudit"; - public static final String COMPONENT_KEYSPACE = "sdccomponent"; - public static final String TITAN_KEYSPACE = "titan"; + String ARTIFACT_KEYSPACE = "sdcartifact"; + String REPO_KEYSPACE = "sdcrepository"; + String AUDIT_KEYSPACE = "sdcaudit"; + String COMPONENT_KEYSPACE = "sdccomponent"; + String TITAN_KEYSPACE = "titan"; - public static final String USER_ADMIN_EVENT_TYPE = "useradminevent"; - public static final String USER_ACCESS_EVENT_TYPE = "useraccessevent"; - public static final String RESOURCE_ADMIN_EVENT_TYPE = "resourceadminevent"; - public static final String DISTRIBUTION_DOWNLOAD_EVENT_TYPE = "distributiondownloadevent"; + String USER_ADMIN_EVENT_TYPE = "useradminevent"; + String USER_ACCESS_EVENT_TYPE = "useraccessevent"; + String RESOURCE_ADMIN_EVENT_TYPE = "resourceadminevent"; + String DISTRIBUTION_DOWNLOAD_EVENT_TYPE = "distributiondownloadevent"; - public static final String DISTRIBUTION_ENGINE_EVENT_TYPE = "distributionengineevent"; - public static final String DISTRIBUTION_NOTIFICATION_EVENT_TYPE = "distributionnotificationevent"; - public static final String DISTRIBUTION_STATUS_EVENT_TYPE = "distributionstatusevent"; - public static final String DISTRIBUTION_DEPLOY_EVENT_TYPE = "distributiondeployevent"; - public static final String DISTRIBUTION_GET_UEB_CLUSTER_EVENT_TYPE = "auditinggetuebclusterevent"; - public static final String DISTRIBUTION_GET_VALID_ARTIFACT_TYPES_EVENT_TYPE = "auditinggetvalidartifacttypesevent"; + String DISTRIBUTION_ENGINE_EVENT_TYPE = "distributionengineevent"; + String DISTRIBUTION_NOTIFICATION_EVENT_TYPE = "distributionnotificationevent"; + String DISTRIBUTION_STATUS_EVENT_TYPE = "distributionstatusevent"; + String DISTRIBUTION_DEPLOY_EVENT_TYPE = "distributiondeployevent"; + String DISTRIBUTION_GET_UEB_CLUSTER_EVENT_TYPE = "auditinggetuebclusterevent"; + String DISTRIBUTION_GET_VALID_ARTIFACT_TYPES_EVENT_TYPE = "auditinggetvalidartifacttypesevent"; - public static final String AUTH_EVENT_TYPE = "authevent"; - public static final String CONSUMER_EVENT_TYPE = "consumerevent"; - public static final String CATEGORY_EVENT_TYPE = "categoryevent"; - public static final String GET_USERS_LIST_EVENT_TYPE = "getuserslistevent"; - public static final String GET_CATEGORY_HIERARCHY_EVENT_TYPE = "getcategoryhierarchyevent"; - public static final String EXTERNAL_API_EVENT_TYPE = "externalapievent"; + String AUTH_EVENT_TYPE = "authevent"; + String CONSUMER_EVENT_TYPE = "consumerevent"; + String CATEGORY_EVENT_TYPE = "categoryevent"; + String GET_USERS_LIST_EVENT_TYPE = "getuserslistevent"; + String GET_CATEGORY_HIERARCHY_EVENT_TYPE = "getcategoryhierarchyevent"; + String EXTERNAL_API_EVENT_TYPE = "externalapievent"; } 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 index c0c49b7b13..18254ac54c 100644 --- 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 @@ -1,3 +1,23 @@ +/*- + * ============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; import java.io.IOException; |