Search in sources :

Example 36 with Party

use of org.estatio.module.party.dom.Party in project estatio by estatio.

the class Invoice_DocumentManagement_IntegTest method findInvoice.

Invoice findInvoice(final InvoiceStatus invoiceStatus) {
    // clears out queryResultsCache
    transactionService.nextTransaction();
    final Party seller = InvoiceForLease_enum.OxfPoison003Gb.getSeller_d().findUsing(serviceRegistry);
    final Party buyer = InvoiceForLease_enum.OxfPoison003Gb.getBuyer_d().findUsing(serviceRegistry);
    final Lease lease = InvoiceForLease_enum.OxfPoison003Gb.getLease_d().findUsing(serviceRegistry);
    final LocalDate invoiceStartDate = InvoiceForLease_enum.OxfPoison003Gb.getLease_d().getStartDate().plusYears(1);
    List<InvoiceForLease> matchingInvoices = findMatchingInvoices(seller, buyer, lease, invoiceStartDate, invoiceStatus);
    assertThat(matchingInvoices.size()).isLessThanOrEqualTo(1);
    return matchingInvoices.isEmpty() ? null : matchingInvoices.get(0);
}
Also used : Party(org.estatio.module.party.dom.Party) Lease(org.estatio.module.lease.dom.Lease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) InvoiceForLease(org.estatio.module.lease.dom.invoicing.InvoiceForLease) LocalDate(org.joda.time.LocalDate)

Example 37 with Party

use of org.estatio.module.party.dom.Party in project estatio by estatio.

the class Lease method newMandate.

// //////////////////////////////////////
public Lease newMandate(final BankAccount bankAccount, @Parameter(regexPattern = org.incode.module.base.dom.types.ReferenceType.Meta.REGEX, regexPatternReplacement = org.incode.module.base.dom.types.ReferenceType.Meta.REGEX_DESCRIPTION) final String reference, final LocalDate startDate, @Parameter(optionality = Optionality.OPTIONAL) final LocalDate endDate, final SequenceType sequenceType, final Scheme scheme, final LocalDate signatureDate) {
    final Party creditor = getPrimaryParty();
    final Party debtor = getSecondaryParty();
    final BankMandate bankMandate = bankMandateRepository.newBankMandate(reference, reference, startDate, endDate, debtor, creditor, bankAccount, sequenceType, scheme, signatureDate);
    paidBy(bankMandate);
    return this;
}
Also used : Party(org.estatio.module.party.dom.Party) BankMandate(org.estatio.module.bankmandate.dom.BankMandate)

Example 38 with Party

use of org.estatio.module.party.dom.Party in project estatio by estatio.

the class PartyRole method remove.

@Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE)
public Party remove() {
    Party party = getParty();
    remove(this);
    return party;
}
Also used : Party(org.estatio.module.party.dom.Party) Action(org.apache.isis.applib.annotation.Action)

Example 39 with Party

use of org.estatio.module.party.dom.Party in project estatio by estatio.

the class PartyDtoFactory_Test method happy_case.

@Test
public void happy_case() throws Exception {
    // given
    final Party p = new Organisation();
    p.setReference("12345678");
    p.setName("New Company");
    // expecting
    final OidDto partyOidDto = new OidDto();
    context.checking(new Expectations() {

        {
            oneOf(mockDtoMappingHelper).oidDtoFor(p);
            will(returnValue(partyOidDto));
            oneOf(mockCommunicationChannelRepository).findByOwnerAndType(p, CommunicationChannelType.POSTAL_ADDRESS);
            will(returnValue(Collections.emptySortedSet()));
        }
    });
    // when
    PartyDto partyDto = partyDtoFactory.newDto(p);
    // and when roundtrip
    String xml = jaxbService.toXml(partyDto);
    PartyDto partyDtoAfter = jaxbService.fromXml(PartyDto.class, xml);
    // then
    assertThat(partyDtoAfter.getName()).isEqualTo(p.getName());
    assertThat(partyDtoAfter.getReference()).isEqualTo(p.getReference());
}
Also used : Expectations(org.jmock.Expectations) OidDto(org.apache.isis.schema.common.v1.OidDto) Party(org.estatio.module.party.dom.Party) Organisation(org.estatio.module.party.dom.Organisation) PartyDto(org.estatio.canonical.party.v1.PartyDto) Test(org.junit.Test)

Example 40 with Party

use of org.estatio.module.party.dom.Party in project estatio by estatio.

the class PropertyImport method importData.

@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
    final Party owner = partyRepository.findPartyByReference(ownerReference);
    final Country country = countryRepository.findCountry(countryCode);
    final ApplicationTenancy appTenancy = applicationTenancyRepository.findByPath(atPath);
    Property property = propertyRepository.findPropertyByReference(reference);
    if (property == null) {
        property = propertyRepository.newProperty(reference, name, PropertyType.valueOf(type), city, country, acquireDate);
    }
    property.setName(name);
    property.setFullName(fullName);
    property.setCountry(country);
    property.setCity(city);
    property.setType(PropertyType.valueOf(type));
    property.setAcquireDate(acquireDate);
    property.setDisposalDate(disposalDate);
    property.setOpeningDate(openingDate);
    property.setExternalReference(externalReference);
    property.addRoleIfDoesNotExist(owner, FixedAssetRoleTypeEnum.PROPERTY_OWNER, null, null);
    property.setParkingSpaces(parkingSpaces);
    property.setArea(grossLettableArea);
    property.setDisplayOrder(displayOrder);
    return Lists.newArrayList(property);
}
Also used : Party(org.estatio.module.party.dom.Party) Country(org.incode.module.country.dom.impl.Country) Property(org.estatio.module.asset.dom.Property) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) 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