From 280f8015d06af1f41a3ef12e8300801c7a5e0d54 Mon Sep 17 00:00:00 2001 From: AviZi Date: Fri, 9 Jun 2017 02:39:56 +0300 Subject: [SDC-29] Amdocs OnBoard 1707 initial commit. Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi --- .../tools/migration/1702_to_1707_zusammen/pom.xml | 241 ++++++++++ .../src/main/assembly/migration-lib-assembly.xml | 41 ++ .../openecomp/core/migration/MigrationMain.java | 485 +++++++++++++++++++++ .../migration/convertors/ComponentConvertor.java | 102 +++++ .../convertors/EntitlementPoolConvertor.java | 96 ++++ .../convertors/FeatureGroupConvertor.java | 100 +++++ .../core/migration/convertors/LKGConvertor.java | 79 ++++ .../convertors/LicenseAgreementConvertor.java | 84 ++++ .../core/migration/convertors/MibConvertor.java | 66 +++ .../migration/convertors/NetworkConvertor.java | 91 ++++ .../core/migration/convertors/NicConvertor.java | 95 ++++ .../OrchestrationTemplateCandidateConvertor.java | 78 ++++ .../migration/convertors/ProcessConvertor.java | 98 +++++ .../core/migration/convertors/VlmConvertor.java | 94 ++++ .../convertors/VspInformationConvertor.java | 141 ++++++ .../convertors/VspServiceArtifactConvertor.java | 86 ++++ .../convertors/VspServiceTemplateConvertor.java | 102 +++++ .../loaders/ComponentCassandraLoader.java | 55 +++ .../loaders/EntitlementPoolCassandraLoader.java | 31 ++ .../loaders/FeatureGroupCassandraLoader.java | 30 ++ .../core/migration/loaders/LKGCassandraLoader.java | 31 ++ .../loaders/LicenseAgreementCassandraLoader.java | 31 ++ .../core/migration/loaders/MibCassandraLoader.java | 55 +++ .../migration/loaders/NetworkCassandraLoader.java | 35 ++ .../core/migration/loaders/NicCassandraLoader.java | 63 +++ ...hestrationTemplateCandidateCassandraLoader.java | 56 +++ .../migration/loaders/ProcessCassandraLoader.java | 55 +++ .../loaders/ServiceArtifactCassandraLoader.java | 61 +++ .../loaders/ServiceTemplateCassandraLoader.java | 61 +++ .../loaders/VendorLicenseModelCassandraLoader.java | 50 +++ .../loaders/VendorSoftwareProductInfoLoader.java | 68 +++ .../loaders/VersionInfoCassandraLoader.java | 55 +++ .../core/migration/loaders/VspInformation.java | 276 ++++++++++++ .../core/migration/store/ElementHandler.java | 136 ++++++ .../core/migration/store/ItemHandler.java | 122 ++++++ .../org/openecomp/core/migration/util/Utils.java | 15 + .../migration/util/marker/MigrationMarker.java | 49 +++ .../util/marker/MigrationMarkerEntity.java | 45 ++ .../src/main/resources/logback.xml | 282 ++++++++++++ 39 files changed, 3741 insertions(+) create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java create mode 100644 openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml (limited to 'openecomp-be/tools/migration/1702_to_1707_zusammen') diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml new file mode 100644 index 0000000000..145a3fb4ab --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml @@ -0,0 +1,241 @@ + + 4.0.0 + + + + 2.4.7 + 2.7.7 + + + + + + openecomp-zusammen-migration + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-api + ${project.version} + + + openecomp-zusammen-plugin + org.openecomp.core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-vendor-software-product-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-vendor-license-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-model-impl + ${project.version} + + + org.openecomp.core + openecomp-zusammen-core + ${project.version} + + + com.amdocs.zusammen.plugin + zusammen-state-store-cassandra-plugin + 0.0.1-SNAPSHOT + + + org.hibernate + hibernate-validator + RELEASE + + + org.openecomp.sdc + openecomp-sdc-vendor-license-core + ${project.version} + + + openecomp-zusammen-migration + org.openecomp.core.migration + 1.1.0-SNAPSHOT + + org.openecomp.sdc + openecomp-sdc-lib + ../../../lib + 1.1.0-SNAPSHOT + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + true + + 1.8 + 1.8 + + + + + org.codehaus.mojo + license-maven-plugin + 1.10 + + false + + ============LICENSE_START======================================================= + + + ============LICENSE_END========================================================= + + + ================================================================================ + + apache_v2 + 2017 + AT&T Intellectual Property. All rights reserved. + + SDC + true + true + true + true + false + + **/*.java + **/*.js + **/*.ts + + + src + app + server-mock + typings + + + + + first + + update-file-header + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.8 + + + copy-dependencies + install + + copy-dependencies + + + ${project.build.directory}/lib + false + false + true + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + package + + + + + + true + custom + + lib/${artifact.artifactId}-${baseVersion}.${artifact.extension} + + org.openecomp.core.migration.MigrationMain + + + + lib/ + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19.1 + + false + true + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + ant-test + package + + + + + + + run + + + + + + maven-assembly-plugin + ${mvn.assembly.version} + + + Generate assembly + install + + single + + + + + + ${basedir}/src/main/assembly/migration-lib-assembly.xml + + + openecomp-zusammen-migration-lib + + + + + + + diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml new file mode 100644 index 0000000000..42296baa6e --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml @@ -0,0 +1,41 @@ + + + + zip + + + false + + + + + + ${basedir}/.. + + cassandra2zusammen.sh + + / + 0755 + + + ${basedir}/target + + + openecomp-zusammen*.jar + + + / + + + ${basedir}/target/lib + /lib + + + + diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java new file mode 100644 index 0000000000..283c9cf25d --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java @@ -0,0 +1,485 @@ +package org.openecomp.core.migration; + +import com.amdocs.zusammen.datatypes.SessionContext; +import com.amdocs.zusammen.datatypes.UserInfo; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.ItemCassandraDao; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.VersionCassandraDao; +import org.openecomp.core.migration.convertors.ComponentConvertor; +import org.openecomp.core.migration.convertors.EntitlementPoolConvertor; +import org.openecomp.core.migration.convertors.FeatureGroupConvertor; +import org.openecomp.core.migration.convertors.LKGConvertor; +import org.openecomp.core.migration.convertors.LicenseAgreementConvertor; +import org.openecomp.core.migration.convertors.MibConvertor; +import org.openecomp.core.migration.convertors.NetworkConvertor; +import org.openecomp.core.migration.convertors.NicConvertor; +import org.openecomp.core.migration.convertors.OrchestrationTemplateCandidateConvertor; +import org.openecomp.core.migration.convertors.ProcessConvertor; +import org.openecomp.core.migration.convertors.VlmConvertor; +import org.openecomp.core.migration.convertors.VspInformationConvertor; +import org.openecomp.core.migration.convertors.VspServiceArtifactConvertor; +import org.openecomp.core.migration.convertors.VspServiceTemplateConvertor; +import org.openecomp.core.migration.loaders.ComponentCassandraLoader; +import org.openecomp.core.migration.loaders.EntitlementPoolCassandraLoader; +import org.openecomp.core.migration.loaders.FeatureGroupCassandraLoader; +import org.openecomp.core.migration.loaders.LKGCassandraLoader; +import org.openecomp.core.migration.loaders.LicenseAgreementCassandraLoader; +import org.openecomp.core.migration.loaders.MibCassandraLoader; +import org.openecomp.core.migration.loaders.NetworkCassandraLoader; +import org.openecomp.core.migration.loaders.NicCassandraLoader; +import org.openecomp.core.migration.loaders.OrchestrationTemplateCandidateCassandraLoader; +import org.openecomp.core.migration.loaders.ProcessCassandraLoader; +import org.openecomp.core.migration.loaders.ServiceArtifactCassandraLoader; +import org.openecomp.core.migration.loaders.ServiceTemplateCassandraLoader; +import org.openecomp.core.migration.loaders.VendorLicenseModelCassandraLoader; +import org.openecomp.core.migration.loaders.VendorSoftwareProductInfoLoader; +import org.openecomp.core.migration.loaders.VersionInfoCassandraLoader; +import org.openecomp.core.migration.loaders.VspInformation; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.core.migration.store.ItemHandler; +import org.openecomp.core.migration.util.marker.MigrationMarker; +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.core.model.types.ServiceTemplate; +import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer; +import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; + +import java.time.Duration; +import java.time.Instant; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import static org.openecomp.core.migration.util.Utils.printMessage; + +public class MigrationMain { + private static final String GLOBAL_USER = "GLOBAL_USER"; + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + private static int status = 0; + + public static Map versionInfoMap = new HashMap<>(); + + public static void main(String[] args) { + CassandraElementRepository cassandraElementRepository = new CassandraElementRepository(); + CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem(); + printMessage(logger, "Checking whether a migration has already been run."); + if (MigrationMarker.isMigrated()) { + printMessage(logger, "The DB has already been migrated, this script will now exit."); + return; + } + ItemCassandraDao itemCassandraDao = new ItemCassandraDao(); + VersionCassandraDao versionCassandraDao = new VersionCassandraDao(); + SessionContext context = new SessionContext(); + context.setUser(new UserInfo(GLOBAL_USER)); + context.setTenant("dox"); + printMessage(logger, "Starting migration.\n"); + Instant startTime = Instant.now(); + + migrateToZusammen(cassandraElementRepository, itemCassandraDao, versionCassandraDao, context); + + Instant stopTime = Instant.now(); + Duration duration = Duration.between(startTime, stopTime); + long minutesPart = duration.toMinutes(); + long secondsPart = duration.minusMinutes(minutesPart).getSeconds(); + + if (status == 0) { + MigrationMarker.markMigrated(); + } + printMessage(logger, + "Migration finished . Total run time was : " + minutesPart + ":" + secondsPart + + " minutes"); + System.exit(status); + } + + + private static void migrateToZusammen(CassandraElementRepository cassandraElementRepository, + ItemCassandraDao itemCassandraDao, + VersionCassandraDao versionCassandraDao, + SessionContext context) { + loadVersionInfo(); + + + try { + convertVsp(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); + printMessage(logger, "Converted VSPs\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for VSPs ,the error is :"); + e.printStackTrace(); + status = -1; + } + + try { + convertOrchestrationTemplateCandidate(context, cassandraElementRepository); + printMessage(logger, "Converted OrchestrationTemplateCandidates\n"); + } catch (Exception e) { + printMessage(logger, + "Could not perform migration for OrchestrationTemplateCandidates ,the error is :"); + e.printStackTrace(); + status = -1; + } + + + try { + convertComponent(context, cassandraElementRepository); + printMessage(logger, "Converted Components\n"); + } catch (Exception e) { + printMessage(logger, + "Could not perform migration for Components ,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertNic(context, cassandraElementRepository); + printMessage(logger, "Converted Nics\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for Nics ,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertNetwork(context, cassandraElementRepository); + printMessage(logger, "Converted Networks\n"); + } catch (Exception e) { + printMessage(logger, + "Could not perform migration for Networks ,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertMibs(context, cassandraElementRepository); + printMessage(logger, "Converted MIBs\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for MIBs,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertServiceArtifact(context, cassandraElementRepository); + printMessage(logger, "Converted Service Artifacts\n"); + } catch (Exception e) { + printMessage(logger, + "Could not perform migration for Service Artifacts,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertServiceTemplate(context, cassandraElementRepository); + printMessage(logger, "Converted Service Templates\n"); + } catch (Exception e) { + printMessage(logger, + "Could not perform migration for Service Templates,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertProcesses(context, cassandraElementRepository); + printMessage(logger, "Converted Processes\n"); + } catch (Exception e) { + printMessage(logger, + "Could not perform migration for Processes,the error is :"); + e.printStackTrace(); + status = -1; + } + + + try { + convertVlm(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); + printMessage(logger, "Converted VLMs\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for VLMs,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertLKG(context, cassandraElementRepository); + printMessage(logger, "Converted LKGs\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for LKGs,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertFeatureGroup(context, cassandraElementRepository); + printMessage(logger, "Converted Feature Groups\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for Feature Groups,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertEP(context, cassandraElementRepository); + printMessage(logger, "Converted EPs\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for EPs,the error is :"); + e.printStackTrace(); + status = -1; + } + try { + convertLicenseAgreement(context, cassandraElementRepository); + printMessage(logger, "Converted License Agreements\n"); + } catch (Exception e) { + printMessage(logger, "Could not perform migration for License Agreements,the error is :"); + e.printStackTrace(); + status = -1; + } + } + + private static void convertOrchestrationTemplateCandidate(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + OrchestrationTemplateCandidateCassandraLoader orchestrationTemplateCandidateCassandraLoader = + new OrchestrationTemplateCandidateCassandraLoader(); + + orchestrationTemplateCandidateCassandraLoader.list().stream() + .filter(entity -> needMigration(entity.getId(), entity.getVersion())) + .forEach(entity -> ElementHandler + .save(context, cassandraElementRepository, entity.getId(), entity.getVersion(), + OrchestrationTemplateCandidateConvertor + .convertOrchestrationTemplateCandidateToElement(entity))); + } + + private static void loadVersionInfo() { + + VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader(); + Collection versions = + versionInfoCassandraLoader.list(); + + versions.forEach(versionInfoEntity -> versionInfoMap.put(versionInfoEntity.getEntityId + (), versionInfoEntity)); + + + } + + private static void convertMibs(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + MibCassandraLoader cassandraLoader = new MibCassandraLoader(); + Collection mibs = cassandraLoader.list(); + mibs.stream().filter(mibEntity -> needMigration(mibEntity.getVspId(), mibEntity.getVersion())) + .forEach + (mibEntity -> { + ElementHandler.save(context, cassandraElementRepository, + mibEntity + .getVspId(), mibEntity.getVersion(), + MibConvertor.convertMibToElement + (mibEntity)); + }); + } + + private static void convertProcesses(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + ProcessCassandraLoader cassandraLoader = new ProcessCassandraLoader(); + Collection processes = cassandraLoader.list(); + processes.stream() + .filter(processEntity -> needMigration(processEntity.getVspId(), processEntity.getVersion + ())).forEach(processEntity -> { + ElementHandler.save( + context, + cassandraElementRepository, + processEntity + .getId(), processEntity.getVersion(), + ProcessConvertor.convertProcessToElement(processEntity)); + }); + } + + private static void convertVsp(SessionContext context, ItemCassandraDao itemCassandraDao, + VersionCassandraDao versionCassandraDao, + CassandraElementRepository cassandraElementRepository) { + VendorSoftwareProductInfoLoader vendorSoftwareProductInfoLoader = new + VendorSoftwareProductInfoLoader(); + Collection vsps = + vendorSoftwareProductInfoLoader.list(); + vsps.stream().filter(vspInformation -> needMigration(vspInformation.getId(), + vspInformation.getVersion())).forEach + (vspInformation + -> + ItemHandler.save(context, + itemCassandraDao, + versionCassandraDao, + vspInformation.getId(), vspInformation + .getVersion(), + VspInformationConvertor + .getVspInfo + (vspInformation), + VspInformationConvertor.getItemVersionData(vspInformation), + vspInformation.getWritetimeMicroSeconds())); + + vsps.stream().filter(vspInformation -> needMigration(vspInformation.getId(), + vspInformation.getVersion())) + .forEach(vspInformation -> ElementHandler.save(context, cassandraElementRepository, + vspInformation.getId(), vspInformation.getVersion(), + VspInformationConvertor.convertVspToElement + (vspInformation))); + } + + private static void convertVlm(SessionContext context, ItemCassandraDao itemCassandraDao, + VersionCassandraDao versionCassandraDao, + CassandraElementRepository cassandraElementRepository) { + VendorLicenseModelCassandraLoader + vendorLicenseModelCassandraDao = new VendorLicenseModelCassandraLoader(); + Collection vlms = + vendorLicenseModelCassandraDao.list(); + vlms.stream().filter(vlm -> needMigration(vlm.getId(), vlm.getVersion())).forEach(vlmEntity -> + ItemHandler.save + (context, itemCassandraDao, + versionCassandraDao, + vlmEntity.getId(), vlmEntity.getVersion(), + VlmConvertor.getVlmInfo + (vlmEntity), + VlmConvertor.getItemVersionData(vlmEntity), new Date().getTime())); + vlms.stream().filter(vlm -> needMigration(vlm.getId(), vlm.getVersion())) + .forEach(vlmEntity -> ElementHandler.save(context, cassandraElementRepository, + vlmEntity.getId(), vlmEntity.getVersion(), + VlmConvertor.convertVlmToElement + (vlmEntity))); + + } + + private static void convertNic(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + NicCassandraLoader nicCassandraLoader = new NicCassandraLoader(); + Collection nics = nicCassandraLoader.list(); + nics.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion + ())).forEach(nicEntity -> ElementHandler.save(context, cassandraElementRepository, + nicEntity.getVspId(), nicEntity.getVersion(), NicConvertor.convertNicToElement + (nicEntity))); + + } + + private static void convertNetwork(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + NetworkCassandraLoader networkCassandraLoader = new NetworkCassandraLoader(); + Collection networks = networkCassandraLoader.list(); + networks.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion + ())).forEach(networkEntity -> ElementHandler.save(context, cassandraElementRepository, + networkEntity.getVspId(), networkEntity.getVersion(), NetworkConvertor + .convertNetworkToElement(networkEntity))); + + } + + private static void convertComponent(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + ComponentCassandraLoader componentCassandraLoader = new ComponentCassandraLoader(); + Collection components = componentCassandraLoader.list(); + components.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion + ())).forEach(componentEntity -> ElementHandler.save(context, cassandraElementRepository, + componentEntity + .getVspId(), componentEntity.getVersion(), ComponentConvertor + .convertComponentToElement(componentEntity))); + + } + + private static void convertServiceArtifact(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + ServiceArtifactCassandraLoader serviceArtifactCassandraLoader = + new ServiceArtifactCassandraLoader(); + Collection serviceArtifacts = serviceArtifactCassandraLoader.list(); + serviceArtifacts.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion + ())).forEach(serviceArtifact -> ElementHandler.save(context, + cassandraElementRepository, + serviceArtifact + .getVspId(), serviceArtifact.getVersion(), + VspServiceArtifactConvertor + .convertServiceArtifactToElement(serviceArtifact))); + + } + + private static void convertServiceTemplate(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + ServiceTemplateCassandraLoader serviceTemplateCassandraLoader = + new ServiceTemplateCassandraLoader(); + Collection serviceTemplates = serviceTemplateCassandraLoader.list(); + serviceTemplates.stream().filter(entity -> needMigration(entity.getVspId(), entity.getVersion + ())).forEach(serviceTemplate -> ElementHandler.save(context, + cassandraElementRepository, + serviceTemplate + .getVspId(), serviceTemplate.getVersion(), + VspServiceTemplateConvertor + .convertServiceTemplateToElement(serviceTemplate))); + + } + + private static void convertLKG(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + LKGCassandraLoader LKGCassandraLoader = new LKGCassandraLoader(); + Collection lkgs = LKGCassandraLoader.list(); + lkgs.stream().filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion + ())) + .forEach(licenseKeyGroupEntity -> ElementHandler.save(context, cassandraElementRepository, + licenseKeyGroupEntity + .getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion(), + LKGConvertor.convertLKGToElement + (licenseKeyGroupEntity))); + } + + private static void convertEP(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + EntitlementPoolCassandraLoader entitlementPoolCassandraLoader = + new EntitlementPoolCassandraLoader(); + Collection entitlementPools = entitlementPoolCassandraLoader.list(); + entitlementPools.stream() + .filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion + ())) + .forEach(entitlementPoolEntity -> ElementHandler.save(context, cassandraElementRepository, + entitlementPoolEntity + .getVendorLicenseModelId(), entitlementPoolEntity.getVersion(), + EntitlementPoolConvertor.convertEntitlementPoolToElement(entitlementPoolEntity))); + } + + private static void convertFeatureGroup(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + FeatureGroupCassandraLoader featureGroupCassandraLoader = new FeatureGroupCassandraLoader(); + Collection featureGroupEntities = featureGroupCassandraLoader.list(); + featureGroupEntities.stream() + .filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion + ())) + .forEach(featureGroupEntity -> ElementHandler.save(context, cassandraElementRepository, + featureGroupEntity + .getVendorLicenseModelId(), featureGroupEntity.getVersion(), + FeatureGroupConvertor.convertFeatureGroupToElement(featureGroupEntity))); + } + + private static void convertLicenseAgreement(SessionContext context, + CassandraElementRepository cassandraElementRepository) { + LicenseAgreementCassandraLoader licenseAgreementCassandraLoader = + new LicenseAgreementCassandraLoader(); + Collection licenseAgreementEntities = + licenseAgreementCassandraLoader.list(); + licenseAgreementEntities.stream() + .filter(entity -> needMigration(entity.getVendorLicenseModelId(), entity.getVersion + ())) + .forEach(licenseAgreementEntity -> ElementHandler.save(context, cassandraElementRepository, + licenseAgreementEntity + .getVendorLicenseModelId(), licenseAgreementEntity.getVersion(), + LicenseAgreementConvertor.convertLicenseAgreementToElement(licenseAgreementEntity))); + } + + + private static boolean needMigration(String itemId, Version versionId) { + + VersionInfoEntity versionInfo = + MigrationMain.versionInfoMap.get(itemId); + if (versionInfo == null) { + printMessage(logger, "ItemId: " + itemId + " is not in version_info table."); + return false; + } + return (versionInfo.getCandidate() != null && versionId.equals(versionInfo.getCandidate() + .getVersion())) + || (versionInfo + .getViewableVersions() != null && versionInfo + .getViewableVersions().contains(versionId)); + } + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java new file mode 100644 index 0000000000..fb597d5a3e --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java @@ -0,0 +1,102 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author katyr + * @since April 23, 2017 + */ + +public class ComponentConvertor { + + private static Set componentsLoaded = new HashSet<>(); + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + public static CollaborationElement[] convertComponentToElement(ComponentEntity componentEntity) { + + CollaborationElement[] componentElements; + List componentNamespace = getComponentNamespace(); + + int index = 0; + String componentsEntityId = StructureElement.Components.name(); + String uniqueId = componentEntity.getVspId()+"_"+componentEntity.getVersion().toString(); + if (componentsLoaded.contains(uniqueId)) { +// printMessage(logger, "Components structural elements exist for component " + +// componentEntity.getId()); + componentElements = new CollaborationElement[2]; + } else { + componentsLoaded.add(uniqueId); +// printMessage(logger, "Creating Components structural elements for component " + +// componentEntity.getId()); + componentElements = new CollaborationElement[3]; + componentElements[index] = ElementHandler.getElementEntity( + componentEntity.getVspId(), componentEntity.getVersion().toString(), componentsEntityId, + componentNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Components.name()), + null, + null, + null); + index++; + } + + componentNamespace.add(componentsEntityId); + componentElements[index] = ElementHandler.getElementEntity( + componentEntity.getVspId(), componentEntity.getVersion().toString(), + componentEntity.getId(), + componentNamespace, + getComponentInfo(componentEntity), + null, + null, + (componentEntity.getCompositionData() != null) ? componentEntity.getCompositionData().getBytes() + : null); + index++; + + componentNamespace.add(componentEntity.getId()); + componentElements[index] = ElementHandler.getElementEntity( + componentEntity.getVspId(), componentEntity.getVersion().toString(),StructureElement.Questionnaire.name() + "_" + componentEntity.getId(), + componentNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Questionnaire.name()), + null, + null, + (componentEntity.getQuestionnaireData() != null) ? componentEntity.getQuestionnaireData().getBytes() + : null); + + return componentElements; + } + + private static Info getComponentInfo(ComponentEntity componentEntity) { + Info info = new Info(); + info.addProperty(ElementPropertyName.type.name(), ElementType.Component); + info.addProperty(ElementPropertyName.compositionData.name(), + componentEntity.getCompositionData()); + + return info; + } + + private static List getComponentNamespace() { + return ElementHandler.getElementPath(); + } + + public static ElementEntityContext convertComponentToElementContext( + ComponentEntity componentEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(componentEntity.getVspId(), componentEntity.getVersion().toString())); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java new file mode 100644 index 0000000000..4c667f6708 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java @@ -0,0 +1,96 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Created by ayalaben on 4/24/2017 + */ +public class EntitlementPoolConvertor { + + private static Set EntitlementPoolsLoaded = new HashSet<>(); + + public static ElementEntityContext convertEntitlementPoolToElementContext( + EntitlementPoolEntity entitlementPoolEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(entitlementPoolEntity.getVendorLicenseModelId(), + entitlementPoolEntity.getVersion().toString())); + } + + public static CollaborationElement[] convertEntitlementPoolToElement( + EntitlementPoolEntity entitlementPoolEntity) { +// printMessage(logger, "source EntitlementPoolEntity -> " + entitlementPoolEntity.toString()); + CollaborationElement[] elements; + List entitlementPoolNamespace = getEntitlementPoolNamespace(entitlementPoolEntity); + + int index = 0; + String entitlememtPoolsEntityId = StructureElement.EntitlementPools.name(); + String uniqueId = entitlementPoolEntity.getVendorLicenseModelId() + "_" + + entitlementPoolEntity.getVersion().toString(); + + if (EntitlementPoolsLoaded.contains(uniqueId)) { + elements = new CollaborationElement[1]; + } else { + EntitlementPoolsLoaded.add(uniqueId); + elements = new CollaborationElement[2]; + elements[index] = ElementHandler.getElementEntity( + entitlementPoolEntity.getVendorLicenseModelId(), + entitlementPoolEntity.getVersion().toString(), + entitlememtPoolsEntityId, entitlementPoolNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.EntitlementPools.name()), + null, null, null); + index++; + } + + entitlementPoolNamespace.add(entitlememtPoolsEntityId); + + elements[index] = ElementHandler.getElementEntity( + entitlementPoolEntity.getVendorLicenseModelId(), + entitlementPoolEntity.getVersion().toString(), + entitlementPoolEntity.getId(), entitlementPoolNamespace, + getEntitelementPoolInfo(entitlementPoolEntity), + entitlementPoolEntity.getReferencingFeatureGroups().stream().map(rel -> + VlmZusammenUtil + .createRelation( RelationType.EntitlmentPoolToReferencingFeatureGroup, rel)) + .collect(Collectors.toList()), null, null); + + return elements; + } + + private static Info getEntitelementPoolInfo(EntitlementPoolEntity entitlementPool) { + + Info info = new Info(); + info.setName(entitlementPool.getName()); + info.setDescription(entitlementPool.getDescription()); + info.addProperty("thresholdValue", entitlementPool.getThresholdValue()); + info.addProperty("threshold_unit", entitlementPool.getThresholdUnit()); + info.addProperty("entitlement_metric", entitlementPool.getEntitlementMetric()); + info.addProperty("increments", entitlementPool.getIncrements()); + info.addProperty("aggregation_func", entitlementPool.getAggregationFunction()); + info.addProperty("operational_scope", entitlementPool.getOperationalScope()); + info.addProperty("EntitlementTime", entitlementPool.getTime()); + info.addProperty("manufacturerReferenceNumber", + entitlementPool.getManufacturerReferenceNumber()); + + return info; + } + + private static List getEntitlementPoolNamespace( + EntitlementPoolEntity entitlementPoolEntity) { + return ElementHandler.getElementPath(""); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java new file mode 100644 index 0000000000..dd3fbe0485 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java @@ -0,0 +1,100 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.Relation; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil; +import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Created by ayalaben on 4/25/2017 + */ +public class FeatureGroupConvertor { + + private static Logger logger = LoggerFactory.getLogger(FeatureGroupConvertor.class); + private static Set FeatureGroupsLoaded = new HashSet<>(); + + public static ElementEntityContext convertFeatureGroupToElementContext(FeatureGroupEntity featureGroupEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(featureGroupEntity.getVendorLicenseModelId(), featureGroupEntity.getVersion().toString())); + } + + public static CollaborationElement[] convertFeatureGroupToElement(FeatureGroupEntity featureGroupEntity) { +// printMessage(logger, "source FeatureGroupEntity -> " + featureGroupEntity.toString()); + CollaborationElement[] elements; + List featureGroupNamespace = getFeatureGroupNamespace(featureGroupEntity); + + int index = 0; + String featureGroupsEntityId = StructureElement.FeatureGroups.name(); + String uniqueId = featureGroupEntity.getVendorLicenseModelId() + "_" + featureGroupEntity.getVersion().toString(); + + if (FeatureGroupsLoaded.contains(uniqueId)) { + elements = new CollaborationElement[1]; + } else { + FeatureGroupsLoaded.add(uniqueId); + elements = new CollaborationElement[2]; + elements[index] = ElementHandler.getElementEntity( + featureGroupEntity.getVendorLicenseModelId(), featureGroupEntity.getVersion().toString(), + featureGroupsEntityId, featureGroupNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.FeatureGroups.name()), + null, null, null); + index++; + } + + featureGroupNamespace.add(featureGroupsEntityId); + + elements[index] = ElementHandler.getElementEntity( + featureGroupEntity.getVendorLicenseModelId(), featureGroupEntity.getVersion().toString(), + featureGroupEntity.getId(), featureGroupNamespace, getFeatureGroupInfo(featureGroupEntity), + getAllFeatureGroupRelations(featureGroupEntity), null, null); + + return elements; + } + + private static Collection getAllFeatureGroupRelations(FeatureGroupEntity featureGroup) { + Collection relations = new ArrayList<>(); + + relations.addAll(featureGroup.getEntitlementPoolIds().stream().map(rel -> + VlmZusammenUtil.createRelation( RelationType.FeatureGroupToEntitlmentPool, rel)) + .collect(Collectors.toList())); + + relations.addAll(featureGroup.getLicenseKeyGroupIds().stream().map(rel -> + VlmZusammenUtil.createRelation( RelationType.FeatureGroupToLicenseKeyGroup, rel)) + .collect(Collectors.toList())); + + relations.addAll(featureGroup.getReferencingLicenseAgreements().stream().map(rel -> + VlmZusammenUtil.createRelation( RelationType.FeatureGroupToReferencingLicenseAgreement, + rel)).collect(Collectors.toList())); + + return relations; + } + + private static Info getFeatureGroupInfo(FeatureGroupEntity featureGroup) { + + Info info = new Info(); + info.setName(featureGroup.getName()); + info.setDescription(featureGroup.getDescription()); + info.addProperty("partNumber", featureGroup.getPartNumber()); + return info; + } + + + private static List getFeatureGroupNamespace(FeatureGroupEntity featureGroupEntity) { + return ElementHandler.getElementPath(""); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java new file mode 100644 index 0000000000..7fd640b12d --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java @@ -0,0 +1,79 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Created by ayalaben on 4/24/2017 + */ +public class LKGConvertor { + + private static Logger logger = LoggerFactory.getLogger(LKGConvertor.class); + private static Set compLKGLoaded = new HashSet<>(); + + public static CollaborationElement[] convertLKGToElement(LicenseKeyGroupEntity licenseKeyGroupEntity) { + CollaborationElement[] elements; + List lkgNamespace = getLKGNamespace(licenseKeyGroupEntity); + + int index = 0; + String lkgsEntityId = StructureElement.LicenseKeyGroups.name(); + String uniqueId = licenseKeyGroupEntity.getVendorLicenseModelId() + "_" + licenseKeyGroupEntity.getVersion().toString(); + + if (compLKGLoaded.contains(uniqueId)) { + elements = new CollaborationElement[1]; + } else { + compLKGLoaded.add(uniqueId); + elements = new CollaborationElement[2]; + elements[index] = ElementHandler.getElementEntity( + licenseKeyGroupEntity.getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion().toString(), lkgsEntityId, lkgNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.LicenseKeyGroups.name()), null, null, null); + index++; + } + + lkgNamespace.add(lkgsEntityId); + + elements[index] = ElementHandler.getElementEntity( + licenseKeyGroupEntity.getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion().toString(), licenseKeyGroupEntity.getId(), lkgNamespace, + getLKGInfo(licenseKeyGroupEntity), licenseKeyGroupEntity.getReferencingFeatureGroups().stream().map(rel -> + VlmZusammenUtil.createRelation( RelationType.LicenseKeyGroupToReferencingFeatureGroup, rel)) + .collect(Collectors.toList()), null, null); + + return elements; + } + + private static Info getLKGInfo(LicenseKeyGroupEntity licenseKeyGroupEntity) { + + Info info = new Info(); + info.setName(licenseKeyGroupEntity.getName()); + info.setDescription(licenseKeyGroupEntity.getDescription()); + info.addProperty("LicenseKeyType", licenseKeyGroupEntity.getType()); + info.addProperty("operational_scope", licenseKeyGroupEntity.getOperationalScope()); + + return info; + } + + private static List getLKGNamespace(LicenseKeyGroupEntity LKGEntity) { + return ElementHandler.getElementPath(""); + } + + public static ElementEntityContext convertLKGToElementContext(LicenseKeyGroupEntity licenseKeyGroupEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(licenseKeyGroupEntity.getVendorLicenseModelId(), licenseKeyGroupEntity.getVersion().toString())); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java new file mode 100644 index 0000000000..25564c3138 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java @@ -0,0 +1,84 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.RelationType; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VlmZusammenUtil; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Created by ayalaben on 4/25/2017 + */ +public class LicenseAgreementConvertor { + + private static Logger logger = LoggerFactory.getLogger(LicenseAgreementConvertor.class); + private static Set LicenseAgreementsLoaded = new HashSet<>(); + + public static ElementEntityContext convertLicenseAgreementToElementContext(LicenseAgreementEntity licenseAgreementEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(licenseAgreementEntity.getVendorLicenseModelId(), licenseAgreementEntity.getVersion().toString())); + } + + + public static CollaborationElement[] convertLicenseAgreementToElement(LicenseAgreementEntity licenseAgreementEntity) { +// printMessage(logger, "source LicenseAgreementEntity -> " + licenseAgreementEntity.toString()); + CollaborationElement[] elements; + List featureGroupNamespace = getLicenseAgreementNamespace(licenseAgreementEntity); + + int index = 0; + String featureGroupsEntityId = StructureElement.LicenseAgreements.name(); + String uniqueId = licenseAgreementEntity.getVendorLicenseModelId() + "_" + licenseAgreementEntity.getVersion().toString(); + + if (LicenseAgreementsLoaded.contains(uniqueId)) { + elements = new CollaborationElement[1]; + } else { + LicenseAgreementsLoaded.add(uniqueId); + elements = new CollaborationElement[2]; + elements[index] = ElementHandler.getElementEntity( + licenseAgreementEntity.getVendorLicenseModelId(), licenseAgreementEntity.getVersion().toString(), + featureGroupsEntityId, featureGroupNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.LicenseAgreements.name()), + null, null, null); + index++; + } + + featureGroupNamespace.add(featureGroupsEntityId); + + elements[index] = ElementHandler.getElementEntity( + licenseAgreementEntity.getVendorLicenseModelId(), licenseAgreementEntity.getVersion().toString(), + licenseAgreementEntity.getId(), featureGroupNamespace, getLicenseAgreementInfo(licenseAgreementEntity), + licenseAgreementEntity.getFeatureGroupIds().stream().map(rel -> + VlmZusammenUtil.createRelation( RelationType.LicenseAgreementToFeatureGroup, rel)) + .collect(Collectors.toList()), null, null); + + return elements; + } + + private static Info getLicenseAgreementInfo(LicenseAgreementEntity licenseAgreement) { + + Info info = new Info(); + info.setName(licenseAgreement.getName()); + info.setDescription(licenseAgreement.getDescription()); + info.addProperty("licenseTerm", licenseAgreement.getLicenseTerm()); + info.addProperty("requirementsAndConstrains", licenseAgreement.getRequirementsAndConstrains()); + + return info; + } + + private static List getLicenseAgreementNamespace(LicenseAgreementEntity licenseAgreement) { + return ElementHandler.getElementPath(""); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java new file mode 100644 index 0000000000..88b9dce95f --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java @@ -0,0 +1,66 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class MibConvertor { + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + private static Set compMibLoaded = new HashSet<>(); + + + public static CollaborationElement[] convertMibToElement(MibEntity mibEntity) { + CollaborationElement[] elements; + List mibNamespace = getMibNamespace(mibEntity); + + int index = 0; + String mibsEntityId = StructureElement.Mibs.name() + "_" + mibEntity.getComponentId(); + if (compMibLoaded.contains(mibsEntityId)) { + elements = new CollaborationElement[1]; + } else { + compMibLoaded.add(mibsEntityId); + elements = new CollaborationElement[2]; + elements[index++] = ElementHandler.getElementEntity( + mibEntity.getVspId(), mibEntity.getVersion().toString(), mibsEntityId, mibNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Mibs.name()), null, null, null); + } + + mibNamespace.add(mibsEntityId); + elements[index] = ElementHandler.getElementEntity( + mibEntity.getVspId(), mibEntity.getVersion().toString(), mibEntity.getId(), mibNamespace, + getMibInfo(mibEntity), null, null, mibEntity.getArtifact().array()); + + return elements; + } + + private static Info getMibInfo(MibEntity mibEntity) { + Info info = new Info(); + info.setName(mibEntity.getType().toString()); + info.getProperties().put("name", mibEntity.getArtifactName()); + return info; + } + + private static List getMibNamespace(MibEntity mibEntity) { + return ElementHandler.getElementPath(StructureElement.Components.name(), mibEntity + .getComponentId()); + } + + public static ElementEntityContext convertMibToElementContext(MibEntity mibEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(mibEntity.getVspId(), mibEntity.getVersion().toString())); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java new file mode 100644 index 0000000000..3d4f1575fc --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java @@ -0,0 +1,91 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author katyr + * @since April 23, 2017 + */ + +public class NetworkConvertor { + + private static Set networksLoaded = new HashSet<>(); + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + + + public static CollaborationElement[] convertNetworkToElement(NetworkEntity networkEntity) { + + CollaborationElement[] networkElements; + List networkNamespace = getNetworkNamespace(); + + int index = 0; + String networksEntityId = StructureElement.Networks.name(); + String uniqueId = networkEntity.getVspId()+"_"+networkEntity.getVersion().toString(); + if (networksLoaded.contains(uniqueId)) { +// printMessage(logger, "Networks structural elements exist for network " + +// networkEntity.getId()); + networkElements = new CollaborationElement[1]; + } else { +// printMessage(logger, "Creating Networks structural element for network " + +// networkEntity.getId()); + networksLoaded.add(uniqueId); + networkElements = new CollaborationElement[2]; + networkElements[index] = ElementHandler.getElementEntity( + networkEntity.getVspId(), networkEntity.getVersion().toString(), networksEntityId, + networkNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Networks.name()), + null, + null, + null); + index++; + } + + networkNamespace.add(networksEntityId); + + networkElements[index] = ElementHandler.getElementEntity( + networkEntity.getVspId(), networkEntity.getVersion().toString(), networkEntity.getId(), + networkNamespace, + getNetworkInfo(networkEntity), + null, + null, + networkEntity.getCompositionData().getBytes()); + + + return networkElements; + } + + private static Info getNetworkInfo(NetworkEntity networkEntity) { + Info info = new Info(); + info.addProperty(ElementPropertyName.type.name(), ElementType.Network); + info.addProperty(ElementPropertyName.compositionData.name(), networkEntity.getCompositionData()); + + return info; + } + + private static List getNetworkNamespace() { + return ElementHandler.getElementPath(); + } + + public static ElementEntityContext convertNetworkToElementContext(NetworkEntity networkEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(networkEntity.getVspId(), networkEntity.getVersion().toString())); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java new file mode 100644 index 0000000000..b17e68c0e5 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java @@ -0,0 +1,95 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class NicConvertor { + + + private static Set compNicLoaded = new HashSet<>(); + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + + + public static CollaborationElement[] convertNicToElement(NicEntity nicEntity) { + + CollaborationElement[] nicElements; + List nicNamespace = getNicNamespace(nicEntity); + + int index = 0; + String nicsEntityId = StructureElement.Nics.name() + "_" + nicEntity.getComponentId(); + if (compNicLoaded.contains(nicsEntityId)) { +// printMessage(logger, "Nics structural element exists for nic " + +// nicEntity.getId()); + nicElements = new CollaborationElement[2]; + } else { +// printMessage(logger, "Creating Nics structural element for nic " + +// nicEntity.getId()); + compNicLoaded.add(nicsEntityId); + nicElements = new CollaborationElement[3]; + nicElements[index] = ElementHandler.getElementEntity( + nicEntity.getVspId(), nicEntity.getVersion().toString(), nicsEntityId, + nicNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Nics.name()), + null, + null, + null); + index++; + } + + nicNamespace.add(nicsEntityId); + nicElements[index] = ElementHandler.getElementEntity( + nicEntity.getVspId(), nicEntity.getVersion().toString(), nicEntity.getId(), + nicNamespace, + getNicInfo(nicEntity), + null, + null, + nicEntity.getCompositionData().getBytes()); + index++; + + nicNamespace.add(nicEntity.getId()); + nicElements[index] = ElementHandler.getElementEntity( + nicEntity.getVspId(), nicEntity.getVersion().toString(),StructureElement.Questionnaire.name() + "_" + nicEntity.getId(), + nicNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Questionnaire.name()), + null, + null, + (nicEntity.getQuestionnaireData() != null) ? nicEntity.getQuestionnaireData().getBytes() + : null); + return nicElements; + } + + private static Info getNicInfo(NicEntity nicEntity) { + Info info = new Info(); + info.addProperty(ElementPropertyName.type.name(), ElementType.Nic); + info.addProperty(ElementPropertyName.compositionData.name(), nicEntity.getCompositionData()); + return info; + } + + private static List getNicNamespace(NicEntity nicEntity) { + return ElementHandler.getElementPath(StructureElement.Components.name(), nicEntity + .getComponentId()); + } + + public static ElementEntityContext convertNicToElementContext(NicEntity nicEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(nicEntity.getVspId(), nicEntity.getVersion().toString())); + } + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java new file mode 100644 index 0000000000..c6778544fd --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java @@ -0,0 +1,78 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.migration.loaders.VspInformation; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class OrchestrationTemplateCandidateConvertor { + + + + + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + public static CollaborationElement[] convertOrchestrationTemplateCandidateToElement( + OrchestrationTemplateCandidateDataEntity entity) { + + + CollaborationElement[] orchestrationTemplateCandidateElements = new CollaborationElement[2]; + List orchestrationTemplateCandidateNamespace = + getOrchestrationTemplateCandidateNamespace(); + + + + orchestrationTemplateCandidateElements[0] = ElementHandler.getElementEntity( + entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidate.name(), + orchestrationTemplateCandidateNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidate.name()), + null, + null, + entity.getFilesDataStructure().getBytes()); + + orchestrationTemplateCandidateNamespace.add(StructureElement.OrchestrationTemplateCandidate.name()); + orchestrationTemplateCandidateElements[1] = ElementHandler.getElementEntity( + entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidateContent.name(), + orchestrationTemplateCandidateNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidateContent.name()), + null, + null, + entity.getContentData().array()); + + + + return orchestrationTemplateCandidateElements; + } + + + private static List getOrchestrationTemplateCandidateNamespace() { + return ElementHandler.getElementPath(); + } + + public static ElementEntityContext convertComponentToElementContext( + ComponentEntity componentEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(componentEntity.getVspId(), componentEntity.getVersion().toString())); + } + + + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java new file mode 100644 index 0000000000..0a145c49f7 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java @@ -0,0 +1,98 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ProcessConvertor { + private static final String NAME = "name"; + private static final String ELEMENT_TYPE = "type"; + private static final String ARTIFACT_NAME = "artifactName"; + private static final String DESCRIPTION = "description"; + private static final String PROCESS_TYPE = "processType"; + private static Set compProcessesLoaded = new HashSet<>(); + + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + + public static CollaborationElement[] convertProcessToElement(ProcessEntity processEntity) { + CollaborationElement[] elements; + boolean isGeneralComponentId = isGeneralComponentId(processEntity); + List processNamespace = getProcessNamespace(processEntity); + int index = 0; + String uniqueId = getUniqueId(processEntity, isGeneralComponentId); + String processesEntityId = isGeneralComponentId ? StructureElement.Processes.name() : + (StructureElement.Processes.name() + "_" +processEntity.getComponentId()); + if (compProcessesLoaded.contains(uniqueId)) { + elements = new CollaborationElement[1]; + } else { + compProcessesLoaded.add(uniqueId); + elements = new CollaborationElement[2]; + elements[index++] = ElementHandler.getElementEntity( + processEntity.getVspId(), processEntity.getVersion().toString(), processesEntityId, + processNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Processes.name()), null, null, null); + } + + processNamespace.add(processesEntityId); + elements[index] = ElementHandler.getElementEntity( + processEntity.getVspId(), processEntity.getVersion().toString(), processEntity.getId(), + processNamespace, + getProcessInfo(processEntity), null, null, processEntity.getArtifact() == + null ? null : processEntity.getArtifact().array()); + + return elements; + } + + private static String getUniqueId(ProcessEntity processEntity, boolean isGeneralComponentId) { + if (isGeneralComponentId) { + return processEntity.getVspId() + "_" + processEntity.getVersion().toString(); + } else { + return StructureElement.Processes.name() + "_" + processEntity + .getComponentId(); + } + } + + private static Info getProcessInfo(ProcessEntity processEntity) { + Info info = new Info(); + info.setName(processEntity.getName()); + info.addProperty(NAME, processEntity.getName()); + info.addProperty(ELEMENT_TYPE, ElementType.Process); + info.addProperty(ARTIFACT_NAME, processEntity.getArtifactName()); + info.addProperty(DESCRIPTION, processEntity.getDescription()); + info.addProperty(PROCESS_TYPE, + processEntity.getType() != null ? processEntity.getType().name() : null); + return info; + } + + private static List getProcessNamespace(ProcessEntity processEntity) { + if (isGeneralComponentId(processEntity)) { + return ElementHandler.getElementPath(); + } else { + return ElementHandler + .getElementPath(StructureElement.Components.name(), processEntity.getComponentId()); + } + } + + private static boolean isGeneralComponentId(ProcessEntity processEntity) { + return processEntity.getComponentId().equals("General"); + } + + public static ElementEntityContext convertProcessToElementContext(ProcessEntity processEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(processEntity.getVspId(), processEntity.getVersion().toString())); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java new file mode 100644 index 0000000000..2e5fac830e --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java @@ -0,0 +1,94 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.loaders.VspInformation; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class VlmConvertor { + + private static Set compNicLoaded = new HashSet<>(); + + public static CollaborationElement[] convertVlmToElement(VendorLicenseModelEntity vendorLicenseModel) { + + CollaborationElement[] vspElements = new CollaborationElement[1]; + List vspNamespace = getVlmNamespace(vendorLicenseModel); + + + String vspEntityId = StructureElement.General.name(); + + vspElements[0] = ElementHandler.getElementEntity( + vendorLicenseModel.getId(), vendorLicenseModel.getVersion().toString(), + vspEntityId, + vspNamespace, + getVlmGeneralInfo(vendorLicenseModel), + null, + null, + null); + return vspElements; + } + + + public static ItemVersionData getItemVersionData( + VendorLicenseModelEntity vendorLicenseModel) { + ItemVersionData itemVersionData = new ItemVersionData(); + Info info = new Info(); + info.setName("main version"); + itemVersionData.setInfo(info); + return itemVersionData; + } + + public static Info getVlmInfo(VendorLicenseModelEntity vendorLicenseModel) { + + Info info = new Info(); + info.setName(vendorLicenseModel.getVendorName()); + info.setDescription(vendorLicenseModel.getDescription()); + info.addProperty("type", "vlm"); + info.addProperty("version", vendorLicenseModel.getVersion()); + info.addProperty("iconRef", vendorLicenseModel.getIconRef()); + return info; + } + + private static List getVlmNamespace(VendorLicenseModelEntity vlmEntity) { + return ElementHandler.getElementPath(""); + } + + private static Info getVlmGeneralInfo(VendorLicenseModelEntity vendorLicenseModel) { + + + Info info = new Info(); + info.setName(StructureElement.General.name()); + info.addProperty(InfoPropertyName.type.name(), InfoPropertyName.vlm.name()); + info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef()); + info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName()); + info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription()); + return info; + } + + public static ElementEntityContext convertVlmToElementContext(VendorLicenseModelEntity + vendorLicenseModel) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().toString())); + } + + + private enum InfoPropertyName { + name, + description, + iconRef, + type, + vlm + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java new file mode 100644 index 0000000000..b7a1d42386 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java @@ -0,0 +1,141 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.loaders.VspInformation; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; + +import java.util.List; + +public class VspInformationConvertor { + + public static ItemVersionData getItemVersionData( + VspInformation vspInformation) { + Info info = new Info(); + info.setName("main version"); + ItemVersionData itemVersionData = new ItemVersionData(); + itemVersionData.setInfo(info); + return itemVersionData; + } + + public static Info getVspInfo(VspInformation vspInformation) { + + Info info = new Info(); + info.setName(vspInformation.getName()); + info.setDescription(vspInformation.getDescription()); + info.addProperty("type", "vsp"); + addVspDetailsToInfo(info, vspInformation); + return info; + } + + private static List getVspNamespace(VendorLicenseModelEntity vlmEntity) { + return ElementHandler.getElementPath(""); + } + + private static void addVspDetailsToInfo(Info info, VspInformation vspInformation) { + info.addProperty("name", vspInformation.getName()); + info.addProperty("description", vspInformation.getDescription()); + info.addProperty("category", vspInformation.getCategory()); + info.addProperty("subCategory", vspInformation.getSubCategory()); + info.addProperty("vendorId", vspInformation.getVendorId()); + info.addProperty("vendorName", vspInformation.getVendorName()); + if (vspInformation.getVlmVersion() != null) { + info.addProperty("vendorVersion", vspInformation.getVlmVersion().toString()); + } + info.addProperty("featureGroups", vspInformation.getFeatureGroups()); + info.addProperty("licenseAgreement", vspInformation.getLicenseAgreement()); + String oldVersion = vspInformation.getIsOldVersion() == null? "1702":"1610"; + info.addProperty("oldVersion", oldVersion); + } + + public static CollaborationElement[] convertVspToElement(VspInformation vspInformation) { + + CollaborationElement[] vspElements = new CollaborationElement[4]; + List vspNamespace = getVspNamespace(vspInformation); + + + String vspEntityId = StructureElement.General.name(); + + vspElements[0] = ElementHandler.getElementEntity( + vspInformation.getId(), vspInformation.getVersion().toString(), + vspEntityId, + vspNamespace, + getVspGeneralInfo(vspInformation), + null, + null, + null); + + String vspOrchestrationTemplateEntityId = StructureElement.OrchestrationTemplate.name(); + vspElements[1] = ElementHandler.getElementEntity( + vspInformation.getId(), vspInformation.getVersion().toString(), + vspOrchestrationTemplateEntityId, + vspNamespace, + ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateEntityId), + null, + null, + null); + + + vspNamespace.add(vspOrchestrationTemplateEntityId); + + String vspOrchestrationTemplateValidationDataEntityId = StructureElement.OrchestrationTemplateValidationData.name(); + vspElements[2] = ElementHandler.getElementEntity( + vspInformation.getId(), vspInformation.getVersion().toString(), + vspOrchestrationTemplateValidationDataEntityId, + vspNamespace, + ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateValidationDataEntityId), + null, + null, + vspInformation.getValidationData()!= null?vspInformation.getValidationData().getBytes() + :null); + + String vspOrchestrationTemplateContentEntityId = StructureElement.OrchestrationTemplateContent.name(); + vspElements[3] = ElementHandler.getElementEntity( + vspInformation.getId(), vspInformation.getVersion().toString(), + vspOrchestrationTemplateContentEntityId, + vspNamespace, + ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateContentEntityId), + null, + null, + vspInformation.getContentData()!= null?vspInformation.getContentData().array() + :null); + + return vspElements; + } + + private static Info getVspGeneralInfo(VspInformation vspInformation) { + + + Info info = new Info(); + info.setName(StructureElement.General.name()); + info.addProperty("name", vspInformation.getName()); + info.addProperty("description", vspInformation.getDescription()); + info.addProperty("category", vspInformation.getCategory()); + info.addProperty("subCategory", vspInformation.getSubCategory()); + info.addProperty("vendorId", vspInformation.getVendorId()); + info.addProperty("vendorName", vspInformation.getVendorName()); + if (vspInformation.getVlmVersion() != null) { + info.addProperty("vendorVersion", vspInformation.getVlmVersion().toString()); + } + info.addProperty("featureGroups", vspInformation.getFeatureGroups()); + info.addProperty("licenseAgreement", vspInformation.getLicenseAgreement()); + String oldVersion = vspInformation.getIsOldVersion() == null? "1702":"1610"; + info.addProperty("oldVersion", oldVersion); + return info; + } + + private static List getVspNamespace(VspInformation vspEntity) { + return ElementHandler.getElementPath(""); + } + + public static ElementEntityContext convertVspToElementContext(VspInformation vspEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(vspEntity.getId(), vspEntity.getVersion().toString())); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java new file mode 100644 index 0000000000..76e35b56c4 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java @@ -0,0 +1,86 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; +import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; +import org.openecomp.sdc.model.impl.zusammen.StructureElement; + + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author katyr + * @since April 23, 2017 + */ + +public class VspServiceArtifactConvertor +{ + private static Set serviceArtifactsLoaded = new HashSet<>(); + + + + public static CollaborationElement[] convertServiceArtifactToElement(ServiceArtifact serviceArtifact) { + + CollaborationElement[] serviceArtifactElements; + List serviceArtifactNamespace = getServiceArtifactNamespace(); + + int index = 0; + String serviceArtifactsEntityId = StructureElement.Artifacts.name(); + String uniqueId = serviceArtifact.getVspId()+"_"+serviceArtifact.getVersion().toString(); + if (serviceArtifactsLoaded.contains(uniqueId)) { + serviceArtifactElements = new CollaborationElement[1]; + } else { + serviceArtifactsLoaded.add(uniqueId); + serviceArtifactElements = new CollaborationElement[2]; + serviceArtifactElements[index] = ElementHandler.getElementEntity( + serviceArtifact.getVspId(), serviceArtifact.getVersion().toString(), serviceArtifactsEntityId, + serviceArtifactNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Artifacts.name()), + null, + null, + null); + index++; + } + + serviceArtifactNamespace.add(serviceArtifactsEntityId); + String elementId = serviceArtifact.getVspId()+"_"+serviceArtifact.getVersion().toString() + +"_"+serviceArtifact.getName(); + serviceArtifactElements[index] = ElementHandler.getElementEntity( + serviceArtifact.getVspId(), serviceArtifact.getVersion().toString(), elementId, + serviceArtifactNamespace, + getServiceArtifactInfo(serviceArtifact), + null, + null, + FileUtils.toByteArray(serviceArtifact.getContent())); + + return serviceArtifactElements; + } + + private static Info getServiceArtifactInfo(ServiceArtifact serviceArtifactEntity) { + Info info = new Info(); + info.setName(serviceArtifactEntity.getName()); + info.addProperty("type", org.openecomp.sdc.model.impl.zusammen.ElementType.Artifact.name()); + + return info; + } + + private static List getServiceArtifactNamespace() { + return ElementHandler.getElementPath(StructureElement.ServiceModel.name()); + } + + public static ElementEntityContext convertServiceArtifactToElementContext(ServiceArtifact + serviceArtifactEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(serviceArtifactEntity.getVspId(), serviceArtifactEntity.getVersion().toString())); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java new file mode 100644 index 0000000000..3854b32366 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java @@ -0,0 +1,102 @@ +package org.openecomp.core.migration.convertors; + +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.store.ElementHandler; +import org.openecomp.core.model.types.ServiceTemplate; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.model.impl.zusammen.ElementType; +import org.openecomp.sdc.model.impl.zusammen.StructureElement; +import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil; + +import java.io.ByteArrayInputStream; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @author katyr + * @since April 23, 2017 + */ + +public class VspServiceTemplateConvertor +{ + private static Set serviceTemplatesLoaded = new HashSet<>(); + + + + public static CollaborationElement[] convertServiceTemplateToElement(ServiceTemplate serviceTemplate) { + + CollaborationElement[] serviceTemplateElements; + List serviceTemplateNamespace = getServiceTemplateNamespace(); + + int index = 0; + String serviceTemplatesEntityId = StructureElement.Templates.name(); + String uniqueId = serviceTemplate.getVspId()+"_"+serviceTemplate.getVersion().toString(); + if (serviceTemplatesLoaded.contains(uniqueId)) { + serviceTemplateElements = new CollaborationElement[1]; + } else { + serviceTemplatesLoaded.add(uniqueId); + String vspServiceModelEntityId = StructureElement.ServiceModel.name(); + + serviceTemplateElements = new CollaborationElement[3]; + serviceTemplateElements[index] = ElementHandler.getElementEntity( + serviceTemplate.getVspId(), + serviceTemplate.getVersion().toString(), + vspServiceModelEntityId, + serviceTemplateNamespace, + ElementHandler.getServiceModelElementInfo(vspServiceModelEntityId,serviceTemplate), + null, + null, + null); + index++; + serviceTemplateNamespace.add(vspServiceModelEntityId); + serviceTemplateElements[index] = ElementHandler.getElementEntity( + serviceTemplate.getVspId(), serviceTemplate.getVersion().toString(), serviceTemplatesEntityId, + serviceTemplateNamespace, + ElementHandler.getStructuralElementInfo(StructureElement.Templates.name()), + null, + null, + null); + index++; + } + + serviceTemplateNamespace.add(serviceTemplatesEntityId); + String elementId = serviceTemplate.getVspId()+"_"+serviceTemplate.getVersion().toString() + +"_"+serviceTemplate.getName(); + serviceTemplateElements[index] = ElementHandler.getElementEntity( + serviceTemplate.getVspId(), serviceTemplate.getVersion().toString(), elementId, + serviceTemplateNamespace, + getServiceTemplateInfo(serviceTemplate), + null, + null, + FileUtils.toByteArray(serviceTemplate.getContent())); + + return serviceTemplateElements; + } + + private static Info getServiceTemplateInfo(ServiceTemplate serviceTemplateEntity) { + Info info = new Info(); + info.setName(serviceTemplateEntity.getName()); + info.addProperty("type", ElementType.Servicetemplate.name()); + info.addProperty("base", serviceTemplateEntity.getBaseName()); + + + + return info; + } + + private static List getServiceTemplateNamespace() { + return ElementHandler.getElementPath(); + } + + public static ElementEntityContext convertServiceTemplateToElementContext(ServiceTemplate + serviceTemplateEntity) { + + return new ElementEntityContext("GLOBAL_USER", new + ElementContext(serviceTemplateEntity.getVspId(), serviceTemplateEntity.getVersion().toString())); + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java new file mode 100644 index 0000000000..3e00f9d2bc --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java @@ -0,0 +1,55 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.type.ComponentEntity; + +import java.util.Collection; + +public class ComponentCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final ComponentAccessor accessor = + noSqlDb.getMappingManager().createAccessor(ComponentAccessor.class); + + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface ComponentAccessor { + + @Query( + "select * from vsp_component ") + Result list(); + + + } + + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java new file mode 100644 index 0000000000..c307bfcdf6 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java @@ -0,0 +1,31 @@ +package org.openecomp.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.vendorlicense.dao.types.EntitlementPoolEntity; + +import java.util.Collection; + +/** + * Created by ayalaben on 4/24/2017 + */ +public class EntitlementPoolCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + + private static final EntitlementPoolCassandraLoader.EntitlementPoolAccessor accessor = + noSqlDb.getMappingManager().createAccessor(EntitlementPoolCassandraLoader.EntitlementPoolAccessor.class); + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface EntitlementPoolAccessor { + @Query("select * from entitlement_pool ") + Result list(); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java new file mode 100644 index 0000000000..0c7627f177 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java @@ -0,0 +1,30 @@ +package org.openecomp.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.vendorlicense.dao.types.FeatureGroupEntity; + +import java.util.Collection; + +/** + * Created by ayalaben on 4/25/2017. + */ +public class FeatureGroupCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final FeatureGroupCassandraLoader.FGAccessor accessor = + noSqlDb.getMappingManager().createAccessor(FeatureGroupCassandraLoader.FGAccessor.class); + + public Collection list() { + return accessor.getAll().all(); + } + + @Accessor + interface FGAccessor { + @Query("SELECT * FROM feature_group") + Result getAll(); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java new file mode 100644 index 0000000000..891a69eb14 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java @@ -0,0 +1,31 @@ +package org.openecomp.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.vendorlicense.dao.types.LicenseKeyGroupEntity; + +import java.util.Collection; + +/** + * Created by ayalaben on 4/24/2017 + */ +public class LKGCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final LKGCassandraLoader.LKGAccessor accessor = + noSqlDb.getMappingManager().createAccessor(LKGCassandraLoader.LKGAccessor.class); + + public Collection list() { + return accessor.getAll().all(); + } + + @Accessor + interface LKGAccessor { + @Query("SELECT * FROM license_key_group") + Result getAll(); + + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java new file mode 100644 index 0000000000..ca44209bdb --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java @@ -0,0 +1,31 @@ +package org.openecomp.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.vendorlicense.dao.types.LicenseAgreementEntity; + +import java.util.Collection; + +/** + * Created by ayalaben on 4/25/2017. + */ +public class LicenseAgreementCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final LicenseAgreementCassandraLoader.LicenseAgreementAccessor accessor = + noSqlDb.getMappingManager().createAccessor(LicenseAgreementCassandraLoader.LicenseAgreementAccessor.class); + + public Collection list() { + return accessor.getAll().all(); + } + + @Accessor + interface LicenseAgreementAccessor { + @Query("SELECT * FROM license_agreement") + Result getAll(); + + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java new file mode 100644 index 0000000000..fdb534df32 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java @@ -0,0 +1,55 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.type.MibEntity; + +import java.util.Collection; + +public class MibCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final MibAccessor accessor = + noSqlDb.getMappingManager().createAccessor(MibAccessor.class); + + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface MibAccessor { + + @Query( + "select * from vsp_component_artifact") + Result list(); + + + } + + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java new file mode 100644 index 0000000000..7ce93bccf2 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java @@ -0,0 +1,35 @@ +package org.openecomp.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.type.NetworkEntity; + +import java.util.Collection; + +/** + * @author katyr + * @since April 23, 2017 + */ + +public class NetworkCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final NetworkCassandraLoader.NetworkAccessor accessor = + noSqlDb.getMappingManager().createAccessor(NetworkCassandraLoader.NetworkAccessor.class); + + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface NetworkAccessor { + + @Query( + "select * from vsp_network ") + Result list(); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java new file mode 100644 index 0000000000..fea9c089b5 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java @@ -0,0 +1,63 @@ +/*- + * ============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.core.migration.loaders; + +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.dao.type.NicEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public class NicCassandraLoader { + + 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); + + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface NicAccessor { + + @Query( + "select vsp_id, version, component_id, nic_id, composition_data,questionnaire_data " + + " from vsp_component_nic ") + Result list(); + + + } + + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java new file mode 100644 index 0000000000..b8c173843d --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java @@ -0,0 +1,56 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.type.ComponentEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; + +import java.util.Collection; + +public class OrchestrationTemplateCandidateCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final OrchestrationTemplateCandidateAccessor accessor = + noSqlDb.getMappingManager().createAccessor(OrchestrationTemplateCandidateAccessor.class); + + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface OrchestrationTemplateCandidateAccessor { + + @Query( + "select * from vsp_orchestration_template_candidate ") + Result list(); + + + } + + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java new file mode 100644 index 0000000000..6672af5fb4 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java @@ -0,0 +1,55 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.type.ProcessEntity; + +import java.util.Collection; + +public class ProcessCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final ProcessAccessor accessor = + noSqlDb.getMappingManager().createAccessor(ProcessAccessor.class); + + + public Collection list() { + return accessor.list().all(); + } + + @Accessor + interface ProcessAccessor { + + @Query( + "select * from vsp_process") + Result list(); + + + } + + + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java new file mode 100644 index 0000000000..523166205a --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java @@ -0,0 +1,61 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.core.model.types.ServiceArtifactEntity; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +public class ServiceArtifactCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final VspServiceArtifactAccessor accessor = + noSqlDb.getMappingManager().createAccessor( + VspServiceArtifactAccessor.class); + + + public Collection list() { + + + List entityList = accessor.listAll().all(); + + return entityList.stream().map(entity -> entity.getServiceArtifact()) + .collect(Collectors.toList()); + } + + @Accessor + interface VspServiceArtifactAccessor { + + @Query("SELECT * FROM vsp_service_artifact") + Result listAll(); + + + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java new file mode 100644 index 0000000000..f7e5853ffb --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java @@ -0,0 +1,61 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.model.types.ServiceTemplate; +import org.openecomp.core.model.types.ServiceTemplateEntity; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +public class ServiceTemplateCassandraLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final VspServiceTemplateAccessor accessor = + noSqlDb.getMappingManager().createAccessor( + VspServiceTemplateAccessor.class); + + + public Collection list() { + + + List entityList = accessor.listAll().all(); + + return entityList.stream().map(entity -> entity.getServiceTemplate()) + .collect(Collectors.toList()); + } + + @Accessor + interface VspServiceTemplateAccessor { + + @Query("SELECT * FROM vsp_service_template") + Result listAll(); + + + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java new file mode 100644 index 0000000000..c02cc1e4ef --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java @@ -0,0 +1,50 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Result; +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.vendorlicense.dao.types.VendorLicenseModelEntity; + +import java.util.Collection; + +public class VendorLicenseModelCassandraLoader { + + private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static VendorLicenseModelAccessor accessor = + noSqlDb.getMappingManager().createAccessor(VendorLicenseModelAccessor.class); + + + public Collection list() { + return accessor.getAll().all(); + } + + @Accessor + interface VendorLicenseModelAccessor { + + @Query("SELECT * FROM vendor_license_model") + Result getAll(); + + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java new file mode 100644 index 0000000000..bac4b6e440 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java @@ -0,0 +1,68 @@ +/*- + * ============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.core.migration.loaders; + +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.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 VendorSoftwareProductInfoLoader { + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final Mapper mapper = + noSqlDb.getMappingManager().mapper(VspInformation.class); + private static final VendorSoftwareProductInfoAccessor accessor = + noSqlDb.getMappingManager().createAccessor(VendorSoftwareProductInfoAccessor.class); + private static final UDTMapper versionMapper = + noSqlDb.getMappingManager().udtMapper(Version.class); + + + public Collection list() { + return accessor.listAll().all(); + } + + + @Accessor + interface VendorSoftwareProductInfoAccessor { + + @Query( + "SELECT * " + + "FROM " + + "vsp_information") + Result listAll(); + + + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java new file mode 100644 index 0000000000..2a6efd22f3 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java @@ -0,0 +1,55 @@ +/*- + * ============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.core.migration.loaders; + +import com.datastax.driver.mapping.Mapper; +import com.datastax.driver.mapping.Result; +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.versioning.dao.VersionInfoDao; +import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; + +import java.util.Collection; + +public class VersionInfoCassandraLoader { + + private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static Mapper mapper = + noSqlDb.getMappingManager().mapper(VersionInfoEntity.class); + private static VersionInfoAccessor accessor = + noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class); + + + + + public Collection list() { + return accessor.getAll().all(); + } + + @Accessor + interface VersionInfoAccessor { + @Query("select * from version_info ") + Result getAll(); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java new file mode 100644 index 0000000000..2db1b09db3 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java @@ -0,0 +1,276 @@ +/*- + * ============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.core.migration.loaders; + +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 java.nio.ByteBuffer; +import java.util.List; + +@Table(keyspace = "dox", name = "vsp_information") +public class VspInformation { + 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; + + @Column(name = "is_old_version") + private String isOldVersion; + + @Column(name = "questionnaire_data") + private String questionnaireData; + + @Column(name = "content_data") + private ByteBuffer contentData; + + + @Computed("writetime(name)") + private Long writetimeMicroSeconds; + + + public VspInformation() { + } + + public VspInformation(String id, Version version) { + this.id = id; + this.version = version; + } + + + 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 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; + } + + public String getIsOldVersion() { + return this.isOldVersion; + } + + public void setIsOldVersion(String oldVersion) { + this.isOldVersion = oldVersion; + } + + public void setVersion(Version version) { + this.version = version; + } + + public Version getVersion() { + return version; + } + + public String getQuestionnaireData() { + return questionnaireData; + } + + public void setQuestionnaireData(String questionnaireData) { + this.questionnaireData = questionnaireData; + } + + public ByteBuffer getContentData() { + return contentData; + } + + public void setContentData(ByteBuffer contentData) { + this.contentData = contentData; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Vsp id = ").append(this.id); + sb.append("Version = ").append(this.version); + + return sb.toString(); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java new file mode 100644 index 0000000000..34e7d79001 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java @@ -0,0 +1,136 @@ +package org.openecomp.core.migration.store; + +import com.amdocs.zusammen.datatypes.Id; +import com.amdocs.zusammen.datatypes.Namespace; +import com.amdocs.zusammen.datatypes.SessionContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.Relation; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; +import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.model.types.ServiceTemplate; +import org.openecomp.core.zusammen.plugin.ZusammenPluginUtil; +import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository; +import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; + +import java.io.ByteArrayInputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ElementHandler { + + private static final String GLOBAL_USER = "GLOBAL_USER"; + + public static void save(SessionContext context, + CassandraElementRepository cassandraElementRepository, + String itemId, Version versionId, + CollaborationElement[] elements) { + + ElementEntityContext elementContext; + for (CollaborationElement element : elements) { + + elementContext = new ElementEntityContext(GLOBAL_USER, new Id(itemId), getVersionId(itemId, + versionId)); + ElementEntity elementEntity = ZusammenPluginUtil.getElementEntity(element); + + cassandraElementRepository.createNamespace(context, elementContext, elementEntity); + + cassandraElementRepository.create(context, elementContext, elementEntity); + + if (isActiveVersion(itemId, versionId)) { + elementContext = + new ElementEntityContext(GLOBAL_USER, new Id(itemId), new Id(versionId.toString())); + cassandraElementRepository.create(context, elementContext, elementEntity); + + } + } + } + + public static CollaborationElement getElementEntity(String itemId, + String versionId, + String elementId, + List elementPath, + Info info, + Collection relations, + List subElements, + byte[] data) { + Namespace namespace = new Namespace(); + for (String pathElementId : elementPath) { + namespace = new Namespace(namespace, new Id(pathElementId)); + } + if (namespace.getValue() == null || namespace.getValue().equals("")) { + namespace = Namespace.ROOT_NAMESPACE; + } + CollaborationElement elementEntity = new CollaborationElement(new Id(itemId), new Id(versionId), + namespace, new Id(elementId)); + + Id parentId = namespace.getParentElementId() != null ? namespace.getParentElementId() : Id.ZERO; + elementEntity.setParentId(parentId); + elementEntity.setInfo(info); + elementEntity.setRelations(relations); + if (subElements != null) { + Set subElementSet = new HashSet<>(); + + subElements.forEach(subElement -> subElementSet.add(new Id(subElement))); + + } + if (data != null) { + elementEntity.setData(new ByteArrayInputStream(data)); + } + + return elementEntity; + } + + public static List getElementPath(String... paths) { + List pathList = new ArrayList<>(); + if (paths != null) { + Collections.addAll(pathList, paths); + } + return pathList; + } + + public static Info getStructuralElementInfo(String elementName) { + Info info = new Info(); + info.setName(elementName); + return info; + } + + + private static Id getVersionId(String itemId, Version versionId) { + VersionInfoEntity versionInfo = + MigrationMain.versionInfoMap.get(itemId); + if (versionInfo == null) { + return new Id(versionId.toString()); + } + Version lastVersion = versionInfo.getCandidate() != null ? versionInfo.getCandidate() + .getVersion() + : versionInfo.getActiveVersion(); + + if (lastVersion.equals(versionId)) { + return new Id(itemId); + } else { + return new Id(versionId.toString()); + } + } + + private static boolean isActiveVersion(String itemId, Version versionId) { + VersionInfoEntity versionInfo = + MigrationMain.versionInfoMap.get(itemId); + return versionInfo != null && versionInfo.getActiveVersion().equals(versionId); + } + + + public static Info getServiceModelElementInfo(String vspServiceModelEntityId, + ServiceTemplate serviceTemplate) { + Info info = ElementHandler.getStructuralElementInfo(vspServiceModelEntityId); + info.addProperty("base", serviceTemplate.getBaseName()); + return info; + + } +} \ No newline at end of file diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java new file mode 100644 index 0000000000..97f5aaf265 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java @@ -0,0 +1,122 @@ +package org.openecomp.core.migration.store; + +import com.amdocs.zusammen.datatypes.Id; +import com.amdocs.zusammen.datatypes.Namespace; +import com.amdocs.zusammen.datatypes.SessionContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.datatypes.item.Relation; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.ItemCassandraDao; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.VersionCassandraDao; +import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntity; + +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ItemHandler { + + public static ElementEntity getElementEntity(String id, List + elementPath, Info info, Collection relations, List subElements, + byte[] data) { + ElementEntity elementEntity = new ElementEntity(new Id(id)); + + Namespace namespace = new Namespace(); + for (String elementId : elementPath) { + namespace = new Namespace(namespace, new Id(elementId)); + } + elementEntity.setNamespace(namespace); + elementEntity.setParentId(namespace.getParentElementId()); + elementEntity.setInfo(info); + elementEntity.setRelations(relations); + if(subElements!=null) { + Set subElementSet = new HashSet<>(); + + subElements.forEach(subElement -> subElementSet.add(new Id(subElement))); + + elementEntity.setSubElementIds(subElementSet); + } + + //elementEntity.setData(new ByteArrayInputStream(data)); + return elementEntity; + } + + public static List getElementPath(String... paths) { + List pathList = new ArrayList<>(); + for (String path : paths) { + pathList.add(path); + } + return pathList; + } + + public static Info getStractualElementInfo(String elementName) { + Info info = new Info(); + info.setName(elementName); + return info; + } + + public static void save(SessionContext context, ItemCassandraDao itemCassandraDao, + VersionCassandraDao versionCassandraDao, + String itemId, Version versionId, Info info, + ItemVersionData itemVersionData, Long writetimeMicroSeconds) { + + Date date = writetimeMicroSeconds==null?new Date():new Date(writetimeMicroSeconds); + itemCassandraDao.create(context,new Id(itemId),info,date); + + versionCassandraDao.create(context, context.getUser().getUserName(),new Id(itemId), + null,getVersionId(itemId,versionId),itemVersionData,date); + + if(isActiveVersion(itemId,versionId)){ + versionCassandraDao.create(context, context.getUser().getUserName(),new Id(itemId), + null,new Id(versionId.toString()),itemVersionData,date); + } + } + + + + private static Info getInfo(VendorLicenseModelEntity vlmEntity) { + Info info = new Info(); + + info.setName(vlmEntity.getVendorName()); + info.setDescription(vlmEntity.getDescription()); + info.addProperty("iconRef",vlmEntity.getIconRef()); + info.addProperty("type",vlmEntity.getIconRef()); + return info; + } + + private static Id getVersionId(String itemId, Version versionId) { + VersionInfoEntity versionInfo = + MigrationMain.versionInfoMap.get(itemId); + if (versionInfo == null) { + return new Id(versionId.toString()); + } + Version lastVersion = versionInfo.getCandidate() != null ? versionInfo.getCandidate() + .getVersion() + : versionInfo.getActiveVersion(); + + if (lastVersion.equals(versionId)) { + return new Id(itemId); + } else { + return new Id(versionId.toString()); + } + } + private static boolean isActiveVersion(String itemId, Version versionId) { + VersionInfoEntity versionInfo = + MigrationMain.versionInfoMap.get(itemId); + if (versionInfo == null) { + return false; + } + + return versionInfo.getActiveVersion().equals(versionId); + } + + +} \ No newline at end of file diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java new file mode 100644 index 0000000000..ea026e5d4f --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java @@ -0,0 +1,15 @@ +package org.openecomp.core.migration.util; + +import org.openecomp.sdc.logging.api.Logger; + +/** + * @author Avrahamg + * @since April 24, 2017 + */ +public class Utils { + public static void printMessage(Logger logger, String message) { + System.out.println(message); + logger.debug(message); + } +} + diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java new file mode 100644 index 0000000000..4481b431ec --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java @@ -0,0 +1,49 @@ +package org.openecomp.core.migration.util.marker; + +import com.datastax.driver.mapping.annotations.Accessor; +import com.datastax.driver.mapping.annotations.Query; +import org.openecomp.core.migration.MigrationMain; +import org.openecomp.core.nosqldb.api.NoSqlDb; +import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; + +/** + * @author katyr + * @since May 01, 2017 + */ + +public class MigrationMarker { + + private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); + + private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); + private static final MigrationTableAccessor accessor = + noSqlDb.getMappingManager().createAccessor(MigrationMarker.MigrationTableAccessor.class); + + public static Boolean isMigrated() { + + MigrationMarkerEntity result = accessor.isMigrated(); + if (result == null) { + return false; + } else { + return result.getMigrated(); + } + } + + public static void markMigrated() { + accessor.markMigrated(); + } + + @Accessor + interface MigrationTableAccessor { + @Query("SELECT * FROM migration where id='1'") + MigrationMarkerEntity isMigrated(); + + + @Query("insert into migration (id,isMigrated) values('1',true)") + void markMigrated(); + + } + +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java new file mode 100644 index 0000000000..47bb91dc49 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java @@ -0,0 +1,45 @@ +package org.openecomp.core.migration.util.marker; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Table; + +/** + * @author katyr + * @since May 03, 2017 + */ + +@Table(keyspace = "dox", name = "migration") +public class MigrationMarkerEntity { + + @ClusteringColumn + private String id; + + @Column(name = "ismigrated") + private Boolean migrated; + + public Boolean getMigrated() { + return migrated; + } + + public void setMigrated(Boolean migrated) { + this.migrated = migrated; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("MigrationMarkerEntity{"); + sb.append("id='").append(id).append('\''); + sb.append(", migrated=").append(migrated); + sb.append('}'); + return sb.toString(); + } +} diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml new file mode 100644 index 0000000000..b1c1335302 --- /dev/null +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i + + 1 + 10 + + + + 20MB + + + ${default-log-pattern} + + + + + + + + + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log + + + + + + AUDIT_MARKER + + NEUTRAL + DENY + + + + + + TRANSACTION_MARKER + + NEUTRAL + DENY + + + + + INFO + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log.%i + + 1 + 10 + + + + 20MB + + + ${default-log-pattern} + + + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log + + + + + + + TRANSACTION_MARKER + + NEUTRAL + DENY + + + + + + + e.level.toInt() <= DEBUG.toInt() + + + DENY + NEUTRAL + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i + + 1 + 10 + + + + 20MB + + + ${default-log-pattern} + + + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/cassandra2zusammen_migration_debug.log + + + + + + + TRANSACTION_MARKER + + NEUTRAL + DENY + + + + + + + e.level.toInt() <= DEBUG.toInt() + + + DENY + NEUTRAL + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log.%i + + 1 + 10 + + + + 20MB + + + ${asdc-debug-log-pattern} + + + + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log + + + + + + AUDIT_MARKER + + DENY + ACCEPT + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i + + 1 + 10 + + + + 20MB + + + ${default-log-pattern} + + + + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log + + + + + + TRANSACTION_MARKER + + DENY + ACCEPT + + + + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log.%i + + 1 + 10 + + + + 20MB + + + ${default-log-pattern} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg