Search in sources :

Example 1 with SetAttributeCommand

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();
}
Also used : SetAttributeCommand(org.finos.waltz.model.SetAttributeCommand) ImmutableSetAttributeCommand(org.finos.waltz.model.ImmutableSetAttributeCommand) PhysicalFlow(org.finos.waltz.model.physical_flow.PhysicalFlow)

Example 2 with SetAttributeCommand

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();
}
Also used : SetAttributeCommand(org.finos.waltz.model.SetAttributeCommand) ImmutableSetAttributeCommand(org.finos.waltz.model.ImmutableSetAttributeCommand) PhysicalFlow(org.finos.waltz.model.physical_flow.PhysicalFlow)

Example 3 with SetAttributeCommand

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);
}
Also used : SetAttributeCommand(org.finos.waltz.model.SetAttributeCommand)

Aggregations

SetAttributeCommand (org.finos.waltz.model.SetAttributeCommand)3 ImmutableSetAttributeCommand (org.finos.waltz.model.ImmutableSetAttributeCommand)2 PhysicalFlow (org.finos.waltz.model.physical_flow.PhysicalFlow)2