Search in sources :

Example 1 with AppRegistrationRequest

use of org.finos.waltz.model.application.AppRegistrationRequest in project waltz by khartec.

the class AppGenerator method create.

@Override
public Map<String, Integer> create(ApplicationContext ctx) {
    DSLContext dsl = getDsl(ctx);
    ApplicationService applicationDao = ctx.getBean(ApplicationService.class);
    OrganisationalUnitService ouDao = ctx.getBean(OrganisationalUnitService.class);
    List<String> animals = Unchecked.supplier(() -> readLines(getClass().getResourceAsStream("/app-names.txt"))).get();
    OrganisationalUnit[] organisationalUnits = ouDao.findAll().toArray(new OrganisationalUnit[0]);
    List<AppRegistrationRequest> registrationRequests = new ArrayList<>();
    for (int i = 0; i < NUM_APPS; i++) {
        String animal = randomPick(animals.toArray(new String[0])) + " - " + i;
        OrganisationalUnit organisationalUnit = randomPick(organisationalUnits);
        LifecyclePhase phase = rnd.nextInt(10) > 7 ? randomPick(LifecyclePhase.values()) : LifecyclePhase.PRODUCTION;
        Criticality businessCriticality = rnd.nextInt(10) > 7 ? randomPick(Criticality.values()) : Criticality.HIGH;
        AppRegistrationRequest app = ImmutableAppRegistrationRequest.builder().name(animal).assetCode("wltz-0" + i).description("All about " + animal).applicationKind(randomPick(ApplicationKind.values())).lifecyclePhase(phase).overallRating(randomPick(RagRating.R, RagRating.A, RagRating.A, RagRating.G, RagRating.G)).organisationalUnitId(organisationalUnit.id().get()).businessCriticality(businessCriticality).build();
        registrationRequests.add(app);
    }
    registrationRequests.forEach(a -> applicationDao.registerApp(a, "admin"));
    return null;
}
Also used : OrganisationalUnitService(org.finos.waltz.service.orgunit.OrganisationalUnitService) ArrayList(java.util.ArrayList) DSLContext(org.jooq.DSLContext) OrganisationalUnit(org.finos.waltz.model.orgunit.OrganisationalUnit) LifecyclePhase(org.finos.waltz.model.application.LifecyclePhase) ImmutableAppRegistrationRequest(org.finos.waltz.model.application.ImmutableAppRegistrationRequest) AppRegistrationRequest(org.finos.waltz.model.application.AppRegistrationRequest) ApplicationService(org.finos.waltz.service.application.ApplicationService) Criticality(org.finos.waltz.model.Criticality)

Example 2 with AppRegistrationRequest

use of org.finos.waltz.model.application.AppRegistrationRequest in project waltz by khartec.

the class EndUserAppService method promoteToApplication.

public AppRegistrationResponse promoteToApplication(Long id, ChangeLogComment comment, String username) {
    AppRegistrationRequest appRegistrationRequest = mkAppRegistrationRequestForEuda(id);
    checkNotNull(appRegistrationRequest, "EUDA has already been promoted");
    endUserAppDao.updateIsPromotedFlag(id);
    AppRegistrationResponse appRegistrationResponse = applicationDao.registerApp(appRegistrationRequest);
    migrateEudaInvolvements(id, appRegistrationResponse);
    changeLogDao.write(mkChangeLog(appRegistrationResponse, comment, username));
    return appRegistrationResponse;
}
Also used : AppRegistrationResponse(org.finos.waltz.model.application.AppRegistrationResponse) ImmutableAppRegistrationRequest(org.finos.waltz.model.application.ImmutableAppRegistrationRequest) AppRegistrationRequest(org.finos.waltz.model.application.AppRegistrationRequest)

Aggregations

AppRegistrationRequest (org.finos.waltz.model.application.AppRegistrationRequest)2 ImmutableAppRegistrationRequest (org.finos.waltz.model.application.ImmutableAppRegistrationRequest)2 ArrayList (java.util.ArrayList)1 Criticality (org.finos.waltz.model.Criticality)1 AppRegistrationResponse (org.finos.waltz.model.application.AppRegistrationResponse)1 LifecyclePhase (org.finos.waltz.model.application.LifecyclePhase)1 OrganisationalUnit (org.finos.waltz.model.orgunit.OrganisationalUnit)1 ApplicationService (org.finos.waltz.service.application.ApplicationService)1 OrganisationalUnitService (org.finos.waltz.service.orgunit.OrganisationalUnitService)1 DSLContext (org.jooq.DSLContext)1