use of com.khartec.waltz.model.person.ImmutablePerson in project waltz by khartec.
the class PersonDataGenerator method visit.
private static void visit(ImmutablePerson parent, int level) {
if (level > MAX_DEPTH)
return;
int nextLevel = level + 1;
int siblingCount = level == 1 ? jobTitles[1].length : rnd.nextInt(7) + 2;
for (int i = 0; i < siblingCount; i++) {
Person person = fairy.person();
String jobTitle = level == 1 ? jobTitles[1][i] : randomPick(jobTitles[level >= jobTitles.length ? jobTitles.length - 1 : level]);
ImmutablePerson p = ImmutablePerson.builder().managerEmployeeId(parent.employeeId()).employeeId(person.getPassportNumber()).personKind(PersonKind.EMPLOYEE).userPrincipalName(person.getUsername()).title(jobTitle).departmentName(randomPick(departmentNames)).displayName(person.getFullName()).email((counter++) + person.getEmail()).build();
peeps.add(p);
visit(p, nextLevel);
}
}
use of com.khartec.waltz.model.person.ImmutablePerson in project waltz by khartec.
the class PersonDataGenerator method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
PersonService personService = ctx.getBean(PersonService.class);
PersonHierarchyService personHierarchyService = ctx.getBean(PersonHierarchyService.class);
Person person = fairy.person();
ImmutablePerson root = ImmutablePerson.builder().employeeId(person.getPassportNumber()).personKind(PersonKind.EMPLOYEE).userPrincipalName(person.getUsername()).title(randomPick(jobTitles[0])).departmentName("CEO").displayName(person.getFullName()).email(person.getEmail()).build();
peeps.add(root);
visit(root, 1);
System.out.println(peeps.size());
personService.bulkSave(peeps);
personHierarchyService.build();
}
Aggregations