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