Search in sources :

Example 1 with PersonService

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;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) Person(org.kuali.kfs.kim.api.identity.Person)

Example 2 with 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;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService)

Example 3 with PersonService

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;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken) Person(org.kuali.kfs.kim.api.identity.Person) HashSet(java.util.HashSet)

Example 4 with PersonService

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;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) ActionTaken(org.kuali.kfs.kew.actiontaken.ActionTaken) Person(org.kuali.kfs.kim.api.identity.Person) HashSet(java.util.HashSet)

Example 5 with PersonService

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;
}
Also used : PersonService(org.kuali.kfs.kim.api.identity.PersonService) Person(org.kuali.kfs.kim.api.identity.Person) AdHocRoutePerson(org.kuali.kfs.krad.bo.AdHocRoutePerson) TestAdHocRoutePerson(edu.cornell.kfs.sys.util.MockDocumentUtils.TestAdHocRoutePerson)

Aggregations

PersonService (org.kuali.kfs.kim.api.identity.PersonService)6 Person (org.kuali.kfs.kim.api.identity.Person)4 HashSet (java.util.HashSet)2 ActionTaken (org.kuali.kfs.kew.actiontaken.ActionTaken)2 ACHPersonPayeeFixture (edu.cornell.kfs.pdp.batch.fixture.ACHPersonPayeeFixture)1 TestAdHocRoutePerson (edu.cornell.kfs.sys.util.MockDocumentUtils.TestAdHocRoutePerson)1 AdHocRoutePerson (org.kuali.kfs.krad.bo.AdHocRoutePerson)1