List of usage examples for org.apache.commons.lang StringUtils containsIgnoreCase
public static boolean containsIgnoreCase(String str, String searchStr)
Checks if String contains a search String irrespective of case, handling null
.
From source file:org.kuali.kfs.fp.document.validation.impl.BudgetAdjustmentAccountingLineAccountIncomeStreamValidation.java
/** * Validate that, if current adjustment amount is non zero, account has an associated income stream chart and account * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent) *//*w w w.j a va2 s . c o m*/ public boolean validate(AttributedDocumentEvent event) { boolean accountNumberAllowed = true; if (getAccountingLineForValidation().getCurrentBudgetAdjustmentAmount().isNonZero()) { getAccountingLineForValidation().refreshReferenceObject("account"); if (!ObjectUtils.isNull(getAccountingLineForValidation().getAccount())) { //KFSMI-4877: if fund group is in system parameter values then income stream account number must exist. String fundGroupCode = getAccountingLineForValidation().getAccount().getSubFundGroup() .getFundGroupCode(); String incomeStreamRequiringFundGroupCode = SpringContext.getBean(ParameterService.class) .getParameterValueAsString(Account.class, KFSConstants.ChartApcParms.INCOME_STREAM_ACCOUNT_REQUIRING_FUND_GROUPS); if (StringUtils.containsIgnoreCase(fundGroupCode, incomeStreamRequiringFundGroupCode)) { if (ObjectUtils .isNull(getAccountingLineForValidation().getAccount().getIncomeStreamAccount())) { GlobalVariables.getMessageMap().putError(KFSPropertyConstants.ACCOUNT_NUMBER, KFSKeyConstants.ERROR_DOCUMENT_BA_NO_INCOME_STREAM_ACCOUNT, getAccountingLineForValidation().getAccountNumber()); accountNumberAllowed = false; } } } } return accountNumberAllowed; }
From source file:org.kuali.kfs.gl.batch.service.impl.CollectorReportServiceImpl.java
/** * Appends header information to the given buffer * * @param buf the buffer where the message should go * @param batch the data from the Collector file *//* w w w. j av a 2 s . co m*/ protected void appendHeaderInformation(StringBuilder buf, CollectorBatch batch, CollectorReportData collectorReportData) { String emailBatchStatus = collectorReportData.getEmailSendingStatus().get(batch.getBatchName()); buf.append("\n Chart: ").append(batch.getChartOfAccountsCode()).append("\n"); buf.append(" Org: ").append(batch.getOrganizationCode()).append("\n"); buf.append(" Campus: ").append(batch.getCampusCode()).append("\n"); buf.append(" Department: ").append(batch.getDepartmentName()).append("\n"); buf.append(" Mailing Address: ").append(batch.getMailingAddress()).append("\n"); buf.append(" Contact: ").append(batch.getPersonUserID()).append("\n"); buf.append(" Email: ").append(batch.getEmailAddress()); if (StringUtils.isNotEmpty(emailBatchStatus)) { String displayStatus = StringUtils.containsIgnoreCase(emailBatchStatus, "ERROR") ? "**Email Failure" : "**Email Success"; buf.append(" ( " + displayStatus + " )").append("\n"); } else { buf.append("\n"); } buf.append(" Transmission Date: ").append(batch.getTransmissionDate()).append("\n\n"); }
From source file:org.kuali.kfs.gl.batch.service.impl.CollectorReportServiceImpl.java
/** * Sends email message to batch mailing list notifying of email send failures during the collector processing * * @param collectorReportData - data from collector run *///from ww w. j a va 2 s .com protected void sendEmailSendFailureNotice(CollectorReportData collectorReportData) { MailMessage message = new MailMessage(); String returnAddress = parameterService.getParameterValueAsString(KFSConstants.ParameterNamespaces.GL, "Batch", KFSConstants.FROM_EMAIL_ADDRESS_PARM_NM); if (StringUtils.isEmpty(returnAddress)) { returnAddress = mailService.getBatchMailingList(); } message.setFromAddress(returnAddress); String subject = configurationService .getPropertyValueAsString(KFSKeyConstants.ERROR_COLLECTOR_EMAILSEND_NOTIFICATION_SUBJECT); message.setSubject(subject); boolean hasEmailSendErrors = false; String body = configurationService .getPropertyValueAsString(KFSKeyConstants.ERROR_COLLECTOR_EMAILSEND_NOTIFICATION_BODY); for (String batchId : collectorReportData.getEmailSendingStatus().keySet()) { String emailStatus = collectorReportData.getEmailSendingStatus().get(batchId); if (StringUtils.containsIgnoreCase(emailStatus, "error")) { body += "Batch: " + batchId + " - " + emailStatus + "\n"; hasEmailSendErrors = true; } } message.setMessage(body); message.addToAddress(mailService.getBatchMailingList()); try { if (hasEmailSendErrors) { mailService.sendMessage(message); LOG.info("Email failure notice has been sent to : " + message.getToAddresses()); } } catch (Exception e) { LOG.error("sendErrorEmail() Invalid email address. Message not sent", e); } }
From source file:org.kuali.kfs.module.cab.service.impl.CapitalAssetBuilderModuleServiceImpl.java
/** * Predicate to determine whether the given object code is of a specified object sub type required for purap cams. * * @param oc An ObjectCode//from w ww . ja va 2 s .c o m * @return True if the ObjectSubType is the one designated for capital assets. */ protected boolean isCapitalAssetObjectCode(ObjectCode oc) { String capitalAssetObjectSubType = this.getParameterService().getParameterValueAsString( KfsParameterConstants.CAPITAL_ASSET_BUILDER_DOCUMENT.class, PurapParameterConstants.CapitalAsset.PURCHASING_OBJECT_SUB_TYPES); return (StringUtils.containsIgnoreCase(capitalAssetObjectSubType, oc.getFinancialObjectSubTypeCode()) ? true : false); }
From source file:org.kuali.kfs.module.external.kc.document.validation.impl.AccountAutoCreateDefaultsRule.java
@Override protected boolean checkIncomeStreamAccountRule() { // KFSMI-4877: if fund group is in system parameter values then income stream account number must exist. if (ObjectUtils.isNotNull(newAccountAutoCreateDefaults.getSubFundGroup()) && StringUtils.isNotBlank(newAccountAutoCreateDefaults.getSubFundGroup().getFundGroupCode())) { if (ObjectUtils.isNull(newAccountAutoCreateDefaults.getIncomeStreamAccount())) { String incomeStreamRequiringFundGroupCode = SpringContext.getBean(ParameterService.class) .getParameterValueAsString(Account.class, KFSConstants.ChartApcParms.INCOME_STREAM_ACCOUNT_REQUIRING_FUND_GROUPS); if (StringUtils.containsIgnoreCase( newAccountAutoCreateDefaults.getSubFundGroup().getFundGroupCode(), incomeStreamRequiringFundGroupCode)) { GlobalVariables.getMessageMap().putError(KFSPropertyConstants.ACCOUNT_NUMBER, KFSKeyConstants.ERROR_DOCUMENT_BA_NO_INCOME_STREAM_ACCOUNT, ""); return false; }/*from ww w .j a v a 2 s . c o m*/ } } return true; }
From source file:org.kuali.kfs.module.purap.document.web.struts.PurchasingActionBase.java
/** * @see org.kuali.kfs.sys.web.struts.KualiAccountingDocumentActionBase#refresh(org.apache.struts.action.ActionMapping, * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) *//* ww w . java 2 s . c om*/ @Override public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { PurchasingAccountsPayableFormBase baseForm = (PurchasingAccountsPayableFormBase) form; PurchasingDocument document = (PurchasingDocument) baseForm.getDocument(); String refreshCaller = baseForm.getRefreshCaller(); BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class); PhoneNumberService phoneNumberService = SpringContext.getBean(PhoneNumberService.class); // Format phone numbers document.setInstitutionContactPhoneNumber( phoneNumberService.formatNumberIfPossible(document.getInstitutionContactPhoneNumber())); document.setRequestorPersonPhoneNumber( phoneNumberService.formatNumberIfPossible(document.getRequestorPersonPhoneNumber())); document.setDeliveryToPhoneNumber( phoneNumberService.formatNumberIfPossible(document.getDeliveryToPhoneNumber())); // names in KIM are longer than what we store these names at; truncate them to match our data dictionary maxlengths if (StringUtils.equals(refreshCaller, "kimPersonLookupable")) { Integer deliveryToNameMaxLength = SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(document.getClass(), PurapPropertyConstants.DELIVERY_TO_NAME); if (StringUtils.isNotEmpty(document.getDeliveryToName()) && ObjectUtils.isNotNull(deliveryToNameMaxLength) && document.getDeliveryToName().length() > deliveryToNameMaxLength.intValue()) { document.setDeliveryToName(document.getDeliveryToName().substring(0, deliveryToNameMaxLength)); GlobalVariables.getMessageMap().clearErrorPath(); GlobalVariables.getMessageMap().addToErrorPath(PurapConstants.DELIVERY_TAB_ERRORS); GlobalVariables.getMessageMap().putWarning(PurapPropertyConstants.DELIVERY_TO_NAME, PurapKeyConstants.WARNING_DELIVERY_TO_NAME_TRUNCATED); GlobalVariables.getMessageMap().removeFromErrorPath(PurapConstants.DELIVERY_TAB_ERRORS); } Integer requestorNameMaxLength = SpringContext.getBean(DataDictionaryService.class) .getAttributeMaxLength(document.getClass(), PurapPropertyConstants.REQUESTOR_PERSON_NAME); if (StringUtils.isNotEmpty(document.getRequestorPersonName()) && ObjectUtils.isNotNull(requestorNameMaxLength) && document.getRequestorPersonName().length() > requestorNameMaxLength.intValue()) { document.setRequestorPersonName( document.getRequestorPersonName().substring(0, requestorNameMaxLength)); GlobalVariables.getMessageMap().clearErrorPath(); GlobalVariables.getMessageMap().addToErrorPath(PurapConstants.ADDITIONAL_TAB_ERRORS); GlobalVariables.getMessageMap().putWarning(PurapPropertyConstants.REQUESTOR_PERSON_NAME, PurapKeyConstants.WARNING_REQUESTOR_NAME_TRUNCATED); GlobalVariables.getMessageMap().removeFromErrorPath(PurapConstants.ADDITIONAL_TAB_ERRORS); } } // Refreshing the fields after returning from a vendor lookup in the vendor tab if (StringUtils.equals(refreshCaller, VendorConstants.VENDOR_LOOKUPABLE_IMPL) && document.getVendorDetailAssignedIdentifier() != null && document.getVendorHeaderGeneratedIdentifier() != null) { document.setVendorContractGeneratedIdentifier(null); document.refreshReferenceObject("vendorContract"); // retrieve vendor based on selection from vendor lookup document.refreshReferenceObject("vendorDetail"); document.templateVendorDetail(document.getVendorDetail()); // populate default address based on selected vendor VendorAddress defaultAddress = SpringContext.getBean(VendorService.class).getVendorDefaultAddress( document.getVendorDetail().getVendorAddresses(), document.getVendorDetail().getVendorHeader() .getVendorType().getAddressType().getVendorAddressTypeCode(), document.getDeliveryCampusCode()); if (defaultAddress == null) { GlobalVariables.getMessageMap().putError(VendorPropertyConstants.VENDOR_DOC_ADDRESS, PurapKeyConstants.ERROR_INACTIVE_VENDORADDRESS); } document.templateVendorAddress(defaultAddress); } // Refreshing the fields after returning from a contract lookup in the vendor tab if (StringUtils.equals(refreshCaller, VendorConstants.VENDOR_CONTRACT_LOOKUPABLE_IMPL)) { if (StringUtils.isNotEmpty(request.getParameter( KFSPropertyConstants.DOCUMENT + "." + PurapPropertyConstants.VENDOR_CONTRACT_ID))) { // retrieve Contract based on selection from contract lookup VendorContract refreshVendorContract = new VendorContract(); refreshVendorContract .setVendorContractGeneratedIdentifier(document.getVendorContractGeneratedIdentifier()); refreshVendorContract = (VendorContract) businessObjectService.retrieve(refreshVendorContract); // retrieve Vendor based on selected contract document.setVendorHeaderGeneratedIdentifier( refreshVendorContract.getVendorHeaderGeneratedIdentifier()); document.setVendorDetailAssignedIdentifier( refreshVendorContract.getVendorDetailAssignedIdentifier()); document.refreshReferenceObject("vendorDetail"); document.templateVendorDetail(document.getVendorDetail()); // always template contract after vendor to keep contract defaults last document.templateVendorContract(refreshVendorContract); // populate default address from selected vendor VendorAddress defaultAddress = SpringContext.getBean(VendorService.class).getVendorDefaultAddress( document.getVendorDetail().getVendorAddresses(), document.getVendorDetail() .getVendorHeader().getVendorType().getAddressType().getVendorAddressTypeCode(), ""); if (defaultAddress == null) { GlobalVariables.getMessageMap().putError(VendorPropertyConstants.VENDOR_DOC_ADDRESS, PurapKeyConstants.ERROR_INACTIVE_VENDORADDRESS); } document.templateVendorAddress(defaultAddress); // update internal dollar limit for PO since the contract might affect this value if (document instanceof PurchaseOrderDocument) { PurchaseOrderDocument poDoc = (PurchaseOrderDocument) document; KualiDecimal limit = SpringContext.getBean(PurchaseOrderService.class) .getInternalPurchasingDollarLimit(poDoc); poDoc.setInternalPurchasingLimit(limit); } } } // Refreshing the fields after returning from an address lookup in the vendor tab if (StringUtils.equals(refreshCaller, VendorConstants.VENDOR_ADDRESS_LOOKUPABLE_IMPL)) { if (StringUtils.isNotEmpty(request.getParameter( KFSPropertyConstants.DOCUMENT + "." + PurapPropertyConstants.VENDOR_ADDRESS_ID))) { // retrieve address based on selection from address lookup VendorAddress refreshVendorAddress = new VendorAddress(); refreshVendorAddress .setVendorAddressGeneratedIdentifier(document.getVendorAddressGeneratedIdentifier()); refreshVendorAddress = (VendorAddress) businessObjectService.retrieve(refreshVendorAddress); document.templateVendorAddress(refreshVendorAddress); } } // Refreshing corresponding fields after returning from various kuali lookups if (StringUtils.equals(refreshCaller, KFSConstants.KUALI_LOOKUPABLE_IMPL)) { if (request.getParameter("document.deliveryCampusCode") != null) { // returning from a building or campus lookup on the delivery tab (update billing address) BillingAddress billingAddress = new BillingAddress(); billingAddress.setBillingCampusCode(document.getDeliveryCampusCode()); Map keys = SpringContext.getBean(PersistenceService.class).getPrimaryKeyFieldValues(billingAddress); billingAddress = SpringContext.getBean(BusinessObjectService.class) .findByPrimaryKey(BillingAddress.class, keys); document.templateBillingAddress(billingAddress); if (request.getParameter("document.deliveryBuildingName") == null) { // came from campus lookup not building, so clear building document.setDeliveryBuildingCode(""); document.setDeliveryBuildingName(""); document.setDeliveryBuildingLine1Address(""); document.setDeliveryBuildingLine2Address(""); document.setDeliveryBuildingRoomNumber(""); document.setDeliveryCityName(""); document.setDeliveryStateCode(""); document.setDeliveryPostalCode(""); document.setDeliveryCountryCode(""); } else { // came from building lookup then turn off "OTHER" and clear room and line2address document.setDeliveryBuildingOtherIndicator(false); document.setDeliveryBuildingRoomNumber(""); document.setDeliveryBuildingLine2Address(""); } } else if (request.getParameter("document.chartOfAccountsCode") != null) { // returning from a chart/org lookup on the document detail tab (update receiving address) document.loadReceivingAddress(); } else { String buildingCodeParam = findBuildingCodeFromCapitalAssetBuildingLookup(request); if (!StringUtils.isEmpty(buildingCodeParam)) { // returning from a building lookup in a capital asset tab location (update location address) PurchasingFormBase purchasingForm = (PurchasingFormBase) form; CapitalAssetLocation location = null; // get building code String buildingCode = request.getParameterValues(buildingCodeParam)[0]; // get campus code String campusCodeParam = buildingCodeParam.replace("buildingCode", "campusCode"); String campusCode = request.getParameterValues(campusCodeParam)[0]; // lookup building Building locationBuilding = new Building(); locationBuilding.setCampusCode(campusCode); locationBuilding.setBuildingCode(buildingCode); Map<String, String> keys = SpringContext.getBean(PersistenceService.class) .getPrimaryKeyFieldValues(locationBuilding); locationBuilding = SpringContext.getBean(BusinessObjectService.class) .findByPrimaryKey(Building.class, keys); Map<String, String> parameters = request.getParameterMap(); Set<String> parameterKeys = parameters.keySet(); String locationCapitalAssetLocationNumber = ""; String locationCapitalAssetItemNumber = ""; for (String parameterKey : parameterKeys) { if (StringUtils.containsIgnoreCase(parameterKey, "newPurchasingCapitalAssetLocationLine")) { // its the new line if (document.getCapitalAssetSystemType().getCapitalAssetSystemTypeCode() .equals(PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) { // get the item number locationCapitalAssetItemNumber = getCaptialAssetItemNumberFromParameter( parameterKey); PurchasingCapitalAssetItem capitalAssetItem = document .getPurchasingCapitalAssetItems() .get(Integer.parseInt(locationCapitalAssetItemNumber)); location = capitalAssetItem.getPurchasingCapitalAssetSystem() .getNewPurchasingCapitalAssetLocationLine(); } else { // no item number location = purchasingForm.getNewPurchasingCapitalAssetLocationLine(); } break; } else if (StringUtils.containsIgnoreCase(parameterKey, "purchasingCapitalAssetLocationLine")) { // its one of the numbered lines, lets locationCapitalAssetLocationNumber = getCaptialAssetLocationNumberFromParameter( parameterKey); if (document.getCapitalAssetSystemType().getCapitalAssetSystemTypeCode() .equals(PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) { // get the item number locationCapitalAssetItemNumber = getCaptialAssetItemNumberFromParameter( parameterKey); PurchasingCapitalAssetItem capitalAssetItem = document .getPurchasingCapitalAssetItems() .get(Integer.parseInt(locationCapitalAssetItemNumber)); location = capitalAssetItem.getPurchasingCapitalAssetSystem() .getCapitalAssetLocations() .get(Integer.parseInt(locationCapitalAssetLocationNumber)); } break; } else if (StringUtils.containsIgnoreCase(parameterKey, "purchasingCapitalAssetSystems")) { // its one of the numbered lines, lets locationCapitalAssetLocationNumber = getCaptialAssetLocationNumberFromParameter( parameterKey); if (!document.getCapitalAssetSystemType().getCapitalAssetSystemTypeCode() .equals(PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) { CapitalAssetSystem capitalAssetSystem = document.getPurchasingCapitalAssetSystems() .get(0); location = capitalAssetSystem.getCapitalAssetLocations() .get(Integer.parseInt(locationCapitalAssetLocationNumber)); } break; } } if ((location != null) && (locationBuilding != null)) { location.templateBuilding(locationBuilding); } } } } return super.refresh(mapping, form, request, response); }
From source file:org.kuali.kfs.module.tem.document.web.struts.TravelActionBase.java
public ActionForward refreshAfterPrimaryDestinationLookup(ActionMapping mapping, TravelFormBase reqForm, HttpServletRequest request) {//from ww w. ja va 2 s .co m String refreshCaller = reqForm.getRefreshCaller(); TravelDocument document = reqForm.getTravelDocument(); boolean isPrimaryDestinationLookupable = PRIMARY_DESTINATION_LOOKUPABLE.equals(refreshCaller); // if a cancel occurred on address lookup we need to reset the payee id and type, rest of fields will still have correct // information if (refreshCaller == null) { return null; } // do not execute the further refreshing logic if the refresh caller is not a per diem lookupable if (!isPrimaryDestinationLookupable) { return null; } Map parameters = request.getParameterMap(); Set<String> parameterKeys = parameters.keySet(); for (String parameterKey : parameterKeys) { if (StringUtils.containsIgnoreCase(parameterKey, TemPropertyConstants.PER_DIEM_EXPENSES)) { // its one of the numbered lines, lets int estimateLineNum = getLineNumberFromParameter(parameterKey); PerDiemExpense expense = document.getPerDiemExpenses().get(estimateLineNum); String[] priDestId = (String[]) parameters.get(parameterKey); PerDiem perDiem = null; if (expense.getPrimaryDestinationId() != TemConstants.CUSTOM_PRIMARY_DESTINATION_ID && expense.getPrimaryDestinationId().equals(new Integer(priDestId[0]))) { perDiem = getPerDiemService().getPerDiem(expense.getPrimaryDestinationId(), expense.getMileageDate(), document.getEffectiveDateForPerDiem(expense.getMileageDate())); } else { perDiem = getPerDiemService().getPerDiem(new Integer(priDestId[0]), expense.getMileageDate(), document.getEffectiveDateForPerDiem(expense.getMileageDate())); } // now copy info over to estimate if (perDiem != null) { expense.setPrimaryDestinationId(perDiem.getPrimaryDestinationId()); expense.setPrimaryDestination(perDiem.getPrimaryDestination().getPrimaryDestinationName()); expense.setCountryState(perDiem.getPrimaryDestination().getRegion().getRegionName()); expense.setCounty(perDiem.getPrimaryDestination().getCounty()); final boolean shouldProrate = document.isOnTripBegin(expense) || document.isOnTripEnd(expense); getTravelDocumentService().setPerDiemMealsAndIncidentals(expense, perDiem, document.getTripType(), document.getTripEnd(), shouldProrate); expense.setLodging(perDiem.getLodging()); } return null; } } Integer primaryDestinationId = document.getPrimaryDestinationId(); if (primaryDestinationId == null) { if (document.getPrimaryDestination().getId() != null) { document.setPerDiemExpenses(new ArrayList<PerDiemExpense>()); } } else if (document.getPrimaryDestination().getId() != null) { if (primaryDestinationId.intValue() != document.getPrimaryDestination().getId()) { document.setPerDiemExpenses(new ArrayList<PerDiemExpense>()); } } if (isPrimaryDestinationLookupable) { PrimaryDestination primaryDestination = new PrimaryDestination(); primaryDestination.setId(primaryDestinationId); document.setPrimaryDestinationIndicator(false); primaryDestination = (PrimaryDestination) SpringContext.getBean(BusinessObjectService.class) .retrieve(primaryDestination); document.setPrimaryDestination(primaryDestination); document.setPrimaryDestinationId(primaryDestination.getId()); document.setTripType(primaryDestination.getRegion().getTripType()); document.setTripTypeCode(primaryDestination.getRegion().getTripTypeCode().toUpperCase()); return null; } return null; }
From source file:org.kuali.kfs.module.tem.document.web.struts.TravelReimbursementAction.java
protected Integer getPerDiemActionLineNumber(final HttpServletRequest request) { for (final String parameterKey : ((Map<String, String>) request.getParameterMap()).keySet()) { if (StringUtils.containsIgnoreCase(parameterKey, TemPropertyConstants.PER_DIEM_EXPENSES)) { return getLineNumberFromParameter(parameterKey); }// w w w . ja v a2s .c o m } return -1; }
From source file:org.kuali.kfs.sys.batch.service.impl.SchedulerServiceImpl.java
protected boolean isPastScheduleCutoffTime(Calendar dateTime, boolean log) { try {/*from w w w. jav a2s .c o m*/ Date scheduleCutoffTimeTemp = scheduler.getTriggersOfJob(SCHEDULE_JOB_NAME, SCHEDULED_GROUP)[0] .getPreviousFireTime(); Calendar scheduleCutoffTime; if (scheduleCutoffTimeTemp == null) { scheduleCutoffTime = dateTimeService.getCurrentCalendar(); } else { scheduleCutoffTime = dateTimeService.getCalendar(scheduleCutoffTimeTemp); } String cutoffParameter = parameterService.getParameterValueAsString(ScheduleStep.class, KFSConstants.SystemGroupParameterNames.BATCH_SCHEDULE_CUTOFF_TIME); String[] scheduleStepCutoffTime = StringUtils.split(cutoffParameter, ":"); if (scheduleStepCutoffTime.length != 3 && scheduleStepCutoffTime.length != 4) { throw new IllegalArgumentException( "Error! The " + KFSConstants.SystemGroupParameterNames.BATCH_SCHEDULE_CUTOFF_TIME + " parameter had an invalid value: " + cutoffParameter); } // if there are 4 components, then we have an AM/PM delimiter // otherwise, assume 24-hour time if (scheduleStepCutoffTime.length == 4) { int hour = Integer.parseInt(scheduleStepCutoffTime[0]); // need to adjust for meaning of hour if (hour == 12) { hour = 0; } else { hour--; } scheduleCutoffTime.set(Calendar.HOUR, hour); if (StringUtils.containsIgnoreCase(scheduleStepCutoffTime[3], "AM")) { scheduleCutoffTime.set(Calendar.AM_PM, Calendar.AM); } else { scheduleCutoffTime.set(Calendar.AM_PM, Calendar.PM); } } else { scheduleCutoffTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(scheduleStepCutoffTime[0])); } scheduleCutoffTime.set(Calendar.MINUTE, Integer.parseInt(scheduleStepCutoffTime[1])); scheduleCutoffTime.set(Calendar.SECOND, Integer.parseInt(scheduleStepCutoffTime[2])); if (parameterService.getParameterValueAsBoolean(ScheduleStep.class, KFSConstants.SystemGroupParameterNames.BATCH_SCHEDULE_CUTOFF_TIME_IS_NEXT_DAY)) { scheduleCutoffTime.add(Calendar.DAY_OF_YEAR, 1); } boolean isPastScheduleCutoffTime = dateTime.after(scheduleCutoffTime); if (log) { LOG.info(new StringBuilder("isPastScheduleCutoffTime=").append(isPastScheduleCutoffTime) .append(" : ").append(dateTimeService.toDateTimeString(dateTime.getTime())).append(" / ") .append(dateTimeService.toDateTimeString(scheduleCutoffTime.getTime()))); } return isPastScheduleCutoffTime; } catch (NumberFormatException e) { throw new RuntimeException( "Caught exception while checking whether we've exceeded the schedule cutoff time", e); } catch (SchedulerException e) { throw new RuntimeException( "Caught exception while checking whether we've exceeded the schedule cutoff time", e); } }
From source file:org.kuali.kfs.sys.businessobject.lookup.ModuleLookupableHelperServiceImpl.java
@Override public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) { super.setBackLocation((String) fieldValues.get(KFSConstants.BACK_LOCATION)); super.setDocFormKey((String) fieldValues.get(KFSConstants.DOC_FORM_KEY)); List<ModuleService> modules = SpringContext.getBean(KualiModuleService.class).getInstalledModuleServices(); String codeValue = fieldValues.get("moduleCode"); String nameValue = fieldValues.get("moduleName"); List<KualiModuleBO> boModules = new ArrayList(); String tempNamespaceName;/*from ww w . j av a 2 s . co m*/ for (ModuleService mod : modules) { if (!StringUtils.isEmpty(nameValue) && !StringUtils .containsIgnoreCase(mod.getModuleConfiguration().getNamespaceCode(), nameValue)) { continue; } tempNamespaceName = SpringContext.getBean(KualiModuleService.class) .getNamespaceName(mod.getModuleConfiguration().getNamespaceCode()); if (!StringUtils.isEmpty(codeValue) && !StringUtils.containsIgnoreCase(tempNamespaceName, codeValue)) { continue; } boModules.add(new KualiModuleBO(mod.getModuleConfiguration().getNamespaceCode(), mod.getModuleConfiguration().getNamespaceCode(), tempNamespaceName)); } return boModules; }