@Test public void testGroupKeyCodeSetExtraction() { PayTypeBo pstnRptGrpBo = boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "1")); Set<String> extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet(); Assert.assertEquals(extractedGroupKeyCodeWithIdSet.size(), 2); Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("ISU-IA")); Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("UGA-GA")); pstnRptGrpBo = boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "5")); extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet(); Assert.assertEquals(2, extractedGroupKeyCodeWithIdSet.size()); Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("IU-IN")); Assert.assertTrue(extractedGroupKeyCodeWithIdSet.contains("UGA-GA")); pstnRptGrpBo = boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "2")); extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet(); Assert.assertTrue( (extractedGroupKeyCodeWithIdSet == null) || extractedGroupKeyCodeWithIdSet.isEmpty()); pstnRptGrpBo = boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "4")); extractedGroupKeyCodeWithIdSet = pstnRptGrpBo.getGroupKeyCodeSet(); Assert.assertTrue( (extractedGroupKeyCodeWithIdSet == null) || extractedGroupKeyCodeWithIdSet.isEmpty()); }
/** * Checks if there is another active security reporting group in the database with the same order * number * * @param reportingGroup the reporting group to validate * @return true if there is no othersecurity reporting group in the database with the same order * number, false otherwise */ public boolean validateReportingGroupOrder(SecurityReportingGroup reportingGroup) { boolean success = true; BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class); // get all the active security reporting groups in the database Map<String, String> fieldValues = new HashMap<String, String>(); fieldValues.put( EndowPropertyConstants.SECURITY_REPORTING_GROUP_ACTIVE_INFICATOR, Boolean.TRUE.toString()); fieldValues.put( EndowPropertyConstants.SECURITY_REPORTING_GROUP_ORDER, String.valueOf(reportingGroup.getSecurityReportingGrpOrder())); List<SecurityReportingGroup> dataToValidateList = new ArrayList<SecurityReportingGroup>( businessObjectService.findMatching(SecurityReportingGroup.class, fieldValues)); // iterate throught the retrieved list of reporting groups and check if there is another // reporting group with the same order // number for (SecurityReportingGroup record : dataToValidateList) { if (reportingGroup.getCode() != null && !reportingGroup.getCode().equals(record.getCode())) { putFieldError( EndowPropertyConstants.SECURITY_REPORTING_GROUP_ORDER, EndowKeyConstants.SecurityReportingGroupConstants .ERROR_SECURITY_REPORTING_GROUP_ORDER_DUPLICATE_VALUE); success = false; break; } } return success; }
/* * This method will set the values to award amount info xml object * attributes. */ private AwardAmountInfo getAwardAmountInfo(Award award) { AmountInfoType amountInfoType = null; AwardAmountInfo awardAmountInfo = AwardAmountInfo.Factory.newInstance(); List<AmountInfoType> amountInfoTypes = new ArrayList<AmountInfoType>(); AwardHierarchy branchNode = award.getAwardHierarchyService().loadFullHierarchyFromAnyNode(award.getParentNumber()); org.kuali.kra.award.home.AwardAmountInfo awardAmount = award.getLastAwardAmountInfo(); BusinessObjectService businessObjectService = KraServiceLocator.getService(BusinessObjectService.class); Collection<Award> awards = businessObjectService.findAll(Award.class); Award parentAward = null; for (Award awardParent : awards) { if (awardParent.getAwardNumber().equals(branchNode.getAwardNumber())) { parentAward = awardParent; break; } } if (branchNode != null) { amountInfoType = setAwardAmountInfo(parentAward, parentAward.getLastAwardAmountInfo()); amountInfoTypes = recurseTree(branchNode, amountInfoTypes); amountInfoTypes.add(0, amountInfoType); awardAmountInfo.setAmountInfoArray(amountInfoTypes.toArray(new AmountInfoType[0])); } return awardAmountInfo; }
/** * @org * .kuali.kfs.module.endow.document.service.CurrentTaxLotService#getCurrentTaxLotBalancesForMatchingSecurityClassCode(String) */ public Collection<CurrentTaxLotBalance> getCurrentTaxLotBalancesForMatchingSecurityClassCode( String securityClassCode) { Collection<CurrentTaxLotBalance> currentTaxLotBalances = new ArrayList(); Collection<Security> securities = new ArrayList(); if (StringUtils.isNotBlank(securityClassCode)) { Map criteria = new HashMap(); if (dataDictionaryService.getAttributeForceUppercase( Security.class, EndowPropertyConstants.SECURITY_CLASS_CODE)) { securityClassCode = securityClassCode.toUpperCase(); } criteria.put(EndowPropertyConstants.SECURITY_CLASS_CODE, securityClassCode); securities = businessObjectService.findMatching(Security.class, criteria); for (Security security : securities) { criteria.clear(); criteria.put(EndowPropertyConstants.CURRENT_TAX_LOT_BALANCE_SECURITY_ID, security.getId()); currentTaxLotBalances.addAll( businessObjectService.findMatching(HoldingHistory.class, criteria)); } } return currentTaxLotBalances; }
@Override public ActionForward reload( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BudgetForm budgetForm = (BudgetForm) form; // setBudgetPersonDefaultPeriodTypeCode(budgetForm); ActionForward actionForward = super.reload(mapping, form, request, response); BusinessObjectService bos = KraServiceLocator.getService(BusinessObjectService.class); BudgetDocument budgetDocument = budgetForm.getBudgetDocument(); Budget budget = budgetDocument.getBudget(); Map queryMap = new HashMap(); queryMap.put("budgetId", budget.getBudgetId()); Collection budgetPersons = bos.findMatching(BudgetPerson.class, queryMap); budget.setBudgetPersons(budgetPersons == null ? new ArrayList() : (List) budgetPersons); BudgetCategoryTypeValuesFinder budgetCategoryTypeValuesFinder = new BudgetCategoryTypeValuesFinder(); List<KeyValue> budgetCategoryTypes = new ArrayList<KeyValue>(); budgetCategoryTypes = budgetCategoryTypeValuesFinder.getKeyValues(); for (int i = 0; i < budgetCategoryTypes.size(); i++) { budgetForm.getNewBudgetLineItems().add(budget.getNewBudgetLineItem()); } budget.setBudgetCategoryTypeCodes(budgetCategoryTypes); return actionForward; }
/** * This overridden updates an existing Rule in the Repository * * @see * org.kuali.rice.krms.impl.repository.RuleBoService#updateRule(org.kuali.rice.krms.api.repository.rule.RuleDefinition) */ @Override public void updateRule(RuleDefinition rule) { if (rule == null) { throw new IllegalArgumentException("rule is null"); } // must already exist to be able to update final String ruleIdKey = rule.getId(); final RuleBo existing = businessObjectService.findBySinglePrimaryKey(RuleBo.class, ruleIdKey); if (existing == null) { throw new IllegalStateException("the rule does not exist: " + rule); } final RuleDefinition toUpdate; if (!existing.getId().equals(rule.getId())) { // if passed in id does not match existing id, correct it final RuleDefinition.Builder builder = RuleDefinition.Builder.create(rule); builder.setId(existing.getId()); toUpdate = builder.build(); } else { toUpdate = rule; } // copy all updateable fields to bo RuleBo boToUpdate = RuleBo.from(toUpdate); // delete any old, existing attributes Map<String, String> fields = new HashMap<String, String>(1); fields.put(PropertyNames.Rule.RULE_ID, toUpdate.getId()); businessObjectService.deleteMatching(RuleAttributeBo.class, fields); // update the rule and create new attributes businessObjectService.save(boToUpdate); }
/** * @see * org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#clearAllCurrentTaxLotRecords() * clears all the records from the CurrentTaxLotBalance table. */ public void clearAllCurrentTaxLotRecords() { Collection<CurrentTaxLotBalance> currentTaxLotBalances = businessObjectService.findAll(CurrentTaxLotBalance.class); for (CurrentTaxLotBalance currentTaxLotBalance : currentTaxLotBalances) { businessObjectService.delete(currentTaxLotBalance); } }
/** * @see org.kuali.kfs.module.endow.batch.service.AvailableCashUpdateService#clearAvailableCash() * Method to clear all the records in the kemidCurrentAvailableBalance table */ public void clearAllAvailableCash() { LOG.info("Step1: Clearing all available cash records"); Collection<KEMIDCurrentAvailableBalance> KEMIDCurrentAvailableBalances = businessObjectService.findAll(KEMIDCurrentAvailableBalance.class); for (KEMIDCurrentAvailableBalance kemidCurrentAvailableBalance : KEMIDCurrentAvailableBalances) { businessObjectService.delete(kemidCurrentAvailableBalance); } }
private String getRoleDescription(AwardUnitContact newUnitContact) { String roleDescription = ""; BusinessObjectService boService = KcServiceLocator.getService(BusinessObjectService.class); UnitAdministratorType aType = boService.findBySinglePrimaryKey( UnitAdministratorType.class, newUnitContact.getUnitAdministratorTypeCode()); if (aType != null) { roleDescription = aType.getDescription(); } return roleDescription; }
/** * @see * org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#updateReportedDate(String) */ @Override public void updateReportedDate(String docNumber) { HashMap<String, String> criteria = new HashMap<String, String>(); criteria.put("documentNumber", docNumber); CustomerInvoiceDocument customerInvoiceDocument = businessObjectService.findByPrimaryKey(CustomerInvoiceDocument.class, criteria); Date reportedDate = dateTimeService.getCurrentSqlDate(); if (ObjectUtils.isNotNull(customerInvoiceDocument)) { customerInvoiceDocument.setReportedDate(reportedDate); businessObjectService.save(customerInvoiceDocument); } }
@SuppressWarnings("deprecation") @ConfigureContext(shouldCommitTransactions = false) public void testOJBConfiguration() throws Exception { TemProfile profile = new TemProfile(); Integer newProfileId = sas.getNextAvailableSequenceNumber(TemConstants.TEM_PROFILE_SEQ_NAME).intValue(); profile.setProfileId(newProfileId); profile.getTemProfileAddress().setProfileId(newProfileId); profile.setCustomerNumber("555555555"); profile.setPrincipalId("66666666"); profile.setDateOfBirth(new Date(Date.parse("03/03/1975"))); profile.setCitizenship("United States"); profile.setDriversLicenseExpDate(new Date(Date.parse("03/03/2014"))); profile.setDriversLicenseNumber("B43212345"); profile.setUpdatedBy("jamey"); profile.setLastUpdate(new Date(Date.parse("03/03/2011"))); profile.setGender("M"); profile.setNonResidentAlien(false); profile.setHomeDeptChartOfAccountsCode("UA"); profile.setHomeDeptOrgCode("VPIT"); List<TravelerType> travelerTypes = (List<TravelerType>) businessObjectService.findMatching(TravelerType.class, new HashMap<String, Object>()); profile.setTravelerType(travelerTypes.get(0)); profile.setTravelerTypeCode(profile.getTravelerType().getCode()); businessObjectService.save(profile); Map<String, Object> values = new HashMap<String, Object>(); values.put(TemPropertyConstants.TemProfileProperties.PROFILE_ID, profile.getProfileId()); List<TemProfile> profileList = (List<TemProfile>) businessObjectService.findMatching(TemProfile.class, values); try { assertTrue(profile.getCustomerNumber().equals(profileList.get(0).getCustomerNumber())); assertTrue(profile.getPrincipalId().equals(profileList.get(0).getPrincipalId())); assertTrue(profile.getDateOfBirth().equals(profileList.get(0).getDateOfBirth())); assertTrue(profile.getCitizenship().equals(profileList.get(0).getCitizenship())); assertTrue( profile.getDriversLicenseExpDate().equals(profileList.get(0).getDriversLicenseExpDate())); assertTrue( profile.getDriversLicenseNumber().equals(profileList.get(0).getDriversLicenseNumber())); assertTrue(profile.getUpdatedBy().equals(profileList.get(0).getUpdatedBy())); assertTrue(profile.getLastUpdate().equals(profileList.get(0).getLastUpdate())); assertTrue(profile.getGender().equals(profileList.get(0).getGender())); assertTrue(profile.getNonResidentAlien().equals(profileList.get(0).getNonResidentAlien())); assertTrue(profile.getHomeDepartment().equals(profileList.get(0).getHomeDepartment())); } catch (Exception e) { assert (false); } }
/** * . This is the Setter Method for siteInvestigator * * @param siteInvestigator The siteInvestigator to set. */ public void setSiteInvestigator(Integer siteInvestigator) { if (siteInvestigator != null) { BusinessObjectService businessObjectService = KraServiceLocator.getService(BusinessObjectService.class); this.rolodex = (NonOrganizationalRolodex) businessObjectService.findByPrimaryKey( NonOrganizationalRolodex.class, getIdentifierMap(ROLODEX_ID_FIELD_NAME, siteInvestigator)); this.siteInvestigatorId = rolodex.getRolodexId().toString(); } this.siteInvestigator = siteInvestigator; }
/** * Returns true if exactly one instance of a given business object type exists in the Database; * false otherwise. * * @param boType * @param propertyName the name of the BO field to query * @param keyField the field to test against. * @return true if one object exists; false if no objects or more than one are found */ private boolean existsUnique( Class<? extends BusinessObject> boType, String propertyName, String keyField) { if (keyField != null) { BusinessObjectService businessObjectService = KcServiceLocator.getService(BusinessObjectService.class); Map<String, String> fieldValues = new HashMap<String, String>(); fieldValues.put(propertyName, keyField); if (businessObjectService.countMatching(boType, fieldValues) == 1) { return true; } } return false; }
@Test public void testKeyCodeSetOwnerAssignment() { PayTypeBo pstnRptGrpBo = boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "1")); for (PayTypeKeyBo keyBo : pstnRptGrpBo.getEffectiveKeySet()) { Assert.assertEquals(keyBo.getOwnerId(), "1"); } pstnRptGrpBo = boService.findByPrimaryKey(PayTypeBo.class, Collections.singletonMap("hrPayTypeId", "5")); for (PayTypeKeyBo keyBo : pstnRptGrpBo.getEffectiveKeySet()) { Assert.assertEquals(keyBo.getOwnerId(), "5"); } }
/** * . This is the Getter Method for siteinvestigator * * @return Returns the siteInvestigator. */ public Integer getSiteInvestigator() { if (siteInvestigator != null) { BusinessObjectService businessObjectService = KraServiceLocator.getService(BusinessObjectService.class); this.rolodex = (Rolodex) businessObjectService.findByPrimaryKey( Rolodex.class, getIdentifierMap(ROLODEX_ID_FIELD_NAME, siteInvestigator)); this.siteInvestigatorId = rolodex.getRolodexId().toString(); } else { this.rolodex = null; } return siteInvestigator; }
public int loadTransactionIntoOriginEntryTable(OriginEntryGroup group) { int numberOfInputData = Integer.valueOf(properties.getProperty("numOfData")); businessObjectService.save(group); int[] fieldLength = this.getFieldLength(fieldLengthList); List<LaborOriginEntry> originEntries = this.loadInputData( LaborOriginEntry.class, "data", numberOfInputData, keyFieldList, fieldLength); for (LaborOriginEntry entry : originEntries) { entry.setEntryGroupId(group.getId()); } businessObjectService.save(originEntries); return originEntries.size(); }
@Override public <T> Collection<T> findMatchingOrderBy( Class<T> clazz, Map<String, ?> fieldValues, String sortField, boolean sortAscending) { return (Collection<T>) businessObjectService.findMatchingOrderBy( (Class<BusinessObject>) clazz, fieldValues, sortField, sortAscending); }
/** * @see * org.kuali.kfs.module.tem.batch.service.CreditCardDataImportService#importCreditCardDataFile(java.lang.String, * org.kuali.kfs.sys.batch.BatchInputFileType) */ @Override public boolean importCreditCardDataFile(String dataFileName, BatchInputFileType inputFileType) { try { FileInputStream fileContents = new FileInputStream(dataFileName); byte[] fileByteContent = IOUtils.toByteArray(fileContents); CreditCardImportData creditCardData = (CreditCardImportData) batchInputFileService.parse(inputFileType, fileByteContent); IOUtils.closeQuietly(fileContents); LOG.info("Credit Card Import - validating: " + dataFileName); List<CreditCardStagingData> validCreditCardList = validateCreditCardData(creditCardData, dataFileName); if (!validCreditCardList.isEmpty()) { businessObjectService.save(validCreditCardList); } } catch (Exception ex) { LOG.error("Failed to process the file : " + dataFileName, ex); moveErrorFile(dataFileName, creditCardDataFileErrorDirectory); return false; } finally { removeDoneFiles(dataFileName); } return true; }
/** * @org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getAllCurrentTaxLotBalance() */ public Collection<CurrentTaxLotBalance> getAllCurrentTaxLotBalance() { Collection<CurrentTaxLotBalance> currentTaxLotBalances = new ArrayList(); currentTaxLotBalances = businessObjectService.findAll(CurrentTaxLotBalance.class); return currentTaxLotBalances; }
/** * @see * org.kuali.kfs.module.endow.document.service.CurrentTaxLotService#getByPrimaryKey(java.lang.String, * java.lang.String, java.lang.String, int, java.lang.String) */ public void updateCurrentTaxLotBalance(CurrentTaxLotBalance currentTaxLotBalance) { if (currentTaxLotBalance == null) { throw new IllegalArgumentException("invalid (null) currentTaxLotBalance"); } businessObjectService.save(currentTaxLotBalance); }
@Override public void setUp() throws Exception { super.setUp(); String messageFileName = LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/message.properties"; String propertiesFileName = LaborTestDataPropertyConstants.TEST_DATA_PACKAGE_NAME + "/laborGLLedgerEntryPoster.properties"; properties = TestDataPreparator.loadPropertiesFromClassPath(propertiesFileName); fieldNames = properties.getProperty("fieldNames"); deliminator = properties.getProperty("deliminator"); keyFieldList = Arrays.asList(StringUtils.split(fieldNames, deliminator)); laborGLLedgerEntryPoster = SpringContext.getBean(PostTransaction.class, "laborGLLedgerEntryPoster"); businessObjectService = SpringContext.getBean(BusinessObjectService.class); originEntryGroupService = SpringContext.getBean(LaborOriginEntryGroupService.class); laborGeneralLedgerEntryService = SpringContext.getBean(LaborGeneralLedgerEntryService.class); DateTimeService dateTimeService = SpringContext.getBean(DateTimeService.class); // TODO:- commented out // group1 = originEntryGroupService.createGroup(dateTimeService.getCurrentSqlDate(), // LABOR_MAIN_POSTER_VALID, false, false, false); today = dateTimeService.getCurrentDate(); LaborGeneralLedgerEntry cleanup = new LaborGeneralLedgerEntry(); ObjectUtil.populateBusinessObject(cleanup, properties, "dataCleanup", fieldNames, deliminator); fieldValues = ObjectUtil.buildPropertyMap( cleanup, Arrays.asList(StringUtils.split(fieldNames, deliminator))); businessObjectService.deleteMatching(LaborGeneralLedgerEntry.class, fieldValues); }
/** * This method tests whether a Organization BO with a given organization name exists. * * @param organizationName * @return */ private boolean validateOrganizationExists(String organizationName) { BusinessObjectService businessObjectService = KraServiceLocator.getService(BusinessObjectService.class); Map<String, String> fieldValues = new HashMap<String, String>(); fieldValues.put("organizationName", organizationName); boolean isValid = true; if (businessObjectService.countMatching(Organization.class, fieldValues) != 1) { this.reportError( NEW_AWARD_APPROVED_SUBAWARD + ORGANIZATION_NAME, KeyConstants.ERROR_ORGANIZATION_NAME_IS_INVALID, new String[] {organizationName}); return false; } return isValid; }
/** * @see * org.kuali.kfs.module.ar.document.service.AccountsReceivableTaxService#getPostalCodeForTaxation(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument) */ @Override public String getPostalCodeForTaxation(CustomerInvoiceDocument document) { String postalCode = null; String customerNumber = document.getAccountsReceivableDocumentHeader().getCustomerNumber(); Integer shipToAddressIdentifier = document.getCustomerShipToAddressIdentifier(); // if customer number or ship to address id isn't provided, go to org options if (ObjectUtils.isNotNull(shipToAddressIdentifier) && StringUtils.isNotEmpty(customerNumber)) { CustomerAddressService customerAddressService = SpringContext.getBean(CustomerAddressService.class); CustomerAddress customerShipToAddress = customerAddressService.getByPrimaryKey(customerNumber, shipToAddressIdentifier); if (ObjectUtils.isNotNull(customerShipToAddress)) { postalCode = customerShipToAddress.getCustomerZipCode(); } } else { Map<String, String> criteria = new HashMap<String, String>(); criteria.put("chartOfAccountsCode", document.getBillByChartOfAccountCode()); criteria.put("organizationCode", document.getBilledByOrganizationCode()); OrganizationOptions organizationOptions = (OrganizationOptions) businessObjectService.findByPrimaryKey(OrganizationOptions.class, criteria); if (ObjectUtils.isNotNull(organizationOptions)) { postalCode = organizationOptions.getOrganizationPostalZipCode(); } } return postalCode; }
@Override public List<SubAward> getLinkedSubAwards(Award award) { Map<String, Object> values = new HashMap<String, Object>(); values.put("awardId", award.getAwardId()); Collection<SubAwardFundingSource> subAwardFundingSources = businessObjectService.findMatching(SubAwardFundingSource.class, values); Set<String> subAwardSet = new TreeSet<String>(); for (SubAwardFundingSource subAwardFundingSource : subAwardFundingSources) { subAwardSet.add(subAwardFundingSource.getSubAward().getSubAwardCode()); } List<SubAward> subAwards = new ArrayList<SubAward>(); for (String subAwardCode : subAwardSet) { VersionHistory activeVersion = getVersionHistoryService().findActiveVersion(SubAward.class, subAwardCode); if (activeVersion == null) { VersionHistory pendingVersion = getVersionHistoryService().findPendingVersion(SubAward.class, subAwardCode); if (pendingVersion != null) { subAwards.add((SubAward) pendingVersion.getSequenceOwner()); } } else { subAwards.add((SubAward) activeVersion.getSequenceOwner()); } } return subAwards; }
protected void buildSubTree( String principalName, BudgetConstructionOrganizationReports bcOrgRpts, int curLevel) { curLevel++; BudgetConstructionPullup bcPullup = new BudgetConstructionPullup(); bcPullup.setPrincipalId(principalName); bcPullup.setChartOfAccountsCode(bcOrgRpts.getChartOfAccountsCode()); bcPullup.setOrganizationCode(bcOrgRpts.getOrganizationCode()); bcPullup.setReportsToChartOfAccountsCode(bcOrgRpts.getReportsToChartOfAccountsCode()); bcPullup.setReportsToOrganizationCode(bcOrgRpts.getReportsToOrganizationCode()); bcPullup.setPullFlag(new Integer(0)); businessObjectService.save(bcPullup); if (curLevel <= MAXLEVEL) { // getActiveChildOrgs does not return orgs that report to themselves List childOrgs = budgetConstructionOrganizationReportsService.getActiveChildOrgs( bcOrgRpts.getChartOfAccountsCode(), bcOrgRpts.getOrganizationCode()); if (childOrgs.size() > 0) { for (Iterator iter = childOrgs.iterator(); iter.hasNext(); ) { BudgetConstructionOrganizationReports bcOrg = (BudgetConstructionOrganizationReports) iter.next(); buildSubTree(principalName, bcOrg, curLevel); } } } else { LOG.warn( String.format( "\n%s/%s reports to organization more than maxlevel of %d", bcOrgRpts.getChartOfAccountsCode(), bcOrgRpts.getOrganizationCode(), MAXLEVEL)); } }
/** * @see * org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#getInvoicesByCustomerNumber(java.lang.String) */ @Override public Collection<CustomerInvoiceDocument> getCustomerInvoiceDocumentsByCustomerNumber( String customerNumber) { Collection<CustomerInvoiceDocument> invoices = new ArrayList<CustomerInvoiceDocument>(); Map<String, String> fieldValues = new HashMap<String, String>(); fieldValues.put("customerNumber", customerNumber); Collection<AccountsReceivableDocumentHeader> documentHeaders = businessObjectService.findMatching(AccountsReceivableDocumentHeader.class, fieldValues); List<String> documentHeaderIds = new ArrayList<String>(); for (AccountsReceivableDocumentHeader header : documentHeaders) { documentHeaderIds.add(header.getDocumentHeader().getDocumentNumber()); } if (0 < documentHeaderIds.size()) { try { for (Document doc : documentService.getDocumentsByListOfDocumentHeaderIds( CustomerInvoiceDocument.class, documentHeaderIds)) { invoices.add((CustomerInvoiceDocument) doc); } } catch (WorkflowException e) { LOG.error("getCustomerInvoiceDocumentsByCustomerNumber " + customerNumber + " failed", e); } } return invoices; }
/** * @see * org.kuali.kfs.module.endow.batch.service.AvailableCashUpdateService#InsertAvailableCash(KemidCurrentCash) * Method to clear all the records in the kemidCurrentAvailableBalance table */ public void InsertAvailableCash(KEMIDCurrentAvailableBalance kemidCurrentAvailableBalance) { if (kemidCurrentAvailableBalance == null) { throw new IllegalArgumentException("invalid (null) kemidCurrentAvailableBalance"); } businessObjectService.save(kemidCurrentAvailableBalance); }
/** * @see * org.kuali.kfs.module.ar.document.service.CustomerInvoiceDocumentService#getOriginalTotalAmountForCustomerInvoiceDocument(org.kuali.kfs.module.ar.document.CustomerInvoiceDocument) */ @Override public KualiDecimal getOriginalTotalAmountForCustomerInvoiceDocument( CustomerInvoiceDocument customerInvoiceDocument) { LOG.info( "\n\n\n\t\t invoice: " + customerInvoiceDocument.getDocumentNumber() + "\n\t\t 111111111 HEADER TOTAL AMOUNT (should be null): " + customerInvoiceDocument .getFinancialSystemDocumentHeader() .getFinancialDocumentTotalAmount() + "\n\n"); customerInvoiceDocument.getDocumentNumber(); HashMap criteria = new HashMap(); criteria.put( KFSPropertyConstants.DOCUMENT_NUMBER, customerInvoiceDocument.getDocumentHeader().getDocumentTemplateNumber()); FinancialSystemDocumentHeader financialSystemDocumentHeader = businessObjectService.findByPrimaryKey(FinancialSystemDocumentHeader.class, criteria); KualiDecimal originalTotalAmount = KualiDecimal.ZERO; originalTotalAmount = financialSystemDocumentHeader.getFinancialDocumentTotalAmount(); LOG.info( "\n\n\n\t\t invoice: " + customerInvoiceDocument.getDocumentNumber() + "\n\t\t 333333333333 HEADER TOTAL AMOUNT (should be set now): " + customerInvoiceDocument .getFinancialSystemDocumentHeader() .getFinancialDocumentTotalAmount() + "\n\n"); return originalTotalAmount; }
/** * This method looks up the default table * * @param String unitNumber * @return AccountAutoCreateDefaults */ protected AccountAutoCreateDefaults getAccountDefaults(String unitNumber) { AccountAutoCreateDefaults defaults = null; if (unitNumber == null || unitNumber.isEmpty()) { return null; } Map<String, String> criteria = new HashMap<String, String>(); criteria.put("kcUnit", unitNumber); defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria); // if the matching defaults is null, try the parents in the hierarchy if (defaults == null) { List<String> parentUnits = null; try { parentUnits = SpringContext.getBean(ContractsAndGrantsModuleService.class).getParentUnits(unitNumber); } catch (Exception ex) { LOG.error( KcUtils.getErrorMessage( KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, null) + ": " + ex.getMessage()); GlobalVariables.getMessageMap() .putError( KcConstants.AccountCreationService.ERROR_KC_ACCOUNT_PARAMS_UNIT_NOTFOUND, "kcUnit", ex.getMessage()); } if (parentUnits != null) { for (String unit : parentUnits) { criteria.put("kcUnit", unit); defaults = businessObjectService.findByPrimaryKey(AccountAutoCreateDefaults.class, criteria); if (defaults != null) { break; } } } } return defaults; }
public static List<KeyValue> initProfileDetailsForBatchDelete() { List<KeyValue> keyValues = new ArrayList<KeyValue>(); BusinessObjectService businessObjectService = KRADServiceLocator.getBusinessObjectService(); Map parentCriteria1 = new HashMap(); parentCriteria1.put("batchProcessProfileType", "Batch Delete"); List<OLEBatchProcessProfileBo> oleBatchProcessProfileBo = (List<OLEBatchProcessProfileBo>) businessObjectService.findMatching(OLEBatchProcessProfileBo.class, parentCriteria1); keyValues.add(new ConcreteKeyValue("", "")); for (OLEBatchProcessProfileBo profileBo : oleBatchProcessProfileBo) { keyValues.add( new ConcreteKeyValue( profileBo.getBatchProcessProfileName(), profileBo.getBatchProcessProfileId())); } return keyValues; }