diff options
Diffstat (limited to 'openecomp-be/tools/migration')
39 files changed, 0 insertions, 3463 deletions
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml deleted file mode 100644 index c2dbc943e5..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml +++ /dev/null @@ -1,241 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <properties> - - <groovy.version>2.4.7</groovy.version> - <janino.version>2.7.7</janino.version> - - </properties> - - - - <name>openecomp-zusammen-migration</name> - <dependencies> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <artifactId>openecomp-zusammen-plugin</artifactId> - <groupId>org.openecomp.sdc.core</groupId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-model-impl</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc.core</groupId> - <artifactId>openecomp-zusammen-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.amdocs.zusammen.plugin</groupId> - <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>${zusammen-state-store.version}</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-validator</artifactId> - <version>${hibernate.validator.version}</version> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-vendor-license-core</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - <artifactId>openecomp-zusammen-migration</artifactId> - <groupId>org.openecomp.sdc.core.migration</groupId> - <version>1.2.0-SNAPSHOT</version> - <parent> - <groupId>org.openecomp.sdc</groupId> - <artifactId>openecomp-sdc-lib</artifactId> - <relativePath>../../../lib</relativePath> - <version>1.2.0-SNAPSHOT</version> - </parent> - <build> - <plugins> - - <!-- ================================================== --> - <!-- Set the JDK compiler version. --> - <!-- ================================================== --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.5.1</version> - <inherited>true</inherited> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>license-maven-plugin</artifactId> - <version>1.10</version> - <configuration> - <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage> - <processStartTag> - ============LICENSE_START======================================================= - </processStartTag> - <processEndTag> - ============LICENSE_END========================================================= - </processEndTag> - <sectionDelimiter> - ================================================================================ - </sectionDelimiter> - <licenseName>apache_v2</licenseName> - <inceptionYear>2017</inceptionYear> - <organizationName>AT&T Intellectual Property. All rights reserved. - </organizationName> - <projectName>SDC</projectName> - <canUpdateCopyright>true</canUpdateCopyright> - <canUpdateDescription>true</canUpdateDescription> - <canUpdateLicense>true</canUpdateLicense> - <emptyLineAfterHeader>true</emptyLineAfterHeader> - <verbose>false</verbose> - <includes> - <include>**/*.java</include> - <include>**/*.js</include> - <include>**/*.ts</include> - </includes> - <roots> - <root>src</root> - <root>app</root> - <root>server-mock</root> - <root>typings</root> - </roots> - </configuration> - <executions> - <execution> - <id>first</id> - <goals> - <goal>update-file-header</goal> - </goals> - <!--phase>process-sources</phase--> - </execution> - </executions> - </plugin> - - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>2.8</version> - <executions> - <execution> - <id>copy-dependencies</id> - <phase>install</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>false</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <!--includeScope>runtime</includeScope--> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>2.4</version> - <executions> - <execution> - <phase>package</phase> - </execution> - </executions> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <classpathLayoutType>custom</classpathLayoutType> - <customClasspathLayout> - lib/${artifact.artifactId}-${baseVersion}.${artifact.extension} - </customClasspathLayout> - <mainClass>org.openecomp.core.migration.MigrationMain - </mainClass> - </manifest> - <manifestEntries> - <Class-Path>lib/</Class-Path> - </manifestEntries> - </archive> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> - <configuration> - <useSystemClassLoader>false</useSystemClassLoader> - <redirectTestOutputToFile>true</redirectTestOutputToFile> - </configuration> - </plugin> - - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <id>ant-test</id> - <phase>package</phase> - <configuration> - <tasks> - <fixcrlf srcdir="./" eol="unix" - includes="cassandra2zusammen.sh"/> - </tasks> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <version>${mvn.assembly.version}</version> - <executions> - <execution> - <id>Generate assembly</id> - <phase>install</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptors> - <descriptor>${basedir}/src/main/assembly/migration-lib-assembly.xml - </descriptor> - </descriptors> - <finalName>openecomp-zusammen-migration-lib</finalName> - </configuration> - </plugin> - - </plugins> - </build> - -</project> 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 deleted file mode 100644 index 42296baa6e..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/assembly/migration-lib-assembly.xml +++ /dev/null @@ -1,41 +0,0 @@ -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - - <formats> - <format>zip</format> - </formats> - - <includeBaseDirectory>false</includeBaseDirectory> - - <!--files> - <file> - <source>../cassandra2zusammen.sh</source> - </file> - </files--> - - <fileSets> - <fileSet> - <directory>${basedir}/..</directory> - <includes> - <include>cassandra2zusammen.sh</include> - </includes> - <outputDirectory>/</outputDirectory> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/target</directory> - <includes> - <include> - openecomp-zusammen*.jar - </include> - </includes> - <outputDirectory>/</outputDirectory> - </fileSet> - <fileSet> - <directory>${basedir}/target/lib</directory> - <outputDirectory>/lib</outputDirectory> - </fileSet> - </fileSets> -</assembly> - 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 deleted file mode 100644 index 1711e41a65..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java +++ /dev/null @@ -1,469 +0,0 @@ -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.ComponentMonitoringUploadEntity; -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; - - private static Map<String, VersionInfoEntity> 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."); - System.exit(status); - } - 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) { - logger.debug(e.getMessage(), e); - status = -1; - } - - try { - convertOrchestrationTemplateCandidate(context, cassandraElementRepository); - printMessage(logger, "Converted OrchestrationTemplateCandidates\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - - - try { - convertComponent(context, cassandraElementRepository); - printMessage(logger, "Converted Components\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertNic(context, cassandraElementRepository); - printMessage(logger, "Converted Nics\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertNetwork(context, cassandraElementRepository); - printMessage(logger, "Converted Networks\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertMibs(context, cassandraElementRepository); - printMessage(logger, "Converted MIBs\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertServiceArtifact(context, cassandraElementRepository); - printMessage(logger, "Converted Service Artifacts\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertServiceTemplate(context, cassandraElementRepository); - printMessage(logger, "Converted Service Templates\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertProcesses(context, cassandraElementRepository); - printMessage(logger, "Converted Processes\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - - - try { - convertVlm(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); - printMessage(logger, "Converted VLMs\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertLKG(context, cassandraElementRepository); - printMessage(logger, "Converted LKGs\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertFeatureGroup(context, cassandraElementRepository); - printMessage(logger, "Converted Feature Groups\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertEP(context, cassandraElementRepository); - printMessage(logger, "Converted EPs\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - try { - convertLicenseAgreement(context, cassandraElementRepository); - printMessage(logger, "Converted License Agreements\n"); - } catch (Exception e) { - logger.debug(e.getMessage(), e); - status = -1; - } - } - - private static void convertOrchestrationTemplateCandidate(SessionContext context, - CassandraElementRepository cassandraElementRepository) { - OrchestrationTemplateCandidateCassandraLoader orchestrationTemplateCandidateCassandraLoader = - new OrchestrationTemplateCandidateCassandraLoader(); - - orchestrationTemplateCandidateCassandraLoader.list().stream() - .filter(entity -> needMigration(entity.getId(), entity.getVersion()) && - entity.getContentData()!=null && entity.getFilesDataStructure()!=null) - .forEach(entity -> ElementHandler - .save(context, cassandraElementRepository, entity.getId(), entity.getVersion(), - OrchestrationTemplateCandidateConvertor - .convertOrchestrationTemplateCandidateToElement(entity))); - } - - private static void loadVersionInfo() { - - VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader(); - Collection<VersionInfoEntity> versions = - versionInfoCassandraLoader.list(); - - versions.forEach(versionInfoEntity -> versionInfoMap.put(versionInfoEntity.getEntityId - (), versionInfoEntity)); - - - } - - private static void convertMibs(SessionContext context, - CassandraElementRepository cassandraElementRepository) { - MibCassandraLoader cassandraLoader = new MibCassandraLoader(); - Collection<ComponentMonitoringUploadEntity> 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<ProcessEntity> 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<VspInformation> 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<VendorLicenseModelEntity> 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<NicEntity> 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<NetworkEntity> 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<ComponentEntity> 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<ServiceArtifact> 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<ServiceTemplate> 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<LicenseKeyGroupEntity> 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<EntitlementPoolEntity> 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<FeatureGroupEntity> 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<LicenseAgreementEntity> 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)); - } - - public static Map<String, VersionInfoEntity> getVersionInfoMap() - { - return versionInfoMap; - } -} 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 deleted file mode 100644 index fb597d5a3e..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ComponentConvertor.java +++ /dev/null @@ -1,102 +0,0 @@ -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<String> componentsLoaded = new HashSet<>(); - private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); - - public static CollaborationElement[] convertComponentToElement(ComponentEntity componentEntity) { - - CollaborationElement[] componentElements; - List<String> 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<String> 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 deleted file mode 100644 index 86faf15837..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java +++ /dev/null @@ -1,92 +0,0 @@ -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<String> 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<String> 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("operational_scope", entitlementPool.getOperationalScope()); - - return info; - } - - private static List<String> 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 deleted file mode 100644 index eac5ce64ea..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java +++ /dev/null @@ -1,102 +0,0 @@ -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<String> 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<String> 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<Relation> getAllFeatureGroupRelations(FeatureGroupEntity featureGroup) { - Collection<Relation> 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()); - info.addProperty("manufacturerReferenceNumber", featureGroup.getManufacturerReferenceNumber()); - - return info; - } - - - private static List<String> 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 deleted file mode 100644 index 7fd640b12d..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LKGConvertor.java +++ /dev/null @@ -1,79 +0,0 @@ -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<String> compLKGLoaded = new HashSet<>(); - - public static CollaborationElement[] convertLKGToElement(LicenseKeyGroupEntity licenseKeyGroupEntity) { - CollaborationElement[] elements; - List<String> 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<String> 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 deleted file mode 100644 index 25564c3138..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/LicenseAgreementConvertor.java +++ /dev/null @@ -1,84 +0,0 @@ -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<String> 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<String> 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<String> 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 deleted file mode 100644 index f145e51f02..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java +++ /dev/null @@ -1,77 +0,0 @@ -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.StructureElement; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; - -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<String> compMibLoaded = new HashSet<>(); - - - public static CollaborationElement[] convertMibToElement( - ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { - CollaborationElement[] elements; - List<String> mibNamespace = getMibNamespace(componentMonitoringUploadEntity); - - int index = 0; - String mibsEntityId = - StructureElement.Mibs.name() + "_" + componentMonitoringUploadEntity.getComponentId(); - if (compMibLoaded.contains(mibsEntityId)) { - elements = new CollaborationElement[1]; - } else { - compMibLoaded.add(mibsEntityId); - elements = new CollaborationElement[2]; - elements[index++] = ElementHandler.getElementEntity( - componentMonitoringUploadEntity.getVspId(), - componentMonitoringUploadEntity.getVersion().toString(), mibsEntityId, mibNamespace, - ElementHandler.getStructuralElementInfo(StructureElement.Mibs.name()), null, null, null); - } - - mibNamespace.add(mibsEntityId); - elements[index] = ElementHandler.getElementEntity( - componentMonitoringUploadEntity.getVspId(), - componentMonitoringUploadEntity.getVersion().toString(), componentMonitoringUploadEntity - .getId(), mibNamespace, - getMibInfo(componentMonitoringUploadEntity), null, null, componentMonitoringUploadEntity - .getArtifact().array()); - - return elements; - } - - private static Info getMibInfo( - ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { - Info info = new Info(); - info.setName(componentMonitoringUploadEntity.getType().toString()); - info.getProperties().put("name", componentMonitoringUploadEntity.getArtifactName()); - return info; - } - - private static List<String> getMibNamespace( - ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { - return ElementHandler - .getElementPath(StructureElement.Components.name(), componentMonitoringUploadEntity - .getComponentId()); - } - - public static ElementEntityContext convertMibToElementContext( - ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { - - return new ElementEntityContext("GLOBAL_USER", new - ElementContext(componentMonitoringUploadEntity.getVspId(), - componentMonitoringUploadEntity - .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 deleted file mode 100644 index 3d4f1575fc..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NetworkConvertor.java +++ /dev/null @@ -1,91 +0,0 @@ -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<String> networksLoaded = new HashSet<>(); - private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); - - - - public static CollaborationElement[] convertNetworkToElement(NetworkEntity networkEntity) { - - CollaborationElement[] networkElements; - List<String> 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<String> 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 deleted file mode 100644 index b17e68c0e5..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/NicConvertor.java +++ /dev/null @@ -1,95 +0,0 @@ -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<String> compNicLoaded = new HashSet<>(); - private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); - - - - public static CollaborationElement[] convertNicToElement(NicEntity nicEntity) { - - CollaborationElement[] nicElements; - List<String> 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<String> 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 deleted file mode 100644 index e6ceb360bd..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.openecomp.core.migration.convertors; - -import com.amdocs.zusammen.datatypes.item.ElementContext; -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.StructureElement; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; - -import java.util.List; - -public class OrchestrationTemplateCandidateConvertor { - - - - - private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); - - public static CollaborationElement[] convertOrchestrationTemplateCandidateToElement( - OrchestrationTemplateCandidateDataEntity entity) { - - - CollaborationElement[] orchestrationTemplateCandidateElements = new CollaborationElement[2]; - List<String> 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<String> 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 deleted file mode 100644 index 0a145c49f7..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/ProcessConvertor.java +++ /dev/null @@ -1,98 +0,0 @@ -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<String> compProcessesLoaded = new HashSet<>(); - - private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); - - - public static CollaborationElement[] convertProcessToElement(ProcessEntity processEntity) { - CollaborationElement[] elements; - boolean isGeneralComponentId = isGeneralComponentId(processEntity); - List<String> 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<String> 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 deleted file mode 100644 index 2e483747ed..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java +++ /dev/null @@ -1,92 +0,0 @@ -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.store.ElementHandler; -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<String> compNicLoaded = new HashSet<>(); - - public static CollaborationElement[] convertVlmToElement(VendorLicenseModelEntity vendorLicenseModel) { - - CollaborationElement[] vspElements = new CollaborationElement[1]; - List<String> 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<String> 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 deleted file mode 100644 index 59fba5f066..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java +++ /dev/null @@ -1,162 +0,0 @@ -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<String> 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; - if(vspInformation.getQuestionnaireData() == null){ - vspElements = new CollaborationElement[4]; - }else{ - vspElements = new CollaborationElement[5]; - } - - int index=0; - - List<String> vspNamespace = getVspNamespace(vspInformation); - - - String vspEntityId = StructureElement.General.name(); - - vspElements[index] = ElementHandler.getElementEntity( - vspInformation.getId(), vspInformation.getVersion().toString(), - vspEntityId, - vspNamespace, - getVspGeneralInfo(vspInformation), - null, - null, - null); - - index++; - String vspOrchestrationTemplateEntityId = StructureElement.OrchestrationTemplate.name(); - vspElements[index] = ElementHandler.getElementEntity( - vspInformation.getId(), vspInformation.getVersion().toString(), - vspOrchestrationTemplateEntityId, - vspNamespace, - ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateEntityId), - null, - null, - null); - - if(vspInformation.getQuestionnaireData()!= null) { - index++; - String vspQuestionnaireEntityId = StructureElement.Questionnaire.name(); - vspElements[index] = ElementHandler.getElementEntity( - vspInformation.getId(), vspInformation.getVersion().toString(), - vspQuestionnaireEntityId, - vspNamespace, - ElementHandler.getStructuralElementInfo(vspQuestionnaireEntityId), - null, - null, - vspInformation.getQuestionnaireData().getBytes() != null ? vspInformation - .getQuestionnaireData().getBytes() : null); - } - vspNamespace.add(vspOrchestrationTemplateEntityId); - index++; - String vspOrchestrationTemplateValidationDataEntityId = StructureElement.OrchestrationTemplateValidationData.name(); - vspElements[index] = ElementHandler.getElementEntity( - vspInformation.getId(), vspInformation.getVersion().toString(), - vspOrchestrationTemplateValidationDataEntityId, - vspNamespace, - ElementHandler.getStructuralElementInfo(vspOrchestrationTemplateValidationDataEntityId), - null, - null, - vspInformation.getValidationData()!= null?vspInformation.getValidationData().getBytes() - :null); - index++; - String vspOrchestrationTemplateContentEntityId = StructureElement.OrchestrationTemplateContent.name(); - vspElements[index] = 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<String> 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 deleted file mode 100644 index 15b8ad729a..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java +++ /dev/null @@ -1,83 +0,0 @@ -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.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<String> serviceArtifactsLoaded = new HashSet<>(); - - - - public static CollaborationElement[] convertServiceArtifactToElement(ServiceArtifact serviceArtifact) { - - CollaborationElement[] serviceArtifactElements; - List<String> 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<String> 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 deleted file mode 100644 index a767246f12..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java +++ /dev/null @@ -1,100 +0,0 @@ -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 java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * @author katyr - * @since April 23, 2017 - */ - -public class VspServiceTemplateConvertor -{ - private static Set<String> serviceTemplatesLoaded = new HashSet<>(); - - - - public static CollaborationElement[] convertServiceTemplateToElement(ServiceTemplate serviceTemplate) { - - CollaborationElement[] serviceTemplateElements; - List<String> 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<String> 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 deleted file mode 100644 index 3e00f9d2bc..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ComponentCassandraLoader.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<ComponentEntity> list() { - return accessor.list().all(); - } - - @Accessor - interface ComponentAccessor { - - @Query( - "select * from vsp_component ") - Result<ComponentEntity> 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 deleted file mode 100644 index c307bfcdf6..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/EntitlementPoolCassandraLoader.java +++ /dev/null @@ -1,31 +0,0 @@ -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<EntitlementPoolEntity> list() { - return accessor.list().all(); - } - - @Accessor - interface EntitlementPoolAccessor { - @Query("select * from entitlement_pool ") - Result<EntitlementPoolEntity> 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 deleted file mode 100644 index 0c7627f177..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/FeatureGroupCassandraLoader.java +++ /dev/null @@ -1,30 +0,0 @@ -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<FeatureGroupEntity> list() { - return accessor.getAll().all(); - } - - @Accessor - interface FGAccessor { - @Query("SELECT * FROM feature_group") - Result<FeatureGroupEntity> 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 deleted file mode 100644 index 891a69eb14..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java +++ /dev/null @@ -1,31 +0,0 @@ -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<LicenseKeyGroupEntity> list() { - return accessor.getAll().all(); - } - - @Accessor - interface LKGAccessor { - @Query("SELECT * FROM license_key_group") - Result<LicenseKeyGroupEntity> 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 deleted file mode 100644 index ca44209bdb..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java +++ /dev/null @@ -1,31 +0,0 @@ -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<LicenseAgreementEntity> list() { - return accessor.getAll().all(); - } - - @Accessor - interface LicenseAgreementAccessor { - @Query("SELECT * FROM license_agreement") - Result<LicenseAgreementEntity> 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 deleted file mode 100644 index b93033cc72..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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.ComponentMonitoringUploadEntity; - -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<ComponentMonitoringUploadEntity> list() { - return accessor.list().all(); - } - - @Accessor - interface MibAccessor { - - @Query( - "select * from vsp_component_artifact") - Result<ComponentMonitoringUploadEntity> 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 deleted file mode 100644 index 7ce93bccf2..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NetworkCassandraLoader.java +++ /dev/null @@ -1,35 +0,0 @@ -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<NetworkEntity> list() { - return accessor.list().all(); - } - - @Accessor - interface NetworkAccessor { - - @Query( - "select * from vsp_network ") - Result<NetworkEntity> 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 deleted file mode 100644 index fea9c089b5..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/NicCassandraLoader.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<NicEntity> mapper = - noSqlDb.getMappingManager().mapper(NicEntity.class); - private static final NicAccessor accessor = - noSqlDb.getMappingManager().createAccessor(NicAccessor.class); - private static final UDTMapper<Version> versionMapper = - noSqlDb.getMappingManager().udtMapper(Version.class); - - - public Collection<NicEntity> 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<NicEntity> 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 deleted file mode 100644 index 09da455847..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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.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<OrchestrationTemplateCandidateDataEntity> list() { - return accessor.list().all(); - } - - @Accessor - interface OrchestrationTemplateCandidateAccessor { - - @Query( - "select * from vsp_orchestration_template_candidate ") - Result<OrchestrationTemplateCandidateDataEntity> 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 deleted file mode 100644 index 6672af5fb4..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ProcessCassandraLoader.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<ProcessEntity> list() { - return accessor.list().all(); - } - - @Accessor - interface ProcessAccessor { - - @Query( - "select * from vsp_process") - Result<ProcessEntity> 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 deleted file mode 100644 index 523166205a..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceArtifactCassandraLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<ServiceArtifact> list() { - - - List<ServiceArtifactEntity> entityList = accessor.listAll().all(); - - return entityList.stream().map(entity -> entity.getServiceArtifact()) - .collect(Collectors.toList()); - } - - @Accessor - interface VspServiceArtifactAccessor { - - @Query("SELECT * FROM vsp_service_artifact") - Result<ServiceArtifactEntity> 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 deleted file mode 100644 index f7e5853ffb..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/ServiceTemplateCassandraLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<ServiceTemplate> list() { - - - List<ServiceTemplateEntity> entityList = accessor.listAll().all(); - - return entityList.stream().map(entity -> entity.getServiceTemplate()) - .collect(Collectors.toList()); - } - - @Accessor - interface VspServiceTemplateAccessor { - - @Query("SELECT * FROM vsp_service_template") - Result<ServiceTemplateEntity> 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 deleted file mode 100644 index c02cc1e4ef..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorLicenseModelCassandraLoader.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<VendorLicenseModelEntity> list() { - return accessor.getAll().all(); - } - - @Accessor - interface VendorLicenseModelAccessor { - - @Query("SELECT * FROM vendor_license_model") - Result<VendorLicenseModelEntity> 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 deleted file mode 100644 index 26fc23cf5d..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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.versioning.dao.types.Version; - -import java.util.Collection; - -public class VendorSoftwareProductInfoLoader { - - private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); - private static final Mapper<VspInformation> mapper = - noSqlDb.getMappingManager().mapper(VspInformation.class); - private static final VendorSoftwareProductInfoAccessor accessor = - noSqlDb.getMappingManager().createAccessor(VendorSoftwareProductInfoAccessor.class); - private static final UDTMapper<Version> versionMapper = - noSqlDb.getMappingManager().udtMapper(Version.class); - - - public Collection<VspInformation> list() { - return accessor.listAll().all(); - } - - - @Accessor - interface VendorSoftwareProductInfoAccessor { - - @Query( - "SELECT * " + - "FROM " + - "vsp_information") - Result<VspInformation> 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 deleted file mode 100644 index 725298b195..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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.nosqldb.api.NoSqlDb; -import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -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<VersionInfoEntity> mapper = - noSqlDb.getMappingManager().mapper(VersionInfoEntity.class); - private static VersionInfoAccessor accessor = - noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class); - - - - - public Collection<VersionInfoEntity> list() { - return accessor.getAll().all(); - } - - @Accessor - interface VersionInfoAccessor { - @Query("select * from version_info ") - Result<VersionInfoEntity> 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 deleted file mode 100644 index 2db1b09db3..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VspInformation.java +++ /dev/null @@ -1,276 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.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<String> 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<String> getFeatureGroups() { - return featureGroups; - } - - public void setFeatureGroups(List<String> 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 deleted file mode 100644 index 548a8d989b..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java +++ /dev/null @@ -1,136 +0,0 @@ -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<String> elementPath, - Info info, - Collection<Relation> relations, - List<String> 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<Id> subElementSet = new HashSet<>(); - - subElements.forEach(subElement -> subElementSet.add(new Id(subElement))); - - } - if (data != null) { - elementEntity.setData(new ByteArrayInputStream(data)); - } - - return elementEntity; - } - - public static List<String> getElementPath(String... paths) { - List<String> 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.getVersionInfoMap().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.getVersionInfoMap().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 deleted file mode 100644 index 801984ab24..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java +++ /dev/null @@ -1,122 +0,0 @@ -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<String> - elementPath, Info info, Collection<Relation> relations, List<String> 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<Id> subElementSet = new HashSet<>(); - - subElements.forEach(subElement -> subElementSet.add(new Id(subElement))); - - elementEntity.setSubElementIds(subElementSet); - } - - //elementEntity.setData(new ByteArrayInputStream(data)); - return elementEntity; - } - - public static List<String> getElementPath(String... paths) { - List<String> 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.getVersionInfoMap().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.getVersionInfoMap().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 deleted file mode 100644 index ea026e5d4f..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/Utils.java +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 4481b431ec..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarker.java +++ /dev/null @@ -1,49 +0,0 @@ -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 deleted file mode 100644 index 47bb91dc49..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/util/marker/MigrationMarkerEntity.java +++ /dev/null @@ -1,45 +0,0 @@ -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 deleted file mode 100644 index 9c9c06c216..0000000000 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml +++ /dev/null @@ -1,15 +0,0 @@ -<configuration> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <!-- encoders are assigned the type - ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> - </encoder> - </appender> - - <root level="warn"> - <appender-ref ref="STDOUT"/> - </root> - -</configuration>
\ No newline at end of file |