private void fireContractCreatedEvent(String userId, ContractBean contract) {
        LOGGER.debug("Firing contract create event from user {0} on contract {1}", userId, contract);
        UserDto requester = UserMapper.INSTANCE.toDto(tryAction(() -> storage.getUser(userId)));

        ApimanEventHeaders.Builder builder = ApimanEventHeaders
             .builder()
             .setId(UUID.randomUUID().toString())
             .setSource(URI.create("/apiman/events/contracts/created"));

        if (contract.getStatus() == ContractStatus.AwaitingApproval) {
            builder.setSubject("approval-required");
        } else {
            builder.setSubject("created");
        }

        PlanVersionBean plan = contract.getPlan();
        ClientVersionBean cvb = contract.getClient();
        ApiVersionBean avb = contract.getApi();
        OrganizationBean orgA = avb.getApi().getOrganization();
        OrganizationBean orgC = cvb.getClient().getOrganization();

        var contractCreatedEvent = ContractCreatedEvent
             .builder()
             .setHeaders(builder.build())
             .setUser(requester)
             .setClientOrgId(orgC.getId())
             .setClientId(cvb.getClient().getId())
             .setClientVersion(cvb.getVersion())
             .setApiOrgId(orgA.getId())
             .setApiId(avb.getApi().getId())
             .setApiVersion(avb.getVersion())
             .setContractId(String.valueOf(contract.getId()))
             .setPlanId(plan.getPlan().getId())
             .setPlanVersion(plan.getVersion())
             .setApprovalRequired(contract.getStatus() == ContractStatus.AwaitingApproval)
             .build();

        LOGGER.debug("Sending contract created event {0}", contractCreatedEvent);
        eventService.fireEvent(contractCreatedEvent);
    }
Aggregates the API, client, and plan policies into a single ordered list.
manager/api/rest-impl/src/main/java/io/apiman/manager/api/service/ContractService.java