Search in sources :

Example 11 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class BudgetImportExport method findOrCreateBudgetAndBudgetItem.

private BudgetItem findOrCreateBudgetAndBudgetItem(final Charge incomingCharge) {
    Property property = propertyRepository.findPropertyByReference(getPropertyReference());
    if (property == null)
        throw new ApplicationException(String.format("Property with reference [%s] not found.", getPropertyReference()));
    Budget budget = budgetRepository.findOrCreateBudget(property, getBudgetStartDate(), getBudgetEndDate());
    BudgetItem budgetItem = budget.findOrCreateBudgetItem(incomingCharge).updateOrCreateBudgetItemValue(getBudgetedValue(), getBudgetStartDate(), BudgetCalculationType.BUDGETED).updateOrCreateBudgetItemValue(getAuditedValue(), getBudgetEndDate(), BudgetCalculationType.ACTUAL);
    return budgetItem;
}
Also used : ApplicationException(org.apache.isis.applib.ApplicationException) BudgetItem(org.estatio.module.budget.dom.budgetitem.BudgetItem) Budget(org.estatio.module.budget.dom.budget.Budget) Property(org.estatio.module.asset.dom.Property)

Example 12 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class PropertyAndUnitsAndOwnerAndManagerBuilder method execute.

@Override
protected void execute(final ExecutionContext executionContext) {
    defaultParam("numberOfUnits", executionContext, fakeDataService.ints().between(10, 20));
    final Property property = new PropertyBuilder().setReference(reference).setName(name).setCity(city).setCountry(country).setPropertyType(propertyType).setAcquireDate(acquireDate).setOpeningDate(openingDate).setLocationStr(locationStr).build(this, executionContext).getObject();
    if (owner != null) {
        ownerRole = new PropertyOwnerBuilder().setProperty(property).setOwner(owner).setStartDate(ownerStartDate).setEndDate(ownerEndDate).build(this, executionContext).getObject();
    }
    if (manager != null) {
        managerrole = new PropertyManagerBuilder().setProperty(property).setManager(manager).setStartDate(managerStartDate).setEndDate(managerEndDate).build(this, executionContext).getObject();
    }
    for (int i = 0; i < getNumberOfUnits(); i++) {
        int unitNumber = i + 1;
        final Unit unit = wrap(property).newUnit(String.format("%s-%03d", property.getReference(), unitNumber), "Unit " + unitNumber, unitType(i));
        unit.setArea(new BigDecimal((i + 1) * 100));
        units.add(unit);
    }
    object = property;
}
Also used : Unit(org.estatio.module.asset.dom.Unit) Property(org.estatio.module.asset.dom.Property) BigDecimal(java.math.BigDecimal)

Example 13 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class ClassificationForPropertyImport method importData.

@Override
public List<Object> importData(final Object previousRow) {
    final Property property = propertyRepository.findPropertyByReference(getPropertyReference());
    if (property == null) {
        throw new IllegalArgumentException(String.format("No property found for '%s'", getPropertyReference()));
    }
    final Taxonomy taxonomy = (Taxonomy) categoryRepository.findByReference(getTaxonomyReference());
    if (taxonomy == null) {
        throw new IllegalArgumentException(String.format("No taxonomy found for '%s'", getTaxonomyReference()));
    }
    final Category category = categoryRepository.findByTaxonomyAndReference(taxonomy, getCategoryReference());
    if (category == null) {
        throw new IllegalArgumentException(String.format("No category found for '%s'", getCategoryReference()));
    }
    final Classification classification = classificationRepository.create(category, property);
    return Lists.newArrayList(classification);
}
Also used : Category(org.incode.module.classification.dom.impl.category.Category) Taxonomy(org.incode.module.classification.dom.impl.category.taxonomy.Taxonomy) Classification(org.incode.module.classification.dom.impl.classification.Classification) Property(org.estatio.module.asset.dom.Property)

Example 14 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class EstatioApplicationTenancyRepositoryForLease_Test method propertyWith.

private Property propertyWith(String countryCode, String reference) {
    Property property = new Property();
    property.setReference(reference);
    property.setCountry(new Country(countryCode, countryCode, countryCode));
    return property;
}
Also used : EstatioApplicationTenancyRepositoryForCountry(org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry) Country(org.incode.module.country.dom.impl.Country) Property(org.estatio.module.asset.dom.Property) EstatioApplicationTenancyRepositoryForProperty(org.estatio.module.asset.dom.EstatioApplicationTenancyRepositoryForProperty)

Example 15 with Property

use of org.estatio.module.asset.dom.Property in project estatio by estatio.

the class InvoiceRepository_Test method setup.

@Before
public void setup() {
    seller = new PartyForTesting();
    buyer = new PartyForTesting();
    paymentMethod = PaymentMethod.BANK_TRANSFER;
    lease = new Lease() {

        @Override
        public Property getProperty() {
            return null;
        }
    };
    invoiceStatus = InvoiceStatus.APPROVED;
    dueDate = new LocalDate(2013, 4, 1);
    invoiceRepository = new InvoiceRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<Invoice> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    invoiceForLeaseRepository = new InvoiceForLeaseRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<InvoiceForLease> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    estatioNumeratorRepository = new NumeratorForCollectionRepository();
}
Also used : Lease(org.estatio.module.lease.dom.Lease) InvoiceRepository(org.estatio.module.invoice.dom.InvoiceRepository) List(java.util.List) PartyForTesting(org.estatio.module.party.dom.PartyForTesting) Property(org.estatio.module.asset.dom.Property) LocalDate(org.joda.time.LocalDate) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Aggregations

Property (org.estatio.module.asset.dom.Property)47 LocalDate (org.joda.time.LocalDate)19 Test (org.junit.Test)19 Party (org.estatio.module.party.dom.Party)12 BudgetItem (org.estatio.module.budget.dom.budgetitem.BudgetItem)11 Programmatic (org.apache.isis.applib.annotation.Programmatic)10 Budget (org.estatio.module.budget.dom.budget.Budget)8 InvoiceForLease (org.estatio.module.lease.dom.invoicing.InvoiceForLease)8 BigDecimal (java.math.BigDecimal)7 List (java.util.List)6 Charge (org.estatio.module.charge.dom.Charge)6 Lease (org.estatio.module.lease.dom.Lease)6 InvoiceItemForLease (org.estatio.module.lease.dom.invoicing.InvoiceItemForLease)6 Expectations (org.jmock.Expectations)6 Before (org.junit.Before)6 Unit (org.estatio.module.asset.dom.Unit)5 Project (org.estatio.module.capex.dom.project.Project)5 Organisation (org.estatio.module.party.dom.Organisation)5 BudgetItemValue (org.estatio.module.budget.dom.budgetitem.BudgetItemValue)4 BankAccount (org.estatio.module.financial.dom.BankAccount)4