summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java')
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/ActionConstants.java147
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDao.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionArtifactDaoFactory.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDao.java26
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDaoFactory.java11
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java62
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionEntity.java158
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionErrorConstants.java198
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionException.java74
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionMapper.java194
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionResponse.java72
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/CategoryLogLevel.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java476
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java230
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java118
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java75
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java139
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/util/ActionUtil.java127
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java26
-rw-r--r--openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDaoFactory.java11
24 files changed, 1118 insertions, 1129 deletions
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 1823b752c8..d24deb75ef 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,91 +17,80 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action;
-
import org.onap.logging.ref.slf4j.ONAPLogConstants;
public class ActionConstants {
- //
- public static final long MAX_ACTION_ARTIFACT_SIZE = 20 * 1024 * 1024L; //20 MB
- //REST layer constants
- 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";
- public static final String ACTION_REQUEST_PARAM_END_POINT_URI = "endpointUri";
- public static final String SUPPORTED_MODELS_VERSION_ID = "versionId";
- public static final String SUPPORTED_COMPONENTS_ID = "Id";
- public static final String ACTION_REQUEST_PARAM_SUPPORTED_MODELS = SUPPORTED_MODELS_VERSION_ID
- + " in supportedModels";
- public static final String ACTION_REQUEST_PARAM_SUPPORTED_COMPONENTS =
- SUPPORTED_COMPONENTS_ID + " in supportedComponents";
-
- public static final String REQUEST_EMPTY_BODY = "{}";
- public static final String REQUEST_TYPE_CREATE_ACTION = "REQUEST_CREATE_ACTION";
- public static final String REQUEST_TYPE_UPDATE_ACTION = "REQUEST_UPDATE_ACTION";
- public static final String REQUEST_TYPE_VERSION_ACTION = "REQUEST_VERSION_ACTION";
-
- //DAO layer constants
- public static final String ACTION_VERSIONABLE_TYPE = "Action";
-
- //Manager constants
- public static final String UNIQUE_ID = "actionUuId";
- public static final String VERSION = "version";
- public static final String INVARIANTUUID = "actionInvariantUuId";
- public static final String STATUS = "status";
- public static final String ARTIFACTS = "artifacts";
- public static final String TIMESTAMP = "timeStamp";
- public static final String UPDATED_BY = "updatedBy";
- public static final String ARTIFACT_NAME = "artifactName";
- public static final String ARTIFACT_FILE = "Artifact to be uploaded";
-
- // Status
- public static final String UNDO_CHECKOUT_RESPONSE_TEXT =
- "Changes to the Action object successfully reverted back.";
+ public static final long MAX_ACTION_ARTIFACT_SIZE = 20 * 1024 * 1024L; //20 MB
- //GET Request Filter Types
- public static final String FILTER_TYPE_VENDOR = "VENDOR";
- 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_OPEN_ECOMP_COMPONENT = "OPEN_ECOMP_COMPONENT";
- public static final String FILTER_TYPE_NONE = "NONE";
+ //REST layer constants
+ 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";
+ public static final String ACTION_REQUEST_PARAM_END_POINT_URI = "endpointUri";
+ public static final String SUPPORTED_MODELS_VERSION_ID = "versionId";
+ public static final String SUPPORTED_COMPONENTS_ID = "Id";
+ public static final String ACTION_REQUEST_PARAM_SUPPORTED_MODELS = SUPPORTED_MODELS_VERSION_ID + " in supportedModels";
+ public static final String ACTION_REQUEST_PARAM_SUPPORTED_COMPONENTS = SUPPORTED_COMPONENTS_ID + " in supportedComponents";
+ public static final String REQUEST_EMPTY_BODY = "{}";
+ public static final String REQUEST_TYPE_CREATE_ACTION = "REQUEST_CREATE_ACTION";
+ public static final String REQUEST_TYPE_UPDATE_ACTION = "REQUEST_UPDATE_ACTION";
+ public static final String REQUEST_TYPE_VERSION_ACTION = "REQUEST_VERSION_ACTION";
+ //DAO layer constants
+ public static final String ACTION_VERSIONABLE_TYPE = "Action";
+ //Manager constants
+ public static final String UNIQUE_ID = "actionUuId";
+ public static final String VERSION = "version";
+ public static final String INVARIANTUUID = "actionInvariantUuId";
+ public static final String STATUS = "status";
+ public static final String ARTIFACTS = "artifacts";
+ public static final String TIMESTAMP = "timeStamp";
+ public static final String UPDATED_BY = "updatedBy";
+ public static final String ARTIFACT_NAME = "artifactName";
+ public static final String ARTIFACT_FILE = "Artifact to be uploaded";
+ // Status
+ public static final String UNDO_CHECKOUT_RESPONSE_TEXT = "Changes to the Action object successfully reverted back.";
+ //GET Request Filter Types
+ public static final String FILTER_TYPE_VENDOR = "VENDOR";
+ 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_OPEN_ECOMP_COMPONENT = "OPEN_ECOMP_COMPONENT";
+ public static final String FILTER_TYPE_NONE = "NONE";
+ public static final String ARTIFACT_METADATA_ATTR_UUID = "ARTIFACT_UUID";
+ public static final String ARTIFACT_METADATA_ATTR_NAME = "ARTIFACT_NAME";
+ public static final String REQUEST_ID = ONAPLogConstants.MDCs.REQUEST_ID;
+ public static final String SERVICE_INSTANCE_ID = "serviceInstanceID";
+ public static final String PARTNER_NAME = ONAPLogConstants.MDCs.PARTNER_NAME;
+ public static final String SERVICE_NAME = ONAPLogConstants.MDCs.SERVICE_NAME;
+ public static final String INSTANCE_UUID = ONAPLogConstants.MDCs.INSTANCE_UUID;
+ public static final String REMOTE_HOST = "RemoteHost";
+ public static final String CLIENT_IP = ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS;
+ public static final String CATEGORY_LOG_LEVEL = "level";
+ public static final String STATUS_CODE = ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
+ public static final String RESPONSE_CODE = ONAPLogConstants.MDCs.RESPONSE_CODE;
+ public static final String RESPONSE_DESCRIPTION = ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
+ public static final String ELAPSED_TIME = "ElapsedTime";
+ public static final String BEGIN_TIMESTAMP = ONAPLogConstants.MDCs.ENTRY_TIMESTAMP;
+ public static final String TARGET_SERVICE_NAME = ONAPLogConstants.MDCs.TARGET_SERVICE_NAME;
+ public static final String TARGET_ENTITY = ONAPLogConstants.MDCs.TARGET_ENTITY;
+ public static final String TARGET_ENTITY_API = "API";
+ public static final String TARGET_ENTITY_DB = "DB";
+ public static final String END_TIMESTAMP = "EndTimestamp";
+ public static final String ERROR_CATEGORY = "ErrorCategory";
+ public static final String ERROR_CODE = "ErrorCode";
+ public static final String ERROR_DESCRIPTION = "ErrorDescription";
+ public static final String MDC_ASDC_INSTANCE_UUID = "ASDC";
+ public static final String SERVICE_METRIC_BEGIN_TIMESTAMP = "SERVICE-METRIC-BEGIN-TIMESTAMP";
+ public static final String LOCAL_ADDR = "localAddr"; //map ServerIPAddress from loggingfilter
- public static final String ARTIFACT_METADATA_ATTR_UUID = "ARTIFACT_UUID";
- public static final String ARTIFACT_METADATA_ATTR_NAME = "ARTIFACT_NAME";
+ public static final String BE_FQDN = "beFqdn"; //map ServerFQDN from logging filter
- public static final String REQUEST_ID = ONAPLogConstants.MDCs.REQUEST_ID;
- public static final String SERVICE_INSTANCE_ID = "serviceInstanceID";
- public static final String PARTNER_NAME = ONAPLogConstants.MDCs.PARTNER_NAME;
- public static final String SERVICE_NAME = ONAPLogConstants.MDCs.SERVICE_NAME;
- public static final String INSTANCE_UUID = ONAPLogConstants.MDCs.INSTANCE_UUID;
- public static final String REMOTE_HOST = "RemoteHost";
- public static final String CLIENT_IP = ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS;
- public static final String CATEGORY_LOG_LEVEL = "level";
- public static final String STATUS_CODE = ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
- public static final String RESPONSE_CODE = ONAPLogConstants.MDCs.RESPONSE_CODE;
- public static final String RESPONSE_DESCRIPTION = ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
- public static final String ELAPSED_TIME = "ElapsedTime";
- public static final String BEGIN_TIMESTAMP = ONAPLogConstants.MDCs.ENTRY_TIMESTAMP;
- public static final String TARGET_SERVICE_NAME = ONAPLogConstants.MDCs.TARGET_SERVICE_NAME;
- public static final String TARGET_ENTITY = ONAPLogConstants.MDCs.TARGET_ENTITY;
- public static final String TARGET_ENTITY_API = "API";
- public static final String TARGET_ENTITY_DB = "DB";
- public static final String END_TIMESTAMP = "EndTimestamp";
- public static final String ERROR_CATEGORY = "ErrorCategory";
- public static final String ERROR_CODE = "ErrorCode";
- public static final String ERROR_DESCRIPTION = "ErrorDescription";
- public static final String MDC_ASDC_INSTANCE_UUID = "ASDC";
- public static final String SERVICE_METRIC_BEGIN_TIMESTAMP = "SERVICE-METRIC-BEGIN-TIMESTAMP";
- public static final String LOCAL_ADDR = "localAddr"; //map ServerIPAddress from loggingfilter
- public static final String BE_FQDN = "beFqdn"; //map ServerFQDN from logging filter
+ public final class UniqueValues {
- public final class UniqueValues {
- public static final String ACTION_NAME = "Action name";
- }
+ public static final String ACTION_NAME = "Action name";
+ }
}
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 746a3b654d..f23014b422 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,19 +17,17 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.dao;
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> {
- public void uploadArtifact(ActionArtifact data);
+ public void uploadArtifact(ActionArtifact data);
- public ActionArtifact downloadArtifact(int effectiveVersion, String artifactUuId);
+ public ActionArtifact downloadArtifact(int effectiveVersion, String artifactUuId);
- public 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 51377a18f1..bab6577a05 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,16 +17,14 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
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() {
- return AbstractFactory.getInstance(ActionArtifactDaoFactory.class);
- }
+ public static ActionArtifactDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ActionArtifactDaoFactory.class);
+ }
}
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 ed6dfcca52..de34bb3b93 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.dao;
+import java.util.List;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.action.dao.types.ActionEntity;
import org.openecomp.sdc.action.errors.ActionException;
@@ -27,25 +27,21 @@ import org.openecomp.sdc.action.types.Action;
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> {
- public Action createAction(Action actionDto) throws ActionException;
-
- public Action updateAction(Action actionDto) throws ActionException;
+ public Action createAction(Action actionDto) throws ActionException;
- public void deleteAction(String actionInvariantUuId) throws ActionException;
+ public Action updateAction(Action actionDto) throws ActionException;
- public List<Action> getFilteredActions(String filterType, String filterId) throws ActionException;
+ public void deleteAction(String actionInvariantUuId) throws ActionException;
- public Action getActionsByActionUuId(String uniqueId) throws ActionException;
+ public List<Action> getFilteredActions(String filterType, String filterId) throws ActionException;
- public List<OpenEcompComponent> getOpenEcompComponents() throws ActionException;
+ public Action getActionsByActionUuId(String uniqueId) throws ActionException;
- public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId)
- throws ActionException;
+ public List<OpenEcompComponent> getOpenEcompComponents() throws ActionException;
- public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException;
+ public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) 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/ActionDaoFactory.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDaoFactory.java
index d8b0c1889e..8b56809956 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/ActionDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class ActionDaoFactory extends AbstractComponentFactory<ActionDao> {
- public static ActionDaoFactory getInstance() {
- return AbstractFactory.getInstance(ActionDaoFactory.class);
- }
+ public static ActionDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ActionDaoFactory.class);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java
index bd6a978ed6..d020e57946 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/ActionArtifactEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,51 +17,47 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
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 java.nio.ByteBuffer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.openecomp.sdc.action.types.ActionArtifact;
-import java.nio.ByteBuffer;
-
@Getter
@Setter
@NoArgsConstructor
@Table(keyspace = "dox", name = "action_artifact")
public class ActionArtifactEntity {
- @PartitionKey
- @Column(name = "artifactuuid")
- private String artifactUuId;
-
- @PartitionKey(value = 1)
- @Column(name = "effective_version")
- private int effectiveVersion;
-
- @Column(name = "artifact")
- private ByteBuffer artifact;
-
- public ActionArtifactEntity(String artifactUuId, int effectiveVersion) {
- this.artifactUuId = artifactUuId;
- this.effectiveVersion = effectiveVersion;
- }
-
- /**
- * To dto action artifact.
- *
- * @return the action artifact
- */
- public ActionArtifact toDto() {
- ActionArtifact destination = new ActionArtifact();
- destination.setArtifactUuId(this.getArtifactUuId());
- destination.setEffectiveVersion(this.getEffectiveVersion());
- destination.setArtifact(this.getArtifact().array());
- return destination;
- }
+ @PartitionKey
+ @Column(name = "artifactuuid")
+ private String artifactUuId;
+ @PartitionKey(value = 1)
+ @Column(name = "effective_version")
+ private int effectiveVersion;
+ @Column(name = "artifact")
+ private ByteBuffer artifact;
+
+ public ActionArtifactEntity(String artifactUuId, int effectiveVersion) {
+ this.artifactUuId = artifactUuId;
+ this.effectiveVersion = effectiveVersion;
+ }
+
+ /**
+ * To dto action artifact.
+ *
+ * @return the action artifact
+ */
+ public ActionArtifact toDto() {
+ ActionArtifact destination = new ActionArtifact();
+ destination.setArtifactUuId(this.getArtifactUuId());
+ destination.setEffectiveVersion(this.getEffectiveVersion());
+ destination.setArtifact(this.getArtifact().array());
+ return destination;
+ }
}
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 d84d560557..566301343f 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
@@ -1,30 +1,27 @@
/*
-* Copyright © 2016-2018 European Support Limited
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.openecomp.sdc.action.dao.types;
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
-
import java.util.Date;
import java.util.Set;
import java.util.stream.Collectors;
-
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -38,72 +35,71 @@ import org.openecomp.sdc.versioning.dao.types.Version;
@Table(keyspace = "dox", name = "Action")
public class ActionEntity {
- @Column(name = "actionUuId")
- private String actionUuId;
- @PartitionKey(value = 0)
- @Column(name = "actionInvariantUuId")
- private String actionInvariantUuId;
- @PartitionKey(value = 1)
- @Frozen
- @Column(name = "version")
- private Version version;
- @Column(name = "status")
- private String status;
- @Column(name = "name")
- private String name;
- @Column(name = "vendor_list")
- private Set<String> vendorList;
- @Column(name = "category_list")
- private Set<String> categoryList;
- @Column(name = "timestamp")
- private Date timestamp;
- @Column(name = "user")
- private String user;
- @Column(name = "supportedModels")
- private Set<String> supportedModels;
- @Column(name = "supportedComponents")
- private Set<String> supportedComponents;
- @Column(name = "data")
- private String data;
-
- public ActionEntity(String actionInvariantUuId, Version version) {
- this.actionInvariantUuId = actionInvariantUuId;
- this.version = version;
- }
+ @Column(name = "actionUuId")
+ private String actionUuId;
+ @PartitionKey(value = 0)
+ @Column(name = "actionInvariantUuId")
+ private String actionInvariantUuId;
+ @PartitionKey(value = 1)
+ @Frozen
+ @Column(name = "version")
+ private Version version;
+ @Column(name = "status")
+ private String status;
+ @Column(name = "name")
+ private String name;
+ @Column(name = "vendor_list")
+ private Set<String> vendorList;
+ @Column(name = "category_list")
+ private Set<String> categoryList;
+ @Column(name = "timestamp")
+ private Date timestamp;
+ @Column(name = "user")
+ private String user;
+ @Column(name = "supportedModels")
+ private Set<String> supportedModels;
+ @Column(name = "supportedComponents")
+ private Set<String> supportedComponents;
+ @Column(name = "data")
+ private String data;
- /**
- * Sets vendor list.
- *
- * @param vendorList the vendor list
- */
- public void setVendorList(Set<String> vendorList) {
- this.vendorList = vendorList != null && !vendorList.isEmpty() ?
- vendorList.stream().map(String::toLowerCase).collect(Collectors.toSet()) : vendorList;
- }
+ public ActionEntity(String actionInvariantUuId, Version version) {
+ this.actionInvariantUuId = actionInvariantUuId;
+ this.version = version;
+ }
- /**
- * Sets category list.
- *
- * @param categoryList the category list
- */
- public void setCategoryList(Set<String> categoryList) {
- this.categoryList = categoryList != null && !categoryList.isEmpty() ?
- categoryList.stream().map(String::toLowerCase).collect(Collectors.toSet()) :
- categoryList;
- }
+ /**
+ * Sets vendor list.
+ *
+ * @param vendorList the vendor list
+ */
+ public void setVendorList(Set<String> vendorList) {
+ this.vendorList =
+ vendorList != null && !vendorList.isEmpty() ? vendorList.stream().map(String::toLowerCase).collect(Collectors.toSet()) : vendorList;
+ }
- /**
- * To dto action.
- *
- * @return the action
- */
- public Action toDto() {
- Action destination = JsonUtil.json2Object(this.getData(), Action.class);
- destination.setData(this.getData());
- destination.setTimestamp(this.getTimestamp());
- destination.setUser(this.getUser());
- destination.setData(this.getData());
- return destination;
- }
+ /**
+ * Sets category list.
+ *
+ * @param categoryList the category list
+ */
+ public void setCategoryList(Set<String> categoryList) {
+ this.categoryList =
+ categoryList != null && !categoryList.isEmpty() ? categoryList.stream().map(String::toLowerCase).collect(Collectors.toSet())
+ : categoryList;
+ }
+ /**
+ * To dto action.
+ *
+ * @return the action
+ */
+ public Action toDto() {
+ Action destination = JsonUtil.json2Object(this.getData(), Action.class);
+ destination.setData(this.getData());
+ destination.setTimestamp(this.getTimestamp());
+ destination.setUser(this.getUser());
+ destination.setData(this.getData());
+ return destination;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.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 f8380a9785..8759e95f5d 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/dao/types/OpenEcompComponentEntity.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.dao.types;
import com.datastax.driver.mapping.annotations.Column;
@@ -36,23 +35,21 @@ import org.openecomp.sdc.action.types.OpenEcompComponent;
@Table(keyspace = "dox", name = "EcompComponent")
public class OpenEcompComponentEntity {
- @PartitionKey
- @Column(name = "id")
- private String id;
-
- @Column(name = "name")
- private String name;
-
+ @PartitionKey
+ @Column(name = "id")
+ private String id;
+ @Column(name = "name")
+ private String name;
- /**
- * To dto OPENECOMP component.
- *
- * @return the OPENECOMP component
- */
- public OpenEcompComponent toDto() {
- OpenEcompComponent destination = new OpenEcompComponent();
- destination.setId(this.getId());
- destination.setName(this.getName());
- return destination;
- }
+ /**
+ * To dto OPENECOMP component.
+ *
+ * @return the OPENECOMP component
+ */
+ 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 9eff8a7050..1acfe15dff 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.errors;
/**
@@ -25,116 +24,85 @@ package org.openecomp.sdc.action.errors;
*/
public class ActionErrorConstants {
- //Error Codes
- public static final String ACTION_REQUEST_INVALID_GENERIC_CODE = "ACT0001";
- public static final String ACTION_AUTHENTICATION_ERR_CODE = "ACT1000";
- public static final String ACTION_AUTHORIZATION_ERR_CODE = "ACT1001";
- public static final String ACTION_INVALID_INSTANCE_ID_CODE = "ACT1002";
- public static final String ACTION_INVALID_REQUEST_ID_CODE = "ACT1003";
- public static final String ACTION_INVALID_PARAM_CODE = "ACT1004";
- //Operation <status> is not supported
- public static final String ACTION_INVALID_REQUEST_BODY_CODE = "ACT1005";
- //ACTION_REQUEST_BODY_EMPTY
- public static final String ACTION_UPDATE_NOT_ALLOWED_CODE_NAME = "ACT1007";
- public static final String ACTION_CHECKOUT_ON_LOCKED_ENTITY = "ACT1008";
- public static final String ACTION_ENTITY_UNIQUE_VALUE_ERROR = "ACT1009";
-
- public static final String ACTION_INVALID_SEARCH_CRITERIA = "ACT1011";
- public static final String ACTION_MULT_SEARCH_CRITERIA = "ACT1012";
- public static final String ACTION_UPDATE_ON_UNLOCKED_ENTITY = "ACT1013";
- public static final String ACTION_UPDATE_INVALID_VERSION = "ACT1014";
- public static final String ACTION_UPDATE_NOT_ALLOWED_CODE = "ACT1015";
-
- public static final String ACTION_CHECKIN_ON_UNLOCKED_ENTITY = "ACT1017";
- public static final String ACTION_SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED = "ACT1018";
- public static final String ACTION_SUBMIT_LOCKED_ENTITY_NOT_ALLOWED = "ACT1019";
- public static final String ACTION_UNDO_CHECKOUT_ON_UNLOCKED_ENTITY = "ACT1020";
- public static final String ACTION_NOT_LOCKED_CODE = "ACT1021";
- public static final String ACTION_ARTIFACT_CHECKSUM_ERROR_CODE = "ACT1022";
- public static final String ACTION_ARTIFACT_TOO_BIG_ERROR_CODE = "ACT1023";
- public static final String ACTION_ARTIFACT_ALREADY_EXISTS_CODE = "ACT1025";
- public static final String ACTION_ARTIFACT_UPDATE_READ_ONLY = "ACT1026";
- public static final String ACTION_ARTIFACT_DELETE_READ_ONLY = "ACT1027";
- public static final String ACTION_ARTIFACT_INVALID_PROTECTION_CODE = "ACT1028";
- public static final String ACTION_ARTIFACT_INVALID_NAME_CODE = "ACT1029";
-
- public static final String ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER = "ACT1041";
- public static final String ACTION_CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER = "ACT1042";
- public static final String ACTION_CHECKOUT_ON_LOCKED_ENTITY_OTHER_USER = "ACT1043";
- public static final String ACTION_UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER = "ACT1044";
- public static final String ACTION_ENTITY_NOT_EXIST_CODE = "ACT1045";
- public static final String ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE = "ACT1046";
- public static final String ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE = "ACT1047";
- 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";
-
-
- //Error Messages
- public static final String ACTION_REQUEST_BODY_EMPTY = "Request Body is missing";
- //"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_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 =
- "Authentication is required to use the API";
- public static final String ACTION_REQUEST_INVALID_NAME =
- "Invalid syntax for action name. No whitespaces allowed.";
- public static final String ACTION_REQUEST_FILTER_PARAM_INVALID =
- "Invalid Search filter criteria provided";
- public static final String ACTION_FILTER_MULTIPLE_QUERY_PARAM_NOT_SUPPORTED =
- "Multiple filter criteria are not supported";
- //"Operation supports filter by one property at a time";
- public static final String ACTION_ARTIFACT_ENTITY_NOT_EXIST = "Specified artifact is not found";
- public static final String ACTION_REQUEST_ARTIFACT_CHECKSUM_ERROR = "Checksum error";
- public static final String ACTION_REQUEST_ARTIFACT_INVALID_PROTECTION_VALUE =
- "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";
- 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";
- public static final String ACTION_ARTIFACT_TOO_BIG_ERROR =
- "Operation is not allowed. Artifact size exceeds the maximum file size limit (20MB).";
-
- //Business Validation Error messages
- public static final String ACTION_UPDATE_NOT_ALLOWED_FOR_NAME =
- "Action Name update is not allowed";
- public static final String ACTION_UPDATE_PARAM_INVALID =
- "Update not allowed for the parameter(s) : %s";
- public static final String ACTION_ENTITY_NOT_EXIST = "Specified Action is not found";
- public static final String ACTION_REQUESTED_VERSION_INVALID = "Invalid requested version : %s";
- public static final String ACTION_UNSUPPORTED_OPERATION = "Operation %s not supported";
- public static final String ACTION_ENTITY_UNIQUE_VALUE_MSG =
- "%s with the value '%s' already exists.";
- 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. 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.";
- public static final String ACTION_ARTIFACT_UPDATE_READ_ONLY_MSG =
- "Cannot update read only artifact.";
- public static final String ACTION_NOT_LOCKED_MSG =
- "Operation is not allowed. Action status should be Locked.";
- public static final String ACTION_ARTIFACT_UPDATE_NAME_INVALID =
- "Artifact name cannot be updated.";
- public static final String ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER =
- "Cannot delete artifact since it is locked by other user %s.";
- 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.";
+ //Error Codes
+ public static final String ACTION_REQUEST_INVALID_GENERIC_CODE = "ACT0001";
+ public static final String ACTION_AUTHENTICATION_ERR_CODE = "ACT1000";
+ public static final String ACTION_AUTHORIZATION_ERR_CODE = "ACT1001";
+ public static final String ACTION_INVALID_INSTANCE_ID_CODE = "ACT1002";
+ public static final String ACTION_INVALID_REQUEST_ID_CODE = "ACT1003";
+ public static final String ACTION_INVALID_PARAM_CODE = "ACT1004";
+ //Operation <status> is not supported
+ public static final String ACTION_INVALID_REQUEST_BODY_CODE = "ACT1005";
+ //ACTION_REQUEST_BODY_EMPTY
+ public static final String ACTION_UPDATE_NOT_ALLOWED_CODE_NAME = "ACT1007";
+ public static final String ACTION_CHECKOUT_ON_LOCKED_ENTITY = "ACT1008";
+ public static final String ACTION_ENTITY_UNIQUE_VALUE_ERROR = "ACT1009";
+ public static final String ACTION_INVALID_SEARCH_CRITERIA = "ACT1011";
+ public static final String ACTION_MULT_SEARCH_CRITERIA = "ACT1012";
+ public static final String ACTION_UPDATE_ON_UNLOCKED_ENTITY = "ACT1013";
+ public static final String ACTION_UPDATE_INVALID_VERSION = "ACT1014";
+ public static final String ACTION_UPDATE_NOT_ALLOWED_CODE = "ACT1015";
+ public static final String ACTION_CHECKIN_ON_UNLOCKED_ENTITY = "ACT1017";
+ public static final String ACTION_SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED = "ACT1018";
+ public static final String ACTION_SUBMIT_LOCKED_ENTITY_NOT_ALLOWED = "ACT1019";
+ public static final String ACTION_UNDO_CHECKOUT_ON_UNLOCKED_ENTITY = "ACT1020";
+ public static final String ACTION_NOT_LOCKED_CODE = "ACT1021";
+ public static final String ACTION_ARTIFACT_CHECKSUM_ERROR_CODE = "ACT1022";
+ public static final String ACTION_ARTIFACT_TOO_BIG_ERROR_CODE = "ACT1023";
+ public static final String ACTION_ARTIFACT_ALREADY_EXISTS_CODE = "ACT1025";
+ public static final String ACTION_ARTIFACT_UPDATE_READ_ONLY = "ACT1026";
+ public static final String ACTION_ARTIFACT_DELETE_READ_ONLY = "ACT1027";
+ public static final String ACTION_ARTIFACT_INVALID_PROTECTION_CODE = "ACT1028";
+ public static final String ACTION_ARTIFACT_INVALID_NAME_CODE = "ACT1029";
+ public static final String ACTION_EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER = "ACT1041";
+ public static final String ACTION_CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER = "ACT1042";
+ public static final String ACTION_CHECKOUT_ON_LOCKED_ENTITY_OTHER_USER = "ACT1043";
+ public static final String ACTION_UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER = "ACT1044";
+ public static final String ACTION_ENTITY_NOT_EXIST_CODE = "ACT1045";
+ public static final String ACTION_ARTIFACT_ENTITY_NOT_EXIST_CODE = "ACT1046";
+ public static final String ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER_CODE = "ACT1047";
+ 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";
+ //Error Messages
+ public static final String ACTION_REQUEST_BODY_EMPTY = "Request Body is missing";
+ //"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_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 = "Authentication is required to use the API";
+ public static final String ACTION_REQUEST_INVALID_NAME = "Invalid syntax for action name. No whitespaces allowed.";
+ public static final String ACTION_REQUEST_FILTER_PARAM_INVALID = "Invalid Search filter criteria provided";
+ public static final String ACTION_FILTER_MULTIPLE_QUERY_PARAM_NOT_SUPPORTED = "Multiple filter criteria are not supported";
+ //"Operation supports filter by one property at a time";
+ public static final String ACTION_ARTIFACT_ENTITY_NOT_EXIST = "Specified artifact is not found";
+ public static final String ACTION_REQUEST_ARTIFACT_CHECKSUM_ERROR = "Checksum error";
+ public static final String ACTION_REQUEST_ARTIFACT_INVALID_PROTECTION_VALUE = "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";
+ 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";
+ public static final String ACTION_ARTIFACT_TOO_BIG_ERROR = "Operation is not allowed. Artifact size exceeds the maximum file size limit (20MB).";
+ //Business Validation Error messages
+ public static final String ACTION_UPDATE_NOT_ALLOWED_FOR_NAME = "Action Name update is not allowed";
+ public static final String ACTION_UPDATE_PARAM_INVALID = "Update not allowed for the parameter(s) : %s";
+ public static final String ACTION_ENTITY_NOT_EXIST = "Specified Action is not found";
+ public static final String ACTION_REQUESTED_VERSION_INVALID = "Invalid requested version : %s";
+ public static final String ACTION_UNSUPPORTED_OPERATION = "Operation %s not supported";
+ public static final String ACTION_ENTITY_UNIQUE_VALUE_MSG = "%s with the value '%s' already exists.";
+ 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. 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.";
+ public static final String ACTION_ARTIFACT_UPDATE_READ_ONLY_MSG = "Cannot update read only artifact.";
+ public static final String ACTION_NOT_LOCKED_MSG = "Operation is not allowed. Action status should be Locked.";
+ public static final String ACTION_ARTIFACT_UPDATE_NAME_INVALID = "Artifact name cannot be updated.";
+ public static final String ACTION_ARTIFACT_DEL_LOCKED_OTHER_USER = "Cannot delete artifact since it is locked by other user %s.";
+ 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.";
}
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 08db9e241a..e702737753 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.errors;
import org.openecomp.sdc.action.util.ActionUtil;
@@ -27,47 +26,46 @@ import org.openecomp.sdc.action.util.ActionUtil;
*/
public class ActionException extends RuntimeException {
- private String errorCode;
- private String description;
- private int logResponseCode;
-
- public ActionException() {
+ 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);
- }
+ /**
+ * 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() {
- return errorCode;
- }
+ public String getErrorCode() {
+ return errorCode;
+ }
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
- public String getDescription() {
- return description;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setDescription(String description) {
- this.description = description;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
- public int getLogResponseCode() {
- return logResponseCode;
- }
+ public int getLogResponseCode() {
+ return logResponseCode;
+ }
- public void setLogResponseCode(int logResponseCode) {
- this.logResponseCode = 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 09c8607b17..ec83fef0e1 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,101 +17,121 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.errors;
+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;
-import static org.openecomp.sdc.action.ActionConstants.WWW_AUTHENTICATE_HEADER_PARAM;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.*;
-
/**
* Mapper class to map Action Library exceptions to corresponding HTTP Response objects.
*/
public class ActionExceptionMapper implements ExceptionMapper<ActionException> {
- @Override
- public Response toResponse(ActionException exception) {
- Response response;
- String errorCode = exception.getErrorCode();
- switch (errorCode) {
- 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(), exception.getDescription()))
- .type(MediaType.APPLICATION_JSON)
- .build();
- break;
- case ACTION_AUTHENTICATION_ERR_CODE:
- response = Response
- .status(Response.Status.UNAUTHORIZED)
- .header(WWW_AUTHENTICATE_HEADER_PARAM, ACTION_REQUEST_AUTHORIZATION_HEADER_INVALID)
- .entity(new ActionExceptionResponse(errorCode,
- Response.Status.UNAUTHORIZED.getReasonPhrase(), exception.getDescription()))
- .type(MediaType.APPLICATION_JSON)
- .build();
- break;
- 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(),
- exception.getDescription())).type(MediaType.APPLICATION_JSON)
- .build();
- break;
- 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(),
- exception.getDescription())).type(MediaType.APPLICATION_JSON)
- .build();
- break;
- 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(),
- exception.getDescription()))
- .type(MediaType.APPLICATION_JSON)
- .build();
+ @Override
+ public Response toResponse(ActionException exception) {
+ Response response;
+ String errorCode = exception.getErrorCode();
+ switch (errorCode) {
+ 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(), exception.getDescription()))
+ .type(MediaType.APPLICATION_JSON).build();
+ break;
+ case ACTION_AUTHENTICATION_ERR_CODE:
+ response = Response.status(Response.Status.UNAUTHORIZED)
+ .header(WWW_AUTHENTICATE_HEADER_PARAM, ACTION_REQUEST_AUTHORIZATION_HEADER_INVALID)
+ .entity(new ActionExceptionResponse(errorCode, Response.Status.UNAUTHORIZED.getReasonPhrase(), exception.getDescription()))
+ .type(MediaType.APPLICATION_JSON).build();
+ break;
+ 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(), exception.getDescription()))
+ .type(MediaType.APPLICATION_JSON).build();
+ break;
+ 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(), exception.getDescription()))
+ .type(MediaType.APPLICATION_JSON).build();
+ break;
+ 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(), exception.getDescription()))
+ .type(MediaType.APPLICATION_JSON).build();
+ }
+ return response;
}
- return response;
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionResponse.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionResponse.java
index 51848464a7..1b9e811bbf 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionResponse.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/errors/ActionExceptionResponse.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,50 +17,48 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.errors;
public class ActionExceptionResponse {
- private String code;
- private String description;
- private String message;
-
- /**
- * Instantiates a new Action exception response.
- *
- * @param code the code
- * @param description the description
- * @param message the message
- */
- public ActionExceptionResponse(String code, String description, String message) {
- this.code = code;
- this.description = description;
- this.message = message;
- }
- public String getCode() {
- return code;
- }
+ private String code;
+ private String description;
+ private String message;
- public void setCode(String code) {
- this.code = code;
- }
+ /**
+ * Instantiates a new Action exception response.
+ *
+ * @param code the code
+ * @param description the description
+ * @param message the message
+ */
+ public ActionExceptionResponse(String code, String description, String message) {
+ this.code = code;
+ this.description = description;
+ this.message = message;
+ }
- public String getDescription() {
- return description;
- }
+ public String getCode() {
+ return code;
+ }
- public void setDescription(String description) {
- this.description = description;
- }
+ public void setCode(String code) {
+ this.code = code;
+ }
- public String getMessage() {
- return message;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setMessage(String message) {
- this.message = message;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/CategoryLogLevel.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/CategoryLogLevel.java
index d87bed310f..6aaec85693 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/CategoryLogLevel.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/logging/CategoryLogLevel.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.logging;
-public enum CategoryLogLevel {
- INFO,
- WARN,
- DEBUG,
- ERROR,
- FATAL
-}
+public enum CategoryLogLevel {INFO, WARN, DEBUG, ERROR, FATAL}
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 672a27ae34..07dd03882d 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
@@ -1,19 +1,18 @@
/*
-* Copyright © 2016-2018 European Support Limited
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.openecomp.sdc.action.types;
import java.util.Date;
@@ -22,252 +21,241 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-
import org.openecomp.sdc.action.ActionConstants;
import org.openecomp.sdc.action.dao.types.ActionEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
-
public class Action implements Comparable {
- private String actionUuId;
- private String actionInvariantUuId;
- private String version;
- private ActionStatus status;
- private String name;
- private String displayName;
- private List<String> vendorList;
- private List<String> categoryList;
- private Date timestamp;
- private String user;
- private List<Map<String, String>> supportedModels;
- private List<Map<String, String>> supportedComponents;
- //private List<HashMap<String,String>> artifacts;
- private List<ActionArtifact> artifacts;
- private String data;
-
- public Action() {
- }
-
- /**
- * Instantiates a new Action.
- *
- * @param action the action
- */
- public Action(Action action) {
- this.actionUuId = action.getActionUuId();
- this.actionInvariantUuId = action.getActionInvariantUuId();
- this.name = action.getName();
- this.setDisplayName(action.getDisplayName());
- this.setVendorList(action.getVendorList());
- this.setCategoryList(action.getCategoryList());
- this.setTimestamp(action.getTimestamp());
- this.setUser(action.getUser());
- this.version = action.getVersion();
- this.status = action.getStatus();
- this.data = action.getData();
- this.supportedComponents = action.getSupportedComponents();
- this.supportedModels = action.getSupportedModels();
- this.artifacts = action.getArtifacts();
- }
-
- public String getActionUuId() {
- return actionUuId;
- }
-
- public void setActionUuId(String actionUuId) {
- this.actionUuId = actionUuId;
- }
-
- public String getActionInvariantUuId() {
- return actionInvariantUuId;
- }
-
- public void setActionInvariantUuId(String actionInvariantUuId) {
- this.actionInvariantUuId = actionInvariantUuId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public ActionStatus getStatus() {
- return status;
- }
-
- public void setStatus(ActionStatus status) {
- this.status = status;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
- public List<String> getVendorList() {
- return vendorList;
- }
-
- public void setVendorList(List<String> vendorList) {
- this.vendorList = vendorList;
- }
-
- public List<String> getCategoryList() {
- return categoryList;
- }
-
- public void setCategoryList(List<String> categoryList) {
- this.categoryList = categoryList;
- }
-
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public List<Map<String, String>> getSupportedModels() {
- return supportedModels;
- }
-
- public void setSupportedModels(List<Map<String, String>> supportedModels) {
- this.supportedModels = supportedModels;
- }
-
- public List<Map<String, String>> getSupportedComponents() {
- return supportedComponents;
- }
-
- public void setSupportedComponents(List<Map<String, String>> supportedComponents) {
- this.supportedComponents = supportedComponents;
- }
-
-
- public List<ActionArtifact> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(List<ActionArtifact> artifacts) {
- this.artifacts = artifacts;
- }
-
- public String getData() {
- return data;
- }
-
- public void setData(String data) {
- this.data = data;
- }
-
- /**
- * To entity action entity.
- *
- * @return the action entity
- */
- public ActionEntity toEntity() {
- ActionEntity destination = new ActionEntity();
-
- destination
- .setActionUuId(this.getActionUuId() != null ? this.getActionUuId().toUpperCase() : null);
- destination.setActionInvariantUuId(
- this.getActionInvariantUuId() != null ? this.getActionInvariantUuId().toUpperCase() : null);
- destination.setName(this.getName() != null ? this.getName().toLowerCase() : null);
- if (Objects.nonNull(this.getVendorList())) {
- destination.setVendorList(new HashSet<>(this.getVendorList()));
- }
- if (Objects.nonNull(this.getCategoryList())) {
- destination.setCategoryList(new HashSet<>(this.getCategoryList()));
- }
- destination.setTimestamp(this.getTimestamp());
- destination.setUser(this.getUser());
- destination.setVersion(Version.valueOf(this.getVersion()));
- if (this.getStatus() != null) {
- destination.setStatus(this.getStatus().name());
- }
- destination.setSupportedComponents(getIdFromMap(this.getSupportedComponents(),
- ActionConstants.SUPPORTED_COMPONENTS_ID));
- destination.setSupportedModels(
- getIdFromMap(this.getSupportedModels(), ActionConstants.SUPPORTED_MODELS_VERSION_ID));
- destination.setData(this.getData());
- return destination;
- }
-
- private Set<String> getIdFromMap(List<Map<String, String>> map, String idName) {
- Set<String> list = new HashSet<>();
- if (map != null && !map.isEmpty()) {
- for (Map<String, String> entry : map) {
- if (entry.containsKey(idName)) {
- list.add(entry.get(idName) != null ? entry.get(idName).toLowerCase() : null);
- }
- }
- return list;
+
+ private String actionUuId;
+ private String actionInvariantUuId;
+ private String version;
+ private ActionStatus status;
+ private String name;
+ private String displayName;
+ private List<String> vendorList;
+ private List<String> categoryList;
+ private Date timestamp;
+ private String user;
+ private List<Map<String, String>> supportedModels;
+ private List<Map<String, String>> supportedComponents;
+ //private List<HashMap<String,String>> artifacts;
+ private List<ActionArtifact> artifacts;
+ private String data;
+
+ public Action() {
+ }
+
+ /**
+ * Instantiates a new Action.
+ *
+ * @param action the action
+ */
+ public Action(Action action) {
+ this.actionUuId = action.getActionUuId();
+ this.actionInvariantUuId = action.getActionInvariantUuId();
+ this.name = action.getName();
+ this.setDisplayName(action.getDisplayName());
+ this.setVendorList(action.getVendorList());
+ this.setCategoryList(action.getCategoryList());
+ this.setTimestamp(action.getTimestamp());
+ this.setUser(action.getUser());
+ this.version = action.getVersion();
+ this.status = action.getStatus();
+ this.data = action.getData();
+ this.supportedComponents = action.getSupportedComponents();
+ this.supportedModels = action.getSupportedModels();
+ this.artifacts = action.getArtifacts();
+ }
+
+ public String getActionUuId() {
+ return actionUuId;
+ }
+
+ public void setActionUuId(String actionUuId) {
+ this.actionUuId = actionUuId;
+ }
+
+ public String getActionInvariantUuId() {
+ return actionInvariantUuId;
+ }
+
+ public void setActionInvariantUuId(String actionInvariantUuId) {
+ this.actionInvariantUuId = actionInvariantUuId;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public ActionStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(ActionStatus status) {
+ this.status = status;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
}
- return null;
- }
- @Override
- public int compareTo(Object object) {
- Action obj = (Action) object;
- Version thisVersion = Version.valueOf(this.version);
- Version objVersion = Version.valueOf(obj.getVersion());
- if (obj.getName().compareTo(this.getName()) == 0) {
- return compareVersions(objVersion, thisVersion);
+ public String getDisplayName() {
+ return displayName;
}
- return obj.getName().compareTo(this.getName());
- }
- private int compareVersions(Version objVersion, Version thisVersion) {
- if (objVersion.getMajor() == thisVersion.getMajor()) {
- return Integer.compare(objVersion.getMinor(), thisVersion.getMinor());
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
}
- return Integer.compare(objVersion.getMajor(), thisVersion.getMajor());
- }
- @Override
- public boolean equals(Object o) {
+ public List<String> getVendorList() {
+ return vendorList;
+ }
- if (this == o) {
- return true;
+ public void setVendorList(List<String> vendorList) {
+ this.vendorList = vendorList;
}
- if (o == null || getClass() != o.getClass()) {
- return false;
+
+ public List<String> getCategoryList() {
+ return categoryList;
}
- Action action = (Action) o;
+ public void setCategoryList(List<String> categoryList) {
+ this.categoryList = categoryList;
+ }
- if (!Objects.equals(version, action.version)) {
- return false;
+ public Date getTimestamp() {
+ return timestamp;
}
- return Objects.equals(name, action.name);
- }
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
- @Override
- public int hashCode() {
- return com.google.common.base.Objects.hashCode(version, name);
- }
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public List<Map<String, String>> getSupportedModels() {
+ return supportedModels;
+ }
+
+ public void setSupportedModels(List<Map<String, String>> supportedModels) {
+ this.supportedModels = supportedModels;
+ }
+
+ public List<Map<String, String>> getSupportedComponents() {
+ return supportedComponents;
+ }
+
+ public void setSupportedComponents(List<Map<String, String>> supportedComponents) {
+ this.supportedComponents = supportedComponents;
+ }
+
+ public List<ActionArtifact> getArtifacts() {
+ return artifacts;
+ }
+
+ public void setArtifacts(List<ActionArtifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ /**
+ * To entity action entity.
+ *
+ * @return the action entity
+ */
+ public ActionEntity toEntity() {
+ ActionEntity destination = new ActionEntity();
+ destination.setActionUuId(this.getActionUuId() != null ? this.getActionUuId().toUpperCase() : null);
+ destination.setActionInvariantUuId(this.getActionInvariantUuId() != null ? this.getActionInvariantUuId().toUpperCase() : null);
+ destination.setName(this.getName() != null ? this.getName().toLowerCase() : null);
+ if (Objects.nonNull(this.getVendorList())) {
+ destination.setVendorList(new HashSet<>(this.getVendorList()));
+ }
+ if (Objects.nonNull(this.getCategoryList())) {
+ destination.setCategoryList(new HashSet<>(this.getCategoryList()));
+ }
+ destination.setTimestamp(this.getTimestamp());
+ destination.setUser(this.getUser());
+ destination.setVersion(Version.valueOf(this.getVersion()));
+ if (this.getStatus() != null) {
+ destination.setStatus(this.getStatus().name());
+ }
+ destination.setSupportedComponents(getIdFromMap(this.getSupportedComponents(), ActionConstants.SUPPORTED_COMPONENTS_ID));
+ destination.setSupportedModels(getIdFromMap(this.getSupportedModels(), ActionConstants.SUPPORTED_MODELS_VERSION_ID));
+ destination.setData(this.getData());
+ return destination;
+ }
+
+ private Set<String> getIdFromMap(List<Map<String, String>> map, String idName) {
+ Set<String> list = new HashSet<>();
+ if (map != null && !map.isEmpty()) {
+ for (Map<String, String> entry : map) {
+ if (entry.containsKey(idName)) {
+ list.add(entry.get(idName) != null ? entry.get(idName).toLowerCase() : null);
+ }
+ }
+ return list;
+ }
+ return null;
+ }
+
+ @Override
+ public int compareTo(Object object) {
+ Action obj = (Action) object;
+ Version thisVersion = Version.valueOf(this.version);
+ Version objVersion = Version.valueOf(obj.getVersion());
+ if (obj.getName().compareTo(this.getName()) == 0) {
+ return compareVersions(objVersion, thisVersion);
+ }
+ return obj.getName().compareTo(this.getName());
+ }
+
+ private int compareVersions(Version objVersion, Version thisVersion) {
+ if (objVersion.getMajor() == thisVersion.getMajor()) {
+ return Integer.compare(objVersion.getMinor(), thisVersion.getMinor());
+ }
+ return Integer.compare(objVersion.getMajor(), thisVersion.getMajor());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Action action = (Action) o;
+ if (!Objects.equals(version, action.version)) {
+ return false;
+ }
+ return Objects.equals(name, action.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return com.google.common.base.Objects.hashCode(version, name);
+ }
}
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 ff4d908ed2..85aee57018 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,127 +17,123 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Objects;
-import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
-
import java.nio.ByteBuffer;
import java.util.Date;
+import org.openecomp.sdc.action.dao.types.ActionArtifactEntity;
public class ActionArtifact {
- private String artifactUuId;
-
- @JsonIgnore
- private Integer effectiveVersion;
-
- private String artifactName;
- private String artifactLabel;
- private String artifactCategory;
- private String artifactDescription;
- private String artifactProtection;
- private Date timestamp;
- private byte[] artifact;
-
- public String getArtifactUuId() {
- return artifactUuId;
- }
-
- public void setArtifactUuId(String artifactUuId) {
- this.artifactUuId = artifactUuId;
- }
-
- public Integer getEffectiveVersion() {
- return effectiveVersion;
- }
-
- public void setEffectiveVersion(Integer effectiveVersion) {
- this.effectiveVersion = effectiveVersion;
- }
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- public String getArtifactLabel() {
- return artifactLabel;
- }
-
- public void setArtifactLabel(String artifactLabel) {
- this.artifactLabel = artifactLabel;
- }
-
- public String getArtifactCategory() {
- return artifactCategory;
- }
-
- public void setArtifactCategory(String artifactCategory) {
- this.artifactCategory = artifactCategory;
- }
-
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- public void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- public String getArtifactProtection() {
- return artifactProtection;
- }
-
- public void setArtifactProtection(String artifactProtection) {
- this.artifactProtection = artifactProtection;
- }
-
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- public byte[] getArtifact() {
- return artifact;
- }
-
- public void setArtifact(byte[] artifact) {
- this.artifact = artifact;
- }
-
- /**
- * To entity action artifact entity.
- *
- * @return the action artifact entity
- */
- public ActionArtifactEntity toEntity() {
- ActionArtifactEntity destination = new ActionArtifactEntity();
- destination.setArtifactUuId(this.getArtifactUuId());
- destination.setEffectiveVersion(this.getEffectiveVersion());
- destination.setArtifact(ByteBuffer.wrap(this.getArtifact()));
-
- return destination;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ActionArtifact) {
- ActionArtifact temp = (ActionArtifact) obj;
- return Objects.equal(artifactUuId, temp.getArtifactUuId());
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(artifactUuId);
- }
+
+ private String artifactUuId;
+ @JsonIgnore
+ private Integer effectiveVersion;
+ private String artifactName;
+ private String artifactLabel;
+ private String artifactCategory;
+ private String artifactDescription;
+ private String artifactProtection;
+ private Date timestamp;
+ private byte[] artifact;
+
+ public String getArtifactUuId() {
+ return artifactUuId;
+ }
+
+ public void setArtifactUuId(String artifactUuId) {
+ this.artifactUuId = artifactUuId;
+ }
+
+ public Integer getEffectiveVersion() {
+ return effectiveVersion;
+ }
+
+ public void setEffectiveVersion(Integer effectiveVersion) {
+ this.effectiveVersion = effectiveVersion;
+ }
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ public String getArtifactLabel() {
+ return artifactLabel;
+ }
+
+ public void setArtifactLabel(String artifactLabel) {
+ this.artifactLabel = artifactLabel;
+ }
+
+ public String getArtifactCategory() {
+ return artifactCategory;
+ }
+
+ public void setArtifactCategory(String artifactCategory) {
+ this.artifactCategory = artifactCategory;
+ }
+
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ public String getArtifactProtection() {
+ return artifactProtection;
+ }
+
+ public void setArtifactProtection(String artifactProtection) {
+ this.artifactProtection = artifactProtection;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public byte[] getArtifact() {
+ return artifact;
+ }
+
+ public void setArtifact(byte[] artifact) {
+ this.artifact = artifact;
+ }
+
+ /**
+ * To entity action artifact entity.
+ *
+ * @return the action artifact entity
+ */
+ public ActionArtifactEntity toEntity() {
+ ActionArtifactEntity destination = new ActionArtifactEntity();
+ destination.setArtifactUuId(this.getArtifactUuId());
+ destination.setEffectiveVersion(this.getEffectiveVersion());
+ destination.setArtifact(ByteBuffer.wrap(this.getArtifact()));
+ return destination;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ActionArtifact) {
+ ActionArtifact temp = (ActionArtifact) obj;
+ return Objects.equal(artifactUuId, temp.getArtifactUuId());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(artifactUuId);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java
index 636f24d781..cf57052114 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,10 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
-public enum ActionArtifactProtection {
- readOnly,
- readWrite
-}
+public enum ActionArtifactProtection {readOnly, readWrite}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java
index c3de8aa4dc..5eacf18265 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,74 +17,74 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
import java.util.HashMap;
import java.util.Map;
public enum ActionLogResponseCode {
+ // @formatter:off
+ MISSING_AUTHORIZATION(100),
+ FORBIDDEN(101),
+ UPDATE_ON_LOCKED_ENTITY(102),
+ CHECKIN_ON_LOCKED_ENTITY_OTHER_USER(103),
+ CHECKOUT_ON_LOCKED_ENTITY(104),
+ UNDO_CHECKOUT_ON_LOCKED_ENTITY(105),
+ DELETE_ARTIFACT_ON_LOCKED_ENTITY(106),
+ DELETE_ON_LOCKED_ENTITY_OTHER_USER(107),
+ INTERNAL_SERVER_ERROR(201),
+ MISSING_MANDATORY_PARAMS(300),
+ MISSING_INSTANCE_ID_HEADER(301),
+ MISSING_REQUEST_ID_HEADER(302),
+ MISSING_REQUEST_BODY(303),
+ INVALID_SEARCH_FILTER_CRITERIA(304),
+ INVALID_REQUESTED_VERSION(305),
+ CHECKSUM_ERROR(306),
+ ARTIFACT_TOO_BIG(307),
+ ACTION_NOT_FOUND(308),
+ ARTIFACT_NOT_FOUND(309),
+ METHOD_NOT_ALLOWED(310),
+ INVALID_REQUEST_PARAM(311),
+ ARTIFACT_PROTECTION_INVALID(312),
+ ACTION_NAME_UPDATE_NOT_ALLOWED(501),
+ //METHOD_NOT_ALLOWED(502),
+ ACTION_NAME_ALREADY_EXISTS(503),
+ MULTIPLE_FILTER_CRITERIA_NOT_SUPPORTED(504),
+ UPDATE_ON_UNLOCKED_ENTITY(505),
+ UPDATE_NOT_ALLOWED(506),
+ //METHOD_NOT_ALLOWED(507),
+ CHECKIN_ON_UNLOCKED_ENTITY(508),
+ SUBMIT_ON_FINAL_ENTITY(509),
+ SUBMIT_ON_LOCKED_ENTITY_OTHER_USER(510),
+ UNDO_CHECKOUT_ON_UNLOCKED_ENTITY(511),
+ ACTION_NOT_LOCKED(512),
+ ARTIFACT_ALREADY_EXISTS(513),
+ ARTIFACT_UPDATE_READ_ONLY(514),
+ ARTIFACT_DELETE_READ_ONLY(515),
+ ARTIFACT_NAME_INVALID(516),
+ ARTIFACT_CREATE_UPDATE_NOT_ALLOWED(518),
+ QUERY_FAILURE(519);
+ // @formatter:on
- MISSING_AUTHORIZATION(100),
- FORBIDDEN(101),
- UPDATE_ON_LOCKED_ENTITY(102),
- CHECKIN_ON_LOCKED_ENTITY_OTHER_USER(103),
- CHECKOUT_ON_LOCKED_ENTITY(104),
- UNDO_CHECKOUT_ON_LOCKED_ENTITY(105),
- DELETE_ARTIFACT_ON_LOCKED_ENTITY(106),
- DELETE_ON_LOCKED_ENTITY_OTHER_USER(107),
- INTERNAL_SERVER_ERROR(201),
- MISSING_MANDATORY_PARAMS(300),
- MISSING_INSTANCE_ID_HEADER(301),
- MISSING_REQUEST_ID_HEADER(302),
- MISSING_REQUEST_BODY(303),
- INVALID_SEARCH_FILTER_CRITERIA(304),
- INVALID_REQUESTED_VERSION(305),
- CHECKSUM_ERROR(306),
- ARTIFACT_TOO_BIG(307),
- ACTION_NOT_FOUND(308),
- ARTIFACT_NOT_FOUND(309),
- METHOD_NOT_ALLOWED(310),
- INVALID_REQUEST_PARAM(311),
- ARTIFACT_PROTECTION_INVALID(312),
- ACTION_NAME_UPDATE_NOT_ALLOWED(501),
- //METHOD_NOT_ALLOWED(502),
- ACTION_NAME_ALREADY_EXISTS(503),
- MULTIPLE_FILTER_CRITERIA_NOT_SUPPORTED(504),
- UPDATE_ON_UNLOCKED_ENTITY(505),
- UPDATE_NOT_ALLOWED(506),
- //METHOD_NOT_ALLOWED(507),
- CHECKIN_ON_UNLOCKED_ENTITY(508),
- SUBMIT_ON_FINAL_ENTITY(509),
- SUBMIT_ON_LOCKED_ENTITY_OTHER_USER(510),
- UNDO_CHECKOUT_ON_UNLOCKED_ENTITY(511),
- ACTION_NOT_LOCKED(512),
- ARTIFACT_ALREADY_EXISTS(513),
- ARTIFACT_UPDATE_READ_ONLY(514),
- ARTIFACT_DELETE_READ_ONLY(515),
- ARTIFACT_NAME_INVALID(516),
- ARTIFACT_CREATE_UPDATE_NOT_ALLOWED(518),
- QUERY_FAILURE(519);
-
- private static Map<Integer, ActionLogResponseCode> mapValueToEnum = new HashMap<>();
+ private static Map<Integer, ActionLogResponseCode> mapValueToEnum = new HashMap<>();
- static {
- for (ActionLogResponseCode responseCode : ActionLogResponseCode.values()) {
- mapValueToEnum.put(responseCode.value, responseCode);
+ static {
+ for (ActionLogResponseCode responseCode : ActionLogResponseCode.values()) {
+ mapValueToEnum.put(responseCode.value, responseCode);
+ }
}
- }
- private int value;
+ private int value;
- ActionLogResponseCode(int value) {
- this.value = value;
- }
+ ActionLogResponseCode(int value) {
+ this.value = value;
+ }
- public static ActionLogResponseCode parseValue(int value) {
- return mapValueToEnum.get(value);
- }
+ public static ActionLogResponseCode parseValue(int value) {
+ return mapValueToEnum.get(value);
+ }
- public int getValue() {
- return value;
- }
+ public int getValue() {
+ return value;
+ }
}
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 6ba70b08ee..f438060150 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
public enum ActionRequest {
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java
index af3516e1eb..651fd19568 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,12 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
-public enum ActionStatus {
- Locked,
- Available,
- Final,
- Deleted
-}
+public enum ActionStatus {Locked, Available, Final, Deleted}
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 3298be7179..1520c6f3a1 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
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,43 +17,44 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
public enum ActionSubOperation {
- //Versioning operations
- CREATE_ACTION_VERSION,
- CREATE_ACTION_UNIQUE_VALUE,
- GET_ACTION_VERSION,
- //Action DAO operations
- CREATE_ACTION_ENTITY,
- GET_ACTIONENTITY_BY_ACTIONINVID,
- GET_ACTIONENTITY_BY_ACTIONUUID,
- GET_ACTIONENTITY_BY_VENDOR,
- GET_ACTIONENTITY_BY_CATEGORY,
- GET_ACTIONENTITY_BY_MODEL,
- GET_ACTIONENTITY_BY_COMPONENT,
- GET_ACTIONENTITY_BY_VERSION,
- GET_ALL_ACTIONS,
- GET_ACTIONINVID_BY_NAME,
+ // @formatter:off
+ //Versioning operations
+ CREATE_ACTION_VERSION,
+ CREATE_ACTION_UNIQUE_VALUE,
+ GET_ACTION_VERSION,
+ //Action DAO operations
+ CREATE_ACTION_ENTITY,
+ GET_ACTIONENTITY_BY_ACTIONINVID,
+ GET_ACTIONENTITY_BY_ACTIONUUID,
+ GET_ACTIONENTITY_BY_VENDOR,
+ GET_ACTIONENTITY_BY_CATEGORY,
+ GET_ACTIONENTITY_BY_MODEL,
+ GET_ACTIONENTITY_BY_COMPONENT,
+ GET_ACTIONENTITY_BY_VERSION,
+ GET_ALL_ACTIONS,
+ GET_ACTIONINVID_BY_NAME,
GET_OPEN_ECOMP_COMPONENTS_ENTITY,
- GET_VERSIONINFO_FOR_ALL_ACTIONS,
- GET_NAME_BY_ACTIONINVID,
- CHECKOUT_ACTION,
- UNDO_CHECKOUT_ACTION,
- CHECKIN_ACTION,
- SUBMIT_ACTION,
- UPDATE_ACTION,
- UPDATE_ACTION_STATUS,
- DELETE_UNIQUEVALUE,
- DELETE_ACTIONVERSION,
- DELETE_ARTIFACT,
- DELETE_ACTION,
- //Validations
- VALIDATE_ACTION_UNIQUE_NAME,
- //Artifacts
- GET_ARTIFACT_BY_ARTIFACTUUID,
- CREATE_ACTION_ARTIFACT,
- UPDATE_ACTION_ARTIFACT,
- DELETE_ACTION_ARTIFACT,
+ GET_VERSIONINFO_FOR_ALL_ACTIONS,
+ GET_NAME_BY_ACTIONINVID,
+ CHECKOUT_ACTION,
+ UNDO_CHECKOUT_ACTION,
+ CHECKIN_ACTION,
+ SUBMIT_ACTION,
+ UPDATE_ACTION,
+ UPDATE_ACTION_STATUS,
+ DELETE_UNIQUEVALUE,
+ DELETE_ACTIONVERSION,
+ DELETE_ARTIFACT,
+ DELETE_ACTION,
+ //Validations
+ VALIDATE_ACTION_UNIQUE_NAME,
+ //Artifacts
+ GET_ARTIFACT_BY_ARTIFACTUUID,
+ CREATE_ACTION_ARTIFACT,
+ UPDATE_ACTION_ARTIFACT,
+ DELETE_ACTION_ARTIFACT,
+ // @formatter:on
}
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java
index bf3f0c54f9..1858833d82 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/OpenEcompComponent.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,88 +17,87 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.types;
import org.openecomp.sdc.action.dao.types.OpenEcompComponentEntity;
public class OpenEcompComponent {
- private String id;
- private String name;
-
- public OpenEcompComponent() {
- //Default constructor
- }
-
- public OpenEcompComponent(String name, String id) {
- this.name = name;
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
+ private String id;
+ private String name;
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
+ public OpenEcompComponent() {
+ //Default constructor
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public OpenEcompComponent(String name, String id) {
+ this.name = name;
+ this.id = id;
+ }
- /**
- * To entity OPENECOMP component entity.
- *
- * @return the OPENECOMP component entity
- */
- public OpenEcompComponentEntity toEntity() {
- OpenEcompComponentEntity destination = new OpenEcompComponentEntity();
- destination.setId(this.getId());
- destination.setName(this.getName());
- return destination;
- }
+ public String getId() {
+ return id;
+ }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
+ public void setId(String id) {
+ this.id = id;
+ }
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
+ public String getName() {
+ return name;
}
- if (object == null) {
- return false;
+
+ public void setName(String name) {
+ this.name = name;
}
- if (this.getClass() != object.getClass()) {
- return false;
+
+ /**
+ * To entity OPENECOMP component entity.
+ *
+ * @return the OPENECOMP component entity
+ */
+ public OpenEcompComponentEntity toEntity() {
+ OpenEcompComponentEntity destination = new OpenEcompComponentEntity();
+ destination.setId(this.getId());
+ destination.setName(this.getName());
+ return destination;
}
- OpenEcompComponent obj = (OpenEcompComponent) object;
- if (id == null) {
- if (obj.id != null) {
- return false;
- }
- } else if (!id.equals(obj.id)) {
- return false;
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
}
- if (name == null) {
- if (obj.name != null) {
- return false;
- }
- } else if (!name.equals(obj.name)) {
- return false;
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object == null) {
+ return false;
+ }
+ if (this.getClass() != object.getClass()) {
+ return false;
+ }
+ OpenEcompComponent obj = (OpenEcompComponent) object;
+ if (id == null) {
+ if (obj.id != null) {
+ return false;
+ }
+ } else if (!id.equals(obj.id)) {
+ return false;
+ }
+ if (name == null) {
+ if (obj.name != null) {
+ return false;
+ }
+ } else if (!name.equals(obj.name)) {
+ return false;
+ }
+ return true;
}
- return true;
- }
}
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 28195b334f..4e0c5658fa 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
@@ -17,24 +17,106 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.action.util;
-import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
-import org.openecomp.sdc.action.logging.CategoryLogLevel;
-import org.openecomp.sdc.action.types.ActionLogResponseCode;
-import org.openecomp.sdc.action.types.ActionSubOperation;
-import org.slf4j.MDC;
+import static org.openecomp.sdc.action.ActionConstants.BEGIN_TIMESTAMP;
+import static org.openecomp.sdc.action.ActionConstants.ELAPSED_TIME;
+import static org.openecomp.sdc.action.ActionConstants.END_TIMESTAMP;
+import static org.openecomp.sdc.action.ActionConstants.ERROR_CATEGORY;
+import static org.openecomp.sdc.action.ActionConstants.ERROR_CODE;
+import static org.openecomp.sdc.action.ActionConstants.ERROR_DESCRIPTION;
+import static org.openecomp.sdc.action.ActionConstants.RESPONSE_CODE;
+import static org.openecomp.sdc.action.ActionConstants.RESPONSE_DESCRIPTION;
+import static org.openecomp.sdc.action.ActionConstants.SERVICE_METRIC_BEGIN_TIMESTAMP;
+import static org.openecomp.sdc.action.ActionConstants.STATUS_CODE;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_ENTITY;
+import static org.openecomp.sdc.action.ActionConstants.TARGET_SERVICE_NAME;
+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_QUERY_FAILURE_CODE;
+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_ON_UNLOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ACTION_NAME_ALREADY_EXISTS;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ACTION_NAME_UPDATE_NOT_ALLOWED;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ACTION_NOT_FOUND;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ACTION_NOT_LOCKED;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_ALREADY_EXISTS;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_DELETE_READ_ONLY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_NAME_INVALID;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_NOT_FOUND;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_PROTECTION_INVALID;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_TOO_BIG;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.ARTIFACT_UPDATE_READ_ONLY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.CHECKIN_ON_LOCKED_ENTITY_OTHER_USER;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.CHECKIN_ON_UNLOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.CHECKOUT_ON_LOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.CHECKSUM_ERROR;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.DELETE_ARTIFACT_ON_LOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.DELETE_ON_LOCKED_ENTITY_OTHER_USER;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.INTERNAL_SERVER_ERROR;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.INVALID_REQUESTED_VERSION;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.INVALID_REQUEST_PARAM;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.INVALID_SEARCH_FILTER_CRITERIA;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.MISSING_AUTHORIZATION;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.MISSING_INSTANCE_ID_HEADER;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.MISSING_REQUEST_BODY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.MISSING_REQUEST_ID_HEADER;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.MULTIPLE_FILTER_CRITERIA_NOT_SUPPORTED;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.QUERY_FAILURE;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.SUBMIT_ON_FINAL_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.SUBMIT_ON_LOCKED_ENTITY_OTHER_USER;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.UNDO_CHECKOUT_ON_LOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.UPDATE_NOT_ALLOWED;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.UPDATE_ON_LOCKED_ENTITY;
+import static org.openecomp.sdc.action.types.ActionLogResponseCode.UPDATE_ON_UNLOCKED_ENTITY;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.ZoneOffset;
-import java.util.*;
+import java.util.Date;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TimeZone;
import java.util.function.LongSupplier;
-
-import static org.openecomp.sdc.action.ActionConstants.*;
-import static org.openecomp.sdc.action.errors.ActionErrorConstants.*;
-import static org.openecomp.sdc.action.types.ActionLogResponseCode.*;
+import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus;
+import org.openecomp.sdc.action.logging.CategoryLogLevel;
+import org.openecomp.sdc.action.types.ActionLogResponseCode;
+import org.openecomp.sdc.action.types.ActionSubOperation;
+import org.slf4j.MDC;
public class ActionUtil {
@@ -44,6 +126,9 @@ public class ActionUtil {
private static final Map<String, ActionLogResponseCode> errorCodeMap = initErrorCodeMap();
private static final EnumMap<CategoryLogLevel, String> errorTypeMap = initErrorTypeMap();
+ private ActionUtil() {
+ }
+
private static Map<String, ActionLogResponseCode> initErrorCodeMap() {
Map<String, ActionLogResponseCode> map = new HashMap<>();
map.put(ACTION_REQUEST_INVALID_GENERIC_CODE, INVALID_REQUEST_PARAM);
@@ -94,9 +179,6 @@ public class ActionUtil {
return map;
}
- private ActionUtil() {
- }
-
/**
* Get Current Timestamp in UTC format.
*
@@ -140,7 +222,6 @@ public class ActionUtil {
if (subOperation != null) {
MDC.put(TARGET_SERVICE_NAME, subOperation.name());
}
-
MDC.put(TARGET_ENTITY, targetEntity);
}
@@ -157,8 +238,7 @@ public class ActionUtil {
actionLogPostProcessor(statusCode, null, isServiceMetricLog);
}
- public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode,
- boolean isServiceMetricLog) {
+ public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode, boolean isServiceMetricLog) {
actionLogPostProcessor(statusCode, responseCode, null, isServiceMetricLog);
}
@@ -170,8 +250,7 @@ public class ActionUtil {
* @param responseDescription the response description
* @param isServiceMetricLog the is service metric log
*/
- public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode,
- String responseDescription,
+ public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode, String responseDescription,
boolean isServiceMetricLog) {
actionLogPostProcessor(statusCode, responseCode, responseDescription, isServiceMetricLog, System::currentTimeMillis);
}
@@ -184,9 +263,7 @@ public class ActionUtil {
* @param responseDescription the response description
* @param isServiceMetricLog the is service metric log
*/
- public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode,
- String responseDescription,
- boolean isServiceMetricLog,
+ public static void actionLogPostProcessor(ResponseStatus statusCode, String responseCode, String responseDescription, boolean isServiceMetricLog,
LongSupplier getCurrentTime) {
MDC.put(STATUS_CODE, statusCode.name());
if (responseCode != null) {
@@ -213,8 +290,7 @@ public class ActionUtil {
* @param errorCode Action Library exception code
* @param errorDescription Description of the error
*/
- public static void actionErrorLogProcessor(CategoryLogLevel errorCategory, String errorCode,
- String errorDescription) {
+ public static void actionErrorLogProcessor(CategoryLogLevel errorCategory, String errorCode, String errorDescription) {
MDC.put(ERROR_CATEGORY, errorCategory.name());
if (errorCode != null) {
MDC.put(ERROR_CODE, getLogResponseCode(errorCode) + (errorTypeMap.getOrDefault(errorCategory, "")));
@@ -223,8 +299,7 @@ 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
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java
index 86ae7510a6..c99c0ce039 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDao.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,9 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.healthcheck.dao;
+import java.util.List;
import org.openecomp.core.dao.BaseDao;
import org.openecomp.sdc.action.dao.types.ActionEntity;
import org.openecomp.sdc.action.errors.ActionException;
@@ -27,25 +27,21 @@ import org.openecomp.sdc.action.types.Action;
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> {
- public Action createAction(Action actionDto) throws ActionException;
-
- public Action updateAction(Action actionDto) throws ActionException;
+ public Action createAction(Action actionDto) throws ActionException;
- public void deleteAction(String actionInvariantUuId) throws ActionException;
+ public Action updateAction(Action actionDto) throws ActionException;
- public List<Action> getFilteredActions(String filterType, String filterId) throws ActionException;
+ public void deleteAction(String actionInvariantUuId) throws ActionException;
- public Action getActionsByActionUuId(String uniqueId) throws ActionException;
+ public List<Action> getFilteredActions(String filterType, String filterId) throws ActionException;
- public List<OpenEcompComponent> getEcompComponents() throws ActionException;
+ public Action getActionsByActionUuId(String uniqueId) throws ActionException;
- public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId)
- throws ActionException;
+ public List<OpenEcompComponent> getEcompComponents() throws ActionException;
- public Action getLockedAction(String actionInvariantUuId, String user) throws ActionException;
+ public List<Action> getActionsByActionInvariantUuId(String actionInvariantUuId) 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/healthcheck/dao/ActionDaoFactory.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDaoFactory.java
index 0ecf04d843..683350b75a 100644
--- a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDaoFactory.java
+++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/healthcheck/dao/ActionDaoFactory.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.healthcheck.dao;
import org.openecomp.core.factory.api.AbstractComponentFactory;
@@ -25,7 +24,7 @@ import org.openecomp.core.factory.api.AbstractFactory;
public abstract class ActionDaoFactory extends AbstractComponentFactory<ActionDao> {
- public static ActionDaoFactory getInstance() {
- return AbstractFactory.getInstance(ActionDaoFactory.class);
- }
+ public static ActionDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ActionDaoFactory.class);
+ }
}