diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api')
17 files changed, 244 insertions, 149 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(); } |