summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2018-08-21 17:55:30 +0530
committerojasdubey <ojas.dubey@amdocs.com>2018-08-22 12:31:35 +0530
commitb111bbed40e9fe02d980fe0af360f60ca47f5ac6 (patch)
tree71c5913289347dca52a2f01f93dc222ed52d0c55 /openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core
parent34db62e9a6b338219980c21ba9f39029f481f866 (diff)
Bugfix - Broken Action Library APIs
1. Fix for Sev-1 bug related to broken action library APIs due to cassandra driver upgrade to 3.x 2. Updated code based on review comments Change-Id: I4e62a7f2bf30a78d1f72f3c78ad8270985bcd56e Issue-ID: SDC-1669 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core')
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java48
1 files changed, 37 insertions, 11 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
index c2d67a7f17..5320b5d5c5 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java
@@ -16,6 +16,30 @@
package org.openecomp.sdc.action.dao.impl;
+import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
+import static com.datastax.driver.core.querybuilder.QueryBuilder.in;
+import static com.datastax.driver.core.querybuilder.QueryBuilder.set;
+import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_MODEL;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NAME;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_NONE;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_VENDOR;
+import static org.openecomp.sdc.action.ActionConstants.STATUS;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY_DB;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_MSG;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_QUERY_FAILURE_MSG;
+
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Statement;
@@ -25,6 +49,16 @@ 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 java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
@@ -54,14 +88,6 @@ import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
import org.slf4j.MDC;
-import java.util.*;
-import java.util.stream.Collectors;
-
-import static com.datastax.driver.core.querybuilder.QueryBuilder.*;
-import static org.openecomp.core.nosqldb.impl.cassandra.CassandraSessionFactory.getSession;
-import static org.openecomp.sdc.action.ActionConstants.*;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.*;
-
public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
@@ -330,7 +356,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
TARGET_ENTITY_DB);
Result<ActionEntity> result =
- accessor.getActionsByInvId(actionInvariantUuId, viewableVersions);
+ accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(viewableVersions));
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
@@ -365,7 +391,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
versions.add(versionInfoEntity.getCandidate().getVersion());
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
TARGET_ENTITY_DB);
- Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, versions);
+ Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, new ArrayList<>(versions));
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
@@ -482,7 +508,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
Result<ActionEntity> getAllActions();
@Query("SELECT * FROM Action where actionInvariantUuId = ? and version in ? ")
- Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, Set<Version> versions);
+ Result<ActionEntity> getActionsByInvId(String actionInvariantUuId, List<Version> versions);
@Query("SELECT * FROM Action where supportedModels CONTAINS ?")
Result<ActionEntity> getActionsByModel(String resource);