use of org.finos.waltz.model.SetAttributeCommand in project waltz by khartec.
the class ActivateCommandProcessor method activatePhysicalFlow.
private ImmutableCommandResponse<UpdateExecutionStatusCommand> activatePhysicalFlow(UpdateExecutionStatusCommand command, ChangeUnit changeUnit, String userName) {
doBasicValidation(command, changeUnit, userName);
PhysicalFlow subject = physicalFlowService.getById(changeUnit.subjectEntity().id());
checkNotNull(subject, "subject not found: " + changeUnit.subjectEntity());
checkTrue(subject.entityLifecycleStatus().equals(changeUnit.subjectInitialStatus()), "current subject status does not initial change unit status: " + subject);
SetAttributeCommand setAttributeCommand = ImmutableSetAttributeCommand.builder().entityReference(subject.entityReference()).name("entity_lifecycle_status").value(EntityLifecycleStatus.ACTIVE.name()).build();
int i = physicalFlowService.updateAttribute(userName, setAttributeCommand);
return ImmutableCommandResponse.<UpdateExecutionStatusCommand>builder().entityReference(subject.entityReference()).originalCommand(command).outcome(i == 1 ? CommandOutcome.SUCCESS : CommandOutcome.FAILURE).message("Updated status of physical flow: " + subject + " to " + EntityLifecycleStatus.ACTIVE).build();
}
use of org.finos.waltz.model.SetAttributeCommand in project waltz by khartec.
the class RetireCommandProcessor method retirePhysicalFlow.
private ImmutableCommandResponse<UpdateExecutionStatusCommand> retirePhysicalFlow(UpdateExecutionStatusCommand command, ChangeUnit changeUnit, String userName) {
PhysicalFlow subject = physicalFlowService.getById(changeUnit.subjectEntity().id());
checkNotNull(subject, "subject not found: " + changeUnit.subjectEntity());
checkTrue(subject.entityLifecycleStatus().equals(changeUnit.subjectInitialStatus()), "current subject status does not match initial change unit status: " + subject);
SetAttributeCommand setAttributeCommand = ImmutableSetAttributeCommand.builder().entityReference(subject.entityReference()).name("entity_lifecycle_status").value(EntityLifecycleStatus.REMOVED.name()).build();
int i = physicalFlowService.updateAttribute(userName, setAttributeCommand);
return ImmutableCommandResponse.<UpdateExecutionStatusCommand>builder().entityReference(subject.entityReference()).originalCommand(command).outcome(i == 1 ? CommandOutcome.SUCCESS : CommandOutcome.FAILURE).message("Updated status of physical flow: " + subject + " to " + EntityLifecycleStatus.REMOVED).build();
}
use of org.finos.waltz.model.SetAttributeCommand in project waltz by khartec.
the class PhysicalFlowEndpoint method updateAttribute.
private int updateAttribute(Request request, Response response) throws IOException {
WebUtilities.requireRole(userRoleService, request, SystemRole.LOGICAL_DATA_FLOW_EDITOR);
String username = WebUtilities.getUsername(request);
SetAttributeCommand command = WebUtilities.readBody(request, SetAttributeCommand.class);
return physicalFlowService.updateAttribute(username, command);
}
Aggregations