use of org.estatio.module.asset.dom.Unit in project estatio by estatio.
the class KeyItemRepository_Test method negativeKeyValue.
@Test
public void negativeKeyValue() {
// given
KeyTable keyTable = new KeyTable();
Unit unit = new Unit();
BigDecimal sourcevalue = new BigDecimal(1);
BigDecimal keyValue = BigDecimal.valueOf(-0.001);
// when
String validateNewBudgetKeyItem = keyItemRepository.validateNewItem(keyTable, unit, sourcevalue, keyValue);
// then
assertThat(validateNewBudgetKeyItem).isEqualTo("keyValue cannot be less than zero");
}
use of org.estatio.module.asset.dom.Unit in project estatio by estatio.
the class LandRegisterForOxfordUnit001 method execute.
@Override
protected void execute(ExecutionContext executionContext) {
// prereqs
executionContext.executeChild(this, PropertyAndUnitsAndOwnerAndManager_enum.OxfGb.builder());
Unit unit = Property_enum.OxfGb.findUsing(serviceRegistry).getUnits().first();
LandRegister landRegister = landRegisters.newRegistration(unit, null, "comuneAmministrativo", "comuneCatastale", "codiceComuneCatastale", new BigDecimal("123.45"), "foglio", "particella", "subalterno", "categoria", "classe", "consistenza", null, "description");
executionContext.addResult(this, landRegister.title(), landRegister);
}
use of org.estatio.module.asset.dom.Unit in project estatio by estatio.
the class PropertyUnitsBuilder method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
checkParam("property", executionContext, Property.class);
defaultParam("numberOfUnits", executionContext, fakeDataService.ints().between(10, 20));
for (int i = 0; i < getNumberOfUnits(); i++) {
final int unitNum = i + 1;
final String unitRef = buildUnitReference(property.getReference(), unitNum);
final UnitType unitType = fakeDataService.enums().anyOf(UnitType.class);
final String unitName = fakeDataService.name().firstName();
final Unit unit = wrap(property).newUnit(unitRef, unitName, unitType);
unit.setArea(new BigDecimal(unitNum * 100));
object.add(unit);
executionContext.addResult(this, unitRef, unit);
}
}
use of org.estatio.module.asset.dom.Unit in project estatio by estatio.
the class UnitImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final Property property = propertyRepository.findPropertyByReference(propertyReference);
Unit unit = unitRepository.findUnitByReference(reference);
if (unit == null) {
unit = property.newUnit(reference, name, UnitType.BOUTIQUE);
}
// set attributes
unit.setName(name);
unit.setType(UnitType.valueOf(type));
unit.changeDates(startDate, endDate);
unit.setArea(area);
unit.setSalesArea(salesArea);
unit.setStorageArea(storageArea);
unit.setMezzanineArea(mezzanineArea);
unit.setDehorsArea(dehorsArea);
unit.setExternalReference(externalReference);
if (communicationChannelRepository.findByOwnerAndType(unit, CommunicationChannelType.POSTAL_ADDRESS).size() == 0) {
communicationChannelRepository.newPostal(unit, CommunicationChannelType.POSTAL_ADDRESS, address1, address2, address3, postalCode, city, stateRepository.findState(stateCode), countryRepository.findCountry(countryCode));
}
if (ownerReference != null) {
Party party = partyRepository.findPartyByReference(ownerReference);
if (party == null) {
throw new IllegalArgumentException(String.format("Party with ownerReference %s not found", getOwnerReference()));
}
// create property owner of not found one already
FixedAssetRole propertyOwnerRole = fixedAssetRoleRepository.findRole(unitRepository.findUnitByReference(reference), FixedAssetRoleTypeEnum.PROPERTY_OWNER);
if (propertyOwnerRole == null) {
unit.createRole(FixedAssetRoleTypeEnum.PROPERTY_OWNER, party, null, null);
}
}
return Lists.newArrayList(unit);
}
use of org.estatio.module.asset.dom.Unit in project estatio by estatio.
the class ClassificationForOccImport method importData.
@Override
public List<Object> importData(final Object previousRow) {
final Lease lease = leaseRepository.findLeaseByReference(getLeaseReference());
if (lease == null) {
throw new IllegalArgumentException(String.format("No lease found for '%s'", getLeaseReference()));
}
final Unit unit = unitRepository.findUnitByReference(getUnitReference());
if (unit == null) {
throw new IllegalArgumentException(String.format("No unit found for '%s'", getUnitReference()));
}
final Occupancy occupancy = occupancyRepository.findByLease(lease).stream().filter(x -> x.getUnit().equals(unit)).findFirst().get();
if (occupancy == null) {
throw new IllegalArgumentException(String.format("No occupancy found for lease '%s' and unit '%s'", getLeaseReference(), getUnitReference()));
}
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, occupancy);
return Lists.newArrayList(classification);
}
Aggregations