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());
}
Aggregations