Search in sources :

Example 11 with Party

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();
}
Also used : Party(org.estatio.module.party.dom.Party) TitleBuffer(org.apache.isis.applib.util.TitleBuffer) Document(org.incode.module.document.dom.impl.docs.Document)

Example 12 with Party

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;
}
Also used : Inject(javax.inject.Inject) NatureOfService(org.apache.isis.applib.annotation.NatureOfService) Party(org.estatio.module.party.dom.Party) SortedSet(java.util.SortedSet) DtoMappingHelper(org.apache.isis.applib.services.dto.DtoMappingHelper) CommunicationChannel(org.incode.module.communications.dom.impl.commchannel.CommunicationChannel) CommunicationChannelType(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelType) Optional(java.util.Optional) PartyDto(org.estatio.canonical.party.v1.PartyDto) DomainService(org.apache.isis.applib.annotation.DomainService) CommunicationChannelRepository(org.incode.module.communications.dom.impl.commchannel.CommunicationChannelRepository) Programmatic(org.apache.isis.applib.annotation.Programmatic) PartyDto(org.estatio.canonical.party.v1.PartyDto) CommunicationChannel(org.incode.module.communications.dom.impl.commchannel.CommunicationChannel) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 13 with Party

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;
}
Also used : AgreementType(org.estatio.module.agreement.dom.type.AgreementType) FinancialAccountType(org.estatio.module.financial.dom.FinancialAccountType) Party(org.estatio.module.party.dom.Party) AgreementRoleType(org.estatio.module.agreement.dom.role.AgreementRoleType) FinancialAccount(org.estatio.module.financial.dom.FinancialAccount) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Example 14 with Party

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;
}
Also used : Party(org.estatio.module.party.dom.Party) Organisation(org.estatio.module.party.dom.Organisation)

Example 15 with Party

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);
}
Also used : Party(org.estatio.module.party.dom.Party) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

Party (org.estatio.module.party.dom.Party)51 Programmatic (org.apache.isis.applib.annotation.Programmatic)22 Test (org.junit.Test)15 Property (org.estatio.module.asset.dom.Property)13 BankAccount (org.estatio.module.financial.dom.BankAccount)13 Organisation (org.estatio.module.party.dom.Organisation)13 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)10 Expectations (org.jmock.Expectations)10 AgreementRole (org.estatio.module.agreement.dom.AgreementRole)8 ArrayList (java.util.ArrayList)7 AgreementRoleType (org.estatio.module.agreement.dom.role.AgreementRoleType)7 Lease (org.estatio.module.lease.dom.Lease)6 CommunicationChannel (org.incode.module.communications.dom.impl.commchannel.CommunicationChannel)6 List (java.util.List)5 Inject (javax.inject.Inject)4 Action (org.apache.isis.applib.annotation.Action)4 Country (org.incode.module.country.dom.impl.Country)4 LocalDate (org.joda.time.LocalDate)4 Optional (java.util.Optional)3 SortedSet (java.util.SortedSet)3