use of org.estatio.dom.asset.Property in project estatio by estatio.
the class Api method putLease.
@ActionSemantics(Of.IDEMPOTENT)
public void putLease(@Named("reference") final String reference, @Named("name") final String name, @Named("tenantReference") final String tenantReference, @Named("landlordReference") final String landlordReference, @Named("type") final String type, @Named("startDate") @Optional final LocalDate startDate, @Named("endDate") @Optional final LocalDate endDate, @Named("tenancyStartDate") @Optional final LocalDate tenancyStartDate, @Named("tenancyEndDate") @Optional final LocalDate tenancyEndDate, @Named("propertyReference") @Optional final String propertyReference) {
final Party tenant = fetchParty(tenantReference);
final Party landlord = fetchParty(landlordReference);
Lease lease = leases.findLeaseByReferenceElseNull(reference);
final LeaseType leaseType = leaseTypes.findOrCreate(type, null);
final Property property = fetchProperty(propertyReference, null, false);
if (lease == null) {
lease = leases.newLease(property.getApplicationTenancy(), reference, name, leaseType, startDate, endDate, tenancyStartDate, tenancyEndDate, landlord, tenant);
}
lease.setTenancyStartDate(tenancyStartDate);
lease.setTenancyEndDate(tenancyEndDate);
}
use of org.estatio.dom.asset.Property in project estatio by estatio.
the class Api method putPropertyPostalAddress.
// //////////////////////////////////////
@ActionSemantics(Of.IDEMPOTENT)
public void putPropertyPostalAddress(@Named("propertyReference") final String propertyReference, @Named("address1") @Optional final String address1, @Named("address2") @Optional final String address2, @Named("city") final String city, @Named("postalCode") @Optional final String postalCode, @Named("stateCode") @Optional final String stateCode, @Named("countryCode") final String countryCode) {
final Property property = properties.findPropertyByReferenceElseNull(propertyReference);
if (property == null) {
throw new ApplicationException(String.format("Property with reference %s not found.", propertyReference));
}
final CommunicationChannel comm = communicationChannelContributions.findCommunicationChannelForType(property, null);
if (comm == null) {
communicationChannelContributions.newPostal(property, CommunicationChannelType.POSTAL_ADDRESS, countries.findCountry(countryCode), states.findState(stateCode), address1, address2, null, postalCode, city);
}
}
use of org.estatio.dom.asset.Property in project estatio by estatio.
the class Api method putPropertyActor.
// //////////////////////////////////////
@ActionSemantics(Of.IDEMPOTENT)
public void putPropertyActor(@Named("propertyReference") final String propertyReference, @Named("reference") final String partyReference, @Named("type") final String typeStr, @Named("startDate") @Optional final LocalDate startDate, @Named("endDate") @Optional final LocalDate endDate) {
final Property property = fetchProperty(propertyReference, null, false);
final Party party = fetchParty(partyReference);
final FixedAssetRoleType type = FixedAssetRoleType.valueOf(typeStr);
property.addRoleIfDoesNotExist(party, type, startDate, endDate);
}
use of org.estatio.dom.asset.Property in project estatio by estatio.
the class Api method putUnit.
// //////////////////////////////////////
@ActionSemantics(Of.IDEMPOTENT)
public void putUnit(@Named("reference") final String reference, @Named("propertyReference") final String propertyReference, @Named("ownerReference") @Optional final String ownerReference, @Named("name") final String name, @Named("type") final String type, @Named("startDate") @Optional final LocalDate startDate, @Named("endDate") @Optional final LocalDate endDate, @Named("area") @Optional final BigDecimal area, @Named("salesArea") @Optional final BigDecimal salesArea, @Named("storageArea") @Optional final BigDecimal storageArea, @Named("mezzanineArea") @Optional final BigDecimal mezzanineArea, @Named("dehorsArea") @Optional final BigDecimal dehorsArea, @Named("address1") @Optional final String address1, @Named("city") @Optional final String city, @Named("postalCode") @Optional final String postalCode, @Named("stateCode") @Optional final String stateCode, @Named("countryCode") @Optional final String countryCode) {
final Property property = fetchProperty(propertyReference, null, false);
Unit unit = units.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);
final CommunicationChannel cc = communicationChannelContributions.findCommunicationChannelForType(unit, CommunicationChannelType.POSTAL_ADDRESS);
if (cc == null) {
communicationChannelContributions.newPostal(unit, CommunicationChannelType.POSTAL_ADDRESS, countries.findCountry(countryCode), states.findState(stateCode), address1, null, null, postalCode, city);
}
}
use of org.estatio.dom.asset.Property in project estatio by estatio.
the class Api method putProperty.
// //////////////////////////////////////
@ActionSemantics(Of.IDEMPOTENT)
public void putProperty(@Named("reference") final String reference, @Named("name") final String name, @Named("countryCode") final String countryCode, @Named("city") final String city, @Named("type") final String type, @Named("acquireDate") @Optional final LocalDate acquireDate, @Named("disposalDate") @Optional final LocalDate disposalDate, @Named("openingDate") @Optional final LocalDate openingDate, @Named("ownerReference") @Optional final String ownerReference, @Named("numeratorFormat") @Optional final String numeratorFormat, @Named("externalReference") @Optional final String externalReference, @Named("atPath") final String countryAtPath) {
final Party owner = fetchParty(ownerReference);
final Country country = fetchCountry(countryCode);
final ApplicationTenancy countryAppTenancy = fetchApplicationTenancy(countryAtPath);
final Property property = fetchProperty(reference, countryAppTenancy, true);
property.setName(name);
property.setCountry(country);
property.setCity(city);
property.setType(PropertyType.valueOf(type));
property.setAcquireDate(acquireDate);
property.setDisposalDate(disposalDate);
property.setOpeningDate(openingDate);
property.setExternalReference(externalReference);
property.addRoleIfDoesNotExist(owner, FixedAssetRoleType.PROPERTY_OWNER, null, null);
if (numeratorFormat != null)
collectionNumerators.createInvoiceNumberNumerator(property, numeratorFormat, BigInteger.ZERO);
}
Aggregations