Search in sources :

Example 1 with FixedAssetRoleTypeEnum

use of org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum in project estatio by estatio.

the class CreateInvoiceNumerators method execute.

@Override
protected void execute(ExecutionContext ec) {
    final List<FixedAssetRoleTypeEnum> roleTypes = Arrays.asList(FixedAssetRoleTypeEnum.PROPERTY_OWNER, FixedAssetRoleTypeEnum.TENANTS_ASSOCIATION);
    for (final Property property : propertyRepository.allProperties()) {
        for (final FixedAssetRole fixedAssetRole : fixedAssetRoleRepository.findAllForProperty(property)) {
            if (roleTypes.contains(fixedAssetRole.getType())) {
                ApplicationTenancy applicationTenancy = estatioApplicationTenancyRepository.findOrCreateTenancyFor(property, fixedAssetRole.getParty());
                final Numerator numerator = estatioNumeratorRepository.createInvoiceNumberNumerator(property, PropertyOwnerBuilder.numeratorReferenceFor(property), bi(0), applicationTenancy);
                ec.addResult(this, property.getReference(), numerator);
            }
        }
    }
}
Also used : Numerator(org.estatio.module.numerator.dom.Numerator) FixedAssetRole(org.estatio.module.asset.dom.role.FixedAssetRole) FixedAssetRoleTypeEnum(org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum) Property(org.estatio.module.asset.dom.Property) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)

Aggregations

Property (org.estatio.module.asset.dom.Property)1 FixedAssetRole (org.estatio.module.asset.dom.role.FixedAssetRole)1 FixedAssetRoleTypeEnum (org.estatio.module.asset.dom.role.FixedAssetRoleTypeEnum)1 Numerator (org.estatio.module.numerator.dom.Numerator)1 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)1