Search in sources :

Example 6 with AgreementType

use of org.estatio.module.agreement.dom.type.AgreementType in project estatio by estatio.

the class AgreementRepository_Test method setup.

@Before
public void setup() {
    agreementType = new AgreementType();
    agreementRoleType = new AgreementRoleType();
    party = new PartyForTesting();
    agreementRepository = new AgreementRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<Agreement> 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;
        }
    };
}
Also used : AgreementType(org.estatio.module.agreement.dom.type.AgreementType) AgreementRoleType(org.estatio.module.agreement.dom.role.AgreementRoleType) List(java.util.List) PartyForTesting(org.estatio.module.party.dom.PartyForTesting) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 7 with AgreementType

use of org.estatio.module.agreement.dom.type.AgreementType in project estatio by estatio.

the class LeaseRepository method newLease.

@Programmatic
public Lease newLease(final ApplicationTenancy applicationTenancy, final String reference, final String name, final LeaseType leaseType, final LocalDate startDate, final LocalDate endDate, final LocalDate tenancyStartDate, final LocalDate tenancyEndDate, final Party landlord, final Party tenant) {
    Lease lease = newTransientInstance();
    final AgreementType at = agreementTypeRepository.find(LeaseAgreementTypeEnum.LEASE.getTitle());
    lease.setType(at);
    lease.setApplicationTenancyPath(applicationTenancy.getPath());
    lease.setReference(reference);
    lease.setName(name);
    lease.setStartDate(startDate);
    lease.setEndDate(endDate);
    lease.setTenancyStartDate(tenancyStartDate);
    lease.setTenancyEndDate(tenancyEndDate);
    lease.setLeaseType(leaseType);
    persistIfNotAlready(lease);
    if (tenant != null) {
        final AgreementRoleType artTenant = agreementRoleTypeRepository.find(LeaseAgreementRoleTypeEnum.TENANT);
        lease.newRole(artTenant, tenant, null, null);
    }
    if (landlord != null) {
        final AgreementRoleType artLandlord = agreementRoleTypeRepository.find(LeaseAgreementRoleTypeEnum.LANDLORD);
        lease.newRole(artLandlord, landlord, null, null);
    }
    return lease;
}
Also used : AgreementType(org.estatio.module.agreement.dom.type.AgreementType) AgreementRoleType(org.estatio.module.agreement.dom.role.AgreementRoleType) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

AgreementType (org.estatio.module.agreement.dom.type.AgreementType)7 AgreementRoleType (org.estatio.module.agreement.dom.role.AgreementRoleType)5 List (java.util.List)4 Programmatic (org.apache.isis.applib.annotation.Programmatic)3 Party (org.estatio.module.party.dom.Party)3 AgreementRole (org.estatio.module.agreement.dom.AgreementRole)2 FinancialAccount (org.estatio.module.financial.dom.FinancialAccount)2 FinancialAccountType (org.estatio.module.financial.dom.FinancialAccountType)2 FinderInteraction (org.incode.module.unittestsupport.dom.repo.FinderInteraction)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 DomainService (org.apache.isis.applib.annotation.DomainService)1 NatureOfService (org.apache.isis.applib.annotation.NatureOfService)1 FixturesInstallingEvent (org.apache.isis.applib.events.system.FixturesInstallingEvent)1 FixtureScriptsDefault (org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault)1 QueryResultsCache (org.apache.isis.applib.services.queryresultscache.QueryResultsCache)1 BankAccountsAndMandatesDto (org.estatio.canonical.bankmandate.v1.BankAccountsAndMandatesDto)1 BankMandateDto (org.estatio.canonical.bankmandate.v1.BankMandateDto)1