Search in sources :

Example 1 with ChangeInitiativeKind

use of org.finos.waltz.model.change_initiative.ChangeInitiativeKind in project waltz by khartec.

the class ChangeInitiativeGenerator method createCiRecords.

private List<ChangeInitiativeRecord> createCiRecords(List<Long> ouIds) {
    AtomicLong idCtr = new AtomicLong();
    return IntStream.range(0, NUM_CHANGE_INITIATIVES).boxed().flatMap(i -> {
        long initiativeId = idCtr.incrementAndGet();
        Tuple4<Long, ChangeInitiativeKind, Long, String> initiative = tuple(initiativeId, INITIATIVE, null, mkName());
        Stream<Tuple4<Long, ChangeInitiativeKind, Long, String>> children = IntStream.range(0, RND.nextInt(4)).boxed().flatMap(x -> {
            long programmeId = idCtr.incrementAndGet();
            Stream<Tuple4<Long, ChangeInitiativeKind, Long, String>> programmes = Stream.of(tuple(programmeId, PROGRAMME, initiativeId, mkName()));
            Stream<Tuple4<Long, ChangeInitiativeKind, Long, String>> projects = IntStream.range(0, RND.nextInt(4)).boxed().map(y -> tuple(idCtr.incrementAndGet(), PROJECT, programmeId, mkName()));
            return Stream.concat(programmes, projects);
        });
        return Stream.concat(Stream.of(initiative), children);
    }).map(t -> buildChangeInitiativeRecord(t, ouIds)).collect(toList());
}
Also used : Tuple4(org.jooq.lambda.tuple.Tuple4) IntStream(java.util.stream.IntStream) LifecyclePhase(org.finos.waltz.model.application.LifecyclePhase) DSL(org.jooq.impl.DSL) Tables(org.finos.waltz.schema.Tables) EntityKind(org.finos.waltz.model.EntityKind) EntityRelationshipRecord(org.finos.waltz.schema.tables.records.EntityRelationshipRecord) LoggerFactory(org.slf4j.LoggerFactory) Random(java.util.Random) InvolvementRecord(org.finos.waltz.schema.tables.records.InvolvementRecord) Tuple2(org.jooq.lambda.tuple.Tuple2) Tuple4(org.jooq.lambda.tuple.Tuple4) CHANGE_INITIATIVE(org.finos.waltz.schema.tables.ChangeInitiative.CHANGE_INITIATIVE) org.jooq(org.jooq) Map(java.util.Map) APPLICATION_GROUP(org.finos.waltz.schema.tables.ApplicationGroup.APPLICATION_GROUP) StreamUtilities(org.finos.waltz.common.StreamUtilities) EntityHierarchyService(org.finos.waltz.service.entity_hierarchy.EntityHierarchyService) Logger(org.slf4j.Logger) ChangeInitiativeRecord(org.finos.waltz.schema.tables.records.ChangeInitiativeRecord) ChangeInitiativeKind(org.finos.waltz.model.change_initiative.ChangeInitiativeKind) Instant(java.time.Instant) ApplicationContext(org.springframework.context.ApplicationContext) Date(java.sql.Date) RandomUtilities(org.finos.waltz.common.RandomUtilities) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Stream(java.util.stream.Stream) INVOLVEMENT(org.finos.waltz.schema.tables.Involvement.INVOLVEMENT) Tuple.tuple(org.jooq.lambda.tuple.Tuple.tuple) RandomUtilities.randomPick(org.finos.waltz.common.RandomUtilities.randomPick) PERSON(org.finos.waltz.schema.tables.Person.PERSON) AtomicLong(java.util.concurrent.atomic.AtomicLong) ChangeInitiativeKind(org.finos.waltz.model.change_initiative.ChangeInitiativeKind) AtomicLong(java.util.concurrent.atomic.AtomicLong)

Aggregations

Date (java.sql.Date)1 Instant (java.time.Instant)1 List (java.util.List)1 Map (java.util.Map)1 Random (java.util.Random)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Collectors.toList (java.util.stream.Collectors.toList)1 IntStream (java.util.stream.IntStream)1 Stream (java.util.stream.Stream)1 RandomUtilities (org.finos.waltz.common.RandomUtilities)1 RandomUtilities.randomPick (org.finos.waltz.common.RandomUtilities.randomPick)1 StreamUtilities (org.finos.waltz.common.StreamUtilities)1 EntityKind (org.finos.waltz.model.EntityKind)1 LifecyclePhase (org.finos.waltz.model.application.LifecyclePhase)1 ChangeInitiativeKind (org.finos.waltz.model.change_initiative.ChangeInitiativeKind)1 Tables (org.finos.waltz.schema.Tables)1 APPLICATION_GROUP (org.finos.waltz.schema.tables.ApplicationGroup.APPLICATION_GROUP)1 CHANGE_INITIATIVE (org.finos.waltz.schema.tables.ChangeInitiative.CHANGE_INITIATIVE)1 INVOLVEMENT (org.finos.waltz.schema.tables.Involvement.INVOLVEMENT)1 PERSON (org.finos.waltz.schema.tables.Person.PERSON)1