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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations