Search in sources :

Example 26 with ApplicationTenancy

use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.

the class EstatioApplicationTenancyRepositoryForProperty_Test method tenancy.

private static ApplicationTenancy tenancy(final String path, final String name) {
    ApplicationTenancy applicationTenancy = new ApplicationTenancy();
    applicationTenancy.setPath(path);
    applicationTenancy.setName(name);
    return applicationTenancy;
}
Also used : ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 27 with ApplicationTenancy

use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.

the class EstatioApplicationTenancyRepositoryForProperty_Test method testFindOrCreatePropertyTenancy_whenCountryAndPropertyExists.

@Test
public void testFindOrCreatePropertyTenancy_whenCountryAndPropertyExists() throws Exception {
    // given
    final Property property = new Property();
    property.setReference("GRA");
    property.setCountry(new Country("ITA", "ITA", "Italy"));
    // when
    ApplicationTenancy propertyTenancy = estatioApplicationTenancyRepositoryForProperty.findOrCreateTenancyFor(property);
    // then
    assertThat(propertyTenancy).isEqualTo(grande);
}
Also used : EstatioApplicationTenancyRepositoryForCountry(org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry) Country(org.incode.module.country.dom.impl.Country) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Test(org.junit.Test)

Example 28 with ApplicationTenancy

use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.

the class Api method putLeaseTermForIndexableRent.

@ActionSemantics(Of.IDEMPOTENT)
public void putLeaseTermForIndexableRent(// start generic fields
@Named("leaseReference") final String leaseReference, @Named("tenantReference") final String tenantReference, @Named("unitReference") @Optional final String unitReference, @Named("itemSequence") final BigInteger itemSequence, @Named("itemType") final String itemType, @Named("itemStartDate") @Parameter(optionality = Optionality.OPTIONAL) final LocalDate itemStartDate, @Named("sequence") final BigInteger sequence, @Named("startDate") @Optional final LocalDate startDate, @Named("endDate") @Optional final LocalDate endDate, @Named("status") @Optional final String statusStr, // end generic fields
@Named("reviewDate") @Optional final LocalDate reviewDate, @Named("effectiveDate") @Optional final LocalDate effectiveDate, @Named("baseValue") @Optional final BigDecimal baseValue, @Named("indexedValue") @Optional final BigDecimal indexedValue, @Named("settledValue") @Optional final BigDecimal settledValue, @Named("levellingValue") @Optional final BigDecimal levellingValue, @Named("levellingPercentage") @Optional final BigDecimal levellingPercentage, @Named("indexReference") final String indexReference, @Named("indexationFrequency") final String indexationFrequency, @Named("indexationPercentage") @Optional final BigDecimal indexationPercentage, @Named("baseIndexReference") @Optional final String baseIndexReference, @Named("baseIndexStartDate") @Optional final LocalDate baseIndexStartDate, @Named("baseIndexEndDate") @Optional final LocalDate baseIndexEndDate, @Named("baseIndexValue") @Optional final BigDecimal baseIndexValue, @Named("nextIndexReference") @Optional final String nextIndexReference, @Named("nextIndexStartDate") @Optional final LocalDate nextIndexStartDate, @Named("nextIndexEndDate") @Optional final LocalDate nextIndexEndDate, @Named("nextIndexValue") @Optional final BigDecimal nextIndexValue) {
    final LeaseTermForIndexable term = (LeaseTermForIndexable) putLeaseTerm(leaseReference, unitReference, itemSequence, itemType, itemStartDate, startDate, endDate, sequence, statusStr);
    final ApplicationTenancy applicationTenancy = term.getLeaseItem().getApplicationTenancy();
    // TODO: applicationTenancies.findTenancyByPath(atPath);
    final Index index = indices.findOrCreateIndex(applicationTenancy, indexReference, indexReference);
    final LeaseTermFrequency indexationFreq = LeaseTermFrequency.valueOf(indexationFrequency);
    term.setIndex(index);
    term.setFrequency(indexationFreq);
    term.setEffectiveDate(effectiveDate);
    term.setBaseValue(baseValue);
    term.setIndexedValue(indexedValue);
    term.setSettledValue(settledValue);
    term.setBaseIndexStartDate(baseIndexStartDate);
    term.setBaseIndexValue(baseIndexValue);
    term.setNextIndexStartDate(nextIndexStartDate);
    term.setNextIndexValue(nextIndexValue);
    term.setIndexationPercentage(indexationPercentage);
    term.setLevellingPercentage(levellingPercentage);
}
Also used : Index(org.estatio.dom.index.Index) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 29 with ApplicationTenancy

use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.

the class Api method putLeaseItem.

@ActionSemantics(Of.IDEMPOTENT)
public void putLeaseItem(@Named("leaseReference") final String leaseReference, @Named("tenantReference") final String tenantReference, @Named("unitReference") @Optional final String unitReference, @Named("type") @Optional final String leaseItemTypeName, @Named("sequence") final BigInteger sequence, @Named("startDate") @Optional final LocalDate startDate, @Named("endDate") @Optional final LocalDate endDate, @Named("chargeReference") @Optional final String chargeReference, @Named("nextDueDate") @Optional final LocalDate nextDueDate, @Named("invoicingFrequency") @Optional final String invoicingFrequency, @Named("paymentMethod") final String paymentMethod, @Named("status") @Optional final String status, @Named("atPath") final String leaseItemAtPath) {
    final Lease lease = fetchLease(leaseReference);
    final Unit unit = fetchUnit(unitReference);
    final ApplicationTenancy unitApplicationTenancy = unit.getApplicationTenancy();
    final ApplicationTenancy countryApplicationTenancy = unitApplicationTenancy.getParent();
    final Charge charge = fetchCharge(chargeReference);
    ApplicationTenancy leaseApplicationTenancy = lease.getApplicationTenancy();
    final ApplicationTenancy leaseItemApplicationTenancy = leaseApplicationTenancy;
    // TODO: removed fetchApplicationTenancy(leaseItemAtPath);
    // if(!leaseApplicationTenancy.getChildren().contains(leaseItemApplicationTenancy))
    // {
    // throw new ApplicationException(
    // String.format("Lease item's appTenancy '%s' not child of lease's appTenancy '%s'.",
    // leaseApplicationTenancy.getName(), leaseItemAtPath));
    // }
    // 
    final LeaseItemType itemType = fetchLeaseItemType(leaseItemTypeName);
    LeaseItem item = lease.findItem(itemType, startDate, sequence);
    if (item == null) {
        item = lease.newItem(itemType, charge, InvoicingFrequency.valueOf(invoicingFrequency), PaymentMethod.valueOf(paymentMethod), startDate, leaseItemApplicationTenancy);
        item.setSequence(sequence);
    }
    item.setNextDueDate(nextDueDate);
    final LeaseItemStatus leaseItemStatus = LeaseItemStatus.valueOfElse(status, LeaseItemStatus.ACTIVE);
}
Also used : Charge(org.estatio.dom.charge.Charge) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 30 with ApplicationTenancy

use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.

the class Api method putOrganisation.

@ActionSemantics(Of.IDEMPOTENT)
public void putOrganisation(@Named("atPath") final String atPath, @Named("reference") final String reference, @Named("name") final String name, @Named("vatCode") @Optional final String vatCode, @Named("fiscalCode") @Optional final String fiscalCode) {
    final ApplicationTenancy applicationTenancy = applicationTenancies.findTenancyByPath(atPath);
    Organisation org = (Organisation) parties.findPartyByReferenceOrNull(reference);
    if (org == null) {
        org = organisations.newOrganisation(reference, name, applicationTenancy);
    }
    org.setApplicationTenancyPath(atPath);
    org.setName(name);
    org.setFiscalCode(fiscalCode);
    org.setVatCode(vatCode);
}
Also used : ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Aggregations

ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)51 Programmatic (org.apache.isis.applib.annotation.Programmatic)9 Test (org.junit.Test)6 Property (org.estatio.module.asset.dom.Property)4 Lease (org.estatio.module.lease.dom.Lease)4 LeaseItem (org.estatio.module.lease.dom.LeaseItem)4 LeaseType (org.estatio.module.lease.dom.LeaseType)4 Expectations (org.jmock.Expectations)4 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)3 ApplicationTenancyLevel (org.estatio.module.base.dom.apptenancy.ApplicationTenancyLevel)3 Charge (org.estatio.module.charge.dom.Charge)3 Numerator (org.estatio.module.numerator.dom.Numerator)3 Country (org.incode.module.country.dom.impl.Country)3 Action (org.apache.isis.applib.annotation.Action)2 DomainObject (org.apache.isis.applib.annotation.DomainObject)2 Charge (org.estatio.dom.charge.Charge)2 IndexValue (org.estatio.module.index.dom.IndexValue)2 PaymentMethod (org.estatio.module.invoice.dom.PaymentMethod)2 LeaseItemStatus (org.estatio.module.lease.dom.LeaseItemStatus)2 LeaseItemType (org.estatio.module.lease.dom.LeaseItemType)2