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;
}
};
}
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;
}
Aggregations