use of org.estatio.module.agreement.dom.role.AgreementRoleType in project estatio by estatio.
the class Lease method existingBankMandatesForTenant.
@SuppressWarnings({ "unchecked", "rawtypes" })
private List<BankMandate> existingBankMandatesForTenant() {
final AgreementRole tenantRole = getSecondaryAgreementRole();
if (tenantRole == null || !tenantRole.isCurrent()) {
return Collections.emptyList();
}
final Party tenant = partyOf(tenantRole);
final AgreementType bankMandateAgreementType = bankMandateAgreementType();
final AgreementRoleType debtorRoleType = debtorRoleType();
return (List) agreementRepository.findByAgreementTypeAndRoleTypeAndParty(bankMandateAgreementType, debtorRoleType, tenant);
}
use of org.estatio.module.agreement.dom.role.AgreementRoleType in project estatio by estatio.
the class BankMandateRepository method newBankMandate.
// //////////////////////////////////////
public BankMandate newBankMandate(final String reference, final String name, final LocalDate startDate, final LocalDate endDate, final Party debtor, final Party creditor, final BankAccount bankAccount, final SequenceType sequenceType, final Scheme scheme, final LocalDate signatureDate) {
BankMandate mandate = newTransientInstance();
mandate.setType(agreementTypeRepository.find(BankMandateAgreementTypeEnum.MANDATE));
mandate.setReference(reference);
mandate.setName(name);
mandate.setStartDate(startDate);
mandate.setEndDate(endDate);
mandate.setBankAccount(bankAccount);
mandate.setSequenceType(sequenceType);
mandate.setScheme(scheme);
mandate.setSignatureDate(signatureDate);
// app tenancy derived from the debtor
mandate.setApplicationTenancyPath(debtor.getApplicationTenancy().getPath());
persistIfNotAlready(mandate);
final AgreementRoleType artCreditor = agreementRoleTypeRepository.find(BankMandateAgreementRoleTypeEnum.CREDITOR);
mandate.newRole(artCreditor, creditor, null, null);
final AgreementRoleType artDebtor = agreementRoleTypeRepository.find(BankMandateAgreementRoleTypeEnum.DEBTOR);
mandate.newRole(artDebtor, debtor, null, null);
return mandate;
}
use of org.estatio.module.agreement.dom.role.AgreementRoleType in project estatio by estatio.
the class PartyBankAccountsAndMandatesDtoFactory method newDto.
@Programmatic
public BankAccountsAndMandatesDto newDto(final Party party) {
final BankAccountsAndMandatesDto dto = new BankAccountsAndMandatesDto();
final List<FinancialAccount> financialAccountList = financialAccountRepository.findAccountsByTypeOwner(FinancialAccountType.BANK_ACCOUNT, party);
final List<BankAccountDto> bankAccountDtos = financialAccountList.stream().map(x -> bankAccountDtoFactory.newDto((BankAccount) x)).collect(Collectors.toList());
dto.setBankAccounts(bankAccountDtos);
final AgreementType bankMandateAt = agreementTypeRepository.find(BankMandateAgreementTypeEnum.MANDATE);
final AgreementRoleType debtorOfMandate = agreementRoleTypeRepository.findByAgreementTypeAndTitle(bankMandateAt, BankMandateAgreementRoleTypeEnum.DEBTOR.getTitle());
final List<AgreementRole> agreementRoles = agreementRoleRepository.findByPartyAndType(party, debtorOfMandate);
final List<BankMandateDto> mandateDtos = agreementRoles.stream().map(x -> x.getAgreement()).map(x -> bankMandateDtoFactory.newDto((BankMandate) x)).collect(Collectors.toList());
dto.setBankMandates(mandateDtos);
return dto;
}
use of org.estatio.module.agreement.dom.role.AgreementRoleType in project estatio by estatio.
the class AgreementRepository_Test method setup.
@Before
public void setup() {
agreementType = new AgreementType();
agreementRoleType = new AgreementRoleType();
party = new PartyForTesting();
agreementRepository = new AgreementRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<Agreement> allInstances() {
finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
return null;
}
@Override
protected <T> List<T> allMatches(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
return null;
}
};
}
use of org.estatio.module.agreement.dom.role.AgreementRoleType in project estatio by estatio.
the class GuaranteeBuilder method execute.
@Override
protected void execute(ExecutionContext ec) {
checkParam("lease", ec, Lease.class);
checkParam("reference", ec, String.class);
defaultParam("name", ec, getReference());
checkParam("guaranteeType", ec, GuaranteeType.class);
checkParam("startDate", ec, LocalDate.class);
checkParam("endDate", ec, LocalDate.class);
checkParam("description", ec, String.class);
checkParam("contractualAmount", ec, BigDecimal.class);
final Guarantee guarantee = guaranteeRepository.newGuarantee(lease, reference, name, guaranteeType, startDate, endDate, description, contractualAmount, startAmount);
ec.addResult(this, guarantee);
object = guarantee;
final AgreementRoleType bankRoleType = agreementRoleTypeRepository.find(GuaranteeAgreementRoleTypeEnum.BANK);
this.bankRole = guarantee.createRole(bankRoleType, bank, bankRoleStartDate, bankRoleEndDate);
}
Aggregations