Search in sources :

Example 71 with Person

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

the class LookupResource method getLookup.

@GET
public Response getLookup() {
    Class classForType = businessObjectEntry.getBusinessObjectClass();
    if (!isAuthorizedForLookup(classForType)) {
        Person user = getUserSessionFromRequest(this.servletRequest).getPerson();
        AuthorizationException authorizationException = new AuthorizationException(user.getPrincipalName(), "lookup", classForType.getName());
        Response.ResponseBuilder responseBuilder = Response.status(Response.Status.FORBIDDEN);
        responseBuilder.entity(authorizationException);
        throw new ForbiddenException(responseBuilder.build());
    }
    List<FormAttribute> lookupAttributes = getLookupAttributeForClass(classForType);
    for (FormAttribute lookupAttribute : lookupAttributes) {
        setNestedLookupFields(lookupAttribute, classForType);
    }
    String title = getLookupDictionary().getLookupTitle(classForType);
    if (StringUtils.isEmpty(title)) {
        title = businessObjectEntry.getObjectLabel() + " Lookup";
    }
    SearchService searchService = getLookupDictionary().getSearchService(classForType);
    if (searchService == null) {
        LOG.error(businessObjectEntry.getName() + " seems to be missing a SearchService! A lookup cannot " + "be queried without a SearchService.");
        throw new InternalServerErrorException("The requested lookup is currently unavailable.");
    }
    LookupResponse.Create create = null;
    if (shouldCreateNewUrlBeIncluded(classForType)) {
        create = getCreateBlock(classForType);
    }
    LookupResponse.Results results = new LookupResponse.Results(searchService.getSearchResultsAttributes(classForType), getBusinessObjectDictionaryService().getLookupDefaultSortFieldNames(classForType));
    LookupResponse lookupResponse = new LookupResponse(title, lookupAttributes, create, results);
    return Response.ok(lookupResponse).build();
}
Also used : ForbiddenException(javax.ws.rs.ForbiddenException) AuthorizationException(org.kuali.kfs.krad.exception.AuthorizationException) FormAttribute(org.kuali.kfs.datadictionary.FormAttribute) LookupResponse(org.kuali.kfs.sys.rest.resource.responses.LookupResponse) Response(javax.ws.rs.core.Response) LookupResponse(org.kuali.kfs.sys.rest.resource.responses.LookupResponse) SearchService(org.kuali.kfs.sys.businessobject.service.SearchService) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) Person(org.kuali.kfs.kim.api.identity.Person) GET(javax.ws.rs.GET)

Example 72 with Person

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

the class AccountingLineAccessibleValidation method isAccountingLineFo.

// CU customization
/*
     * KFSPTS-1273
     */
private boolean isAccountingLineFo(Document document) {
    Person currentUser = GlobalVariables.getUserSession().getPerson();
    List<String> roleIds = new ArrayList<String>();
    roleIds.add(KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.FISCAL_OFFICER_KIM_ROLE_NAME));
    roleIds.add(KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.FISCAL_OFFICER_PRIMARY_DELEGATE_KIM_ROLE_NAME));
    roleIds.add(KimApiServiceLocator.getRoleService().getRoleIdByNamespaceCodeAndName(KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.FISCAL_OFFICER_SECONDARY_DELEGATE_KIM_ROLE_NAME));
    Map<String, String> roleQualifier = new HashMap<String, String>();
    roleQualifier.put(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document.getDocumentNumber());
    roleQualifier.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
    roleQualifier.put(KfsKimAttributes.FINANCIAL_DOCUMENT_TOTAL_AMOUNT, ((FinancialSystemDocumentHeader) document.getDocumentHeader()).getFinancialDocumentTotalAmount().toString());
    roleQualifier.put(KfsKimAttributes.CHART_OF_ACCOUNTS_CODE, accountingLineForValidation.getChartOfAccountsCode());
    roleQualifier.put(KfsKimAttributes.ACCOUNT_NUMBER, accountingLineForValidation.getAccountNumber());
    return KimApiServiceLocator.getRoleService().principalHasRole(currentUser.getPrincipalId(), roleIds, roleQualifier);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FinancialSystemDocumentHeader(org.kuali.kfs.sys.businessobject.FinancialSystemDocumentHeader) Person(org.kuali.kfs.kim.api.identity.Person)

Example 73 with Person

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

the class CuDisbursementVoucherDocument method initiateDocument.

public void initiateDocument() {
    PhoneNumberService phoneNumberService = SpringContext.getBean(PhoneNumberService.class);
    Person currentUser = GlobalVariables.getUserSession().getPerson();
    setDisbVchrContactPersonName(currentUser.getName());
    setDisbVchrContactEmailId(currentUser.getEmailAddressUnmasked());
    String phoneNumber = currentUser.getPhoneNumber();
    if (StringUtils.isNotBlank(phoneNumber) && !StringUtils.equalsIgnoreCase("null", phoneNumber)) {
        if (!phoneNumberService.isDefaultFormatPhoneNumber(currentUser.getPhoneNumber())) {
            setDisbVchrContactPhoneNumber(phoneNumberService.formatNumberIfPossible(currentUser.getPhoneNumber()));
        } else if (StringUtils.equalsIgnoreCase(phoneNumber, "null")) {
        // do nothing... we don't want phone number set to invalid value
        } else {
            setDisbVchrContactPhoneNumber(phoneNumber);
        }
    }
    if (!phoneNumberService.isDefaultFormatPhoneNumber(currentUser.getPhoneNumber())) {
        setDisbVchrContactPhoneNumber(phoneNumberService.formatNumberIfPossible(currentUser.getPhoneNumber()));
    }
    setDisbVchrContactEmailId(currentUser.getEmailAddress());
    ChartOrgHolder chartOrg = SpringContext.getBean(org.kuali.kfs.sys.service.FinancialSystemUserService.class).getPrimaryOrganization(currentUser, KFSConstants.CoreModuleNamespaces.FINANCIAL);
    // the campus code via the business object service.
    if (chartOrg != null && chartOrg.getOrganization() != null) {
        setCampusCode(chartOrg.getOrganization().getOrganizationPhysicalCampusCode());
    } else {
        // A valid campus code was not found; therefore, use the default affiliated  campus code.
        String affiliatedCampusCode = currentUser.getCampusCode();
        setCampusCode(affiliatedCampusCode);
    }
    setDisbursementVoucherDueDate(getCuDisbursementVoucherDefaultDueDateService().findDefaultDueDate());
    // default doc location
    if (StringUtils.isBlank(getDisbursementVoucherDocumentationLocationCode())) {
        setDisbursementVoucherDocumentationLocationCode(getParameterService().getParameterValueAsString(DisbursementVoucherDocument.class, FPParameterConstants.DEFAULT_DOC_LOCATION));
    }
    // default bank code
    Bank defaultBank = SpringContext.getBean(BankService.class).getDefaultBankByDocType(this.getClass());
    if (defaultBank != null) {
        this.disbVchrBankCode = defaultBank.getBankCode();
        this.bank = defaultBank;
    }
}
Also used : PhoneNumberService(org.kuali.kfs.vnd.service.PhoneNumberService) BankService(org.kuali.kfs.sys.service.BankService) Bank(org.kuali.kfs.sys.businessobject.Bank) ChartOrgHolder(org.kuali.kfs.sys.businessobject.ChartOrgHolder) Person(org.kuali.kfs.kim.api.identity.Person) DisbursementVoucherDocument(org.kuali.kfs.fp.document.DisbursementVoucherDocument)

Example 74 with Person

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

the class PayeeACHAccountExtractServiceImpl method processACHBatchDetail.

/**
 * Processes a single ACH batch detail, and routes a Payee ACH Account maintenance document accordingly.
 */
protected String processACHBatchDetail(PayeeACHAccountExtractDetail achDetail) {
    LOG.info("processACHBatchDetail: Starting processACHBatchDetail for: " + achDetail.getLogData());
    Person payee = personService.getPersonByPrincipalName(achDetail.getNetID());
    String processingError = validateACHBatchDetail(achDetail, payee);
    if (StringUtils.isNotBlank(processingError)) {
        return processingError;
    }
    processingError = addOrUpdateACHAccountIfNecessary(payee, achDetail, PayeeIdTypeCodes.ENTITY, payee.getEntityId());
    if (StringUtils.isNotBlank(processingError)) {
        return processingError;
    }
    processingError = addOrUpdateACHAccountIfNecessary(payee, achDetail, PayeeIdTypeCodes.EMPLOYEE, payee.getEmployeeId());
    return processingError;
}
Also used : Person(org.kuali.kfs.kim.api.identity.Person)

Example 75 with Person

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

the class CuFormatAction method start.

@Override
public ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    CuFormatForm formatForm = (CuFormatForm) form;
    Person kualiUser = GlobalVariables.getUserSession().getPerson();
    FormatSelection formatSelection = formatService.getDataForFormat(kualiUser);
    DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class);
    formatForm.setCampus(kualiUser.getCampusCode());
    // no data for format because another format process is already running
    if (formatSelection.getStartDate() != null) {
        GlobalVariables.getMessageMap().putError(KFSConstants.GLOBAL_ERRORS, PdpKeyConstants.Format.ERROR_PDP_FORMAT_PROCESS_ALREADY_RUNNING, dateTimeService.toDateTimeString(formatSelection.getStartDate()));
    } else {
        List<CustomerProfile> customers = formatSelection.getCustomerList();
        for (CustomerProfile element : customers) {
            if (formatSelection.getCampus().equals(element.getDefaultPhysicalCampusProcessingCode())) {
                element.setSelectedForFormat(Boolean.TRUE);
            } else {
                element.setSelectedForFormat(Boolean.FALSE);
            }
        }
        formatForm.setPaymentDate(dateTimeService.toDateString(dateTimeService.getCurrentTimestamp()));
        formatForm.setPaymentTypes(PdpConstants.PaymentTypes.ALL);
        formatForm.setPaymentDistribution(CUPdpConstants.PaymentDistributions.PROCESS_ALL);
        formatForm.setCustomers(customers);
        formatForm.setRanges(formatSelection.getRangeList());
    }
    return mapping.findForward(PdpConstants.MAPPING_SELECTION);
}
Also used : FormatSelection(org.kuali.kfs.pdp.businessobject.FormatSelection) CustomerProfile(org.kuali.kfs.pdp.businessobject.CustomerProfile) Person(org.kuali.kfs.kim.api.identity.Person) DateTimeService(org.kuali.kfs.core.api.datetime.DateTimeService)

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