aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-action-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml16
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup47
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDao.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDaoFactory.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDao.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java (renamed from openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/EcompComponentEntity.java)18
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionErrorConstants.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionException.java21
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionMapper.java134
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java (renamed from openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/EcompComponent.java)18
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml18
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup30
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoImpl.java403
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/pom.xml8
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup23
25 files changed, 516 insertions, 379 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml
index e9bf8143b2..340d51b77c 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml
@@ -4,29 +4,29 @@
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>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-api</artifactId>
+
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-action-lib</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>openecomp-sdc-action-api</artifactId>
-
-
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-core-lib</artifactId>
<type>pom</type>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-nosqldb-core</artifactId>
<version>${project.version}</version>
</dependency>
@@ -38,8 +38,8 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
- <version>2.7.4</version>
+ <version>${jackson.annotations.version}</version>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..5da20949fe
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/pom.xml.versionsBackup
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-core-lib</artifactId>
+ <type>pom</type>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-nosqldb-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.7.4</version>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java
index 625ce7efe8..fd6c76c92c 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java
@@ -20,13 +20,14 @@
package org.openecomp.sdc.action;
+
public class ActionConstants {
//
public static final long MAX_ACTION_ARTIFACT_SIZE = 20 * 1024 * 1024; //20 MB
//REST layer constants
- public static final String X_ECOMP_INSTANCE_ID_HEADER_PARAM = "X-ECOMP-InstanceID";
- public static final String X_ECOMP_REQUEST_ID_HEADER_PARAM = "X-ECOMP-RequestID";
+ public static final String X_OPEN_ECOMP_INSTANCE_ID_HEADER_PARAM = "X-OPEN-ECOMP-InstanceID";
+ public static final String X_OPEN_ECOMP_REQUEST_ID_HEADER_PARAM = "X-OPEN-ECOMP-RequestID";
public static final String WWW_AUTHENTICATE_HEADER_PARAM = "WWW-Authenticate";
public static final String ACTION_REQUEST_PARAM_NAME = "name";
@@ -66,7 +67,7 @@ public class ActionConstants {
public static final String FILTER_TYPE_CATEGORY = "CATEGORY";
public static final String FILTER_TYPE_NAME = "NAME";
public static final String FILTER_TYPE_MODEL = "MODEL";
- public static final String FILTER_TYPE_ECOMP_COMPONENT = "ECOMP_COMPONENT";
+ public static final String FILTER_TYPE_OPEN_ECOMP_COMPONENT = "OPEN_ECOMP_COMPONENT";
public static final String FILTER_TYPE_NONE = "NONE";
public static final String ARTIFACT_METADATA_ATTR_UUID = "ARTIFACT_UUID";
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDao.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDao.java
index a120645512..746a3b654d 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDao.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDao.java
@@ -24,11 +24,12 @@ import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
import org.openecomp.sdc.action.types.ActionArtifact;
+
public interface ActionArtifactDao extends BaseDao<ActionArtifactEntity> {
- void uploadArtifact(ActionArtifact data);
+ public void uploadArtifact(ActionArtifact data);
- ActionArtifact downloadArtifact(int effectiveVersion, String artifactUuId);
+ public ActionArtifact downloadArtifact(int effectiveVersion, String artifactUuId);
- void updateArtifact(ActionArtifact data);
+ public void updateArtifact(ActionArtifact data);
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDaoFactory.java
index f0936976ba..51377a18f1 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDaoFactory.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.action.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
import org.openecomp.core.factory.api.AbstractFactory;
+
public abstract class ActionArtifactDaoFactory extends AbstractComponentFactory<ActionArtifactDao> {
public static ActionArtifactDaoFactory getInstance() {
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDao.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDao.java
index 01f5014ad4..ed6dfcca52 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDao.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDao.java
@@ -24,28 +24,28 @@ import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.action.dao.types.ActionEntity;
import org.openecomp.sdc.action.errors.ActionException;
import org.openecomp.sdc.action.types.Action;
-import org.openecomp.sdc.action.types.EcompComponent;
+import org.openecomp.sdc.action.types.OpenEcompComponent;
import org.openecomp.sdc.versioning.dao.VersionableDao;
import java.util.List;
public interface ActionDao extends VersionableDao, BaseDao<ActionEntity> {
- Action createAction(Action actionDto) throws ActionException;
+ public Action createAction(Action actionDto) throws ActionException;
- Action updateAction(Action actionDto) throws ActionException;
+ public Action updateAction(Action actionDto) throws ActionException;
- void deleteAction(String actionInvariantUuId) throws ActionException;
+ public void deleteAction(String actionInvariantUuId) throws ActionException;
- List<Action> getFilteredActions(String filterType, String filterId) throws ActionException;
+ public List<Action> getFilteredActions(String filterType, String filterId) throws ActionException;
- Action getActionsByActionUuId(String uniqueId) throws ActionException;
+ public Action getActionsByActionUuId(String uniqueId) throws ActionException;
- List<EcompComponent> getEcompComponents() throws ActionException;
+ public List<OpenEcompComponent> getOpenEcompComponents() throws ActionException;
- List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId)
+ public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId)
throws ActionException;
- Action getLockedAction(String actionInvariantUuId, String user) throws ActionException;
+ public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException;
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java
index 9aa9e8d375..2c2bfe3ae9 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java
@@ -28,19 +28,19 @@ import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.action.types.Action;
import org.openecomp.sdc.versioning.dao.types.Version;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
+
@Table(keyspace = "dox", name = "Action")
public class ActionEntity {
- @Column(name = "actionUUID")
+ @Column(name = "actionUuId")
private String actionUuId;
@PartitionKey(value = 0)
- @Column(name = "actionInvariantUUID")
+ @Column(name = "actionInvariantUuId")
private String actionInvariantUuId;
@PartitionKey(value = 1)
@Frozen
@@ -124,7 +124,7 @@ public class ActionEntity {
*/
public void setVendorList(List<String> vendorList) {
if (vendorList != null && !vendorList.isEmpty()) {
- List<String> lowerCaseVendorList = new ArrayList<>();
+ List<String> lowerCaseVendorList = new ArrayList<String>();
lowerCaseVendorList
.addAll(vendorList.stream().map(String::toLowerCase).collect(Collectors.toList()));
this.vendorList = lowerCaseVendorList;
@@ -144,7 +144,7 @@ public class ActionEntity {
*/
public void setCategoryList(List<String> categoryList) {
if (categoryList != null && !categoryList.isEmpty()) {
- List<String> lowerCaseCategoryList = new ArrayList<>();
+ List<String> lowerCaseCategoryList = new ArrayList<String>();
lowerCaseCategoryList
.addAll(categoryList.stream().map(String::toLowerCase).collect(Collectors.toList()));
this.categoryList = lowerCaseCategoryList;
@@ -209,16 +209,4 @@ public class ActionEntity {
return destination;
}
- /*private List<HashMap<String,String>> createMapFromList(List<String> list, String idName){
- List<HashMap<String,String>> keyValueList = new ArrayList<>();
- if(list != null && !list.isEmpty()){
- for(String attributeId : list){
- HashMap<String,String> attributeIdMap = new HashMap<>();
- attributeIdMap.put(idName,attributeId);
- keyValueList.add(attributeIdMap);
- }
- return keyValueList;
- }
- return null;
- }*/
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/EcompComponentEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
index 9a71023629..326da718dd 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/EcompComponentEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
@@ -23,10 +23,10 @@ package org.openecomp.sdc.action.dao.types;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-import org.openecomp.sdc.action.types.EcompComponent;
+import org.openecomp.sdc.action.types.OpenEcompComponent;
-@Table(keyspace = "dox", name = "ECOMPComponent")
-public class EcompComponentEntity {
+@Table(keyspace = "dox", name = "EcompComponent")
+public class OpenEcompComponentEntity {
@PartitionKey
@Column(name = "id")
@@ -35,10 +35,10 @@ public class EcompComponentEntity {
@Column(name = "name")
private String name;
- public EcompComponentEntity() {
+ public OpenEcompComponentEntity() {
}
- public EcompComponentEntity(String id, String name) {
+ public OpenEcompComponentEntity(String id, String name) {
this.id = id;
this.name = name;
}
@@ -60,12 +60,12 @@ public class EcompComponentEntity {
}
/**
- * To dto ecomp component.
+ * To dto OPENECOMP component.
*
- * @return the ecomp component
+ * @return the OPENECOMP component
*/
- public EcompComponent toDto() {
- EcompComponent destination = new EcompComponent();
+ public OpenEcompComponent toDto() {
+ OpenEcompComponent destination = new OpenEcompComponent();
destination.setId(this.getId());
destination.setName(this.getName());
return destination;
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionErrorConstants.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionErrorConstants.java
index 092d9abee5..9eff8a7050 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionErrorConstants.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionErrorConstants.java
@@ -20,6 +20,9 @@
package org.openecomp.sdc.action.errors;
+/**
+ * Action Library Error Constants for Error codes and user-friendly detailed error messages.
+ */
public class ActionErrorConstants {
//Error Codes
@@ -65,6 +68,7 @@ public class ActionErrorConstants {
public static final String ACTION_DELETE_ON_LOCKED_ENTITY_CODE = "ACT1048";
public static final String ACTION_INTERNAL_SERVER_ERR_CODE = "ACT1060";
+ //Logging Query failure Response code
public static final String ACTION_QUERY_FAILURE_CODE = "QUERY_FAILURE";
public static final String ACTION_QUERY_FAILURE_MSG = "Query Failure";
@@ -74,10 +78,10 @@ public class ActionErrorConstants {
//"The API failed due to missing body";
public static final String ACTION_REQUEST_MISSING_MANDATORY_PARAM =
"Missing mandatory parameter(s) : ";
- public static final String ACTION_REQUEST_ECOMP_INSTANCE_ID_INVALID =
- "X-ECOMP-InstanceID HTTP header missing or empty";
- public static final String ACTION_REQUEST_ECOMP_REQUEST_ID_INVALID =
- "X-ECOMP-RequestID HTTP header missing or empty";
+ public static final String ACTION_REQUEST_OPEN_ECOMP_INSTANCE_ID_INVALID =
+ "X-OPEN-ECOMP-InstanceID HTTP header missing or empty";
+ public static final String ACTION_REQUEST_OPEN_ECOMP_REQUEST_ID_INVALID =
+ "X-OPEN-ECOMP-RequestID HTTP header missing or empty";
public static final String ACTION_REQUEST_CONTENT_TYPE_INVALID =
"Content-Type HTTP header missing or empty";
public static final String ACTION_REQUEST_AUTHORIZATION_HEADER_INVALID =
@@ -95,8 +99,8 @@ public class ActionErrorConstants {
"Invalid artifact protection value";
public static final String ACTION_ARTIFACT_INVALID_NAME =
- "Artifact name cannot contain any of the following characters : #<>$+%!`&*'|{}?=/:@ "
- + "including whitespaces, double quotes and back-slash";
+ "Artifact name cannot contain any of the following characters : #<>$+%!`&*'|{}?=/:@ including"
+ + " whitespaces, double quotes and back-slash";
public static final String ACTION_ARTIFACT_READ_FILE_ERROR = "Error Occurred while reading file";
public static final String ACTION_REQUEST_ARTIFACT_OPERATION_ALLOWED =
"Artifacts cannot be created/updated using this operation";
@@ -116,7 +120,7 @@ public class ActionErrorConstants {
public static final String ACTION_ARTIFACT_ALREADY_EXISTS =
"Artifact name already exists for Action with id %s. Please use another name.";
public static final String ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG =
- "The request failed due to an internal ASDC problem. ECOMP Component should continue the "
+ "The request failed due to an internal ASDC problem. Open ECOMP Component should continue the "
+ "attempts, with corrected data if required, to create the resource.";
public static final String ACTION_ARTIFACT_DELETE_READ_ONLY_MSG =
"Cannot delete read only artifact.";
@@ -131,6 +135,6 @@ public class ActionErrorConstants {
public static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG =
"Can not undo checkout on versionable entity %s with id %s since it is not checked out.";
public static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG =
- "Can not undo checkout on versionable entity %s with id"
- + " %s since it is checked out by other user: %s.";
+ "Can not undo checkout on versionable entity %s with id %s since it is checked out by other "
+ + "user: %s.";
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionException.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionException.java
index fff88d6f84..08db9e241a 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionException.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionException.java
@@ -20,18 +20,31 @@
package org.openecomp.sdc.action.errors;
+import org.openecomp.sdc.action.util.ActionUtil;
+
+/**
+ * Custom Exception class for handling Action Library error scenarios.
+ */
public class ActionException extends RuntimeException {
private String errorCode;
private String description;
+ private int logResponseCode;
public ActionException() {
}
+ /**
+ * Instantiates a new Action exception.
+ *
+ * @param errorCode the error code
+ * @param description the description
+ */
public ActionException(String errorCode, String description) {
this.errorCode = errorCode;
this.description = description;
+ this.logResponseCode = ActionUtil.getLogResponseCode(this.errorCode);
}
public String getErrorCode() {
@@ -49,4 +62,12 @@ public class ActionException extends RuntimeException {
public void setDescription(String description) {
this.description = description;
}
+
+ public int getLogResponseCode() {
+ return logResponseCode;
+ }
+
+ public void setLogResponseCode(int logResponseCode) {
+ this.logResponseCode = logResponseCode;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionMapper.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionMapper.java
index 23c14aaaa2..98e1c6938a 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionMapper.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionMapper.java
@@ -20,92 +20,132 @@
package org.openecomp.sdc.action.errors;
-import org.openecomp.sdc.action.ActionConstants;
+import static org.openecomp.sdc.action.ActionConstants.WWW_AUTHENTICATE_HEADER_PARAM;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_ALREADY_EXISTS_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_CHECKSUM_ERROR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DELETE_READ_ONLY;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_NAME_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_INVALID_PROTECTION_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_TOO_BIG_ERROR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ARTIFACT_UPDATE_READ_ONLY;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_AUTHENTICATION_ERR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_AUTHORIZATION_ERR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_CHECKIN_ON_UNLOCKED_ENTITY;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_CHECKOUT_ON_LOCKED_ENTITY;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_CHECKOUT_ON_LOCKED_ENTITY_OTHER_USER;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_DELETE_ON_LOCKED_ENTITY_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY_UNIQUE_VALUE_ERROR;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_INSTANCE_ID_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_PARAM_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_REQUEST_BODY_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_REQUEST_ID_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INVALID_SEARCH_CRITERIA;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_MULT_SEARCH_CRITERIA;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_NOT_LOCKED_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_AUTHORIZATION_HEADER_INVALID;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_REQUEST_INVALID_GENERIC_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_SUBMIT_LOCKED_ENTITY_NOT_ALLOWED;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UNDO_CHECKOUT_ON_UNLOCKED_ENTITY;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_INVALID_VERSION;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE_NAME;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_FOR_NAME;
+import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_UPDATE_ON_UNLOCKED_ENTITY;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
+/**
+ * Mapper class to map Action Library exceptions to corresponding HTTP Response objects.
+ */
public class ActionExceptionMapper implements ExceptionMapper<ActionException> {
@Override
- public Response toResponse(ActionException actionException) {
+ public Response toResponse(ActionException exception) {
Response response;
- String errorCode = actionException.getErrorCode();
+ String errorCode = exception.getErrorCode();
switch (errorCode) {
- case ActionErrorConstants.ACTION_REQUEST_INVALID_GENERIC_CODE:
- case ActionErrorConstants.ACTION_INVALID_INSTANCE_ID_CODE:
- case ActionErrorConstants.ACTION_INVALID_REQUEST_ID_CODE:
- case ActionErrorConstants.ACTION_INVALID_REQUEST_BODY_CODE:
- case ActionErrorConstants.ACTION_INVALID_PARAM_CODE:
- case ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_FOR_NAME:
- case ActionErrorConstants.ACTION_CHECKOUT_ON_LOCKED_ENTITY:
- case ActionErrorConstants.ACTION_ENTITY_UNIQUE_VALUE_ERROR:
- case ActionErrorConstants.ACTION_INVALID_SEARCH_CRITERIA:
- case ActionErrorConstants.ACTION_MULT_SEARCH_CRITERIA:
- case ActionErrorConstants.ACTION_UPDATE_ON_UNLOCKED_ENTITY:
- case ActionErrorConstants.ACTION_UPDATE_INVALID_VERSION:
- case ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE:
- case ActionErrorConstants.ACTION_CHECKIN_ON_UNLOCKED_ENTITY:
- case ActionErrorConstants.ACTION_SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED:
- case ActionErrorConstants.ACTION_SUBMIT_LOCKED_ENTITY_NOT_ALLOWED:
- case ActionErrorConstants.ACTION_UNDO_CHECKOUT_ON_UNLOCKED_ENTITY:
- case ActionErrorConstants.ACTION_UPDATE_NOT_ALLOWED_CODE_NAME:
- case ActionErrorConstants.ACTION_ARTIFACT_CHECKSUM_ERROR_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_ALREADY_EXISTS_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_INVALID_NAME_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_TOO_BIG_ERROR_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_INVALID_PROTECTION_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_DELETE_READ_ONLY:
- case ActionErrorConstants.ACTION_NOT_LOCKED_CODE:
+ case ACTION_REQUEST_INVALID_GENERIC_CODE:
+ case ACTION_INVALID_INSTANCE_ID_CODE:
+ case ACTION_INVALID_REQUEST_ID_CODE:
+ case ACTION_INVALID_REQUEST_BODY_CODE:
+ case ACTION_INVALID_PARAM_CODE:
+ case ACTION_UPDATE_NOT_ALLOWED_FOR_NAME:
+ case ACTION_CHECKOUT_ON_LOCKED_ENTITY:
+ case ACTION_ENTITY_UNIQUE_VALUE_ERROR:
+ case ACTION_INVALID_SEARCH_CRITERIA:
+ case ACTION_MULT_SEARCH_CRITERIA:
+ case ACTION_UPDATE_ON_UNLOCKED_ENTITY:
+ case ACTION_UPDATE_INVALID_VERSION:
+ case ACTION_UPDATE_NOT_ALLOWED_CODE:
+ case ACTION_CHECKIN_ON_UNLOCKED_ENTITY:
+ case ACTION_SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED:
+ case ACTION_SUBMIT_LOCKED_ENTITY_NOT_ALLOWED:
+ case ACTION_UNDO_CHECKOUT_ON_UNLOCKED_ENTITY:
+ case ACTION_UPDATE_NOT_ALLOWED_CODE_NAME:
+ case ACTION_ARTIFACT_CHECKSUM_ERROR_CODE:
+ case ACTION_ARTIFACT_ALREADY_EXISTS_CODE:
+ case ACTION_ARTIFACT_INVALID_NAME_CODE:
+ case ACTION_ARTIFACT_TOO_BIG_ERROR_CODE:
+ case ACTION_ARTIFACT_INVALID_PROTECTION_CODE:
+ case ACTION_ARTIFACT_DELETE_READ_ONLY:
+ case ACTION_NOT_LOCKED_CODE:
response = Response
.status(Response.Status.BAD_REQUEST)
.entity(new ActionExceptionResponse(errorCode,
- Response.Status.BAD_REQUEST.getReasonPhrase(), actionException.getDescription()))
+ Response.Status.BAD_REQUEST.getReasonPhrase(), exception.getDescription()))
.type(MediaType.APPLICATION_JSON)
.build();
break;
- case ActionErrorConstants.ACTION_AUTHENTICATION_ERR_CODE:
+ case ACTION_AUTHENTICATION_ERR_CODE:
response = Response
.status(Response.Status.UNAUTHORIZED)
- .header(ActionConstants.WWW_AUTHENTICATE_HEADER_PARAM,
- ActionErrorConstants.ACTION_REQUEST_AUTHORIZATION_HEADER_INVALID)
+ .header(WWW_AUTHENTICATE_HEADER_PARAM, ACTION_REQUEST_AUTHORIZATION_HEADER_INVALID)
.entity(new ActionExceptionResponse(errorCode,
- Response.Status.UNAUTHORIZED.getReasonPhrase(), actionException.getDescription()))
+ Response.Status.UNAUTHORIZED.getReasonPhrase(), exception.getDescription()))
.type(MediaType.APPLICATION_JSON)
.build();
break;
- case ActionErrorConstants.ACTION_AUTHORIZATION_ERR_CODE:
- case ActionErrorConstants.ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER:
- case ActionErrorConstants.ACTION_CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER:
- case ActionErrorConstants.ACTION_CHECKOUT_ON_LOCKED_ENTITY_OTHER_USER:
- case ActionErrorConstants.ACTION_UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER:
- case ActionErrorConstants.ACTION_DELETE_ON_LOCKED_ENTITY_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_UPDATE_READ_ONLY:
+ case ACTION_AUTHORIZATION_ERR_CODE:
+ case ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER:
+ case ACTION_CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER:
+ case ACTION_CHECKOUT_ON_LOCKED_ENTITY_OTHER_USER:
+ case ACTION_UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER:
+ case ACTION_DELETE_ON_LOCKED_ENTITY_CODE:
+ case ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE:
+ case ACTION_ARTIFACT_UPDATE_READ_ONLY:
response = Response
.status(Response.Status.FORBIDDEN)
.entity(
new ActionExceptionResponse(errorCode, Response.Status.FORBIDDEN.getReasonPhrase(),
- actionException.getDescription())).type(MediaType.APPLICATION_JSON)
+ exception.getDescription())).type(MediaType.APPLICATION_JSON)
.build();
break;
- case ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE:
- case ActionErrorConstants.ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE:
+ case ACTION_ENTITY_NOT_EXIST_CODE:
+ case ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE:
response = Response
.status(Response.Status.NOT_FOUND)
.entity(
new ActionExceptionResponse(errorCode, Response.Status.NOT_FOUND.getReasonPhrase(),
- actionException.getDescription())).type(MediaType.APPLICATION_JSON)
+ exception.getDescription())).type(MediaType.APPLICATION_JSON)
.build();
break;
- case ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE:
+ case ACTION_INTERNAL_SERVER_ERR_CODE:
default:
response = Response
.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity(new ActionExceptionResponse(errorCode,
Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(),
- actionException.getDescription()))
+ exception.getDescription()))
.type(MediaType.APPLICATION_JSON)
.build();
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java
index 176d443a81..b7672644d2 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java
@@ -36,7 +36,6 @@ public class Action implements Comparable {
private ActionStatus status;
private String name;
private String displayName;
- private String endpointUri;
private List<String> vendorList;
private List<String> categoryList;
private Date timestamp;
@@ -120,14 +119,6 @@ public class Action implements Comparable {
this.displayName = displayName;
}
- public String getEndpointUri() {
- return endpointUri;
- }
-
- public void setEndpointUri(String endpointUri) {
- this.endpointUri = endpointUri;
- }
-
public List<String> getVendorList() {
return vendorList;
}
@@ -176,6 +167,7 @@ public class Action implements Comparable {
this.supportedComponents = supportedComponents;
}
+
public List<ActionArtifact> getArtifacts() {
return artifacts;
}
@@ -213,8 +205,8 @@ public class Action implements Comparable {
if (this.getStatus() != null) {
destination.setStatus(this.getStatus().name());
}
- destination.setSupportedComponents(
- getIdFromMap(this.getSupportedComponents(), ActionConstants.SUPPORTED_COMPONENTS_ID));
+ destination.setSupportedComponents(getIdFromMap(this.getSupportedComponents(),
+ ActionConstants.SUPPORTED_COMPONENTS_ID));
destination.setSupportedModels(
getIdFromMap(this.getSupportedModels(), ActionConstants.SUPPORTED_MODELS_VERSION_ID));
destination.setData(this.getData());
@@ -224,11 +216,11 @@ public class Action implements Comparable {
private List<String> getIdFromMap(List<HashMap<String, String>> map, String idName) {
List<String> list = new ArrayList<>();
if (map != null && !map.isEmpty()) {
- map.forEach(entry -> {
+ for (HashMap<String, String> entry : map) {
if (entry.containsKey(idName)) {
list.add(entry.get(idName) != null ? entry.get(idName).toLowerCase() : null);
}
- });
+ }
return list;
}
return null;
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java
index ef41673541..1c354e0f41 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java
@@ -26,6 +26,7 @@ import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
import java.nio.ByteBuffer;
import java.util.Date;
+
public class ActionArtifact {
private String artifactUuId;
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java
index 1a20f9ecb7..6ba70b08ee 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java
@@ -26,7 +26,7 @@ public enum ActionRequest {
DELETE_ACTION,
GET_FILTERED_ACTIONS,
GET_ACTIONS_INVARIANT_ID,
- GET_ECOMP_COMPONENTS,
+ GET_OPEN_ECOMP_COMPONENTS,
ACTION_VERSIONING,
CHECKOUT_ACTION,
CHECKIN_ACTION,
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java
index 0dd97e6646..3298be7179 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java
@@ -36,7 +36,7 @@ public enum ActionSubOperation {
GET_ACTIONENTITY_BY_VERSION,
GET_ALL_ACTIONS,
GET_ACTIONINVID_BY_NAME,
- GET_ECOMP_COMPONENTS_ENTITY,
+ GET_OPEN_ECOMP_COMPONENTS_ENTITY,
GET_VERSIONINFO_FOR_ALL_ACTIONS,
GET_NAME_BY_ACTIONINVID,
CHECKOUT_ACTION,
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/EcompComponent.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java
index cbcebb13ef..bf3f0c54f9 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/EcompComponent.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java
@@ -20,18 +20,18 @@
package org.openecomp.sdc.action.types;
-import org.openecomp.sdc.action.dao.types.EcompComponentEntity;
+import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
-public class EcompComponent {
+public class OpenEcompComponent {
private String id;
private String name;
- public EcompComponent() {
+ public OpenEcompComponent() {
//Default constructor
}
- public EcompComponent(String name, String id) {
+ public OpenEcompComponent(String name, String id) {
this.name = name;
this.id = id;
}
@@ -53,12 +53,12 @@ public class EcompComponent {
}
/**
- * To entity ecomp component entity.
+ * To entity OPENECOMP component entity.
*
- * @return the ecomp component entity
+ * @return the OPENECOMP component entity
*/
- public EcompComponentEntity toEntity() {
- EcompComponentEntity destination = new EcompComponentEntity();
+ public OpenEcompComponentEntity toEntity() {
+ OpenEcompComponentEntity destination = new OpenEcompComponentEntity();
destination.setId(this.getId());
destination.setName(this.getName());
return destination;
@@ -84,7 +84,7 @@ public class EcompComponent {
if (this.getClass() != object.getClass()) {
return false;
}
- EcompComponent obj = (EcompComponent) object;
+ OpenEcompComponent obj = (OpenEcompComponent) object;
if (id == null) {
if (obj.id != null) {
return false;
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java
index 787f6abc26..0315a31a70 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java
@@ -116,7 +116,6 @@ import java.time.ZoneOffset;
import java.util.Date;
import java.util.TimeZone;
-
public class ActionUtil {
private static final String UTC_DATE_FORMAT = "dd MMM yyyy kk:mm:ss z";
@@ -125,7 +124,7 @@ public class ActionUtil {
/**
* Get Current Timestamp in UTC format.
*
- * @return Current Timestamp in UTC format.
+ * @return Current Timestamp in UTC format
*/
public static Date getCurrentTimeStampUtc() {
return Date.from(java.time.ZonedDateTime.now(ZoneOffset.UTC).toInstant());
@@ -134,8 +133,8 @@ public class ActionUtil {
/**
* Convert timestamp to UTC format date string.
*
- * @param timeStamp UTC timestamp to be converted to the UTC Date format.
- * @return UTC formatted Date string from timestamp.
+ * @param timeStamp UTC timestamp to be converted to the UTC Date format
+ * @return UTC formatted Date string from timestamp
*/
public static String getUtcDateStringFromTimestamp(Date timeStamp) {
DateFormat df = new SimpleDateFormat(UTC_DATE_FORMAT);
@@ -146,8 +145,8 @@ public class ActionUtil {
/**
* Convert timestamp to UTC format date string.
*
- * @param timeStamp UTC timestamp to be converted to the UTC Date format.
- * @return UTC formatted Date string from timestamp.
+ * @param timeStamp UTC timestamp to be converted to the UTC Date format
+ * @return UTC formatted Date string from timestamp
*/
public static String getLogUtcDateStringFromTimestamp(Date timeStamp) {
DateFormat df = new SimpleDateFormat(LOG_UTC_DATE_FORMAT);
@@ -158,7 +157,7 @@ public class ActionUtil {
/**
* Method to set up specific attributes MDC for the current logging operation.
*
- * @param subOperation Request Name.
+ * @param subOperation Request Name
*/
public static void actionLogPreProcessor(ActionSubOperation subOperation, String targetEntity) {
MDC.put(BEGIN_TIMESTAMP, String.valueOf(System.currentTimeMillis()));
@@ -172,7 +171,7 @@ public class ActionUtil {
/**
* Method to enhance the MDC after the logging operation for Metrics and Audit logs.
*
- * @param statusCode Response code for the current operation.
+ * @param statusCode Response code for the current operation
*/
public static void actionLogPostProcessor(StatusCode statusCode) {
actionLogPostProcessor(statusCode, false);
@@ -188,11 +187,13 @@ public class ActionUtil {
}
/**
- * Method to enhance the MDC after the logging operation for Metrics and Audit logs.
+ * Action log post processor.
*
- * @param statusCode Response code for the current operation.
+ * @param statusCode the status code
+ * @param responseCode the response code
+ * @param responseDescription the response description
+ * @param isServiceMetricLog the is service metric log
*/
-
public static void actionLogPostProcessor(StatusCode statusCode, String responseCode,
String responseDescription,
boolean isServiceMetricLog) {
@@ -217,9 +218,9 @@ public class ActionUtil {
/**
* Action Library Error logging Helper.
*
- * @param errorCategory WARN or ERROR.
- * @param errorCode Action Library exception code.
- * @param errorDescription Description of the error.
+ * @param errorCategory WARN or ERROR
+ * @param errorCode Action Library exception code
+ * @param errorDescription Description of the error
*/
public static void actionErrorLogProcessor(CategoryLogLevel errorCategory, String errorCode,
String errorDescription) {
@@ -237,7 +238,6 @@ public class ActionUtil {
errorType = "F";
break;
default:
- break;
}
MDC.put(ERROR_CODE, getLogResponseCode(errorCode) + errorType);
}
@@ -245,11 +245,11 @@ public class ActionUtil {
}
/**
- * Method to convert Action Library exception codes to OPENECOMP Audit codes in {@link.
- * ActionLogResponseCode} e.g: ACT1060 --> 201.
+ * Method to convert Action Library exception codes to OPENECOMP Audit codes in {@link
+ * ActionLogResponseCode} e.g: ACT1060 --> 201
*
- * @param errorCode Action library exception code.
- * @return Audit log code corresponding to the Action Library exception.
+ * @param errorCode Action library exception code
+ * @return Audit log code corresponding to the Action Library exception
*/
public static int getLogResponseCode(String errorCode) {
ActionLogResponseCode responseCode = INTERNAL_SERVER_ERROR;
@@ -365,7 +365,6 @@ public class ActionUtil {
responseCode = QUERY_FAILURE;
break;
default:
- break;
}
return responseCode.getValue();
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml
index 465e36a5e2..40092e9131 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://maven.apache.org/POM/4.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>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-core</artifactId>
<parent>
<groupId>org.openecomp.sdc</groupId>
@@ -11,11 +13,6 @@
<version>1.1.0-SNAPSHOT</version>
</parent>
-
- <artifactId>openecomp-sdc-action-core</artifactId>
-
-
-
<dependencies>
<dependency>
<groupId>org.openecomp.sdc</groupId>
@@ -27,11 +24,6 @@
<artifactId>openecomp-sdc-versioning-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.openecomp.sdc.sdc_common</groupId>
- <artifactId>openecomp-logging-api</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup
new file mode 100644
index 0000000000..274bdb04c7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/pom.xml.versionsBackup
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-core</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-api</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java
index 2767c9eeca..51f3cac607 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoFactoryImpl.java
@@ -23,8 +23,9 @@ package org.openecomp.sdc.action.dao.impl;
import org.openecomp.sdc.action.dao.ActionArtifactDao;
import org.openecomp.sdc.action.dao.ActionArtifactDaoFactory;
+
public class ActionArtifactDaoFactoryImpl extends ActionArtifactDaoFactory {
- private static final ActionArtifactDao INSTANCE = new ActionArtifactDaoImpl();
+ private static ActionArtifactDao INSTANCE = new ActionArtifactDaoImpl();
@Override
public ActionArtifactDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java
index 3e884c24e3..bfa5830b8d 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionArtifactDaoImpl.java
@@ -25,7 +25,6 @@ import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_ENTITY
import static org.openecomp.sdc.action.errors.ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE;
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 static org.openecomp.sdc.action.util.ActionUtil.actionLogPostProcessor;
import com.datastax.driver.core.exceptions.NoHostAvailableException;
import com.datastax.driver.mapping.Mapper;
@@ -33,8 +32,8 @@ import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.logging.api.Logger;
-import org.openecomp.core.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.action.dao.ActionArtifactDao;
@@ -49,12 +48,13 @@ import org.openecomp.sdc.action.util.ActionUtil;
import java.util.Collection;
import java.util.List;
+
public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity>
implements ActionArtifactDao {
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ActionArtifactEntity> mapper =
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<ActionArtifactEntity> mapper =
noSqlDb.getMappingManager().mapper(ActionArtifactEntity.class);
- private static final ActionArtifactAccessor accessor =
+ private static ActionArtifactAccessor accessor =
noSqlDb.getMappingManager().createAccessor(ActionArtifactAccessor.class);
private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
@@ -97,7 +97,7 @@ public class ActionArtifactDaoImpl extends CassandraBaseDao<ActionArtifactEntity
try {
ActionUtil
.actionLogPreProcessor(ActionSubOperation.GET_ARTIFACT_BY_ARTIFACTUUID, TARGET_ENTITY_DB);
- Result<ActionArtifactEntity> result;
+ Result<ActionArtifactEntity> result = null;
result = accessor.getArtifactByUuId(effectiveVersion, artifactUuId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java
index 66bd20687d..7ecda7844d 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-core/src/main/java/org/openecomp/sdc/action/dao/impl/ActionDaoFactoryImpl.java
@@ -23,8 +23,9 @@ package org.openecomp.sdc.action.dao.impl;
import org.openecomp.sdc.action.dao.ActionDao;
import org.openecomp.sdc.action.dao.ActionDaoFactory;
+
public class ActionDaoFactoryImpl extends ActionDaoFactory {
- private static final ActionDao INSTANCE = new ActionDaoImpl();
+ private static ActionDao INSTANCE = new ActionDaoImpl();
@Override
public ActionDao createInterface() {
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 29b5171470..b7f4b5c926 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
@@ -24,7 +24,25 @@ 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.util.ActionUtil.actionLogPostProcessor;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_CATEGORY;
+import static org.openecomp.sdc.action.ActionConstants.FILTER_TYPE_OPEN_ECOMP_COMPONENT;
+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_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;
@@ -38,23 +56,22 @@ import com.datastax.driver.mapping.UDTMapper;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.logging.api.Logger;
-import org.openecomp.core.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.action.ActionConstants;
import org.openecomp.sdc.action.dao.ActionDao;
import org.openecomp.sdc.action.dao.types.ActionEntity;
-import org.openecomp.sdc.action.dao.types.EcompComponentEntity;
-import org.openecomp.sdc.action.errors.ActionErrorConstants;
+import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
import org.openecomp.sdc.action.errors.ActionException;
import org.openecomp.sdc.action.logging.CategoryLogLevel;
import org.openecomp.sdc.action.logging.StatusCode;
import org.openecomp.sdc.action.types.Action;
import org.openecomp.sdc.action.types.ActionStatus;
import org.openecomp.sdc.action.types.ActionSubOperation;
-import org.openecomp.sdc.action.types.EcompComponent;
+import org.openecomp.sdc.action.types.OpenEcompComponent;
import org.openecomp.sdc.action.util.ActionUtil;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.VersionInfoDao;
@@ -76,22 +93,22 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
+
public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements ActionDao {
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ActionEntity> mapper =
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<ActionEntity> mapper =
noSqlDb.getMappingManager().mapper(ActionEntity.class);
- private static final ActionAccessor accessor =
+ private static ActionAccessor accessor =
noSqlDb.getMappingManager().createAccessor(ActionAccessor.class);
- private static final UDTMapper<Version> versionMapper =
+ private static UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
- private static final VersionInfoDao versionInfoDao =
+ private static VersionInfoDao versionInfoDao =
VersionInfoDaoFactory.getInstance().createInterface();
- private static final VersionInfoDeletedDao versionInfoDeletedDao =
+ private static VersionInfoDeletedDao versionInfoDeletedDao =
VersionInfoDeletedDaoFactory.getInstance().createInterface();
private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
@Override
public void registerVersioning(String versionableEntityType) {
VersioningManagerFactory.getInstance().createInterface()
@@ -102,62 +119,58 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
}
@Override
- public Action createAction(Action actionDto) {
+ public Action createAction(Action action) {
try {
- ActionUtil.actionLogPreProcessor(
- ActionSubOperation.CREATE_ACTION_ENTITY, ActionConstants.TARGET_ENTITY_DB);
- this.create(actionDto.toEntity());
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.CREATE_ACTION_ENTITY, TARGET_ENTITY_DB);
+ this.create(action.toEntity());
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
- return actionDto;
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ return action;
+ } catch (NoHostAvailableException exception) {
+ logGenericException(exception);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
}
@Override
- public Action updateAction(Action actionDto) {
+ public Action updateAction(Action action) {
try {
- log.debug(" entering updateAction with actionUUID= " + actionDto.getActionUuId());
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION,
- ActionConstants.TARGET_ENTITY_DB);
- this.update(actionDto.toEntity());
+ log.debug(" entering updateAction with actionUUID= " + action.getActionUuId());
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION, TARGET_ENTITY_DB);
+ this.update(action.toEntity());
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
- log.debug(" exit updateAction with actionUUID= " + actionDto.getActionUuId());
- return actionDto;
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ log.debug(" exit updateAction with actionUUID= " + action.getActionUuId());
+ return action;
+ } catch (NoHostAvailableException exception) {
+ logGenericException(exception);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
}
@Override
public void deleteAction(String actionInvariantUuId) {
try {
- log.debug("entering deleteAction with actionInvariantUUID = " + actionInvariantUuId);
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
- ActionConstants.TARGET_ENTITY_DB);
+ log.debug("entering deleteAction with actionInvariantUuId = " + actionInvariantUuId);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
VersionInfoDeletedEntity activeVersionEntity = versionInfoDeletedDao.get(
new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
actionInvariantUuId));
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
+
Version activeVersion = activeVersionEntity.getActiveVersion();
Statement getNameFromInvUuId = QueryBuilder.select().column("name").from("dox", "Action")
.where(eq("actioninvariantuuid", actionInvariantUuId))
.and(in("version", versionMapper.toUDT(activeVersion)));
ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID,
- ActionConstants.TARGET_ENTITY_DB);
+ .actionLogPreProcessor(ActionSubOperation.GET_NAME_BY_ACTIONINVID, TARGET_ENTITY_DB);
ResultSet results = getSession().execute(getNameFromInvUuId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
+
if (!results.isExhausted()) {
String name = results.one().getString("name");
List<Version> versions = getVersionsByName(name);
@@ -165,96 +178,12 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
}
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
log.debug("exit deleteAction");
}
-
- @Override
- public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
- List<Action> actions = new ArrayList<>();
- try {
- log.debug(" entering getActionsByActionInvariantUUID with actionInvariantUUID= "
- + actionInvariantUuId);
- Set<Version> viewableVersions = new HashSet<>();
- VersionPredicate filter = new VersionPredicate();
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
- ActionConstants.TARGET_ENTITY_DB);
- VersionInfoEntity versionInfoEntity = versionInfoDao
- .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
- if (versionInfoEntity == null) {
- //Check for action in the Delete version info table
- VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
- new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
- actionInvariantUuId));
- if (versionInfoDeletedEntity != null) {
- viewableVersions = versionInfoDeletedEntity.getViewableVersions();
- //Remove intermediate minor versions from viewable versions
- if (versionInfoDeletedEntity.getActiveVersion() != null) {
- filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
- filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
- viewableVersions.removeIf(filter::isIntermediateMinorVersion);
- }
- }
- } else {
- viewableVersions = versionInfoEntity.getViewableVersions();
- //Remove intermediate minor versions from viewable versions
- if (versionInfoEntity.getActiveVersion() != null) {
- filter.activeVersion = versionInfoEntity.getActiveVersion();
- filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
- viewableVersions.removeIf(filter::isIntermediateMinorVersion);
- }
- //Add candidate version if available
- if (versionInfoEntity.getCandidate() != null) {
- viewableVersions.add(versionInfoEntity.getCandidate().getVersion());
- }
- }
- MDC.put(ActionConstants.TARGET_ENTITY, ActionConstants.TARGET_ENTITY_DB);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
-
- log.debug(
- "Found " + viewableVersions + " viewable version for action with actionInvariantUUID "
- + actionInvariantUuId);
-
- //Fetch action data for the viewable versions
- if (!viewableVersions.isEmpty()) {
- ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
- ActionConstants.TARGET_ENTITY_DB);
- Result<ActionEntity> result =
- accessor.getActionsByInvId(actionInvariantUuId, viewableVersions);
- ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
- log.metrics("");
- if (result != null) {
- actions
- .addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
- }
- }
- } catch (NoHostAvailableException noHostAvailableException) {
- logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
- }
- log.debug(
- " exit getActionsByActionInvariantUUID with actionInvariantUUID= " + actionInvariantUuId);
- return actions;
- }
-
- private void logGenericException(Exception exception) {
- ActionUtil
- .actionLogPostProcessor(StatusCode.ERROR, ActionErrorConstants.ACTION_QUERY_FAILURE_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
- log.metrics("");
- ActionUtil.actionErrorLogProcessor(
- CategoryLogLevel.FATAL, ActionErrorConstants.ACTION_QUERY_FAILURE_CODE,
- ActionErrorConstants.ACTION_QUERY_FAILURE_MSG);
- log.error(exception.getMessage());
- }
-
-
@Override
public List<Action> getFilteredActions(String filterType, String filterId) {
List<Action> actions = new ArrayList<>();
@@ -263,48 +192,45 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
" entering getFilteredActions By filterType = " + filterType + " With value = " + filterId);
try {
switch (filterType) {
- case ActionConstants.FILTER_TYPE_VENDOR:
+ case FILTER_TYPE_VENDOR:
ActionUtil
.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_VENDOR,
- ActionConstants.TARGET_ENTITY_DB);
+ TARGET_ENTITY_DB);
result = accessor.getActionsByVendor(filterId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");
break;
- case ActionConstants.FILTER_TYPE_CATEGORY:
+ case FILTER_TYPE_CATEGORY:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_CATEGORY,
- ActionConstants.TARGET_ENTITY_DB);
+ TARGET_ENTITY_DB);
result = accessor.getActionsByCategory(filterId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");
break;
- case ActionConstants.FILTER_TYPE_MODEL:
+ case FILTER_TYPE_MODEL:
ActionUtil
.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_MODEL,
- ActionConstants.TARGET_ENTITY_DB);
+ TARGET_ENTITY_DB);
result = accessor.getActionsByModel(filterId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");
break;
- case ActionConstants.FILTER_TYPE_ECOMP_COMPONENT:
+ case FILTER_TYPE_OPEN_ECOMP_COMPONENT:
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_COMPONENT,
- ActionConstants.TARGET_ENTITY_DB);
- result = accessor.getActionsByEcompComponent(filterId);
+ TARGET_ENTITY_DB);
+ result = accessor.getActionsByOpenEcompComponent(filterId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");
break;
- case ActionConstants.FILTER_TYPE_NONE:
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS,
- ActionConstants.TARGET_ENTITY_DB);
+ case FILTER_TYPE_NONE:
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ALL_ACTIONS, TARGET_ENTITY_DB);
result = accessor.getAllActions();
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");
break;
- case ActionConstants.FILTER_TYPE_NAME:
+ case FILTER_TYPE_NAME:
ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME,
- ActionConstants.TARGET_ENTITY_DB);
+ .actionLogPreProcessor(ActionSubOperation.GET_ACTIONINVID_BY_NAME, TARGET_ENTITY_DB);
result = accessor.getInvIdByName(filterId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE);
log.metrics("");
@@ -328,69 +254,135 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
" exit getFilteredActions By filterType = " + filterType + " With value = " + filterId);
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
return actions;
}
@Override
- public List<EcompComponent> getEcompComponents() {
- List<EcompComponent> ecompComponents = new ArrayList<>();
- Result<EcompComponentEntity> result;
+ public Action getActionsByActionUuId(String actionUuId) {
try {
- log.debug(" entering getECOMPComponents ");
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ECOMP_COMPONENTS_ENTITY,
- ActionConstants.TARGET_ENTITY_DB);
- result = accessor.getEcompComponents();
+ log.debug(" entering getActionsByActionUuId with actionUUID= " + actionUuId);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID,
+ TARGET_ENTITY_DB);
+ Result<ActionEntity> result = accessor.actionInvariantUuId(actionUuId);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
- ecompComponents.addAll(
- result.all().stream().map(EcompComponentEntity::toDto).collect(Collectors.toList()));
+ log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
+ ActionEntity entity = result.one();
+ if (entity != null) {
+ return entity.toDto();
+ }
}
+ log.debug(" exit getActionsByActionUuId with actionUUID= " + actionUuId);
+ return null;
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
- log.debug(" exit getECOMPComponents ");
- return ecompComponents;
}
@Override
- public Action getActionsByActionUuId(String uniqueId) {
+ public List<OpenEcompComponent> getOpenEcompComponents() {
+ List<OpenEcompComponent> openEcompComponents = new ArrayList<>();
+ Result<OpenEcompComponentEntity> result;
try {
- log.debug(" entering getActionsByActionUUID with actionUUID= " + uniqueId);
+ log.debug(" entering getOpenEcompComponents ");
ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONUUID,
- ActionConstants.TARGET_ENTITY_DB);
- Result<ActionEntity> result = accessor.actionInvariantUuId(uniqueId);
+ .actionLogPreProcessor(ActionSubOperation.GET_OPEN_ECOMP_COMPONENTS_ENTITY, TARGET_ENTITY_DB);
+ result = accessor.getOpenEcompComponents();
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
if (result != null) {
- log.debug(" exit getActionsByActionUUID with actionUUID= " + uniqueId);
- ActionEntity entity = result.one();
- if (entity != null) {
- return entity.toDto();
+ openEcompComponents.addAll(
+ result.all().stream().map(OpenEcompComponentEntity::toDto).collect(Collectors.toList()));
+ }
+ } catch (NoHostAvailableException noHostAvailableException) {
+ logGenericException(noHostAvailableException);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ }
+ log.debug(" exit getOpenEcompComponents ");
+ return openEcompComponents;
+ }
+
+ @Override
+ public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) {
+ List<Action> actions = new ArrayList<Action>();
+ try {
+ log.debug(" entering getActionsByActionInvariantUuId with actionInvariantUuId= "
+ + actionInvariantUuId);
+ Set<Version> viewableVersions = new HashSet<>();
+ VersionPredicate filter = new VersionPredicate();
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
+ VersionInfoEntity versionInfoEntity = versionInfoDao
+ .get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
+ if (versionInfoEntity == null) {
+ //Check for action in the Delete version info table
+ VersionInfoDeletedEntity versionInfoDeletedEntity = versionInfoDeletedDao.get(
+ new VersionInfoDeletedEntity(ActionConstants.ACTION_VERSIONABLE_TYPE,
+ actionInvariantUuId));
+ if (versionInfoDeletedEntity != null) {
+ viewableVersions = versionInfoDeletedEntity.getViewableVersions();
+ //Remove intermediate minor versions from viewable versions
+ if (versionInfoDeletedEntity.getActiveVersion() != null) {
+ filter.activeVersion = versionInfoDeletedEntity.getActiveVersion();
+ filter.finalVersion = versionInfoDeletedEntity.getLatestFinalVersion();
+ viewableVersions.removeIf(filter::isIntermediateMinorVersion);
+ }
+ }
+ } else {
+ viewableVersions = versionInfoEntity.getViewableVersions();
+ //Remove intermediate minor versions from viewable versions
+ if (versionInfoEntity.getActiveVersion() != null) {
+ filter.activeVersion = versionInfoEntity.getActiveVersion();
+ filter.finalVersion = versionInfoEntity.getLatestFinalVersion();
+ viewableVersions.removeIf(filter::isIntermediateMinorVersion);
+ }
+ //Add candidate version if available
+ if (versionInfoEntity.getCandidate() != null) {
+ viewableVersions.add(versionInfoEntity.getCandidate().getVersion());
+ }
+ }
+
+ MDC.put(TARGET_ENTITY, TARGET_ENTITY_DB);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+
+ log.debug(
+ "Found " + viewableVersions + " viewable version for action with actionInvariantUuId "
+ + actionInvariantUuId);
+
+ //Fetch action data for the viewable versions
+ if (!viewableVersions.isEmpty()) {
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
+ TARGET_ENTITY_DB);
+ Result<ActionEntity> result =
+ accessor.getActionsByInvId(actionInvariantUuId, viewableVersions);
+ ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
+ log.metrics("");
+ if (result != null) {
+ actions
+ .addAll(result.all().stream().map(ActionEntity::toDto).collect(Collectors.toList()));
}
}
- log.debug(" exit getActionsByActionUUID with actionUUID= " + uniqueId);
- return null;
} catch (NoHostAvailableException noHostAvailableException) {
logGenericException(noHostAvailableException);
- throw new ActionException(ActionErrorConstants.ACTION_INTERNAL_SERVER_ERR_CODE,
- ActionErrorConstants.ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
+ throw new ActionException(ACTION_INTERNAL_SERVER_ERR_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG);
}
+ log.debug(
+ " exit getActionsByActionInvariantUuId with actionInvariantUuId= " + actionInvariantUuId);
+ return actions;
}
@Override
public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException {
- log.debug(" entering getLockedAction with actionInvariantUUID= " + actionInvariantUuId);
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
- ActionConstants.TARGET_ENTITY_DB);
+ log.debug(" entering getLockedAction with actionInvariantUuId= " + actionInvariantUuId);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
Action action = null;
VersionInfoEntity versionInfoEntity = versionInfoDao
.get(new VersionInfoEntity(ActionConstants.ACTION_VERSIONABLE_TYPE, actionInvariantUuId));
@@ -403,7 +395,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
Set<Version> versions = new HashSet<>();
versions.add(versionInfoEntity.getCandidate().getVersion());
ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTIONENTITY_BY_ACTIONINVID,
- ActionConstants.TARGET_ENTITY_DB);
+ TARGET_ENTITY_DB);
Result<ActionEntity> result = accessor.getActionsByInvId(actionInvariantUuId, versions);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
@@ -412,22 +404,27 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
action = actionEntity != null ? actionEntity.toDto() : null;
}
} else {
- throw new ActionException(ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
- String
- .format(ActionErrorConstants.ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
+ throw new ActionException(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE,
+ String.format(ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER, actionUser));
}
} else {
- throw new ActionException(
- ActionErrorConstants.ACTION_NOT_LOCKED_CODE,
- ActionErrorConstants.ACTION_NOT_LOCKED_MSG);
+ throw new ActionException(ACTION_NOT_LOCKED_CODE, ACTION_NOT_LOCKED_MSG);
}
} else {
- throw new ActionException(ActionErrorConstants.ACTION_ENTITY_NOT_EXIST_CODE,
- ActionErrorConstants.ACTION_ENTITY_NOT_EXIST);
+ throw new ActionException(ACTION_ENTITY_NOT_EXIST_CODE, ACTION_ENTITY_NOT_EXIST);
}
return action;
}
+ private void logGenericException(Exception exception) {
+ ActionUtil.actionLogPostProcessor(StatusCode.ERROR, ACTION_QUERY_FAILURE_CODE,
+ ACTION_ENTITY_INTERNAL_SERVER_ERROR_MSG, false);
+ log.metrics("");
+ ActionUtil.actionErrorLogProcessor(CategoryLogLevel.FATAL, ACTION_QUERY_FAILURE_CODE,
+ ACTION_QUERY_FAILURE_MSG);
+ log.error(exception.getMessage());
+ }
+
@Override
protected Mapper<ActionEntity> getMapper() {
return mapper;
@@ -445,19 +442,20 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
}
/**
- * param actionInvariantUuId. param versions.
+ *
+ * @param actionInvariantUUID.
+ * @param versions.
*/
private void updateActionStatusForDelete(String actionInvariantUuId, List<Version> versions) {
log.debug(
- "entering updateActionStatusForDelete with actionInvariantUUID = " + actionInvariantUuId
+ "entering updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
+ " for versions " + versions);
List<UDTValue> versionUdt = new ArrayList<>();
+ for (Version v : versions) {
+ versionUdt.add(versionMapper.toUDT(v));
+ }
- versions.forEach(v -> versionMapper.toUDT(v));
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS,
- ActionConstants.TARGET_ENTITY_DB);
-
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.UPDATE_ACTION_STATUS, TARGET_ENTITY_DB);
//Update the status column of action table
Statement updateStatusStatement =
QueryBuilder.update("dox", "Action").with(set("status", ActionStatus.Deleted.name()))
@@ -467,7 +465,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
log.metrics("");
//Update the status in the data field of action table
updateStatusInActionData(actionInvariantUuId, versions, ActionStatus.Deleted);
- log.debug("exit updateActionStatusForDelete with actionInvariantUUID = " + actionInvariantUuId
+ log.debug("exit updateActionStatusForDelete with actionInvariantUuId = " + actionInvariantUuId
+ " for versions " + versions);
}
@@ -480,13 +478,13 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
*/
private void updateStatusInActionData(String actionInvariantUuId, List<Version> versions,
ActionStatus status) {
- log.debug("entering updateStatusInActionData for actionInvariantUUID = " + actionInvariantUuId
- + " and status = " + status + " for versions " + versions);
+ log.debug("entering updateStatusInActionData for actionInvariantUuId = " + actionInvariantUuId
+ + " and status = " + status + " for versions " + versions);
for (Version v : versions) {
ActionEntity entity = this.get(new ActionEntity(actionInvariantUuId, v));
String currentData = entity.getData();
Map<String, Object> currentDataMap = JsonUtil.json2Object(currentData, LinkedHashMap.class);
- currentDataMap.put(ActionConstants.STATUS, status);
+ currentDataMap.put(STATUS, status);
String updatedActionData = JsonUtil.object2Json(currentDataMap);
entity.setData(updatedActionData);
this.updateAction(entity.toDto());
@@ -497,19 +495,18 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
/**
* Get list of all major and minor version values for a given action by action name.
*
- * @param name Name of the action
- * @return List of {@link Version} objects for the action
+ * @param name Name of the action.
+ * @return List of {@link Version} objects for the action.
*/
private List<Version> getVersionsByName(String name) {
log.debug("entering getVersionsByName for Action Name = " + name);
- ActionUtil
- .actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION,
- ActionConstants.TARGET_ENTITY_DB);
+ ActionUtil.actionLogPreProcessor(ActionSubOperation.GET_ACTION_VERSION, TARGET_ENTITY_DB);
Statement statement =
QueryBuilder.select().column("version").from("dox", "Action").where(eq("name", name));
ResultSet results = getSession().execute(statement);
ActionUtil.actionLogPostProcessor(StatusCode.COMPLETE, null, "", false);
log.metrics("");
+
List<Version> versionList = new ArrayList<>();
for (Row row : results) {
Version version = versionMapper.fromUDT((UDTValue) row.getObject("version"));
@@ -532,7 +529,7 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
Result<ActionEntity> getActionsByModel(String resource);
@Query("SELECT * FROM Action where supportedComponents CONTAINS ?")
- Result<ActionEntity> getActionsByEcompComponent(String resource);
+ Result<ActionEntity> getActionsByOpenEcompComponent(String resource);
@Query("SELECT * FROM Action where vendor_list CONTAINS ?")
Result<ActionEntity> getActionsByVendor(String vendor);
@@ -543,8 +540,8 @@ public class ActionDaoImpl extends CassandraBaseDao<ActionEntity> implements Act
@Query("SELECT actionInvariantUuId FROM Action where name = ? limit 1")
Result<ActionEntity> getInvIdByName(String name);
- @Query("SELECT * FROM ECOMPComponent")
- Result<EcompComponentEntity> getEcompComponents();
+ @Query("SELECT * FROM EcompComponent")
+ Result<OpenEcompComponentEntity> getOpenEcompComponents();
@Query("SELECT * FROM Action where actionUUID = ?")
Result<ActionEntity> actionInvariantUuId(String actionUuId);
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml
index e4a4140477..62932ef0a7 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml
@@ -3,6 +3,9 @@
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>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-lib</artifactId>
+ <packaging>pom</packaging>
<parent>
<groupId>org.openecomp.sdc</groupId>
@@ -10,11 +13,6 @@
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>openecomp-sdc-action-lib</artifactId>
- <packaging>pom</packaging>
-
-
-
<modules>
<module>openecomp-sdc-action-api</module>
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..447437fe33
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/pom.xml.versionsBackup
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-action-lib</artifactId>
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+
+ <modules>
+ <module>openecomp-sdc-action-api</module>
+ <module>openecomp-sdc-action-core</module>
+ </modules>
+
+
+</project> \ No newline at end of file