public void rejectContract(ContractActionDto action, String rejectorId) {
        // Must exist
        ContractBean contract = getContractById(action.getContractId());

        // We probably need an optimised query :-).
        ClientVersionBean cvb = contract.getClient();
        ApiVersionBean avb = contract.getApi();
        PlanVersionBean plan = contract.getPlan();
        OrganizationBean orgA = avb.getApi().getOrganization();
        OrganizationBean orgC = cvb.getClient().getOrganization();
        UserBean rejector = tryAction(() -> storage.getUser(rejectorId));

        contract.setStatus(ContractStatus.Rejected);

        fireContractRejectedEvent(rejector, action.getRejectionReason(), contract, orgC, cvb, orgA, avb, plan);
        contractService.deleteContract(orgC.getId(), cvb.getClient().getId(), cvb.getVersion(), contract.getId());
        LOGGER.debug("{0} rejected a contract: {1} -> {2}", rejectorId, contract, action);
    }
Actions like publish, register, re-register, etc.

NB: Might fold this into respective services later.

@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/rest-impl/src/main/java/io/apiman/manager/api/service/ActionService.java