use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy 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);
}
use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy 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.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.
the class NumeratorRepository_Test method setup.
@Before
public void setup() {
propertyBookmark = new Bookmark("PROP", "123");
applicationTenancy = new ApplicationTenancy();
applicationTenancy.setPath("/");
context.checking(new Expectations() {
{
allowing(mockBookmarkService).bookmarkFor(mockProperty);
will(returnValue(propertyBookmark));
}
});
numeratorRepository = new NumeratorRepository() {
@Override
protected <T> T firstMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
return null;
}
@Override
protected List<Numerator> 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;
}
};
numeratorRepository.bookmarkService = mockBookmarkService;
}
use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy in project estatio by estatio.
the class LeaseTermImportAbstract method initLeaseItem.
protected LeaseItem initLeaseItem() {
// find or create leaseItem
final Lease lease = fetchLease(getLeaseReference());
final ApplicationTenancy leaseItemApplicationTenancy = ObjectUtils.firstNonNull(securityApplicationTenancyRepository.findByPath(getLeaseItemAtPath()), lease.getApplicationTenancy());
final Charge charge = fetchCharge(getItemChargeReference());
final LeaseItemType itemType = fetchLeaseItemType(getItemTypeName());
LeaseItem item = lease.findItem(itemType, getItemStartDate(), getItemSequence());
if (item == null) {
item = lease.newItem(itemType, LeaseAgreementRoleTypeEnum.LANDLORD, charge, InvoicingFrequency.valueOf(getItemInvoicingFrequency()), PaymentMethod.valueOf(getItemPaymentMethod()), getItemStartDate());
item.setSequence(getItemSequence());
}
item.setEpochDate(getItemEpochDate());
item.setNextDueDate(getItemNextDueDate());
final LeaseItemStatus leaseItemStatus = LeaseItemStatus.valueOfElse(getItemStatus(), LeaseItemStatus.ACTIVE);
item.setStatus(leaseItemStatus);
// Find source item and create source link
if (getSourceItemTypeName() != null) {
final LeaseItemType sourceItemType = LeaseItemType.valueOf(sourceItemTypeName);
LeaseItem sourceItem = item.getLease().findItem(sourceItemType, sourceItemStartDate, sourceItemSequence);
if (sourceItem != null) {
item.findOrCreateSourceItem(sourceItem);
}
}
return item;
}
use of org.isisaddons.module.security.dom.tenancy.ApplicationTenancy 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);
}
Aggregations