Ejemplo n.º 1
0
  /**
   * Validates a collection of anything splitable. This implies that it contains <code>
   * {@link CreditSplit}</code> instances.
   *
   * @param splitable_it
   * @param creditType
   * @param greaterCummulative
   * @return boolean is valid?
   */
  public boolean validateCreditSplitable(
      Iterator<? extends CreditSplitable> splitable_it,
      InvestigatorCreditType creditType,
      DecimalHolder greaterCummulative) {
    if (!splitable_it.hasNext()) {
      return isCreditSplitTotalValid(greaterCummulative.getValue());
    }
    boolean retval = true;

    CreditSplitable splitable = splitable_it.next();
    info(VALIDATING_MESSAGE, getCreditSplitableName(splitable));

    DecimalHolder lesserCummulative = new DecimalHolder(KualiDecimal.ZERO);
    retval &=
        validateCreditSplit(splitable.getCreditSplits().iterator(), creditType, lesserCummulative);

    greaterCummulative.add(lesserCummulative);

    return retval & validateCreditSplitable(splitable_it, creditType, greaterCummulative);
  }
Ejemplo n.º 2
0
  /**
   * Validates a collection of anything splits. Negative values and values exceeding 100.00 are not
   * permissible.
   *
   * @param creditSplit_it
   * @param creditType
   * @param lesserCummulative
   * @return boolean <code>true</code> if it is a valid percentage (falls between 0.00 and 100.00)
   */
  public boolean validateCreditSplit(
      Iterator<? extends CreditSplit> creditSplit_it,
      InvestigatorCreditType creditType,
      DecimalHolder lesserCummulative) {
    if (!creditSplit_it.hasNext()) {
      return false;
    }

    CreditSplit creditSplit = creditSplit_it.next();
    if (creditType.getInvCreditTypeCode().equals(creditSplit.getInvCreditTypeCode())) {
      lesserCummulative.add(creditSplit.getCredit());
      info("Credit split is %s", creditSplit.getCredit());
      return isCreditSplitValid(creditSplit.getCredit());
    }

    return validateCreditSplit(creditSplit_it, creditType, lesserCummulative);
  }
Ejemplo n.º 3
0
 /** @see java.lang.Comparable#compareTo(java.lang.Object) */
 public int compareTo(DecimalHolder obj) {
   return value.compareTo(obj.getValue());
 }
Ejemplo n.º 4
0
 public void add(DecimalHolder val) {
   value = value.add(val.getValue());
 }