Search in sources :

Example 56 with Person

use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class IWantDocumentAction method approverEnteredOwnNetidAsApprover.

private boolean approverEnteredOwnNetidAsApprover(ActionForm form) {
    IWantDocumentForm iWantDocForm = (IWantDocumentForm) form;
    String enteredApproverNetID = iWantDocForm.getNewAdHocRoutePersonNetId();
    Person currentUser = GlobalVariables.getUserSession().getPerson();
    String currentUserNetID = currentUser.getPrincipalName();
    if (StringUtils.equalsIgnoreCase(currentUserNetID, enteredApproverNetID)) {
        GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, CUPurapKeyConstants.ERROR_IWNT_APPROVER_CANNOT_ROUTE_TO_SELF);
        return true;
    }
    return false;
}
Also used : Person(org.kuali.kfs.kim.api.identity.Person)

Example 57 with Person

use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class CuSimpleChartValuesFinder method getKeyValues.

public List<KeyValue> getKeyValues() {
    String defaultChartCode = "";
    String defaultChartCodeMethod = "";
    try {
        defaultChartCode = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE);
        defaultChartCodeMethod = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE_METHOD);
    } catch (Exception e) {
    // Do nothing
    }
    Collection<Chart> chartCodes = keyValuesService.findAll(Chart.class);
    List<KeyValue> chartKeyLabels = new ArrayList<>();
    // If the DEFAULT_CHART_CODE_METHOD parameter DNE or has no value assigned to it, no default
    if (defaultChartCodeMethod.equals("")) {
        chartKeyLabels.add(new ConcreteKeyValue("", ""));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive()) {
                // only show active charts
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with the default chart
    if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_CHART_METHOD)) {
        chartKeyLabels.add(new ConcreteKeyValue(defaultChartCode, defaultChartCode));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive() && !element.getChartOfAccountsCode().equals(defaultChartCode)) {
                // only show active charts
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with chart code of the user's primary department
    if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_PRIMARY_DEPT_METHOD)) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        String primaryDepartmentChartCode = financialSystemUserService.getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
        chartKeyLabels.add(new ConcreteKeyValue(primaryDepartmentChartCode, primaryDepartmentChartCode));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive() && !element.getChartOfAccountsCode().equals(primaryDepartmentChartCode)) {
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    // populate with the default chart unless user's primary department has been defined
    if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_PRIMARY_DEPT_CHART_METHOD)) {
        Person currentUser = GlobalVariables.getUserSession().getPerson();
        String primaryDepartmentChartCode = financialSystemUserService.getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
        String chartUsed = null;
        if (primaryDepartmentChartCode != null && !primaryDepartmentChartCode.equals("")) {
            chartUsed = primaryDepartmentChartCode;
        } else {
            chartUsed = defaultChartCode;
        }
        chartKeyLabels.add(new ConcreteKeyValue(chartUsed, chartUsed));
        for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
            Chart element = (Chart) iter.next();
            if (element.isActive() && !element.getChartOfAccountsCode().equals(chartUsed)) {
                chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
            }
        }
    }
    return chartKeyLabels;
}
Also used : ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) ConcreteKeyValue(org.kuali.kfs.core.api.util.ConcreteKeyValue) KeyValue(org.kuali.kfs.core.api.util.KeyValue) ArrayList(java.util.ArrayList) Person(org.kuali.kfs.kim.api.identity.Person) Chart(org.kuali.kfs.coa.businessobject.Chart)

Example 58 with Person

use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class AccountingDocumentGeneratorBase method buildDocumentNote.

protected Note buildDocumentNote(AccountingXmlDocumentNote xmlNote) {
    Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
    Note note = emptyNoteGenerator.get();
    note.setNoteText(xmlNote.getDescription());
    note.setAuthorUniversalIdentifier(systemUser.getPrincipalId());
    note.setNotePostedTimestampToCurrent();
    return note;
}
Also used : AccountingXmlDocumentNote(edu.cornell.kfs.fp.batch.xml.AccountingXmlDocumentNote) Note(org.kuali.kfs.krad.bo.Note) AdHocRoutePerson(org.kuali.kfs.krad.bo.AdHocRoutePerson) Person(org.kuali.kfs.kim.api.identity.Person)

Example 59 with Person

use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class RassProjectDirectorConverter method buildProjectDirector.

protected CGProjectDirector buildProjectDirector(RassXMLAwardPiCoPiEntry rassAwardPiCoPi) {
    CGProjectDirector projectDirector = createNewProjectDirectorInstance();
    Person projectDirectorPerson = personService.getPersonByPrincipalName(rassAwardPiCoPi.getProjectDirectorPrincipalName());
    if (ObjectUtils.isNull(projectDirectorPerson)) {
        throw new RuntimeException("Cannot find person with principal name \"" + rassAwardPiCoPi.getProjectDirectorPrincipalName() + "\"");
    }
    if (!doesPersonHaveProjectDirectorRole(projectDirectorPerson)) {
        LOG.info("buildProjectDirector, " + projectDirectorPerson.getPrincipalName() + " needs to be added to the project director role");
        roleService.assignPrincipalToRole(projectDirectorPerson.getPrincipalId(), KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR, new HashMap<String, String>());
    }
    projectDirector.setPrincipalId(projectDirectorPerson.getPrincipalId());
    ObjectPropertyUtils.setPropertyValue(projectDirector, projectDirectorPrimaryIndicatorPropertyName, getNullSafePrimaryDirectorFlag(rassAwardPiCoPi));
    return projectDirector;
}
Also used : CGProjectDirector(org.kuali.kfs.module.cg.businessobject.CGProjectDirector) Person(org.kuali.kfs.kim.api.identity.Person)

Example 60 with Person

use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.

the class PayeeACHAccountExtractServiceImplTest method processACHBatchDetailsInNewUserSession.

private boolean processACHBatchDetailsInNewUserSession() throws Exception {
    Person systemUser = MockPersonUtil.createMockPerson(UserNameFixture.kfs);
    UserSession systemUserSession = MockPersonUtil.createMockUserSession(systemUser);
    return GlobalVariables.doInNewGlobalVariables(systemUserSession, payeeACHAccountExtractService::processACHBatchDetails);
}
Also used : UserSession(org.kuali.kfs.krad.UserSession) Person(org.kuali.kfs.kim.api.identity.Person)

Aggregations

Person (org.kuali.kfs.kim.api.identity.Person)84 ArrayList (java.util.ArrayList)11 PersonService (org.kuali.kfs.kim.api.identity.PersonService)11 HashMap (java.util.HashMap)9 Note (org.kuali.kfs.krad.bo.Note)9 CuDisbursementVoucherDocument (edu.cornell.kfs.fp.document.CuDisbursementVoucherDocument)8 WorkflowDocument (org.kuali.kfs.kew.api.WorkflowDocument)6 AdHocRoutePerson (org.kuali.kfs.krad.bo.AdHocRoutePerson)6 DateTimeService (org.kuali.kfs.core.api.datetime.DateTimeService)5 KualiDecimal (org.kuali.kfs.core.api.util.type.KualiDecimal)5 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)5 DisbursementVoucherDocument (org.kuali.kfs.fp.document.DisbursementVoucherDocument)4 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)4 CustomerProfile (org.kuali.kfs.pdp.businessobject.CustomerProfile)4 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)3 PayeeACHAccount (org.kuali.kfs.pdp.businessobject.PayeeACHAccount)3 Bank (org.kuali.kfs.sys.businessobject.Bank)3 ChartOrgHolder (org.kuali.kfs.sys.businessobject.ChartOrgHolder)3 AccountingXmlDocumentNote (edu.cornell.kfs.fp.batch.xml.AccountingXmlDocumentNote)2 CuDisbursementPayee (edu.cornell.kfs.fp.businessobject.CuDisbursementPayee)2