use of org.estatio.module.lease.dom.LeaseType in project estatio by estatio.
the class LeaseBuilderLEGACY method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
executionContext.executeChild(this, new LeaseTypeForItalyRefData());
defaultParam("reference", executionContext, fakeDataService.strings().fixed(3));
defaultParam("name", executionContext, fakeDataService.name().lastName() + " Mall");
defaultParam("leaseType", executionContext, fakeDataService.collections().anyBounded(LeaseType.class));
defaultParam("atPath", executionContext, ApplicationTenancy_enum.Gb.getPath());
defaultParam("startDate", executionContext, fakeDataService2.dates().before(fakeDataService2.periods().daysUpTo(2 * 365)));
if (getDuration() == null && getEndDate() == null) {
defaultParam("endDate", executionContext, getStartDate().plus(fakeDataService2.periods().years(10, 20)));
}
final ApplicationTenancy applicationTenancy = applicationTenancies.findTenancyByPath(getAtPath());
this.lease = leaseRepository.newLease(applicationTenancy, getReference(), getName(), getLeaseType(), getStartDate(), getDuration(), getEndDate(), getLandlord(), getTenant());
}
use of org.estatio.module.lease.dom.LeaseType in project estatio by estatio.
the class LeaseTypeForItalyRefData method createLeaseType.
private void createLeaseType(ExecutionContext fixtureResults, LeaseTypeData ltd) {
final LeaseType leaseType = leaseTypeRepository.findOrCreate(ltd.name(), ltd.title(), applicationTenancyRepository.findByPath("/ITA"));
fixtureResults.addResult(this, leaseType.getReference(), leaseType);
}
use of org.estatio.module.lease.dom.LeaseType in project estatio by estatio.
the class LeaseTypeImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
final ApplicationTenancy appTenancy = applicationTenancyRepository.findByPath(atPath);
final LeaseType leaseType = leaseTypeRepository.findOrCreate(reference, name, appTenancy);
if (ObjectUtils.compare(name, leaseType.getName()) != 0) {
leaseType.setName(name);
}
return Lists.newArrayList(leaseType);
}
use of org.estatio.module.lease.dom.LeaseType in project estatio by estatio.
the class LeaseMenu method choices3NewLease.
public List<LeaseType> choices3NewLease(final Property property) {
if (property == null) {
return null;
}
final ApplicationTenancy propertyApplicationTenancy = property.getApplicationTenancy();
List<LeaseType> result = Lists.newArrayList();
for (LeaseType leaseType : leaseTypeRepository.allLeaseTypes()) {
final ApplicationTenancyLevel propertyAppTenancyLevel = ApplicationTenancyLevel.of(propertyApplicationTenancy);
final ApplicationTenancyLevel leaseTypeAppTenancyLevel = ApplicationTenancyLevel.of(leaseType.getApplicationTenancy());
if (propertyAppTenancyLevel.equals(leaseTypeAppTenancyLevel) || propertyAppTenancyLevel.childOf(leaseTypeAppTenancyLevel)) {
result.add(leaseType);
}
}
return result;
}
use of org.estatio.module.lease.dom.LeaseType in project estatio by estatio.
the class LeaseBuilder method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
checkParam("reference", executionContext, String.class);
checkParam("name", executionContext, String.class);
checkParam("property", executionContext, Unit.class);
checkParam("landlord", executionContext, Party.class);
checkParam("tenant", executionContext, Party.class);
checkParam("startDate", executionContext, LocalDate.class);
checkParam("endDate", executionContext, LocalDate.class);
defaultParam("invoiceAddressCreationPolicy", executionContext, InvoiceAddressCreationPolicy.DONT_CREATE);
defaultParam("addressesCreationPolicy", executionContext, AddressesCreationPolicy.DONT_CREATE);
landlord.addRole(LeaseRoleTypeEnum.LANDLORD);
tenant.addRole(LeaseRoleTypeEnum.TENANT);
final ApplicationTenancy atPath = ApplicationTenancy_enum.Global.findUsing(serviceRegistry);
final LeaseType leaseType = leaseTypeRepository.findOrCreate("STD", "Standard", atPath);
Lease lease = leaseRepository.newLease(property.getApplicationTenancy(), reference, name, leaseType, startDate, null, endDate, landlord, tenant);
executionContext.addResult(this, lease.getReference(), lease);
if (manager != null) {
final AgreementRole role = lease.createRole(agreementRoleTypeRepository.find(LeaseAgreementRoleTypeEnum.MANAGER), manager, null, null);
executionContext.addResult(this, role);
}
for (final OccupancySpec spec : occupancySpecs) {
Occupancy occupancy = occupancyRepository.newOccupancy(lease, spec.unit, spec.startDate);
occupancy.setEndDate(spec.endDate);
occupancy.setBrandName(spec.brand, spec.brandCoverage, spec.countryOfOrigin);
occupancy.setSectorName(spec.sector);
occupancy.setActivityName(spec.activity);
executionContext.addResult(this, occupancy);
}
if (invoiceAddressCreationPolicy == InvoiceAddressCreationPolicy.CREATE) {
addInvoiceAddressForTenant(lease, tenant, CommunicationChannelType.EMAIL_ADDRESS);
}
if (addressesCreationPolicy == AddressesCreationPolicy.CREATE) {
createAddress(lease, AgreementRoleCommunicationChannelTypeEnum.ADMINISTRATION_ADDRESS);
createAddress(lease, AgreementRoleCommunicationChannelTypeEnum.INVOICE_ADDRESS);
}
if (leaseRepository.findLeaseByReference(reference) == null) {
throw new RuntimeException("could not find lease reference='" + reference + "'");
}
object = lease;
}
Aggregations