aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-dao
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-dao')
-rw-r--r--catalog-dao/pom.xml24
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java17
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java73
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java1
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java11
5 files changed, 12 insertions, 114 deletions
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index 7d10b3f4e1..2627899e1f 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -300,28 +300,4 @@
</plugins>
</pluginManagement>
</build>
-
- <profiles>
- <profile>
- <id>Fortify</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>com.fortify.ps.maven.plugin</groupId>
- <artifactId>sca-maven-plugin</artifactId>
- <version>4.30</version>
- <configuration>
- <source>1.8</source>
- <buildId>${project.parent.artifactId}</buildId>
- <toplevelArtifactId>${project.parent.artifactId}</toplevelArtifactId>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java
deleted file mode 100644
index e548a594d9..0000000000
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksAccessor.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.openecomp.sdc.be.dao.cassandra;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Param;
-import com.datastax.driver.mapping.annotations.Query;
-
-@Accessor
-public interface MigrationTasksAccessor {
-
- @Query("SELECT minor_version FROM sdcrepository.migrationTasks WHERE major_version = :majorVersion order by minor_version desc limit 1")
- ResultSet getLatestMinorVersion(@Param("majorVersion") Long majorVersion);
-
- @Query("DELETE FROM sdcrepository.migrationTasks WHERE major_version = :majorVersion")
- void deleteTasksForMajorVersion(@Param("majorVersion") Long majorVersion);
-
-}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java
deleted file mode 100644
index 89ad9662fa..0000000000
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/MigrationTasksDao.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.openecomp.sdc.be.dao.cassandra;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.MappingManager;
-import fj.data.Either;
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.resources.data.MigrationTaskEntry;
-import org.openecomp.sdc.be.resources.data.auditing.AuditingTypesConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import java.math.BigInteger;
-
-@Component("sdc-migration-tasks-cassandra-dao")
-public class MigrationTasksDao extends CassandraDao {
-
- private static Logger logger = LoggerFactory.getLogger(MigrationTasksDao.class.getName());
- private MigrationTasksAccessor migrationTasksAccessor;
- private Mapper<MigrationTaskEntry> migrationTaskMapper;
-
- @PostConstruct
- public void init() {
- String keyspace = AuditingTypesConstants.REPO_KEYSPACE;
- if (client.isConnected()) {
- Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> result = client.connect(keyspace);
- if (result.isLeft()) {
- session = result.left().value().left;
- manager = result.left().value().right;
- migrationTasksAccessor = manager.createAccessor(MigrationTasksAccessor.class);
- migrationTaskMapper = manager.mapper(MigrationTaskEntry.class);
- logger.info("** migrationTasksAccessor created");
- } else {
- logger.info("** migrationTasksAccessor failed");
- throw new RuntimeException("Artifact keyspace [" + keyspace + "] failed to connect with error : "
- + result.right().value());
- }
- } else {
- logger.info("** Cassandra client isn't connected");
- logger.info("** migrationTasksAccessor created, but not connected");
- }
- }
-
- public BigInteger getLatestMinorVersion(BigInteger majorVersion) {
- try {
- ResultSet latestMinorVersion = migrationTasksAccessor.getLatestMinorVersion(majorVersion.longValue());
- Row minorVersionRow = latestMinorVersion.one();
- return minorVersionRow == null ? BigInteger.valueOf(Long.MIN_VALUE) : BigInteger.valueOf(minorVersionRow.getLong(0));
- } catch (RuntimeException e) {
- logger.error("failed to get latest minor version for major version {}", majorVersion, e);
- throw e;
- }
- }
-
- public void deleteAllTasksForVersion(BigInteger majorVersion) {
- try {
- migrationTasksAccessor.deleteTasksForMajorVersion(majorVersion.longValue());
- } catch (RuntimeException e) {
- logger.error("failed to delete tasks for major version {}", majorVersion, e);
- throw e;
- }
- }
-
- public void createMigrationTask(MigrationTaskEntry migrationTask) {
- migrationTaskMapper.save(migrationTask);
- }
-
-
-}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java
index f7506f77e1..885a7a7ce3 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/schema/tables/MigrationTasksTableDescription.java
@@ -54,6 +54,7 @@ public class MigrationTasksTableDescription implements ITableDescription {
NAME("task_name", DataType.varchar(), false),
STATUS("task_status", DataType.varchar(), false),
MESSAGE("msg", DataType.varchar(), false),
+ DESCRIPTION("description", DataType.varchar(), false),
EXECUTION_TIME("execution_time", DataType.cdouble(), false);
private String fieldName;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java
index 08376b616f..b64ef201dd 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java
@@ -34,6 +34,9 @@ public class MigrationTaskEntry {
@Column(name = "msg")
private String message;
+ @Column(name = "description")
+ private String description;
+
public void setMajorVersion(Long majorVersion) {
this.majorVersion = majorVersion;
}
@@ -89,4 +92,12 @@ public class MigrationTaskEntry {
public double getExecutionTime() {
return executionTime;
}
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
}