use of org.estatio.module.agreement.dom.type.AgreementType in project estatio by estatio.
the class AgreementRoleTypeRepository_Test method setup.
@Before
public void setup() {
agreementType = new AgreementType();
agreementRoleTypeRepository = new AgreementRoleTypeRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<AgreementRoleType> 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;
}
};
QueryResultsCache.Control control = new QueryResultsCache.Control();
control.on(new FixturesInstallingEvent(new FixtureScriptsDefault()));
final QueryResultsCache queryResultsCache = new QueryResultsCache() {
{
control = new Control();
}
};
agreementRoleTypeRepository.queryResultsCache = queryResultsCache;
}
use of org.estatio.module.agreement.dom.type.AgreementType in project estatio by estatio.
the class AgreementRoleCommunicationChannelTypeRepository method findOrCreate.
public AgreementRoleCommunicationChannelType findOrCreate(final IAgreementRoleCommunicationChannelType data, final IAgreementType IAgreementType) {
final String title = data.getTitle();
final AgreementType agreementType = agreementTypeRepository.findOrCreate(IAgreementType);
AgreementRoleCommunicationChannelType arcct = findByAgreementTypeAndTitle(agreementType, title);
if (arcct == null) {
arcct = getContainer().newTransientInstance(AgreementRoleCommunicationChannelType.class);
arcct.setTitle(title);
arcct.setAppliesTo(agreementType);
getContainer().persist(arcct);
}
return arcct;
}
use of org.estatio.module.agreement.dom.type.AgreementType in project estatio by estatio.
the class GuaranteeRepository method newGuarantee.
@Programmatic
public Guarantee newGuarantee(final Lease lease, @Parameter(regexPattern = ReferenceType.Meta.REGEX, regexPatternReplacement = ReferenceType.Meta.REGEX_DESCRIPTION) 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.find(GuaranteeAgreementRoleTypeEnum.GUARANTEE);
Party leasePrimaryParty = lease.getPrimaryParty();
AgreementRoleType artGuarantor = agreementRoleTypeRepository.find(GuaranteeAgreementRoleTypeEnum.GUARANTOR);
Party leaseSecondaryParty = lease.getSecondaryParty();
Guarantee guarantee = newTransientInstance(Guarantee.class);
final AgreementType at = agreementTypeRepository.find(GuaranteeAgreementTypeEnum.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 = financialAccountRepository.newFinancialAccount(financialAccountType, reference, name, leaseSecondaryParty);
guarantee.setFinancialAccount(financialAccount);
if (ObjectUtils.compare(startAmount, BigDecimal.ZERO) > 0) {
financialAccountTransactionRepository.newTransaction(guarantee.getFinancialAccount(), startDate, null, startAmount);
}
}
persistIfNotAlready(guarantee);
return guarantee;
}
use of org.estatio.module.agreement.dom.type.AgreementType 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.type.AgreementType 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;
}
Aggregations