use of org.estatio.module.numerator.dom.Numerator in project estatio by estatio.
the class OrderRepository method create.
@Programmatic
public Order create(final Property property, final String orderNumber, final String sellerOrderReference, final LocalDate entryDate, final LocalDate orderDate, final Party seller, final Party buyer, final String atPath, final OrderApprovalState approvalStateIfAny) {
final Numerator numerator = numeratorRepository.findOrCreateNumerator("Order number", null, "%05d", BigInteger.ZERO, applicationTenancyRepository.findByPath(atPath));
final Order order = new Order(property, orderNumber == null ? numerator.nextIncrementStr() : orderNumber, sellerOrderReference, entryDate, orderDate, seller, buyer, atPath, approvalStateIfAny);
serviceRegistry2.injectServicesInto(order);
repositoryService.persistAndFlush(order);
return order;
}
use of org.estatio.module.numerator.dom.Numerator 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);
}
}
}
}
use of org.estatio.module.numerator.dom.Numerator in project estatio by estatio.
the class InvoiceNumeratorImport method importData.
@Override
public List<Object> importData(Object previousRow) {
// find or create app tenancy (because of use wildcards)
ApplicationTenancy applicationTenancy = securityApplicationTenancyRepository.newTenancy(atPath, atPath, securityApplicationTenancyRepository.findByPath(atPath.split("/%/")[0]));
Property property = propertyRepository.findPropertyByReference(propertyReference);
Numerator numerator;
if (atPath.contains("/%/")) {
numerator = numeratorRepository.findScopedNumeratorIncludeWildCardMatching(Constants.NumeratorName.INVOICE_NUMBER, property, applicationTenancy);
} else {
numerator = numeratorRepository.findNumerator(Constants.NumeratorName.INVOICE_NUMBER, property, applicationTenancy);
}
if (numerator == null) {
numerator = numeratorRepository.createScopedNumerator(Constants.NumeratorName.INVOICE_NUMBER, property, formatStr, lastIncrement, applicationTenancy);
}
return Lists.newArrayList(numerator);
}
use of org.estatio.module.numerator.dom.Numerator in project estatio by estatio.
the class NumeratorForOrganisationBuilder method execute.
@Override
protected void execute(ExecutionContext executionContext) {
checkParam("country", executionContext, Country.class);
checkParam("format", executionContext, String.class);
defaultParam("name", executionContext, PartyConstants.ORGANISATION_REFERENCE_NUMERATOR_NAME);
Numerator numerator = numeratorRepository.createGlobalNumerator(name, format, BigInteger.ZERO, estatioApplicationTenancyRepository.findOrCreateTenancyFor(country));
executionContext.addResult(this, name, numerator);
object = numerator;
}
use of org.estatio.module.numerator.dom.Numerator in project estatio by estatio.
the class InvoiceForLease_Test method setUp.
@Before
public void setUp() throws Exception {
numerator = new Numerator();
numerator.setFormat("XXX-%05d");
numerator.setLastIncrement(BigInteger.TEN);
applicationTenancy = new ApplicationTenancy();
applicationTenancy.setPath("/");
context.checking(new Expectations() {
{
allowing(mockClockService).now();
will(returnValue(LocalDate.now()));
}
});
}
Aggregations