use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class IncomingInvoice method title.
public String title() {
final TitleBuffer buf = new TitleBuffer();
final Optional<Document> document = lookupAttachedPdfService.lookupIncomingInvoicePdfFrom(this);
document.ifPresent(d -> buf.append(d.getName()));
final Party seller = getSeller();
if (seller != null) {
buf.append(": ", seller);
}
final String invoiceNumber = getInvoiceNumber();
if (invoiceNumber != null) {
buf.append(", ", invoiceNumber);
}
return buf.toString();
}
use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class PartyDtoFactory method newDto.
@Programmatic
public PartyDto newDto(final Party party) {
PartyDto dto = new PartyDto();
dto.setSelf(mappingHelper.oidDtoFor(party));
dto.setName(party.getName());
dto.setReference(party.getReference());
final SortedSet<CommunicationChannel> postalAddresses = communicationChannelRepository.findByOwnerAndType(party, CommunicationChannelType.POSTAL_ADDRESS);
final Optional<CommunicationChannel> postalAddressIfAny = postalAddresses.stream().filter(x -> x.isLegal()).findFirst();
if (postalAddressIfAny.isPresent()) {
dto.setLegalPostalAddress(mappingHelper.oidDtoFor(postalAddressIfAny.get()));
}
return dto;
}
use of org.estatio.module.party.dom.Party 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.party.dom.Party in project estatio by estatio.
the class EstatioApplicationTenancyRepositoryForLease_Test method partyWith.
private Party partyWith(final String hello) {
Party pa = new Organisation();
pa.setReference(hello);
return pa;
}
use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class InvoiceForLeaseRepository method findOrCreateMatchingInvoice.
@Programmatic
public InvoiceForLease findOrCreateMatchingInvoice(final ApplicationTenancy applicationTenancy, final PaymentMethod paymentMethod, final Lease lease, final InvoiceStatus invoiceStatus, final LocalDate dueDate, final String interactionId) {
Party buyer = lease.getSecondaryParty();
Party seller = lease.getPrimaryParty();
return findOrCreateMatchingInvoice(applicationTenancy, seller, buyer, paymentMethod, lease, invoiceStatus, dueDate, interactionId);
}
Aggregations