本文整理汇总了Java中org.kuali.rice.core.api.util.type.KualiDecimal.isPositive方法的典型用法代码示例。如果您正苦于以下问题:Java KualiDecimal.isPositive方法的具体用法?Java KualiDecimal.isPositive怎么用?Java KualiDecimal.isPositive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.core.api.util.type.KualiDecimal
的用法示例。
在下文中一共展示了KualiDecimal.isPositive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: continueIfSubcontractorTotalGreaterThanAwardTotal
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Checks if the {@link Subcontractor} total amount is greater than the award total. If so asks the user if they want to
* continue validation. if no is selected further validation is aborted and the user is returned to the award document.
*
* @return true if the user selects yes, false otherwise
*/
protected boolean continueIfSubcontractorTotalGreaterThanAwardTotal() {
boolean proceed = true;
KualiDecimal awardTotal = newAward.getAwardTotalAmount();
KualiDecimal subcontractorTotal = newAward.getAwardSubcontractorsTotalAmount();
if ((ObjectUtils.isNotNull(awardTotal) && subcontractorTotal.isGreaterThan(awardTotal)) || (ObjectUtils.isNull(awardTotal) && subcontractorTotal.isPositive())) {
String subcontracorLabel = dataDictionaryService.getCollectionLabel(Award.class, OLEPropertyConstants.AWARD_SUBCONTRACTORS);
String awardLabel = dataDictionaryService.getAttributeErrorLabel(Award.class, OLEPropertyConstants.AWARD_TOTAL_AMOUNT);
proceed = askOrAnalyzeYesNoQuestion("subcontractorTotalGreaterThanAwardTotal", buildConfirmationQuestion(OLEKeyConstants.WARNING_AWARD_SUBCONTRACTOR_TOTAL_GREATER_THAN_AWARD_TOTAL, subcontracorLabel, awardLabel));
}
return proceed;
}
示例2: getCustomerInvoiceOpenAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.integration.ar.AccountsReceivableModuleService#getCustomerInvoiceOpenAmount(java.util.List, java.lang.Integer, java.sql.Date)
*/
@Override
public Map<String, KualiDecimal> getCustomerInvoiceOpenAmount(List<String> customerTypeCodes, Integer customerInvoiceAge, Date invoiceDueDateFrom) {
Map<String, KualiDecimal> customerInvoiceOpenAmountMap = new HashMap<String, KualiDecimal>();
Collection<? extends AccountsReceivableCustomerInvoice> customerInvoiceDocuments = this.getOpenCustomerInvoices(customerTypeCodes, customerInvoiceAge, invoiceDueDateFrom);
if (ObjectUtils.isNull(customerInvoiceDocuments)) {
return customerInvoiceOpenAmountMap;
}
for (AccountsReceivableCustomerInvoice invoiceDocument : customerInvoiceDocuments) {
KualiDecimal openAmount = invoiceDocument.getOpenAmount();
if (ObjectUtils.isNotNull(openAmount) && openAmount.isPositive()) {
customerInvoiceOpenAmountMap.put(invoiceDocument.getDocumentNumber(), openAmount);
}
}
return customerInvoiceOpenAmountMap;
}
示例3: continueIfSubcontractorTotalGreaterThanAwardTotal
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Checks if the {@link Subcontractor} total amount is greater than the award total. If so asks the user if they want to
* continue validation. if no is selected further validation is aborted and the user is returned to the award document.
*
* @return true if the user selects yes, false otherwise
*/
protected boolean continueIfSubcontractorTotalGreaterThanAwardTotal() {
boolean proceed = true;
KualiDecimal awardTotal = newAward.getAwardTotalAmount();
KualiDecimal subcontractorTotal = newAward.getAwardSubcontractorsTotalAmount();
if ((ObjectUtils.isNotNull(awardTotal) && subcontractorTotal.isGreaterThan(awardTotal)) || (ObjectUtils.isNull(awardTotal) && subcontractorTotal.isPositive())) {
String subcontracorLabel = dataDictionaryService.getCollectionLabel(Award.class, KFSPropertyConstants.AWARD_SUBCONTRACTORS);
String awardLabel = dataDictionaryService.getAttributeErrorLabel(Award.class, KFSPropertyConstants.AWARD_TOTAL_AMOUNT);
proceed = askOrAnalyzeYesNoQuestion("subcontractorTotalGreaterThanAwardTotal", buildConfirmationQuestion(KFSKeyConstants.WARNING_AWARD_SUBCONTRACTOR_TOTAL_GREATER_THAN_AWARD_TOTAL, subcontracorLabel, awardLabel));
}
return proceed;
}
示例4: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean validate(AttributedDocumentEvent event) {
BigDecimal quantity = customerCreditMemoDetail.getCreditMemoItemQuantity();
KualiDecimal invoiceOpenItemAmount = customerCreditMemoDetail.getInvoiceOpenItemAmount();
KualiDecimal creditMemoItemAmount = customerCreditMemoDetail.getCreditMemoItemTotalAmount();
boolean isValid;
if (ObjectUtils.isNotNull(creditMemoItemAmount) && ObjectUtils.isNull(quantity)) {
// customer credit memo total amount must be greater than zero
isValid = creditMemoItemAmount.isPositive();
if (!isValid) {
GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + ArPropertyConstants.CustomerCreditMemoDocumentFields.CREDIT_MEMO_ITEM_TOTAL_AMOUNT, ArKeyConstants.ERROR_CUSTOMER_CREDIT_MEMO_DETAIL_ITEM_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
return false;
}
// customer credit memo total amount must not be greater than invoice open item total amount
isValid = creditMemoItemAmount.isLessEqual(invoiceOpenItemAmount);
if (!isValid) {
GlobalVariables.getMessageMap().putError(DOCUMENT_ERROR_PREFIX + ArPropertyConstants.CustomerCreditMemoDocumentFields.CREDIT_MEMO_ITEM_TOTAL_AMOUNT, ArKeyConstants.ERROR_CUSTOMER_CREDIT_MEMO_DETAIL_ITEM_AMOUNT_GREATER_THAN_INVOICE_ITEM_AMOUNT);
return false;
}
}
return true;
}
示例5: adjustValues
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This method will adjust the last accounting line to make the amounts sum up to the total.
*
* @param sourceAccountingList
* @param total
* @return
*/
protected List<TemSourceAccountingLine> adjustValues(List<TemSourceAccountingLine> sourceAccountingList, KualiDecimal total) {
KualiDecimal totalAmount = KualiDecimal.ZERO;
for (TemSourceAccountingLine newLine : sourceAccountingList) {
totalAmount = totalAmount.add(newLine.getAmount());
}
TemSourceAccountingLine line = sourceAccountingList.get(sourceAccountingList.size() - 1);
KualiDecimal remainderAmount = total.subtract(totalAmount);
if (remainderAmount.isPositive()) {
line.setAmount(line.getAmount().subtract(remainderAmount));
}
else if (remainderAmount.isNegative()) {
line.setAmount(line.getAmount().add(remainderAmount));
}
return sourceAccountingList;
}
示例6: isValidTransferAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* determine whether the amount to be tranferred is only up to the amount in ledger balance for a given pay period
*
* @param accountingDocument the given accounting document
* @return true if the amount to be tranferred is only up to the amount in ledger balance for a given pay period; otherwise,
* false
*/
protected boolean isValidTransferAmount(Map<String, ExpenseTransferAccountingLine> accountingLineGroupMap) {
Set<Entry<String, ExpenseTransferAccountingLine>> entrySet = accountingLineGroupMap.entrySet();
for (Entry<String, ExpenseTransferAccountingLine> entry : entrySet) {
ExpenseTransferAccountingLine accountingLine = entry.getValue();
Map<String, Object> fieldValues = this.buildFieldValueMap(accountingLine);
KualiDecimal balanceAmount = getBalanceAmount(fieldValues, accountingLine.getPayrollEndDateFiscalPeriodCode());
KualiDecimal transferAmount = accountingLine.getAmount();
// the tranferred amount cannot greater than the balance amount
if (balanceAmount.abs().isLessThan(transferAmount.abs())) {
return false;
}
// a positive amount cannot be transferred if the balance amount is negative
if (balanceAmount.isNegative() && transferAmount.isPositive()) {
return false;
}
}
return true;
}
示例7: canNegtiveAmountBeTransferred
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Determines whether a negtive amount can be transferred from one account to another
*
* @param accountingLineGroupMap the givenaccountingLineGroupMap
* @return true if a negtive amount can be transferred from one account to another; otherwise, false
*/
protected boolean canNegtiveAmountBeTransferred(Map<String, ExpenseTransferAccountingLine> accountingLineGroupMap) {
for (String key : accountingLineGroupMap.keySet()) {
ExpenseTransferAccountingLine accountingLine = accountingLineGroupMap.get(key);
Map<String, Object> fieldValues = this.buildFieldValueMap(accountingLine);
KualiDecimal balanceAmount = getBalanceAmount(fieldValues, accountingLine.getPayrollEndDateFiscalPeriodCode());
KualiDecimal transferAmount = accountingLine.getAmount();
// a negtive amount cannot be transferred if the balance amount is positive
if (transferAmount.isNegative() && balanceAmount.isPositive()) {
return false;
}
}
return true;
}
示例8: isDebitConsideringNothingPositiveOrNegative
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.sys.document.service.DebitDeterminerService#isDebitConsideringNothingPositiveOrNegative(org.kuali.kfs.sys.document.GeneralLedgerPendingEntrySource, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySourceDetail)
*/
@Override
public boolean isDebitConsideringNothingPositiveOrNegative(GeneralLedgerPendingEntrySource poster, GeneralLedgerPendingEntrySourceDetail postable) {
LOG.debug("isDebitConsideringNothingPositiveOrNegative(AccountingDocumentRuleBase, AccountingDocument, AccountingLine) - start");
boolean isDebit = false;
KualiDecimal amount = postable.getAmount();
boolean isPositiveAmount = amount.isPositive();
// isDebit if income/liability/expense/asset and line amount is positive
if (isPositiveAmount && (isIncomeOrLiability(postable) || isExpenseOrAsset(postable))) {
isDebit = true;
}
else {
isDebit = false;
}
LOG.debug("isDebitConsideringNothingPositiveOnly(AccountingDocumentRuleBase, AccountingDocument, AccountingLine) - end");
return isDebit;
}
示例9: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* For all CashReceiptFamilysDocument, the following rules on total amounts are required:
* 1. The the document net total must be greater than 0.
* 2. The document must be balanced, i.e. the document net total must be equal to the accounting line total;
* For Cash Receipt, since there could be change request, the total amount refers to the net total after change total is taken off.
* Following are the formula for various total amounts in Cash Receipt:
* net total = money in - money out
* money in = check + currency + coin
* money out = change currency + change coin
*
* @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent)
*/
@Override
public boolean validate(AttributedDocumentEvent event) {
CashReceiptFamilyBase cfd = getCashReceiptFamilyDocumentForValidation();
boolean isValid = true;
// For CR, we want to check the original total amount before it is confirmed; otherwise we check the confirmed total amount;
// this has been taken care of by its getTotalAmount(), so we don't need to check the doc status here.
// Also, since getTotalAmount() already takes care of returning the net total (i.e. with change total subtracted),
// we don't need subtract change total here either.
KualiDecimal totalAmount = cfd.getTotalDollarAmount();
// make sure that net reconciliation total is greater than zero
if (!totalAmount.isPositive()) {
isValid = false;
GlobalVariables.getMessageMap().putError(KFSConstants.GLOBAL_ERRORS, CashReceipt.ERROR_DOCUMENT_CASH_RECEIPT_NET_TOTAL_NOT_GREATER_THAN_ZERO);
}
// make sure the document is in balance
KualiDecimal accountingLineTotal = cfd.getSourceTotal();
if (totalAmount.compareTo(accountingLineTotal) != 0) {
isValid = false;
GlobalVariables.getMessageMap().putError(KFSConstants.GLOBAL_ERRORS, CashReceipt.ERROR_DOCUMENT_CASH_RECEIPT_BALANCE);
}
return isValid;
}
示例10: isDebitConsideringSectionAndTypePositiveOnly
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* @see org.kuali.ole.sys.document.service.DebitDeterminerService#isDebitConsideringSectionAndTypePositiveOnly(org.kuali.ole.sys.document.AccountingDocument, org.kuali.ole.sys.businessobject.AccountingLine)
*/
public boolean isDebitConsideringSectionAndTypePositiveOnly(AccountingDocument accountingDocument, AccountingLine accountingLine) {
LOG.debug("isDebitConsideringSectionAndTypePositiveOnly(AccountingDocumentRuleBase, AccountingDocument, AccountingLine) - start");
boolean isDebit = false;
KualiDecimal amount = accountingLine.getAmount();
boolean isPositiveAmount = amount.isPositive();
// non error correction - only allow amount >0
if (!isPositiveAmount && !isErrorCorrection(accountingDocument)) {
throw new IllegalStateException(isDebitCalculationIllegalStateExceptionMessage);
}
// source line
if (accountingLine.isSourceAccountingLine()) {
// could write below block in one line using == as XNOR operator, but that's confusing to read:
// isDebit = (rule.isIncomeOrLiability(accountingLine) == isPositiveAmount);
if (isPositiveAmount) {
isDebit = isIncomeOrLiability(accountingLine);
}
else {
isDebit = isExpenseOrAsset(accountingLine);
}
}
// target line
else {
if (accountingLine.isTargetAccountingLine()) {
if (isPositiveAmount) {
isDebit = isExpenseOrAsset(accountingLine);
}
else {
isDebit = isIncomeOrLiability(accountingLine);
}
}
else {
throw new IllegalArgumentException(isInvalidLineTypeIllegalArgumentExceptionMessage);
}
}
LOG.debug("isDebitConsideringSectionAndTypePositiveOnly(AccountingDocumentRuleBase, AccountingDocument, AccountingLine) - end");
return isDebit;
}
示例11: validateTransactionAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validates the entry's transaction amount
*
* @param originEntry the origin entry being scrubbed
* @param workingEntry the scrubbed version of the origin entry
* @return a Message if an error was encountered, otherwise null
*/
protected Message validateTransactionAmount(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
LOG.debug("validateTransactionAmount() started");
KualiDecimal amount = originEntry.getTransactionLedgerEntryAmount();
BalanceType originEntryBalanceType = accountingCycleCachingService.getBalanceType(originEntry.getFinancialBalanceTypeCode());
if (originEntryBalanceType == null) {
// We can't validate the amount without a balance type code
return null;
}
if (originEntryBalanceType.isFinancialOffsetGenerationIndicator()) {
if (amount.isPositive() || amount.isZero()) {
workingEntry.setTransactionLedgerEntryAmount(originEntry.getTransactionLedgerEntryAmount());
}
else {
return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_NEGATIVE_AMOUNT, amount.toString(), Message.TYPE_FATAL);
}
if (StringHelper.isEmpty(originEntry.getTransactionDebitCreditCode())) {
return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_NEITHER_D_NOR_C, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
}
if ( debitOrCredit.contains(originEntry.getTransactionDebitCreditCode()) ) {
workingEntry.setTransactionDebitCreditCode(originEntry.getTransactionDebitCreditCode());
}
else {
return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_NEITHER_D_NOR_C, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
}
}
else {
if ((originEntry.getTransactionDebitCreditCode() == null) || (" ".equals(originEntry.getTransactionDebitCreditCode())) || ("".equals(originEntry.getTransactionDebitCreditCode()))) {
workingEntry.setTransactionDebitCreditCode(OLEConstants.GL_BUDGET_CODE);
}
else {
return MessageBuilder.buildMessage(OLEKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_MUST_BE_SPACE, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
}
}
return null;
}
示例12: validate
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean validate(AttributedDocumentEvent event) {
KualiDecimal amount = customerInvoiceDetail.getAmount();
if (KualiDecimal.ZERO.equals(amount)) {
GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, ArKeyConstants.ERROR_CUSTOMER_INVOICE_DETAIL_TOTAL_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
return false;
}
else {
// else if amount is greater than or less than zero
if (customerInvoiceDocument.isInvoiceReversal()) {
if (customerInvoiceDetail.isDiscountLine() && amount.isNegative()) {
GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, ArKeyConstants.ERROR_CUSTOMER_INVOICE_DETAIL_TOTAL_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
return false;
}
else if (!customerInvoiceDetail.isDiscountLine() && amount.isPositive()) {
GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, ArKeyConstants.ERROR_CUSTOMER_INVOICE_DETAIL_TOTAL_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
return false;
}
}
else {
if (customerInvoiceDetail.isDiscountLine() && amount.isPositive()) {
GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, ArKeyConstants.ERROR_CUSTOMER_INVOICE_DETAIL_TOTAL_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
return false;
}
else if (!customerInvoiceDetail.isDiscountLine() && amount.isNegative()) {
GlobalVariables.getMessageMap().putError(KFSConstants.AMOUNT_PROPERTY_NAME, ArKeyConstants.ERROR_CUSTOMER_INVOICE_DETAIL_TOTAL_AMOUNT_LESS_THAN_OR_EQUAL_TO_ZERO);
return false;
}
}
}
return true;
}
示例13: getTotalApplied
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* This special casing for negative applieds is a display issue. We basically dont want to ever display that they applied a
* negative amount, even while they may have an unsaved document with negative applications that are failing validations.
*
* @return
*/
public KualiDecimal getTotalApplied() {
KualiDecimal totalApplied = getPaymentApplicationDocument().getTotalApplied();
if (totalApplied.isPositive()) {
return totalApplied;
}
else {
return KualiDecimal.ZERO;
}
}
示例14: validateTransactionAmount
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
/**
* Validates the entry's transaction amount
*
* @param originEntry the origin entry being scrubbed
* @param workingEntry the scrubbed version of the origin entry
* @return a Message if an error was encountered, otherwise null
*/
protected Message validateTransactionAmount(OriginEntryInformation originEntry, OriginEntryInformation workingEntry, AccountingCycleCachingService accountingCycleCachingService) {
LOG.debug("validateTransactionAmount() started");
KualiDecimal amount = originEntry.getTransactionLedgerEntryAmount();
BalanceType originEntryBalanceType = accountingCycleCachingService.getBalanceType(originEntry.getFinancialBalanceTypeCode());
if (originEntryBalanceType == null) {
// We can't validate the amount without a balance type code
return null;
}
if (originEntryBalanceType.isFinancialOffsetGenerationIndicator()) {
if (amount.isPositive() || amount.isZero()) {
workingEntry.setTransactionLedgerEntryAmount(originEntry.getTransactionLedgerEntryAmount());
}
else {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_NEGATIVE_AMOUNT, amount.toString(), Message.TYPE_FATAL);
}
if (StringHelper.isEmpty(originEntry.getTransactionDebitCreditCode())) {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_NEITHER_D_NOR_C, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
}
if ( debitOrCredit.contains(originEntry.getTransactionDebitCreditCode()) ) {
workingEntry.setTransactionDebitCreditCode(originEntry.getTransactionDebitCreditCode());
}
else {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_NEITHER_D_NOR_C, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
}
}
else {
if ((originEntry.getTransactionDebitCreditCode() == null) || (" ".equals(originEntry.getTransactionDebitCreditCode())) || ("".equals(originEntry.getTransactionDebitCreditCode()))) {
workingEntry.setTransactionDebitCreditCode(KFSConstants.GL_BUDGET_CODE);
}
else {
return MessageBuilder.buildMessage(KFSKeyConstants.ERROR_DEBIT_CREDIT_INDICATOR_MUST_BE_SPACE, originEntry.getTransactionDebitCreditCode(), Message.TYPE_FATAL);
}
}
return null;
}
示例15: isDebit
import org.kuali.rice.core.api.util.type.KualiDecimal; //导入方法依赖的package包/类
public boolean isDebit(GeneralLedgerPendingEntrySourceDetail postable) {
boolean debit = false;
AssetGlpeSourceDetail assetPostable = (AssetGlpeSourceDetail)postable;
KualiDecimal amount = assetPostable.getAmount();
if((assetPostable.isCapitalization() && amount.isNegative()) || (assetPostable.isAccumulatedDepreciation() && amount.isPositive()) || (assetPostable.isCapitalizationOffset() && amount.isPositive())) {
debit = true;
}
return debit;
}