use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class BankMandateImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final Lease lease = fetchLease(leaseReference);
BankAccount bankAccount;
BankMandate bankMandate = null;
// find or create bank account
final Party owner = lease.getSecondaryParty();
bankAccount = (BankAccount) financialAccountRepository.findByOwnerAndReference(owner, bankAccountReference);
if (bankAccount == null) {
bankAccount = bankAccountRepository.newBankAccount(owner, bankAccountReference, null);
}
if (reference != null) {
bankMandate = bankMandateRepository.findByReference(reference);
}
if (bankMandate == null) {
lease.newMandate(bankAccount, reference, startDate, endDate, SequenceType.valueOf(sequenceType), Scheme.valueOf(scheme), signatureDate);
bankMandate = lease.getPaidBy();
}
bankMandate.setBankAccount(bankAccount);
bankMandate.setReference(reference);
bankMandate.setName(name);
bankMandate.setStartDate(startDate);
bankMandate.setEndDate(endDate);
bankMandate.setSepaMandateIdentifier(sepaMandateIdentifier);
bankMandate.setSequenceType(SequenceType.valueOf(sequenceType));
bankMandate.setScheme(Scheme.valueOf(scheme));
bankMandate.setSignatureDate(signatureDate);
lease.paidBy(bankMandate);
return Lists.newArrayList(bankMandate);
}
use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class PartyRelationshipRepository method on.
// //////////////////////////////////////
/**
* Although this is an intra-module interaction, we use the subscriber because many of the other modules need to subscribe to this event also.
*/
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(final Party.DeleteEvent ev) {
Party sourceParty = ev.getSource();
Party replacementParty = ev.getReplacement();
switch(ev.getEventPhase()) {
case VALIDATE:
break;
case EXECUTING:
for (PartyRelationship partyRelationship : findByParty(sourceParty)) {
if (replacementParty == null) {
// Remove relationships when no replacement is provided
partyRelationship.doRemove();
} else {
if (partyRelationship.getFrom().equals(sourceParty)) {
partyRelationship.setFrom(replacementParty);
}
if (partyRelationship.getTo().equals(sourceParty)) {
partyRelationship.setTo(replacementParty);
}
}
}
break;
default:
break;
}
}
use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class AgreementCommunicationChannelLocator method onFile.
@Programmatic
public List<CommunicationChannel> onFile(final Agreement agreement, final String art, final List<CommunicationChannelType> communicationChannelTypes) {
final List<CommunicationChannel> communicationChannels = Lists.newArrayList();
final AgreementRoleType partyInRoleOf = agreementRoleTypeRepository.findByTitle(art);
final SortedSet<AgreementRole> agreementRoles = agreement.getRoles();
for (final AgreementRole role : agreementRoles) {
if (role.getType() == partyInRoleOf) {
final Party party = role.getParty();
final SortedSet<CommunicationChannel> channels = communicationChannelRepository.findByOwner(party);
for (CommunicationChannel channel : channels) {
if (communicationChannelTypes.contains(channel.getType())) {
communicationChannels.add(channel);
}
}
break;
}
}
return communicationChannels;
}
use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class InvoiceAttributesVM method getSellerBankAccountBankName.
@Programmatic
public String getSellerBankAccountBankName() {
FinancialAccount financialAccount = invoice.getSellerBankAccount();
if (!(financialAccount instanceof BankAccount)) {
return null;
}
final BankAccount bankAccount = (BankAccount) financialAccount;
Party bank = bankAccount.getBank();
if (bank == null) {
return null;
}
return bank.getName();
}
use of org.estatio.module.party.dom.Party in project estatio by estatio.
the class OrderItem_createInvoiceItemLink method choices0Act.
public List<IncomingInvoiceItem> choices0Act() {
// the disable guard ensures this is non-null
final Party seller = mixee.getOrdr().getSeller();
// candidates
final List<IncomingInvoiceItem> invoiceItems = invoiceItemRepository.findBySeller(seller);
// exclude any invoice items already linked to this order
invoiceItems.removeAll(orderItemInvoiceItemLinkRepository.findLinkedInvoiceItemsByOrderItem(mixee));
// exclude those where the net amount for the invoice item has already been linked to other order items
for (Iterator<IncomingInvoiceItem> iterator = invoiceItems.iterator(); iterator.hasNext(); ) {
final IncomingInvoiceItem invoiceItem = iterator.next();
final BigDecimal netAmountNotLinked = orderItemInvoiceItemLinkRepository.calculateNetAmountNotLinkedFromInvoiceItem(invoiceItem);
if (netAmountNotLinked.compareTo(BigDecimal.ZERO) <= 0) {
iterator.remove();
}
}
return invoiceItems;
}
Aggregations