Search in sources :

Example 6 with ApplicationTenancy

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);
}
Also used : Country(org.estatio.dom.geography.Country) Property(org.estatio.dom.asset.Property) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 7 with ApplicationTenancy

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());
}
Also used : LeaseTypeForItalyRefData(org.estatio.module.lease.fixtures.LeaseTypeForItalyRefData) LeaseType(org.estatio.module.lease.dom.LeaseType) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Example 8 with ApplicationTenancy

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;
}
Also used : Expectations(org.jmock.Expectations) Bookmark(org.apache.isis.applib.services.bookmark.Bookmark) List(java.util.List) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 9 with ApplicationTenancy

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;
}
Also used : Lease(org.estatio.module.lease.dom.Lease) Charge(org.estatio.module.charge.dom.Charge) LeaseItemStatus(org.estatio.module.lease.dom.LeaseItemStatus) LeaseItemType(org.estatio.module.lease.dom.LeaseItemType) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) LeaseItem(org.estatio.module.lease.dom.LeaseItem)

Example 10 with ApplicationTenancy

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);
}
Also used : LeaseType(org.estatio.module.lease.dom.LeaseType) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)51 Programmatic (org.apache.isis.applib.annotation.Programmatic)9 Test (org.junit.Test)6 Property (org.estatio.module.asset.dom.Property)4 Lease (org.estatio.module.lease.dom.Lease)4 LeaseItem (org.estatio.module.lease.dom.LeaseItem)4 LeaseType (org.estatio.module.lease.dom.LeaseType)4 Expectations (org.jmock.Expectations)4 MemberOrder (org.apache.isis.applib.annotation.MemberOrder)3 ApplicationTenancyLevel (org.estatio.module.base.dom.apptenancy.ApplicationTenancyLevel)3 Charge (org.estatio.module.charge.dom.Charge)3 Numerator (org.estatio.module.numerator.dom.Numerator)3 Country (org.incode.module.country.dom.impl.Country)3 Action (org.apache.isis.applib.annotation.Action)2 DomainObject (org.apache.isis.applib.annotation.DomainObject)2 Charge (org.estatio.dom.charge.Charge)2 IndexValue (org.estatio.module.index.dom.IndexValue)2 PaymentMethod (org.estatio.module.invoice.dom.PaymentMethod)2 LeaseItemStatus (org.estatio.module.lease.dom.LeaseItemStatus)2 LeaseItemType (org.estatio.module.lease.dom.LeaseItemType)2