use of org.kuali.kfs.kim.api.identity.PersonService in project cu-kfs by CU-CommunityApps.
the class RassMockServiceFactory method buildMockPersonService.
public PersonService buildMockPersonService() throws Exception {
PersonService personService = Mockito.mock(PersonService.class);
Stream.of(UserNameFixture.mgw3, UserNameFixture.kan2, UserNameFixture.mls398).forEach(fixture -> {
Person mockPerson = MockPersonUtil.createMockPerson(fixture);
String principalName = mockPerson.getPrincipalName();
Mockito.when(personService.getPersonByPrincipalName(principalName)).thenReturn(mockPerson);
});
return personService;
}
use of org.kuali.kfs.kim.api.identity.PersonService in project cu-kfs by CU-CommunityApps.
the class SecurityRequestDocument method getRequestPerson.
public Person getRequestPerson() {
PersonService personService = KimApiServiceLocator.getPersonService();
requestPerson = personService.getPerson(principalId);
if (requestPerson == null) {
try {
requestPerson = KimApiServiceLocator.getPersonService().getPersonImplementationClass().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return requestPerson;
}
use of org.kuali.kfs.kim.api.identity.PersonService in project cu-kfs by CU-CommunityApps.
the class CuPurchaseOrderAmendmentDocument method getAllPriorApprovers.
public Set<Person> getAllPriorApprovers() throws WorkflowException {
PersonService personService = KimApiServiceLocator.getPersonService();
List<ActionTaken> actionsTaken = this.getFinancialSystemDocumentHeader().getWorkflowDocument().getActionsTaken();
Set<String> principalIds = new HashSet<String>();
Set<Person> persons = new HashSet<Person>();
for (ActionTaken actionTaken : actionsTaken) {
if (KewApiConstants.ACTION_TAKEN_APPROVED_CD.equals(actionTaken.getActionTaken())) {
String principalId = actionTaken.getPrincipalId();
if (!principalIds.contains(principalId)) {
principalIds.add(principalId);
persons.add(personService.getPerson(principalId));
}
}
}
return persons;
}
use of org.kuali.kfs.kim.api.identity.PersonService in project cu-kfs by CU-CommunityApps.
the class DisbursementVoucherDocument method getAllPriorApprovers.
public Set<Person> getAllPriorApprovers() throws WorkflowException {
PersonService personService = KimApiServiceLocator.getPersonService();
List<ActionTaken> actionsTaken = getDocumentHeader().getWorkflowDocument().getActionsTaken();
Set<String> principalIds = new HashSet<>();
Set<Person> persons = new HashSet<>();
for (ActionTaken actionTaken : actionsTaken) {
if (KewApiConstants.ACTION_TAKEN_APPROVED_CD.equals(actionTaken.getActionTaken())) {
String principalId = actionTaken.getPrincipalId();
if (!principalIds.contains(principalId)) {
principalIds.add(principalId);
persons.add(personService.getPerson(principalId));
}
}
}
return persons;
}
use of org.kuali.kfs.kim.api.identity.PersonService in project cu-kfs by CU-CommunityApps.
the class CreateAccountingDocumentServiceImplTest method buildMockPersonService.
private PersonService buildMockPersonService() throws Exception {
PersonService personService = Mockito.mock(PersonService.class);
Person systemUser = MockPersonUtil.createMockPerson(UserNameFixture.kfs);
Mockito.when(personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER)).thenReturn(systemUser);
Person testUser = MockPersonUtil.createMockPerson(TestUserFixture.TEST_USER);
Mockito.when(personService.getPersonByEmployeeId(TestUserFixture.TEST_USER.employeeId)).thenReturn(testUser);
return personService;
}
Aggregations