Search in sources :

Example 1 with PersonHierarchyService

use of org.finos.waltz.service.person_hierarchy.PersonHierarchyService in project waltz by khartec.

the class PersonDataGenerator method create.

@Override
public Map<String, Integer> create(ApplicationContext ctx) {
    PersonService personService = ctx.getBean(PersonService.class);
    PersonHierarchyService personHierarchyService = ctx.getBean(PersonHierarchyService.class);
    List<Long> ouIds = getDsl(ctx).select(ORGANISATIONAL_UNIT.ID).from(ORGANISATIONAL_UNIT).fetch(ORGANISATIONAL_UNIT.ID);
    Person person = fairy.person();
    ImmutablePerson root = ImmutablePerson.builder().employeeId(person.getPassportNumber()).personKind(PersonKind.EMPLOYEE).userPrincipalName(person.getUsername()).title(randomPick(SampleData.jobTitles[0])).departmentName("CEO").displayName(person.getFullName()).email(person.getEmail()).organisationalUnitId(10L).isRemoved(false).build();
    peeps.add(root);
    visit(root, 1, ouIds);
    personService.bulkSave(peeps);
    ImmutablePerson admin = randomPick(peeps);
    getDsl(ctx).update(PERSON).set(PERSON.USER_PRINCIPAL_NAME, "admin").set(PERSON.EMAIL, "admin").where(PERSON.EMPLOYEE_ID.eq(admin.employeeId())).execute();
    personHierarchyService.build();
    return MapUtilities.newHashMap("created", peeps.size());
}
Also used : PersonHierarchyService(org.finos.waltz.service.person_hierarchy.PersonHierarchyService) PersonService(org.finos.waltz.service.person.PersonService) ImmutablePerson(org.finos.waltz.model.person.ImmutablePerson) ImmutablePerson(org.finos.waltz.model.person.ImmutablePerson) Person(io.codearte.jfairy.producer.person.Person)

Aggregations

Person (io.codearte.jfairy.producer.person.Person)1 ImmutablePerson (org.finos.waltz.model.person.ImmutablePerson)1 PersonService (org.finos.waltz.service.person.PersonService)1 PersonHierarchyService (org.finos.waltz.service.person_hierarchy.PersonHierarchyService)1