Search in sources :

Example 1 with EntityInvolvementChangeCommand

use of com.khartec.waltz.model.involvement.EntityInvolvementChangeCommand in project waltz by khartec.

the class InvolvementEndpoint method updateEntityInvolvement.

private Boolean updateEntityInvolvement(Request request) throws java.io.IOException {
    EntityReference entityReference = getEntityReference(request);
    requireEditRoleForEntity(userRoleService, request, entityReference.kind());
    EntityInvolvementChangeCommand command = readBody(request, EntityInvolvementChangeCommand.class);
    String username = getUsername(request);
    switch(command.operation()) {
        case ADD:
            return service.addEntityInvolvement(username, entityReference, command);
        case REMOVE:
            return service.removeEntityInvolvement(username, entityReference, command);
        default:
            throw new UnsupportedOperationException("Command operation: " + command.operation() + " is not supported");
    }
}
Also used : EntityReference(com.khartec.waltz.model.EntityReference) EntityInvolvementChangeCommand(com.khartec.waltz.model.involvement.EntityInvolvementChangeCommand)

Aggregations

EntityReference (com.khartec.waltz.model.EntityReference)1 EntityInvolvementChangeCommand (com.khartec.waltz.model.involvement.EntityInvolvementChangeCommand)1