From f5f13c4f6b6fe3b4d98e349dfd7db59339803436 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 19 Feb 2017 12:35:04 +0200 Subject: push addional code Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando --- .../pom.xml | 63 ++++ .../VendorSoftwareProductConstants.java | 38 +++ .../dao/ComponentArtifactDao.java | 40 +++ .../dao/ComponentArtifactDaoFactory.java | 32 ++ .../vendorsoftwareproduct/dao/ComponentDao.java | 38 +++ .../dao/ComponentDaoFactory.java | 31 ++ .../sdc/vendorsoftwareproduct/dao/NetworkDao.java | 33 ++ .../dao/NetworkDaoFactory.java | 31 ++ .../sdc/vendorsoftwareproduct/dao/NicDao.java | 40 +++ .../vendorsoftwareproduct/dao/NicDaoFactory.java | 31 ++ .../vendorsoftwareproduct/dao/PackageInfoDao.java | 33 ++ .../dao/PackageInfoDaoFactory.java | 31 ++ .../dao/ProcessArtifactDao.java | 32 ++ .../dao/ProcessArtifactDaoFactory.java | 32 ++ .../sdc/vendorsoftwareproduct/dao/ProcessDao.java | 30 ++ .../dao/ProcessDaoFactory.java | 31 ++ .../vendorsoftwareproduct/dao/UploadDataDao.java | 34 ++ .../dao/UploadDataDaoFactory.java | 31 ++ .../dao/VendorSoftwareProductDao.java | 140 +++++++++ .../dao/VendorSoftwareProductDaoFactory.java | 34 ++ .../dao/VendorSoftwareProductInfoDao.java | 30 ++ .../dao/VendorSoftwareProductInfoDaoFactory.java | 32 ++ .../dao/VspQuestionnaireDao.java | 32 ++ .../dao/VspQuestionnaireDaoFactory.java | 32 ++ .../sdc/vendorsoftwareproduct/dao/type/Action.java | 27 ++ .../dao/type/ComponentArtifactEntity.java | 140 +++++++++ .../dao/type/ComponentEntity.java | 199 ++++++++++++ .../dao/type/CompositionEntity.java | 40 +++ .../dao/type/NetworkEntity.java | 183 +++++++++++ .../vendorsoftwareproduct/dao/type/NicEntity.java | 203 ++++++++++++ .../dao/type/PackageInfo.java | 176 +++++++++++ .../dao/type/ProcessArtifactEntity.java | 128 ++++++++ .../dao/type/ProcessEntity.java | 179 +++++++++++ .../dao/type/TranslatedFileData.java | 97 ++++++ .../dao/type/UploadDataEntity.java | 135 ++++++++ .../vendorsoftwareproduct/dao/type/VspDetails.java | 242 ++++++++++++++ .../dao/type/VspQuestionnaireEntity.java | 111 +++++++ .../types/composition/Component.java | 44 +++ .../types/composition/ComponentData.java | 80 +++++ .../types/composition/CompositionData.java | 44 +++ .../types/composition/CompositionDataEntity.java | 24 ++ .../types/composition/CompositionEntityId.java | 64 ++++ .../types/composition/CompositionEntityType.java | 28 ++ .../types/composition/Network.java | 67 ++++ .../types/composition/NetworkType.java | 26 ++ .../types/composition/Nic.java | 102 ++++++ .../src/main/resources/factoryConfiguration.json | 14 + .../pom.xml | 67 ++++ .../impl/ComponentArtifactDaoCassandraImpl.java | 159 ++++++++++ .../dao/impl/ComponentArtifactDaoFactoryImpl.java | 33 ++ .../dao/impl/ComponentDaoCassandraImpl.java | 139 ++++++++ .../dao/impl/ComponentDaoFactoryImpl.java | 33 ++ .../dao/impl/NetworkDaoCassandraImpl.java | 127 ++++++++ .../dao/impl/NetworkDaoFactoryImpl.java | 33 ++ .../dao/impl/NicDaoCassandraImpl.java | 148 +++++++++ .../dao/impl/NicDaoFactoryImpl.java | 33 ++ .../dao/impl/PackageInfoDaoFactoryImpl.java | 33 ++ .../dao/impl/PackageInfoDaoImpl.java | 103 ++++++ .../dao/impl/ProcessArtifactDaoCassandraImpl.java | 82 +++++ .../dao/impl/ProcessArtifactDaoFactoryImpl.java | 33 ++ .../dao/impl/ProcessDaoCassandraImpl.java | 139 ++++++++ .../dao/impl/ProcessDaoFactoryImpl.java | 33 ++ .../dao/impl/UploadDataDaoFactoryImpl.java | 33 ++ .../dao/impl/UploadDataDaoImpl.java | 92 ++++++ .../impl/VendorSoftwareProductDaoFactoryImpl.java | 33 ++ .../dao/impl/VendorSoftwareProductDaoImpl.java | 349 +++++++++++++++++++++ .../VendorSoftwareProductInfoDaoFactoryImpl.java | 34 ++ .../dao/impl/VendorSoftwareProductInfoDaoImpl.java | 83 +++++ .../dao/impl/VspQuestionnaireDaoCassandraImpl.java | 72 +++++ .../dao/impl/VspQuestionnaireDaoFactoryImpl.java | 33 ++ .../dao/ServiceModelDaoFactoryTest.java | 97 ++++++ .../pom.xml | 23 ++ 72 files changed, 5328 insertions(+) create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/Action.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentArtifactEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/CompositionEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NetworkEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfo.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessArtifactEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileData.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/UploadDataEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionData.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkType.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java create mode 100644 openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib') diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml new file mode 100644 index 0000000000..100e85536d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-lib + 1.0.0-SNAPSHOT + + + openecomp-sdc-vendor-software-product-api + + + + com.google.code.gson + gson + 2.3.1 + test + + + org.openecomp.core + openecomp-core-lib + pom + ${project.version} + + + org.openecomp.core + openecomp-facade-core + ${project.version} + + + org.openecomp.core + openecomp-nosqldb-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-versioning-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-translator-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-enrichment-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-model-core + ${project.version} + + + + + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java new file mode 100644 index 0000000000..860ef5fd41 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductConstants.java @@ -0,0 +1,38 @@ +/*- + * ============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.vendorsoftwareproduct; + +public final class VendorSoftwareProductConstants { + public static final String VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE = "VendorSoftwareProduct"; + public static final String GENERAL_COMPONENT_ID = "General"; + public static final String VSP_PACKAGE_ZIP = "VSPPackage.zip"; + public static final String CSAR = "CSAR"; + public static final String UPLOAD_RAW_DATA = "UPLOAD_RAW_DATA"; + + public final class UniqueValues { + public static final String VENDOR_SOFTWARE_PRODUCT_NAME = "Vendor Software Product name"; + public static final String PROCESS_NAME = "Process name"; + public static final String NETWORK_NAME = "Network name"; + public static final String COMPONENT_NAME = "ComponentData name"; + public static final String NIC_NAME = "NIC name"; + //public static final String COMPONENT_ARTIFACT_NAME = "ComponentArtifact name"; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDao.java new file mode 100644 index 0000000000..d43c9687c2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDao.java @@ -0,0 +1,40 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; + +import java.util.Collection; + +public interface ComponentArtifactDao extends VersionableDao { + + ComponentArtifactEntity getArtifactByType(ComponentArtifactEntity entity); + + void update(ComponentArtifactEntity entity); + + void delete(ComponentArtifactEntity entity); + + Collection getArtifactNamesAndTypesForComponent( + ComponentArtifactEntity entity); + + void deleteAll(ComponentArtifactEntity entity); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDaoFactory.java new file mode 100644 index 0000000000..56a0ec65af --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentArtifactDaoFactory.java @@ -0,0 +1,32 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ComponentArtifactDaoFactory + extends AbstractComponentFactory { + + public static ComponentArtifactDaoFactory getInstance() { + return AbstractFactory.getInstance(ComponentArtifactDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDao.java new file mode 100644 index 0000000000..ca795b4929 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDao.java @@ -0,0 +1,38 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface ComponentDao extends VersionableDao, BaseDao { + + void updateQuestionnaireData(String vspId, Version version, String componentId, + String questionnaireData); + + Collection listQuestionnaires(String vspId, Version version); + + void deleteAll(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDaoFactory.java new file mode 100644 index 0000000000..e1cf30bfb1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ComponentDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ComponentDaoFactory extends AbstractComponentFactory { + + public static ComponentDaoFactory getInstance() { + return AbstractFactory.getInstance(ComponentDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java new file mode 100644 index 0000000000..199e65fd83 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDao.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +public interface NetworkDao extends VersionableDao, BaseDao { + + void updateQuestionnaireData(String vspId, Version version, String id, String questionnaireData); + + void deleteAll(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDaoFactory.java new file mode 100644 index 0000000000..8db3d605e4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NetworkDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class NetworkDaoFactory extends AbstractComponentFactory { + + public static NetworkDaoFactory getInstance() { + return AbstractFactory.getInstance(NetworkDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDao.java new file mode 100644 index 0000000000..bbfa8bf8c0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDao.java @@ -0,0 +1,40 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface NicDao extends VersionableDao, BaseDao { + + void updateQuestionnaireData(String vspId, Version version, String componentId, String nicId, + String questionnaireData); + + Collection listByVsp(String vspId, Version version); + + void deleteByComponentId(String vspId, Version version, String componentId); + + void deleteByVspId(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDaoFactory.java new file mode 100644 index 0000000000..b61ad6a3ca --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/NicDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class NicDaoFactory extends AbstractComponentFactory { + + public static NicDaoFactory getInstance() { + return AbstractFactory.getInstance(NicDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDao.java new file mode 100644 index 0000000000..a22c725b6f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDao.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.List; + +public interface PackageInfoDao extends BaseDao { + List listByCategory(String category, String subCategory); + + void deleteRowTranslateContent(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDaoFactory.java new file mode 100644 index 0000000000..a8e3d6563d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/PackageInfoDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class PackageInfoDaoFactory extends AbstractComponentFactory { + + public static PackageInfoDaoFactory getInstance() { + return AbstractFactory.getInstance(PackageInfoDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDao.java new file mode 100644 index 0000000000..5b562368b5 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDao.java @@ -0,0 +1,32 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity; + +public interface ProcessArtifactDao { + + void update(ProcessArtifactEntity entity); + + ProcessArtifactEntity get(ProcessArtifactEntity entity); + + void delete(ProcessArtifactEntity entity); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDaoFactory.java new file mode 100644 index 0000000000..534777c701 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessArtifactDaoFactory.java @@ -0,0 +1,32 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ProcessArtifactDaoFactory + extends AbstractComponentFactory { + + public static ProcessArtifactDaoFactory getInstance() { + return AbstractFactory.getInstance(ProcessArtifactDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDao.java new file mode 100644 index 0000000000..8aa3400d24 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDao.java @@ -0,0 +1,30 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; + +public interface ProcessDao extends VersionableDao, BaseDao { + + void deleteAll(ProcessEntity entity); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDaoFactory.java new file mode 100644 index 0000000000..f661a0ccda --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ProcessDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ProcessDaoFactory extends AbstractComponentFactory { + + public static ProcessDaoFactory getInstance() { + return AbstractFactory.getInstance(ProcessDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDao.java new file mode 100644 index 0000000000..cdc3a770db --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDao.java @@ -0,0 +1,34 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.nio.ByteBuffer; + +public interface UploadDataDao extends BaseDao { + + void deleteContentDataAndValidationData(String vspId, Version version); + + ByteBuffer getContentData(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDaoFactory.java new file mode 100644 index 0000000000..9654551f8f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/UploadDataDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class UploadDataDaoFactory extends AbstractComponentFactory { + + public static UploadDataDaoFactory getInstance() { + return AbstractFactory.getInstance(UploadDataDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java new file mode 100644 index 0000000000..d8de3c6bd4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDao.java @@ -0,0 +1,140 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.nio.ByteBuffer; +import java.util.Collection; +import java.util.List; + +public interface VendorSoftwareProductDao extends VersionableDao { + + void createVendorSoftwareProductInfo(VspDetails vspDetails); + + Collection listVendorSoftwareProductsInfo(); + + VspDetails getVendorSoftwareProductInfo(VspDetails vspDetails); + + void updateVendorSoftwareProductInfo(VspDetails vspDetails); + + void deleteVendorSoftwareProductInfo(VspDetails vspDetails); + + + void updateUploadData(UploadDataEntity uploadData); + + UploadDataEntity getUploadData(UploadDataEntity uploadData); + + ByteBuffer getContentData(UploadDataEntity uploadDataEntity); + + + List listPackages(String category, String subCategory); + + void insertPackageDetails(PackageInfo packageInfo); + + PackageInfo getPackageInfo(PackageInfo packageInfo); + + void deletePackageInfo(PackageInfo packageInfo); + + + Collection listNetworks(String vspId, Version version); + + void createNetwork(NetworkEntity network); + + void updateNetwork(NetworkEntity network); + + NetworkEntity getNetwork(String vspId, Version version, String networkId); + + void deleteNetwork(String vspId, Version version); + + + Collection listComponents(String vspId, Version version); + + void createComponent(ComponentEntity component); + + void updateComponent(ComponentEntity component); + + ComponentEntity getComponent(String vspId, Version version, String componentId); + + Collection listComponentsQuestionnaire(String vspId, Version version); + + void updateComponentQuestionnaire(String vspId, Version version, String componentId, + String questionnaireData); + + void deleteComponent(String vspId, Version version); + + + Collection listProcesses(String vspId, Version version, String componentId); + + void deleteProcesses(String vspId, Version version, String componentId); + + ProcessEntity getProcess(String vspId, Version version, String componentId, String processId); + + void createProcess(ProcessEntity processEntity); + + void updateProcess(ProcessEntity processEntity); + + void deleteProcess(String vspId, Version version, String componentId, String processId); + + + void uploadProcessArtifact(String vspId, Version version, String componentId, String processId, + byte[] artifact, String artifactFileName); + + ProcessArtifactEntity getProcessArtifact(String vspId, Version version, String componentId, + String processId); + + void deleteProcessArtifact(String vspId, Version version, String componentId, String processId); + + + VspQuestionnaireEntity getQuestionnaire(String vspId, Version version); + + void updateQuestionnaire(String vspId, Version version, String questionnaireData); + + + Collection listNics(String vspId, Version version, String componentId); + + void createNic(NicEntity nic); + + void updateNic(NicEntity nicEntity); + + NicEntity getNic(String vspId, Version version, String componentId, String nicId); + + void updateNicQuestionnaire(String vspId, Version version, String componentId, String nicId, + String questionnaireData); + + Collection listNicsByVsp(String vspId, Version version); + + void deleteNic(String vspId, Version version, String componentId); + + void deleteUploadData(String vspId, Version version); + + void updateVspLatestModificationTime(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDaoFactory.java new file mode 100644 index 0000000000..33aaa8e1ad --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductDaoFactory.java @@ -0,0 +1,34 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class VendorSoftwareProductDaoFactory + extends AbstractComponentFactory { + + + public static VendorSoftwareProductDaoFactory getInstance() { + return AbstractFactory.getInstance(VendorSoftwareProductDaoFactory.class); + } + +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java new file mode 100644 index 0000000000..74a3f69e6c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDao.java @@ -0,0 +1,30 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.dao.BaseDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.versioning.dao.VersionableDao; + +public interface VendorSoftwareProductInfoDao extends VersionableDao, BaseDao { + +// void updateLastModificationTime(VspDetails entity); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDaoFactory.java new file mode 100644 index 0000000000..570ddc496e --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VendorSoftwareProductInfoDaoFactory.java @@ -0,0 +1,32 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class VendorSoftwareProductInfoDaoFactory + extends AbstractComponentFactory { + + public static VendorSoftwareProductInfoDaoFactory getInstance() { + return AbstractFactory.getInstance(VendorSoftwareProductInfoDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDao.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDao.java new file mode 100644 index 0000000000..4658f71d2a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDao.java @@ -0,0 +1,32 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +public interface VspQuestionnaireDao extends VersionableDao { + + VspQuestionnaireEntity get(VspQuestionnaireEntity entity); + + void updateQuestionnaireData(String id, Version version, String questionnaireData); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDaoFactory.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDaoFactory.java new file mode 100644 index 0000000000..afc3dc9649 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/VspQuestionnaireDaoFactory.java @@ -0,0 +1,32 @@ +/*- + * ============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.vendorsoftwareproduct.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class VspQuestionnaireDaoFactory + extends AbstractComponentFactory { + + public static VspQuestionnaireDaoFactory getInstance() { + return AbstractFactory.getInstance(VspQuestionnaireDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/Action.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/Action.java new file mode 100644 index 0000000000..3e82053574 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/Action.java @@ -0,0 +1,27 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +public enum Action { + CREATE_PACKAGE, + CHECK_IN, + CHECK_OUT +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentArtifactEntity.java new file mode 100644 index 0000000000..3636a591d4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentArtifactEntity.java @@ -0,0 +1,140 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.core.enrichment.types.ComponentArtifactType; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_component_artifact") +public class ComponentArtifactEntity implements VersionableEntity { + public static final String ENTITY_TYPE = "Vendor Software Product Component Artifact"; + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + @PartitionKey(value = 1) + @Frozen + private Version version; + @ClusteringColumn + @Column(name = "component_id") + private String componentId; + @ClusteringColumn(value = 1) + @Column(name = "artifact_type") + private ComponentArtifactType type; + @ClusteringColumn(value = 2) + @Column(name = "artifact_id") + private String id; + @Column(name = "name") + private String artifactName; + private ByteBuffer artifact; + + public ComponentArtifactEntity() { + + } + + /** + * Instantiates a new Component artifact entity. + * + * @param vspId the vsp id + * @param version the version + * @param componentId the component id + * @param id the id + */ + public ComponentArtifactEntity(String vspId, Version version, String componentId, String id) { + this.vspId = vspId; + this.version = version; + this.componentId = componentId; + this.id = id; + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + + public String getComponentId() { + return componentId; + } + + public void setComponentId(String componentId) { + this.componentId = componentId; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getVspId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getArtifactName() { + return artifactName; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + public ByteBuffer getArtifact() { + return artifact; + } + + public void setArtifact(ByteBuffer artifact) { + this.artifact = artifact; + } + + public ComponentArtifactType getType() { + return type; + } + + public void setType(ComponentArtifactType type) { + this.type = type; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java new file mode 100644 index 0000000000..a74ba04ec4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentEntity.java @@ -0,0 +1,199 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import com.datastax.driver.mapping.annotations.Transient; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.ArrayList; +import java.util.List; + + +@Table(keyspace = "dox", name = "vsp_component") +public class ComponentEntity implements CompositionEntity { + private static final String ENTITY_TYPE = "Vendor Software Product ComponentData"; + + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + @PartitionKey(value = 1) + @Frozen + private Version version; + @ClusteringColumn + @Column(name = "component_id") + private String id; + @Column(name = "composition_data") + private String compositionData; + @Column(name = "questionnaire_data") + private String questionnaireData; + @Transient + private List nics = new ArrayList<>(); + + public ComponentEntity() { + + } + + /** + * Instantiates a new Component entity. + * + * @param vspId the vsp id + * @param version the version + * @param id the id + */ + public ComponentEntity(String vspId, Version version, String id) { + this.vspId = vspId; + this.version = version; + this.id = id; + } + + @Override + public CompositionEntityType getType() { + return CompositionEntityType.component; + } + + @Override + public CompositionEntityId getCompositionEntityId() { + return new CompositionEntityId(getId(), new CompositionEntityId(getVspId(), null)); + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getVspId(); + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public String getCompositionData() { + return compositionData; + } + + @Override + public void setCompositionData(String compositionData) { + this.compositionData = compositionData; + } + + public ComponentData getComponentCompositionData() { + return compositionData == null ? null + : JsonUtil.json2Object(compositionData, ComponentData.class); + } + + public void setComponentCompositionData(ComponentData component) { + this.compositionData = component == null ? null : JsonUtil.object2Json(component); + } + + @Override + public String getQuestionnaireData() { + return questionnaireData; + } + + @Override + public void setQuestionnaireData(String questionnaireData) { + this.questionnaireData = questionnaireData; + } + + public List getNics() { + return nics; + } + + public void setNics(List nics) { + this.nics = nics; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + ComponentEntity that = (ComponentEntity) obj; + + if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) { + return false; + } + if (version != null ? !version.equals(that.version) : that.version != null) { + return false; + } + if (id != null ? !id.equals(that.id) : that.id != null) { + return false; + } + if (compositionData != null ? !compositionData.equals(that.compositionData) + : that.compositionData != null) { + return false; + } + return questionnaireData != null ? questionnaireData.equals(that.questionnaireData) + : that.questionnaireData == null; + + } + + @Override + public int hashCode() { + int result = vspId != null ? vspId.hashCode() : 0; + result = 31 * result + (version != null ? version.hashCode() : 0); + result = 31 * result + (id != null ? id.hashCode() : 0); + result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0); + result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/CompositionEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/CompositionEntity.java new file mode 100644 index 0000000000..b3e8eef3f2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/CompositionEntity.java @@ -0,0 +1,40 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +public interface CompositionEntity extends VersionableEntity { + + CompositionEntityType getType(); + + CompositionEntityId getCompositionEntityId(); + + String getCompositionData(); + + void setCompositionData(String compositionData); + + String getQuestionnaireData(); + + void setQuestionnaireData(String questionnaireData); +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NetworkEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NetworkEntity.java new file mode 100644 index 0000000000..1599e4a88c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NetworkEntity.java @@ -0,0 +1,183 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Network; +import org.openecomp.sdc.versioning.dao.types.Version; + +@Table(keyspace = "dox", name = "vsp_network") +public class NetworkEntity implements CompositionEntity { + private static final String ENTITY_TYPE = "Vendor Software Product Network"; + + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + @PartitionKey(value = 1) + @Frozen + private Version version; + @ClusteringColumn + @Column(name = "network_id") + private String id; + @Column(name = "composition_data") + private String compositionData; + @Column(name = "questionnaire_data") + private String questionnaireData; + + public NetworkEntity() { + + } + + /** + * Instantiates a new Network entity. + * + * @param vspId the vsp id + * @param version the version + * @param id the id + */ + public NetworkEntity(String vspId, Version version, String id) { + this.vspId = vspId; + this.version = version; + this.id = id; + } + + @Override + public CompositionEntityType getType() { + return CompositionEntityType.network; + } + + @Override + public CompositionEntityId getCompositionEntityId() { + return new CompositionEntityId(getId(), new CompositionEntityId(getVspId(), null)); + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getVspId(); + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public String getCompositionData() { + return compositionData; + } + + @Override + public void setCompositionData(String compositionData) { + this.compositionData = compositionData; + } + + public Network getNetworkCompositionData() { + return compositionData == null ? null : JsonUtil.json2Object(compositionData, Network.class); + } + + public void setNetworkCompositionData(Network network) { + this.compositionData = network == null ? null : JsonUtil.object2Json(network); + } + + @Override + public String getQuestionnaireData() { + return questionnaireData; + } + + @Override + public void setQuestionnaireData(String questionnaireData) { + this.questionnaireData = questionnaireData; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + NetworkEntity that = (NetworkEntity) obj; + + if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) { + return false; + } + if (version != null ? !version.equals(that.version) : that.version != null) { + return false; + } + if (id != null ? !id.equals(that.id) : that.id != null) { + return false; + } + if (compositionData != null ? !compositionData.equals(that.compositionData) + : that.compositionData != null) { + return false; + } + return questionnaireData != null ? questionnaireData.equals(that.questionnaireData) + : that.questionnaireData == null; + + } + + @Override + public int hashCode() { + int result = vspId != null ? vspId.hashCode() : 0; + result = 31 * result + (version != null ? version.hashCode() : 0); + result = 31 * result + (id != null ? id.hashCode() : 0); + result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0); + result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java new file mode 100644 index 0000000000..33042a128a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/NicEntity.java @@ -0,0 +1,203 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic; +import org.openecomp.sdc.versioning.dao.types.Version; + + +@Table(keyspace = "dox", name = "vsp_component_nic") +public class NicEntity implements CompositionEntity { + private static final String ENTITY_TYPE = "Vendor Software Product ComponentData NIC"; + + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + @PartitionKey(value = 1) + @Frozen + private Version version; + @ClusteringColumn + @Column(name = "component_id") + private String componentId; + @ClusteringColumn(value = 1) + @Column(name = "nic_id") + private String id; + @Column(name = "composition_data") + private String compositionData; + @Column(name = "questionnaire_data") + private String questionnaireData; + + public NicEntity() { + + } + + /** + * Instantiates a new Nic entity. + * + * @param vspId the vsp id + * @param version the version + * @param componentId the component id + * @param id the id + */ + public NicEntity(String vspId, Version version, String componentId, String id) { + this.vspId = vspId; + this.version = version; + this.componentId = componentId; + this.id = id; + } + + @Override + public CompositionEntityType getType() { + return CompositionEntityType.nic; + } + + @Override + public CompositionEntityId getCompositionEntityId() { + return new CompositionEntityId(getId(), + new CompositionEntityId(getComponentId(), new CompositionEntityId(getVspId(), null))); + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getVspId(); + } + + public String getComponentId() { + return componentId; + } + + public void setComponentId(String componentId) { + this.componentId = componentId; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public String getCompositionData() { + return compositionData; + } + + @Override + public void setCompositionData(String compositionData) { + this.compositionData = compositionData; + } + + public Nic getNicCompositionData() { + return compositionData == null ? null : JsonUtil.json2Object(compositionData, Nic.class); + } + + public void setNicCompositionData(Nic nic) { + this.compositionData = nic == null ? null : JsonUtil.object2Json(nic); + } + + @Override + public String getQuestionnaireData() { + return questionnaireData; + } + + @Override + public void setQuestionnaireData(String questionnaireData) { + this.questionnaireData = questionnaireData; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + NicEntity nicEntity = (NicEntity) obj; + + if (vspId != null ? !vspId.equals(nicEntity.vspId) : nicEntity.vspId != null) { + return false; + } + if (version != null ? !version.equals(nicEntity.version) : nicEntity.version != null) { + return false; + } + if (componentId != null ? !componentId.equals(nicEntity.componentId) + : nicEntity.componentId != null) { + return false; + } + if (id != null ? !id.equals(nicEntity.id) : nicEntity.id != null) { + return false; + } + if (compositionData != null ? !compositionData.equals(nicEntity.compositionData) + : nicEntity.compositionData != null) { + return false; + } + return questionnaireData != null ? questionnaireData.equals(nicEntity.questionnaireData) + : nicEntity.questionnaireData == null; + + } + + @Override + public int hashCode() { + int result = vspId != null ? vspId.hashCode() : 0; + result = 31 * result + (version != null ? version.hashCode() : 0); + result = 31 * result + (componentId != null ? componentId.hashCode() : 0); + result = 31 * result + (id != null ? id.hashCode() : 0); + result = 31 * result + (compositionData != null ? compositionData.hashCode() : 0); + result = 31 * result + (questionnaireData != null ? questionnaireData.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfo.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfo.java new file mode 100644 index 0000000000..03f26cb57d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfo.java @@ -0,0 +1,176 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + + +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "package_details") +public class PackageInfo { + + + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + + @PartitionKey(value = 1) + @Frozen + private Version version; + + @Column(name = "display_name") + private String displayName; + + @Column(name = "vsp_name") + private String vspName; + + @Column(name = "vsp_description") + private String vspDescription; + + @Column(name = "vendor_name") + private String vendorName; + + private String category; + + @Column(name = "sub_category") + private String subCategory; + + @Column(name = "vendor_release") + private String vendorRelease; + + @Column(name = "package_checksum") + private String packageChecksum; + + @Column(name = "package_type") + private String packageType; + + @Column(name = "translate_content") + private ByteBuffer translatedFile; + + public PackageInfo() { + } + + public PackageInfo(String packageId, Version version) { + this.vspId = packageId; + this.version = version; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getVspDescription() { + return vspDescription; + } + + public void setVspDescription(String vspDescription) { + this.vspDescription = vspDescription; + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorRelease() { + return vendorRelease; + } + + public void setVendorRelease(String vendorRelease) { + this.vendorRelease = vendorRelease; + } + + public String getPackageChecksum() { + return packageChecksum; + } + + public void setPackageChecksum(String packageChecksum) { + this.packageChecksum = packageChecksum; + } + + public String getPackageType() { + return packageType; + } + + public void setPackageType(String packageType) { + this.packageType = packageType; + } + + public ByteBuffer getTranslatedFile() { + return translatedFile; + } + + public void setTranslatedFile(ByteBuffer translatedFile) { + this.translatedFile = translatedFile; + } + + public String getVspName() { + return vspName; + } + + public void setVspName(String vendorName) { + this.vspName = vendorName; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessArtifactEntity.java new file mode 100644 index 0000000000..89e6de1e87 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessArtifactEntity.java @@ -0,0 +1,128 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_process") +public class ProcessArtifactEntity implements VersionableEntity { + public static final String ENTITY_TYPE = "Vendor Software Product Process artifact"; + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + @PartitionKey(value = 1) + @Frozen + private Version version; + @ClusteringColumn + @Column(name = "component_id") + private String componentId; + @ClusteringColumn(value = 1) + @Column(name = "process_id") + private String id; + @Column(name = "artifact_name") + private String artifactName; + private ByteBuffer artifact; + + public ProcessArtifactEntity() { + + } + + /** + * Instantiates a new Process artifact entity. + * + * @param vspId the vsp id + * @param version the version + * @param componentId the component id + * @param id the id + */ + public ProcessArtifactEntity(String vspId, Version version, String componentId, String id) { + this.vspId = vspId; + this.version = version; + this.componentId = componentId; + this.id = id; + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + + public String getComponentId() { + return componentId; + } + + public void setComponentId(String componentId) { + this.componentId = componentId; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getVspId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getArtifactName() { + return artifactName; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + public ByteBuffer getArtifact() { + return artifact; + } + + public void setArtifact(ByteBuffer artifact) { + this.artifact = artifact; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java new file mode 100644 index 0000000000..d407540194 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntity.java @@ -0,0 +1,179 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +@Table(keyspace = "dox", name = "vsp_process") +public class ProcessEntity implements VersionableEntity { + public static final String ENTITY_TYPE = "Vendor Software Product Process"; + @PartitionKey + @Column(name = "vsp_id") + private String vspId; + @PartitionKey(value = 1) + @Frozen + private Version version; + @ClusteringColumn + @Column(name = "component_id") + private String componentId; + @ClusteringColumn(value = 1) + @Column(name = "process_id") + private String id; + private String name; + private String description; + @Column(name = "artifact_name") + private String artifactName; + + public ProcessEntity() { + + } + + /** + * Instantiates a new Process entity. + * + * @param vspId the vsp id + * @param version the version + * @param componentId the component id + * @param id the id + */ + public ProcessEntity(String vspId, Version version, String componentId, String id) { + this.vspId = vspId; + this.version = version; + this.componentId = componentId; + this.id = id; + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + + public String getComponentId() { + return componentId; + } + + public void setComponentId(String componentId) { + this.componentId = componentId; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getVspId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getArtifactName() { + return artifactName; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + ProcessEntity that = (ProcessEntity) obj; + + if (vspId != null ? !vspId.equals(that.vspId) : that.vspId != null) { + return false; + } + if (version != null ? !version.equals(that.version) : that.version != null) { + return false; + } + if (componentId != null ? !componentId.equals(that.componentId) : that.componentId != null) { + return false; + } + if (id != null ? !id.equals(that.id) : that.id != null) { + return false; + } + if (name != null ? !name.equals(that.name) : that.name != null) { + return false; + } + return description != null ? description.equals(that.description) : that.description == null + && + (artifactName != null ? artifactName.equals(that.artifactName) : that.artifactName == null); + + } + + @Override + public int hashCode() { + int result = vspId != null ? vspId.hashCode() : 0; + result = 31 * result + (version != null ? version.hashCode() : 0); + result = 31 * result + (componentId != null ? componentId.hashCode() : 0); + result = 31 * result + (id != null ? id.hashCode() : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (artifactName != null ? artifactName.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileData.java new file mode 100644 index 0000000000..c6f197a4cf --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileData.java @@ -0,0 +1,97 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +public class TranslatedFileData { + + private String displayName; + private String version; + private String category; + private String subcategory; + private String vandorName; + private String vendorRelease; + private String packageChecksum; + private String packageType; + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubcategory() { + return subcategory; + } + + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + + public String getVandorName() { + return vandorName; + } + + public void setVandorName(String vandorName) { + this.vandorName = vandorName; + } + + public String getVendorRelease() { + return vendorRelease; + } + + public void setVendorRelease(String vendorRelease) { + this.vendorRelease = vendorRelease; + } + + public String getPackageChecksum() { + return packageChecksum; + } + + public void setPackageChecksum(String packageChecksum) { + this.packageChecksum = packageChecksum; + } + + public String getPackageType() { + return packageType; + } + + public void setPackageType(String packageType) { + this.packageType = packageType; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/UploadDataEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/UploadDataEntity.java new file mode 100644 index 0000000000..a70b2cd6c8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/UploadDataEntity.java @@ -0,0 +1,135 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_information") +public class UploadDataEntity implements VersionableEntity { + private static final String ENTITY_TYPE = "Vendor Software Product Upload data"; + + @PartitionKey + @Column(name = "vsp_id") + private String id; + + @PartitionKey(value = 1) + @Frozen + private Version version; + + @Column(name = "package_name") + private String packageName; + + @Column(name = "package_version") + private String packageVersion; + + @Column(name = "validation_data") + private String validationData; + + @Column(name = "content_data") + private ByteBuffer contentData; + + public UploadDataEntity() { + } + + public UploadDataEntity(String id, Version version) { + this.id = id; + this.version = version; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public String getPackageVersion() { + return packageVersion; + } + + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } + + public String getValidationData() { + return validationData; + } + + public void setValidationData(String validationData) { + this.validationData = validationData; + } + + public ValidationStructureList getValidationDataStructure() { + return validationData == null ? null + : JsonUtil.json2Object(validationData, ValidationStructureList.class); + } + + public void setValidationDataStructure(ValidationStructureList validationData) { + this.validationData = validationData == null ? null + : JsonUtil.object2Json(validationData); + } + + public ByteBuffer getContentData() { + return contentData; + } + + public void setContentData(ByteBuffer contentData) { + this.contentData = contentData; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java new file mode 100644 index 0000000000..3423ba36b3 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java @@ -0,0 +1,242 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Computed; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +import java.util.List; + +@Table(keyspace = "dox", name = "vsp_information") +public class VspDetails implements VersionableEntity { + public static final String ENTITY_TYPE = "Vendor Software Product"; + + @PartitionKey + @Column(name = "vsp_id") + private String id; + + @PartitionKey(value = 1) + @Frozen + private Version version; + + private String name; + private String description; + + private String category; + + @Column(name = "sub_category") + private String subCategory; + + private String icon; + + @Column(name = "vendor_name") + private String vendorName; + + @Column(name = "vendor_id") + private String vendorId; + + @Column(name = "vlm_version") + @Frozen + private Version vlmVersion; + + @Column(name = "license_agreement") + private String licenseAgreement; + + @Column(name = "feature_groups") + private List featureGroups; + + @Column(name = "package_name") + private String packageName; + + @Column(name = "package_version") + private String packageVersion; + + @Column(name = "validation_data") + private String validationData; + + @Computed("writetime(name)") + private Long writetimeMicroSeconds; + + public VspDetails() { + } + + public VspDetails(String id, Version version) { + this.id = id; + this.version = version; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getVendorName() { + return vendorName; + } + + public void setVendorName(String vendorName) { + this.vendorName = vendorName; + } + + public String getVendorId() { + return vendorId; + } + + public void setVendorId(String vendorId) { + this.vendorId = vendorId; + } + + public Version getVlmVersion() { + return vlmVersion; + } + + public void setVlmVersion(Version vlmVersion) { + this.vlmVersion = vlmVersion; + } + + public String getLicenseAgreement() { + return licenseAgreement; + } + + public void setLicenseAgreement(String licenseAgreement) { + this.licenseAgreement = licenseAgreement; + } + + public List getFeatureGroups() { + return featureGroups; + } + + public void setFeatureGroups(List featureGroups) { + this.featureGroups = featureGroups; + } + + public String getPackageName() { + return packageName; + } + + public void setPackageName(String packageName) { + this.packageName = packageName; + } + + public String getPackageVersion() { + return packageVersion; + } + + public void setPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + } + + public String getValidationData() { + return validationData; + } + + public void setValidationData(String validationData) { + this.validationData = validationData; + } + + public ValidationStructureList getValidationDataStructure() { + return validationData == null ? null + : JsonUtil.json2Object(validationData, ValidationStructureList.class); + } + + public void setValidationDataStructure(ValidationStructureList validationData) { + this.validationData = validationData == null ? null + : JsonUtil.object2Json(validationData); + } + + public Long getWritetimeMicroSeconds() { + return this.writetimeMicroSeconds; + } + + public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) { + this.writetimeMicroSeconds = writetimeMicroSeconds; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntity.java new file mode 100644 index 0000000000..42fbecfe01 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntity.java @@ -0,0 +1,111 @@ +/*- + * ============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.vendorsoftwareproduct.dao.type; + +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityId; +import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; +import org.openecomp.sdc.versioning.dao.types.Version; + +@Table(keyspace = "dox", name = "vsp_information") +public class VspQuestionnaireEntity implements CompositionEntity { + private static final String ENTITY_TYPE = "Vendor Software Product"; + + @PartitionKey + @Column(name = "vsp_id") + private String id; + @PartitionKey(value = 1) + @Frozen + private Version version; + @Column(name = "questionnaire_data") + private String questionnaireData; + + public VspQuestionnaireEntity() { + + } + + public VspQuestionnaireEntity(String vspId, Version version) { + this.id = vspId; + this.version = version; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + @Override + public CompositionEntityType getType() { + return CompositionEntityType.vsp; + } + + @Override + public CompositionEntityId getCompositionEntityId() { + return new CompositionEntityId(getId(), null); + } + + @Override + public String getCompositionData() { + return null; //none + } + + @Override + public void setCompositionData(String compositionData) { + //none + } + + public String getQuestionnaireData() { + return questionnaireData; + } + + public void setQuestionnaireData(String questionnaireData) { + this.questionnaireData = questionnaireData; + } + +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java new file mode 100644 index 0000000000..b112ee2216 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Component.java @@ -0,0 +1,44 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import java.util.List; + +public class Component { + private ComponentData data; + private List nics; + + public ComponentData getData() { + return data; + } + + public void setData(ComponentData data) { + this.data = data; + } + + public List getNics() { + return nics; + } + + public void setNics(List nics) { + this.nics = nics; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java new file mode 100644 index 0000000000..0b3096c686 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java @@ -0,0 +1,80 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public class ComponentData implements CompositionDataEntity { + private String name; + private String description; + private String displayName; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ComponentData)) { + return false; + } + + ComponentData that = (ComponentData) obj; + + if (!name.equals(that.name)) { + return false; + } + if (description != null ? !description.equals(that.description) : that.description != null) { + return false; + } + return displayName != null ? displayName.equals(that.displayName) : that.displayName == null; + + } + + @Override + public int hashCode() { + int result = name.hashCode(); + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (displayName != null ? displayName.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionData.java new file mode 100644 index 0000000000..30e11cde60 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionData.java @@ -0,0 +1,44 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import java.util.List; + +public class CompositionData { + private List networks; + private List components; + + public List getNetworks() { + return networks; + } + + public void setNetworks(List networks) { + this.networks = networks; + } + + public List getComponents() { + return components; + } + + public void setComponents(List components) { + this.components = components; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataEntity.java new file mode 100644 index 0000000000..9c09b0ded4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataEntity.java @@ -0,0 +1,24 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public interface CompositionDataEntity { +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java new file mode 100644 index 0000000000..af1123b2e8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java @@ -0,0 +1,64 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public class CompositionEntityId { + private String id; + private CompositionEntityId parentId; + + public CompositionEntityId(String id, CompositionEntityId parentId) { + this.id = id; + this.parentId = parentId; + } + + public String getId() { + return id; + } + + public CompositionEntityId getParentId() { + return parentId; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + CompositionEntityId that = (CompositionEntityId) obj; + + if (id != null ? !id.equals(that.id) : that.id != null) { + return false; + } + return parentId != null ? parentId.equals(that.parentId) : that.parentId == null; + + } + + @Override + public int hashCode() { + int result = id != null ? id.hashCode() : 0; + result = 31 * result + (parentId != null ? parentId.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java new file mode 100644 index 0000000000..f762aeb341 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityType.java @@ -0,0 +1,28 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public enum CompositionEntityType { + vsp, + network, + component, + nic +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java new file mode 100644 index 0000000000..2f9eb4e69c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java @@ -0,0 +1,67 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public class Network implements CompositionDataEntity { + private String name; + private boolean dhcp; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isDhcp() { + return dhcp; + } + + public void setDhcp(boolean dhcp) { + this.dhcp = dhcp; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + Network network = (Network) obj; + + if (dhcp != network.dhcp) { + return false; + } + return name != null ? name.equals(network.name) : network.name == null; + + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (dhcp ? 1 : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkType.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkType.java new file mode 100644 index 0000000000..d90135a205 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkType.java @@ -0,0 +1,26 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public enum NetworkType { + Internal, + External +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java new file mode 100644 index 0000000000..e44a731824 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Nic.java @@ -0,0 +1,102 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +public class Nic implements CompositionDataEntity { + private String name; + private String description; + private String networkId; + private String networkName; + private NetworkType networkType; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public NetworkType getNetworkType() { + return networkType; + } + + public void setNetworkType(NetworkType networkType) { + this.networkType = networkType; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + + Nic nic = (Nic) obj; + + if (name != null ? !name.equals(nic.name) : nic.name != null) { + return false; + } + if (description != null ? !description.equals(nic.description) : nic.description != null) { + return false; + } + if (networkId != null ? !networkId.equals(nic.networkId) : nic.networkId != null) { + return false; + } + return networkType == nic.networkType; + + } + + @Override + public int hashCode() { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (description != null ? description.hashCode() : 0); + result = 31 * result + (networkId != null ? networkId.hashCode() : 0); + result = 31 * result + (networkType != null ? networkType.hashCode() : 0); + return result; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json new file mode 100644 index 0000000000..86b2f857cf --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/resources/factoryConfiguration.json @@ -0,0 +1,14 @@ +{ + "org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.VendorSoftwareProductDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.VendorSoftwareProductInfoDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.UploadDataDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.PackageInfoDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.NetworkDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ComponentDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ComponentArtifactDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.NicDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.VspQuestionnaireDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ProcessDaoFactoryImpl", + "org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDaoFactory": "org.openecomp.sdc.vendorsoftwareproduct.dao.impl.ProcessArtifactDaoFactoryImpl" + +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml new file mode 100644 index 0000000000..c732472152 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-lib + 1.0.0-SNAPSHOT + + + openecomp-sdc-vendor-software-product-core + + + + com.google.code.gson + gson + 2.3.1 + test + + + org.yaml + snakeyaml + 1.14 + test + + + org.openecomp.sdc + openecomp-sdc-enrichment-impl + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-api + ${project.version} + + + org.openecomp.core + openecomp-nosqldb-api + ${project.version} + + + org.freemarker + freemarker + 2.3.23 + + + org.testng + testng + ${testng.version} + test + + + org.openecomp.core + openecomp-config-lib + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-model-impl + ${project.version} + test + + + + \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java new file mode 100644 index 0000000000..2525537cef --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java @@ -0,0 +1,159 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + + +import java.nio.ByteBuffer; +import java.util.Collection; + +public class ComponentArtifactDaoCassandraImpl extends CassandraBaseDao + implements ComponentArtifactDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final ComponentArtifactAccessor accessor = + noSqlDb.getMappingManager().createAccessor(ComponentArtifactAccessor.class); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(ComponentArtifactEntity.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + + @Override + public void registerVersioning(String versionableEntityType) { + VersionableEntityMetadata metadata = new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName()); + + // metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata + // (VendorSoftwareProductConstants.UniqueValues.COMPONENT_ARTIFACT_NAME, + // Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(), mapper + // .getTableMetadata().getPartitionKey().get(1).getName(), "name")))); + + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, metadata); + } + + @Override + public ComponentArtifactEntity getArtifactByType(ComponentArtifactEntity entity) { + return accessor.listByType(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getType().toString()).one(); + } + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(ComponentArtifactEntity entity) { + return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getType().toString(), entity.getId()}; + } + + @Override + public Collection list(ComponentArtifactEntity entity) { + return accessor.listByType(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getType().toString()).all(); + } + + @Override + public void update(ComponentArtifactEntity entity) { + accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId(), entity.getArtifactName(), entity.getArtifact(), + entity.getType().toString()); + + } + + @Override + public void delete(ComponentArtifactEntity entity) { + accessor.delete(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getType().toString()); + } + + @Override + public Collection getArtifactNamesAndTypesForComponent( + ComponentArtifactEntity entity) { + return accessor.getArtifactNamesAndTypesForComponent(entity.getVspId(), + versionMapper.toUDT(entity.getVersion()), entity.getComponentId()).all(); + } + + @Override + public void deleteAll(ComponentArtifactEntity entity) { + accessor.deleteAll(entity.getVspId(), versionMapper.toUDT(entity.getVersion())); + } + + + @Accessor + interface ComponentArtifactAccessor { + + @Query( + "insert into vsp_component_artifact (vsp_id, version, component_id, artifact_id, name, " + + "artifact, artifact_type) values (?,?,?,?,?,?,?)") + ResultSet update(String vspId, UDTValue version, String componentId, String id, + String artifactName, ByteBuffer artifact, String type); + + @Query( + "select vsp_id, version, component_id, artifact_type, artifact_id, name, artifact from " + + "vsp_component_artifact where vsp_id=? and version=? and component_id=? and " + + "artifact_type =?") + Result listByType(String vspId, UDTValue version, String componentId, + String type); + + @Query( + "delete name, artifact from vsp_component_artifact where vsp_id=? and version=? and " + + "component_id=? and artifact_type=? and artifact_id=?") + ResultSet delete(String vspId, UDTValue version, String componentId, String type, + String artifactId); + + @Query( + "delete from vsp_component_artifact where vsp_id=? and version=? and component_id=? " + + "and artifact_type=?") + ResultSet delete(String vspId, UDTValue version, String componentId, String artifactType); + + @Query("delete from vsp_component_artifact where vsp_id=? and version=?") + ResultSet deleteAll(String vspId, UDTValue version); + + @Query( + "select name, artifact_type from vsp_component_artifact where vsp_id=? and version=? " + + "and component_id=?") + Result getArtifactNamesAndTypesForComponent(String vspId, + UDTValue version, + String componentId); + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java new file mode 100644 index 0000000000..07a9f104f4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory; + +public class ComponentArtifactDaoFactoryImpl extends ComponentArtifactDaoFactory { + private static final ComponentArtifactDao INSTANCE = new ComponentArtifactDaoCassandraImpl(); + + @Override + public ComponentArtifactDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java new file mode 100644 index 0000000000..85372380c0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java @@ -0,0 +1,139 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.UniqueValueMetadata; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +public class ComponentDaoCassandraImpl extends CassandraBaseDao + implements ComponentDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(ComponentEntity.class); + private static final ComponentAccessor accessor = + noSqlDb.getMappingManager().createAccessor(ComponentAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void registerVersioning(String versionableEntityType) { + VersionableEntityMetadata metadata = new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName()); + + + metadata.setUniqueValuesMetadata(Collections.singletonList( + new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.COMPONENT_NAME, + Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name")))); + + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, metadata); + } + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(ComponentEntity entity) { + return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getId()}; + } + + @Override + public void update(ComponentEntity entity) { + accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getId(), entity.getCompositionData()); + } + + @Override + public Collection list(ComponentEntity entity) { + return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all(); + } + + @Override + public void updateQuestionnaireData(String vspId, Version version, String id, + String questionnaireData) { + accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), id); + } + + @Override + public Collection listQuestionnaires(String vspId, Version version) { + return accessor.listQuestionnaires(vspId, versionMapper.toUDT(version)).all(); + } + + @Override + public void deleteAll(String vspId, Version version) { + accessor.deleteAll(vspId, version); + } + + @Accessor + interface ComponentAccessor { + + @Query( + "select vsp_id, version, component_id, composition_data from vsp_component " + + "where vsp_id=? and version=?") + Result list(String vspId, UDTValue version); + + @Query( + "select vsp_id, version, component_id, questionnaire_data from vsp_component " + + "where vsp_id=? and version=?") + Result listQuestionnaires(String vspId, UDTValue version); + + @Query( + "insert into vsp_component (vsp_id, version, component_id, composition_data) " + + "values (?,?,?,?)") + ResultSet updateCompositionData(String vspId, UDTValue version, String id, + String compositionData); + + @Query( + "update vsp_component set questionnaire_data=? where vsp_id=? and version=? " + + "and component_id=?") + ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version, + String id); + + @Query("delete from vsp_component where vsp_id=? and version=?") + ResultSet deleteAll(String vspId, Version version); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java new file mode 100644 index 0000000000..1e57242ce1 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; + +public class ComponentDaoFactoryImpl extends ComponentDaoFactory { + private static final ComponentDao INSTANCE = new ComponentDaoCassandraImpl(); + + @Override + public ComponentDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java new file mode 100644 index 0000000000..f7b8f30f0a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.UniqueValueMetadata; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +public class NetworkDaoCassandraImpl extends CassandraBaseDao implements NetworkDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(NetworkEntity.class); + private static final NetworkAccessor accessor = + noSqlDb.getMappingManager().createAccessor(NetworkAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void registerVersioning(String versionableEntityType) { + VersionableEntityMetadata metadata = new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName()); + + + metadata.setUniqueValuesMetadata(Collections.singletonList( + new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.NETWORK_NAME, + Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name")))); + + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, metadata); + } + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(NetworkEntity entity) { + return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getId()}; + } + + @Override + public void update(NetworkEntity entity) { + accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getId(), entity.getCompositionData()); + } + + @Override + public void updateQuestionnaireData(String vspId, Version version, String id, + String questionnaireData) { + accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), id); + } + + @Override + public Collection list(NetworkEntity entity) { + return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all(); + } + + @Override + public void deleteAll(String vspId, Version version) { + accessor.deleteAll(vspId, version); + } + + @Accessor + interface NetworkAccessor { + + @Query( + "select vsp_id, version, network_id, composition_data from vsp_network where vsp_id=? " + + "and version=?") + Result list(String vspId, UDTValue version); + + @Query( + "insert into vsp_network (vsp_id, version, network_id, composition_data) values (?,?,?,?)") + ResultSet updateCompositionData(String vspId, UDTValue version, String id, + String compositionData); + + @Query( + "update vsp_network set questionnaire_data=? where vsp_id=? and version=? and network_id=?") + ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version, + String id); + + @Query("delete from vsp_network where vsp_id=? and version=?") + ResultSet deleteAll(String vspId, Version version); + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java new file mode 100644 index 0000000000..b4360996df --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory; + +public class NetworkDaoFactoryImpl extends NetworkDaoFactory { + private static final NetworkDao INSTANCE = new NetworkDaoCassandraImpl(); + + @Override + public NetworkDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java new file mode 100644 index 0000000000..e7e1eed8e0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java @@ -0,0 +1,148 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.UniqueValueMetadata; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +public class NicDaoCassandraImpl extends CassandraBaseDao implements NicDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(NicEntity.class); + private static final NicAccessor accessor = + noSqlDb.getMappingManager().createAccessor(NicAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void registerVersioning(String versionableEntityType) { + VersionableEntityMetadata metadata = new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName()); + + + metadata.setUniqueValuesMetadata(Collections + .singletonList(new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.NIC_NAME, + Arrays.asList("vsp_id", "version", "component_id", "name")))); + + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, metadata); + } + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(NicEntity entity) { + return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId()}; + } + + @Override + public void create(NicEntity entity) { + super.create(entity); + } + + @Override + public void update(NicEntity entity) { + accessor.updateCompositionData(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId(), entity.getCompositionData()); + } + + @Override + public void updateQuestionnaireData(String vspId, Version version, String id, String componentId, + String questionnaireData) { + accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), id, + componentId); + } + + @Override + public Collection listByVsp(String vspId, Version version) { + return accessor.listByVspId(vspId, versionMapper.toUDT(version)).all(); + } + + @Override + public Collection list(NicEntity entity) { + return accessor.listByComponentId(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId()).all(); + } + + public void deleteByComponentId(String vspId, Version version, String componentId) { + accessor.deleteByComponentId(vspId, version, componentId); + } + + public void deleteByVspId(String vspId, Version version) { + accessor.deleteByVspId(vspId, versionMapper.toUDT(version)); + } + + @Accessor + interface NicAccessor { + + @Query( + "select vsp_id, version, component_id, nic_id, composition_data " + + "from vsp_component_nic where vsp_id=? and version=? and component_id=?") + Result listByComponentId(String vspId, UDTValue version, String componentId); + + @Query("select * from vsp_component_nic where vsp_id=? and version=?") + Result listByVspId(String vspId, UDTValue version); + + @Query( + "insert into vsp_component_nic (vsp_id, version, component_id, nic_id, composition_data) " + + "values (?,?,?,?,?)") + ResultSet updateCompositionData(String vspId, UDTValue version, String componentId, String id, + String compositionData); + + @Query( + "update vsp_component_nic set questionnaire_data=? where vsp_id=? and version=? " + + "and component_id=? and nic_id=?") + ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version, + String componentId, String id); + + @Query("delete from vsp_component_nic where vsp_id=? and version=? and component_id=?") + ResultSet deleteByComponentId(String vspId, Version version, String componentId); + + @Query("delete from vsp_component_nic where vsp_id=? and version=?") + ResultSet deleteByVspId(String vspId, UDTValue version); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java new file mode 100644 index 0000000000..f4dd8d5a71 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory; + +public class NicDaoFactoryImpl extends NicDaoFactory { + private static final NicDao INSTANCE = new NicDaoCassandraImpl(); + + @Override + public NicDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoFactoryImpl.java new file mode 100644 index 0000000000..8b9bedcd3a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory; + +public class PackageInfoDaoFactoryImpl extends PackageInfoDaoFactory { + private static final PackageInfoDao INSTANCE = new PackageInfoDaoImpl(); + + @Override + public PackageInfoDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java new file mode 100644 index 0000000000..9b7b81fe52 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java @@ -0,0 +1,103 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class PackageInfoDaoImpl extends CassandraBaseDao implements PackageInfoDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(PackageInfo.class); + private static final PackageInfoAccessor accessor = + noSqlDb.getMappingManager().createAccessor(PackageInfoAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(PackageInfo entity) { + return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion())}; + } + + @Override + public Collection list(PackageInfo entity) { + return accessor.listInfo().all(); + } + + @Override + public List listByCategory(String category, String subCategory) { + Result packages = accessor.listInfo(); + + List filteredPackages = new ArrayList<>(); + for (PackageInfo packageInfo : packages) { + if (category != null) { + if (category.equals(packageInfo.getCategory())) { + filteredPackages.add(packageInfo); + } + } else if (subCategory != null) { + if (subCategory.equals(packageInfo.getSubCategory())) { + filteredPackages.add(packageInfo); + } + } else { + filteredPackages.add(packageInfo); + } + } + + return filteredPackages; + } + + @Override + public void deleteRowTranslateContent(String vspId, Version version) { + accessor.deleteRowTranslateContent(vspId, version); + } + + @Accessor + interface PackageInfoAccessor { + + @Query( + "SELECT vsp_id,version,display_name,vsp_name,vsp_description,vendor_name,category," + + "sub_category,vendor_release,package_checksum,package_type FROM package_details") + Result listInfo(); + + @Query("DELETE TRANSLATE_CONTENT FROM package_details WHERE vsp_id=? and version=?") + Result deleteRowTranslateContent(String vspId, Version version); + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java new file mode 100644 index 0000000000..0e9fd90a13 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java @@ -0,0 +1,82 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.nio.ByteBuffer; + +public class ProcessArtifactDaoCassandraImpl implements ProcessArtifactDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final ProcessArtifactAccessor accessor = + noSqlDb.getMappingManager().createAccessor(ProcessArtifactAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void update(ProcessArtifactEntity entity) { + accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId(), entity.getArtifactName(), entity.getArtifact()); + } + + @Override + public ProcessArtifactEntity get(ProcessArtifactEntity entity) { + return accessor + .get(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), entity.getComponentId(), + entity.getId()); + } + + @Override + public void delete(ProcessArtifactEntity entity) { + accessor.delete(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId()); + } + + @Accessor + interface ProcessArtifactAccessor { + + @Query( + "insert into vsp_process (vsp_id, version, component_id, process_id, artifact_name," + + " artifact) values (?,?,?,?,?,?)") + ResultSet update(String vspId, UDTValue version, String componentId, String id, + String artifactName, ByteBuffer artifact); + + @Query( + "select vsp_id, version, component_id, process_id, artifact_name, artifact " + + "from vsp_process where vsp_id=? and version=? and component_id=? and process_id=?") + ProcessArtifactEntity get(String vspId, UDTValue version, String componentId, String id); + + @Query( + "delete artifact_name, artifact from vsp_process where vsp_id=? and version=? and" + + " component_id=? and process_id=?") + ResultSet delete(String vspId, UDTValue version, String componentId, String id); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java new file mode 100644 index 0000000000..2a5d9013bd --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDaoFactory; + +public class ProcessArtifactDaoFactoryImpl extends ProcessArtifactDaoFactory { + private static final ProcessArtifactDao INSTANCE = new ProcessArtifactDaoCassandraImpl(); + + @Override + public ProcessArtifactDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java new file mode 100644 index 0000000000..b8900eb5d3 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java @@ -0,0 +1,139 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.UniqueValueMetadata; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +public class ProcessDaoCassandraImpl implements ProcessDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(ProcessEntity.class); + private static final ProcessAccessor accessor = + noSqlDb.getMappingManager().createAccessor(ProcessAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void registerVersioning(String versionableEntityType) { + VersionableEntityMetadata metadata = new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName()); + + metadata.setUniqueValuesMetadata(Collections.singletonList( + new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME, + Arrays.asList("vsp_id", "version", "component_id", "name")))); + + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, metadata); + } + + @Override + public Collection list(ProcessEntity entity) { + return accessor + .list(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), entity.getComponentId()) + .all(); + } + + @Override + public void create(ProcessEntity entity) { + accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId(), entity.getName(), entity.getDescription()); + } + + @Override + public void update(ProcessEntity entity) { + accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId(), entity.getName(), entity.getDescription()); + } + + @Override + public ProcessEntity get(ProcessEntity entity) { + return accessor + .get(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), entity.getComponentId(), + entity.getId()); + } + + @Override + public void delete(ProcessEntity entity) { + if (entity.getId() == null) { + accessor.deleteAll(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId()); + } else { + accessor.delete(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), + entity.getComponentId(), entity.getId()); + } + } + + public void deleteAll(ProcessEntity entity) { + accessor.deleteAll(entity.getVspId(), versionMapper.toUDT(entity.getVersion())); + } + + @Accessor + interface ProcessAccessor { + + @Query( + "insert into vsp_process (vsp_id, version, component_id, process_id, name, description) " + + "values (?,?,?,?,?,?)") + ResultSet update(String vspId, UDTValue version, String componentId, String id, String name, + String description); + + @Query( + "select vsp_id, version, component_id, process_id, name, description, artifact_name " + + "from vsp_process where vsp_id=? and version=? and component_id=? and process_id=?") + ProcessEntity get(String vspId, UDTValue version, String componentId, String id); + + @Query( + "select vsp_id, version, component_id, process_id, name, description, artifact_name " + + "from vsp_process where vsp_id=? and version=? and component_id=?") + Result list(String vspId, UDTValue version, String componentId); + + @Query( + "delete from vsp_process where vsp_id=? and version=? and component_id=? and process_id=?") + ResultSet delete(String vspId, UDTValue version, String componentId, String id); + + @Query("delete from vsp_process where vsp_id=? and version=? and component_id=?") + ResultSet deleteAll(String vspId, UDTValue version, String componentId); + + @Query("delete from vsp_process where vsp_id=? and version=?") + ResultSet deleteAll(String vspId, UDTValue version); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java new file mode 100644 index 0000000000..4c981d8448 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory; + +public class ProcessDaoFactoryImpl extends ProcessDaoFactory { + private static final ProcessDao INSTANCE = new ProcessDaoCassandraImpl(); + + @Override + public ProcessDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java new file mode 100644 index 0000000000..317bc344c4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDaoFactory; + +public class UploadDataDaoFactoryImpl extends UploadDataDaoFactory { + private static final UploadDataDao INSTANCE = new UploadDataDaoImpl(); + + @Override + public UploadDataDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java new file mode 100644 index 0000000000..df019a4f53 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java @@ -0,0 +1,92 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.nio.ByteBuffer; +import java.util.Collection; + +public class UploadDataDaoImpl extends CassandraBaseDao implements UploadDataDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(UploadDataEntity.class); + private static final UploadDataAccessor accessor = + noSqlDb.getMappingManager().createAccessor(UploadDataAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(UploadDataEntity entity) { + return new Object[]{entity.getId(), versionMapper.toUDT(entity.getVersion())}; + } + + @Override + public Collection list(UploadDataEntity entity) { + return accessor.listAll().all(); + } + + @Override + public void deleteContentDataAndValidationData(String vspId, Version version) { + accessor.deleteContentDataAndValidationData(vspId, versionMapper.toUDT(version)); + } + + @Override + public ByteBuffer getContentData(String vspId, Version version) { + return accessor.getContentData(vspId, version).one().getContentData(); + } + + + @Accessor + interface UploadDataAccessor { + + @Query( + "SELECT package_name, package_version, content_data, validation_data FROM vsp_information") + Result listAll(); + + @Query( + "DELETE package_name, package_version, content_data, validation_data FROM vsp_information " + + "WHERE vsp_id=? and version=?") + Result deleteContentDataAndValidationData(String vspId, UDTValue udtValue); + + @Query("SELECT CONTENT_DATA FROM vsp_information WHERE vsp_id=? and version=?") + Result getContentData(String vspId, Version version); + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java new file mode 100644 index 0000000000..587f8ac036 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; + +public class VendorSoftwareProductDaoFactoryImpl extends VendorSoftwareProductDaoFactory { + private static final VendorSoftwareProductDao INSTANCE = new VendorSoftwareProductDaoImpl(); + + @Override + public VendorSoftwareProductDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java new file mode 100644 index 0000000000..f592e63280 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java @@ -0,0 +1,349 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.core.model.dao.EnrichedServiceArtifactDao; +import org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory; +import org.openecomp.core.model.dao.ServiceArtifactDaoFactory; +import org.openecomp.core.model.dao.ServiceArtifactDaoInter; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDaoFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.nio.ByteBuffer; +import java.util.Collection; +import java.util.List; +import java.util.Objects; + +public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao { + + private static final VendorSoftwareProductInfoDao vspInfoDao = + VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); + private static final PackageInfoDao packageInfoDao = + PackageInfoDaoFactory.getInstance().createInterface(); + private static final UploadDataDao uploadDataDao = + UploadDataDaoFactory.getInstance().createInterface(); + private static final VspQuestionnaireDao vspQuestionnaireDao = + VspQuestionnaireDaoFactory.getInstance().createInterface(); + private static final NetworkDao networkDao = NetworkDaoFactory.getInstance().createInterface(); + private static final ComponentDao componentDao = + ComponentDaoFactory.getInstance().createInterface(); + private static final NicDao nicDao = NicDaoFactory.getInstance().createInterface(); + private static final ProcessDao processDao = ProcessDaoFactory.getInstance().createInterface(); + private static final ProcessArtifactDao processArtifactDao = + ProcessArtifactDaoFactory.getInstance().createInterface(); + private static final ComponentArtifactDao componentArtifactDao = + ComponentArtifactDaoFactory.getInstance().createInterface(); + private static final ServiceArtifactDaoInter artifactDao = + ServiceArtifactDaoFactory.getInstance().createInterface(); + private static final EnrichedServiceArtifactDao enrichArtifactDao = + EnrichedServiceArtifactDaoFactory.getInstance().createInterface(); + + @Override + public void registerVersioning(String versionableEntityType) { + vspInfoDao.registerVersioning(versionableEntityType); + vspQuestionnaireDao.registerVersioning(versionableEntityType); + networkDao.registerVersioning(versionableEntityType); + componentDao.registerVersioning(versionableEntityType); + nicDao.registerVersioning(versionableEntityType); + processDao.registerVersioning(versionableEntityType); + } + + @Override + public void createVendorSoftwareProductInfo(VspDetails vspDetails) { + vspInfoDao.create(vspDetails); + } + + @Override + public Collection listVendorSoftwareProductsInfo() { + return vspInfoDao.list(new VspDetails()); + } + + public VspDetails getVendorSoftwareProductInfo(VspDetails vspDetails) { + return vspInfoDao.get(vspDetails); + } + + + @Override + public void updateVendorSoftwareProductInfo(VspDetails vspDetails) { + vspInfoDao.update(vspDetails); + } + + @Override + public void deleteVendorSoftwareProductInfo(VspDetails vspDetails) { + vspInfoDao.delete(vspDetails); + } + + @Override + public void updateUploadData(UploadDataEntity uploadData) { + uploadDataDao.update(uploadData); + } + + @Override + public UploadDataEntity getUploadData(UploadDataEntity uploadData) { + return uploadDataDao.get(uploadData); + } + + @Override + public ByteBuffer getContentData(UploadDataEntity uploadDataEntity) { + return uploadDataDao.getContentData(uploadDataEntity.getId(), uploadDataEntity.getVersion()); + } + + @Override + public void insertPackageDetails(PackageInfo packageInfo) { + packageInfoDao.update(packageInfo); + } + + @Override + public PackageInfo getPackageInfo(PackageInfo packageInfo) { + return packageInfoDao.get(packageInfo); + } + + @Override + public void deletePackageInfo(PackageInfo packageInfo) { + packageInfoDao.delete(packageInfo); + } + + @Override + public Collection listNetworks(String vspId, Version version) { + return networkDao.list(new NetworkEntity(vspId, version, null)); + } + + @Override + public void createNetwork(NetworkEntity network) { + networkDao.create(network); + } + + @Override + public void updateNetwork(NetworkEntity networkEntity) { + networkDao.update(networkEntity); + } + + @Override + public NetworkEntity getNetwork(String vspId, Version version, String networkId) { + return networkDao.get(new NetworkEntity(vspId, version, networkId)); + } + + @Override + public void deleteNetwork(String vspId, Version version) { + NetworkEntity networkEntity = new NetworkEntity(vspId, version, null); + networkDao.delete(networkEntity); + } + + @Override + public List listPackages(String category, String subCategory) { + return packageInfoDao.listByCategory(category, subCategory); + } + + + @Override + public Collection listComponents(String vspId, Version version) { + return componentDao.list(new ComponentEntity(vspId, version, null)); + } + + @Override + public void createComponent(ComponentEntity component) { + componentDao.create(component); + } + + @Override + public void updateComponent(ComponentEntity component) { + componentDao.update(component); + } + + @Override + public ComponentEntity getComponent(String vspId, Version version, String componentId) { + return componentDao.get(new ComponentEntity(vspId, version, componentId)); + } + + @Override + public Collection listComponentsQuestionnaire(String vspId, Version version) { + return componentDao.listQuestionnaires(vspId, version); + } + + @Override + public void updateComponentQuestionnaire(String vspId, Version version, String componentId, + String questionnaireData) { + componentDao.updateQuestionnaireData(vspId, version, componentId, questionnaireData); + } + + @Override + public void deleteComponent(String vspId, Version version) { + ComponentEntity componentEntity = new ComponentEntity(vspId, version, null); + componentDao.delete(componentEntity); + } + + @Override + public Collection listProcesses(String vspId, Version version, + String componentId) { + return processDao.list(new ProcessEntity(vspId, version, componentId, null)); + } + + @Override + public void deleteProcesses(String vspId, Version version, String componentId) { + processDao.delete(new ProcessEntity(vspId, version, componentId, null)); + } + + @Override + public ProcessEntity getProcess(String vspId, Version version, String componentId, + String processId) { + return processDao.get(new ProcessEntity(vspId, version, componentId, processId)); + } + + @Override + public void createProcess(ProcessEntity processEntity) { + processDao.create(processEntity); + } + + @Override + public void updateProcess(ProcessEntity processEntity) { + processDao.update(processEntity); + } + + @Override + public void deleteProcess(String vspId, Version version, String componentId, String processId) { + processDao.delete(new ProcessEntity(vspId, version, componentId, processId)); + } + + @Override + public void uploadProcessArtifact(String vspId, Version version, String componentId, + String processId, byte[] artifact, String artifactName) { + ProcessArtifactEntity processArtifact = + new ProcessArtifactEntity(vspId, version, componentId, processId); + processArtifact.setArtifact(ByteBuffer.wrap(artifact)); + processArtifact.setArtifactName(artifactName); + processArtifactDao.update(processArtifact); + } + + @Override + public ProcessArtifactEntity getProcessArtifact(String vspId, Version version, String componentId, + String processId) { + return processArtifactDao + .get(new ProcessArtifactEntity(vspId, version, componentId, processId)); + } + + @Override + public void deleteProcessArtifact(String vspId, Version version, String componentId, + String processId) { + processArtifactDao.delete(new ProcessArtifactEntity(vspId, version, componentId, processId)); + } + + @Override + public VspQuestionnaireEntity getQuestionnaire(String vspId, Version version) { + return vspQuestionnaireDao.get(new VspQuestionnaireEntity(vspId, version)); + } + + @Override + public void updateQuestionnaire(String vspId, Version version, String questionnaireData) { + vspQuestionnaireDao.updateQuestionnaireData(vspId, version, questionnaireData); + } + + @Override + public Collection listNics(String vspId, Version version, String componentId) { + return nicDao.list(new NicEntity(vspId, version, componentId, null)); + } + + @Override + public void createNic(NicEntity nic) { + nicDao.create(nic); + } + + @Override + public NicEntity getNic(String vspId, Version version, String componentId, String nicId) { + return nicDao.get(new NicEntity(vspId, version, componentId, nicId)); + } + + @Override + public void updateNic(NicEntity nicEntity) { + nicDao.update(nicEntity); + } + + @Override + public void updateNicQuestionnaire(String vspId, Version version, String componentId, + String nicId, String questionnaireData) { + nicDao.updateQuestionnaireData(vspId, version, componentId, nicId, questionnaireData); + } + + @Override + public Collection listNicsByVsp(String vspId, Version version) { + return nicDao.listByVsp(vspId, version); + } + + @Override + public void deleteNic(String vspId, Version version, String componentId) { + NicEntity nicEntity = new NicEntity(vspId, version, componentId, null); + nicDao.delete(nicEntity); + } + + @Override + public void deleteUploadData(String vspId, Version version) { + networkDao.deleteAll(vspId, version); + nicDao.deleteByVspId(vspId, version); + artifactDao.delete(vspId, version); + enrichArtifactDao.delete(vspId, version); + ComponentArtifactEntity componentArtifactEntity = + new ComponentArtifactEntity(vspId, version, null, null); + ProcessEntity processEntity = new ProcessEntity(vspId, version, null, null); + componentArtifactDao.deleteAll(componentArtifactEntity); + processDao.deleteAll(processEntity); + componentDao.deleteAll(vspId, version); + uploadDataDao.deleteContentDataAndValidationData(vspId, version); + } + + @Override + public void updateVspLatestModificationTime(String vspId, Version version) { + if (Objects.isNull(vspId) || Objects.isNull(version)) { + return; + } + + VspDetails retrieved = getVendorSoftwareProductInfo(new VspDetails(vspId, version)); + updateVendorSoftwareProductInfo(retrieved); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java new file mode 100644 index 0000000000..1dcb3f4c66 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java @@ -0,0 +1,34 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; + +public class VendorSoftwareProductInfoDaoFactoryImpl extends VendorSoftwareProductInfoDaoFactory { + private static final VendorSoftwareProductInfoDao INSTANCE = + new VendorSoftwareProductInfoDaoImpl(); + + @Override + public VendorSoftwareProductInfoDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java new file mode 100644 index 0000000000..c3096dab29 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java @@ -0,0 +1,83 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.dao.impl.CassandraBaseDao; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +import java.util.Collection; + +public class VendorSoftwareProductInfoDaoImpl extends CassandraBaseDao + implements VendorSoftwareProductInfoDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(VspDetails.class); + private static final VendorSoftwareProductInfoAccessor accessor = + noSqlDb.getMappingManager().createAccessor(VendorSoftwareProductInfoAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void registerVersioning(String versionableEntityType) { + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName())); + } + + @Override + protected Mapper getMapper() { + return mapper; + } + + @Override + protected Object[] getKeys(VspDetails entity) { + return new Object[]{entity.getId(), versionMapper.toUDT(entity.getVersion())}; + } + + @Override + public Collection list(VspDetails entity) { + return accessor.listAll().all(); + } + + @Accessor + interface VendorSoftwareProductInfoAccessor { + + @Query( + "SELECT vsp_id,version,name,description,icon,category,sub_category,vendor_id," + + "vlm_version,license_agreement,feature_groups FROM vsp_information") + Result listAll(); + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java new file mode 100644 index 0000000000..ef4dd0de74 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java @@ -0,0 +1,72 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import com.datastax.driver.core.ResultSet; +import com.datastax.driver.core.UDTValue; +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.UDTMapper; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity; +import org.openecomp.sdc.versioning.VersioningManagerFactory; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +public class VspQuestionnaireDaoCassandraImpl implements VspQuestionnaireDao { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(VspQuestionnaireEntity.class); + private static final VspQuestionnaireAccessor accessor = + noSqlDb.getMappingManager().createAccessor(VspQuestionnaireAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + @Override + public void registerVersioning(String versionableEntityType) { + VersioningManagerFactory.getInstance().createInterface() + .register(versionableEntityType, new VersionableEntityMetadata( + mapper.getTableMetadata().getName(), + mapper.getTableMetadata().getPartitionKey().get(0).getName(), + mapper.getTableMetadata().getPartitionKey().get(1).getName())); + } + + @Override + public VspQuestionnaireEntity get(VspQuestionnaireEntity entity) { + return mapper.get(entity.getId(), versionMapper.toUDT(entity.getVersion())); + } + + @Override + public void updateQuestionnaireData(String id, Version version, String questionnaireData) { + accessor.updateQuestionnaireData(questionnaireData, id, versionMapper.toUDT(version)); + } + + @Accessor + interface VspQuestionnaireAccessor { + + @Query("update vsp_information set questionnaire_data=? where vsp_id=? and version=?") + ResultSet updateQuestionnaireData(String questionnaireData, String id, UDTValue version); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java new file mode 100644 index 0000000000..aa91302ca2 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.dao.impl; + +import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDaoFactory; + +public class VspQuestionnaireDaoFactoryImpl extends VspQuestionnaireDaoFactory { + private static final VspQuestionnaireDao INSTANCE = new VspQuestionnaireDaoCassandraImpl(); + + @Override + public VspQuestionnaireDao createInterface() { + return INSTANCE; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java new file mode 100644 index 0000000000..2c8ffb1ded --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java @@ -0,0 +1,97 @@ +package org.openecomp.sdc.vendorsoftwareproduct.dao; + +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; + +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.core.model.dao.ServiceModelDaoFactory; +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.core.utilities.CommonMethods; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.HashMap; +import java.util.Map; + +public class ServiceModelDaoFactoryTest { + + private static final String vspId = CommonMethods.nextUuId(); + private static final Version version = Version.valueOf("1.0"); + private static final String baseServiceTemplateName = "baseYaml.yaml"; + private static String artifact001; + + +// @Test + public void storeServiceModelTest() { + + + ToscaServiceModel model = getToscaServiceModel(); + ServiceModelDaoFactory.getInstance().createInterface().storeServiceModel(vspId, version, model); + } + + +// @Test(dependsOnMethods = "storeServiceModelTest") + public void getServiceModelTest() { + Object model = + ServiceModelDaoFactory.getInstance().createInterface().getServiceModel(vspId, version); + Assert.assertNotNull(model); + Assert.assertTrue(model instanceof ToscaServiceModel); + if (model instanceof ToscaServiceModel) { + + artifact001 = + (String) ((ToscaServiceModel) model).getArtifactFiles().getFileList().toArray()[0]; + } + } + +// @Test(dependsOnMethods = "getServiceModelTest") + public void getServiceModelInfoTest() { + Object info = ServiceModelDaoFactory.getInstance().createInterface() + .getServiceModelInfo(vspId, version, artifact001); + Assert.assertNotNull(info); + Assert.assertTrue(info instanceof ServiceArtifact); + if (info instanceof ServiceArtifact) { + Assert.assertEquals(((ServiceArtifact) info).getName(), artifact001); + } + } + + private ToscaServiceModel getToscaServiceModel() { + + Map serviceTemplates = getServiceTemplates(baseServiceTemplateName); + FileContentHandler artifacts = getArtifacts(); + return new ToscaServiceModel(artifacts, serviceTemplates, baseServiceTemplateName); + } + + + private Map getServiceTemplates(String base) { + + Map serviceTemplates = new HashMap<>(); + + serviceTemplates.put(base, getServiceTemplate()); + serviceTemplates.put("SERV1", getServiceTemplate()); + serviceTemplates.put("SERV2", getServiceTemplate()); + serviceTemplates.put("SERV3", getServiceTemplate()); + serviceTemplates.put("SERV4", getServiceTemplate()); + + return serviceTemplates; + } + + public FileContentHandler getArtifacts() { + Map artifacts = new HashMap<>(); + artifacts.put("art1", "this is art1".getBytes()); + artifacts.put("art2", ("this is art2 desc:" + CommonMethods.nextUuId()).getBytes()); + artifacts.put("art2", ("this is art3 desc:" + CommonMethods.nextUuId()).getBytes()); + artifacts.put("art2", ("this is art4 desc:" + CommonMethods.nextUuId()).getBytes()); + + FileContentHandler fileContentHandler = new FileContentHandler(); + fileContentHandler.putAll(artifacts); + return fileContentHandler; + } + + public ServiceTemplate getServiceTemplate() { + ServiceTemplate serviceTemplate = new ServiceTemplate(); + serviceTemplate.setTosca_definitions_version("version 1.0"); + serviceTemplate.setDescription(CommonMethods.nextUuId()); + return serviceTemplate; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml new file mode 100644 index 0000000000..8eabd76102 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + + org.openecomp.sdc + openecomp-sdc-lib + 1.0.0-SNAPSHOT + + + + openecomp-sdc-vendor-software-product-lib + pom + + + openecomp-sdc-vendor-software-product-api + openecomp-sdc-vendor-software-product-core + + + + \ No newline at end of file -- cgit 1.2.3-korg