code: 409,
message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.",
messageId: "SVC4017"
+ }
+
+ #---------SVC4018-----------------------------
+ # %1 - componentType
+ # %2 - component id
+ CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: {
+ code: 409,
+ message: "System deployed %1 cannot be archived. Component: '%2'",
+ messageId: "SVC4018"
}
\ No newline at end of file
message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.",
messageId: "SVC4017"
}
+
+ #---------SVC4018-----------------------------
+ # %1 - componentType
+ # %2 - component id
+ CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: {
+ code: 409,
+ message: "System deployed %1 cannot be archived. Component: '%2'",
+ messageId: "SVC4018"
+ }
\ No newline at end of file
User user = accessValidations.userIsAdminOrDesigner(userId, containerComponentType + "_ARCHIVE");
Either<List<String>, ActionStatus> result = this.archiveOperation.archiveComponent(componentId);
if (result.isRight()) {
- throw new ByActionStatusComponentException(result.right().value(), componentId);
+ ActionStatus status = result.right().value();
+ if (ActionStatus.CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES.equals(status)) {
+ throw new ByActionStatusComponentException(status, containerComponentType, componentId);
+ }
+ throw new ByActionStatusComponentException(status, componentId);
}
this.auditAction(ArchiveOperation.Action.ARCHIVE, result.left().value(), user, containerComponentType);
// Send Archive Notification To Facade
code: 409,
message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.",
messageId: "SVC4017"
+ }
+
+ #---------SVC4018-----------------------------
+ # %1 - componentType
+ # %2 - component id
+ CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: {
+ code: 409,
+ message: "System deployed %1 cannot be archived. Component: '%2'",
+ messageId: "SVC4018"
}
\ No newline at end of file
code: 409,
message: "Cannot change substitution node type as properties of the existing type are referenced by properties %1.",
messageId: "SVC4017"
+ }
+
+ #---------SVC4018-----------------------------
+ # %1 - componentType
+ # %2 - component id
+ CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES: {
+ code: 409,
+ message: "System deployed %1 cannot be archived. Component: '%2'",
+ messageId: "SVC4018"
}
\ No newline at end of file
INVALID_NODE_TYPES_YAML,
//system deployed resources
CANNOT_DELETE_SYSTEM_DEPLOYED_RESOURCES,
+ CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES,
TOSCA_GET_FUNCTION_INPUTS_ONLY_SELF_ERROR,
TOSCA_GET_FUNCTION_INPUTS_NOT_FOUND,
TOSCA_GET_FUNCTION_TYPE_DIVERGE,
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
public Either<List<String>, ActionStatus> archiveComponent(String componentId) {
final Either<GraphVertex, JanusGraphOperationStatus> vertexResult = this.janusGraphDao.getVertexById(componentId);
if (vertexResult.isLeft()) {
+ Map<String, Object> metadataJson = vertexResult.left().value().getMetadataJson();
+ String normative = JsonPresentationFields.NORMATIVE.getPresentation();
+ if (MapUtils.isNotEmpty(metadataJson) && metadataJson.containsKey(normative) && (boolean) metadataJson.get(normative)) {
+ return Either.right(ActionStatus.CANNOT_ARCHIVE_SYSTEM_DEPLOYED_RESOURCES);
+ }
return doAction(ARCHIVE, vertexResult.left().value());
} else {
return Either.right(onError(ARCHIVE.name(), componentId, vertexResult.right().value()));