Exemplo n.º 1
0
 public int compareTo(final FileDetails o) {
   if (o == null) {
     throw new NullPointerException();
   }
   // N.B. this is in reverse order to how we'd normally compare
   int result = o.getFile().compareTo(file);
   if (result == 0) {
     result = ObjectUtils.compare(o.getLastModified(), lastModified);
   }
   return result;
 }
Exemplo n.º 2
0
  public Guarantee newGuarantee(
      final Lease lease,
      final String reference,
      final String name,
      final GuaranteeType guaranteeType,
      final LocalDate startDate,
      final LocalDate endDate,
      final String description,
      final BigDecimal contractualAmount,
      final BigDecimal startAmount) {

    AgreementRoleType artGuarantee =
        agreementRoleTypeRepository.findByTitle(GuaranteeConstants.ART_GUARANTEE);
    Party leasePrimaryParty = lease.getPrimaryParty();

    AgreementRoleType artGuarantor =
        agreementRoleTypeRepository.findByTitle(GuaranteeConstants.ART_GUARANTOR);
    Party leaseSecondaryParty = lease.getSecondaryParty();

    Guarantee guarantee = newTransientInstance(Guarantee.class);
    final AgreementType at = agreementTypeRepository.find(GuaranteeConstants.AT_GUARANTEE);
    guarantee.setType(at);
    guarantee.setReference(reference);
    guarantee.setDescription(description);
    guarantee.setName(name);
    guarantee.setStartDate(startDate);
    guarantee.setEndDate(endDate);
    guarantee.setGuaranteeType(guaranteeType);
    guarantee.setLease(lease);
    guarantee.setContractualAmount(contractualAmount);

    guarantee.newRole(artGuarantee, leasePrimaryParty, null, null);
    guarantee.newRole(artGuarantor, leaseSecondaryParty, null, null);

    FinancialAccountType financialAccountType = guaranteeType.getFinancialAccountType();
    if (financialAccountType != null) {
      FinancialAccount financialAccount =
          financialAccounts.newFinancialAccount(
              financialAccountType, reference, name, leaseSecondaryParty);
      guarantee.setFinancialAccount(financialAccount);
      if (ObjectUtils.compare(startAmount, BigDecimal.ZERO) > 0) {
        financialAccountTransactions.newTransaction(
            guarantee.getFinancialAccount(), startDate, null, startAmount);
      }
    }

    persistIfNotAlready(guarantee);
    return guarantee;
  }
Exemplo n.º 3
0
 @Override
 public int compareTo(VirtualPath o) {
   return ObjectUtils.compare(toString(), o.toString());
 }