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();
}
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);
}
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;
}
}
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;
}
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);
}
Aggregations