use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class DocumentTypeAndTemplatesFSForInvoicesUsingSsrs_Test method setUp.
@Before
public void setUp() throws Exception {
stubDocumentType = DocumentTypeData.PRELIM_LETTER.create();
stubInvoice = new InvoiceForLease();
stubInvoice.setDueDate(new LocalDate(2016, 11, 1));
stubBuyer = new Organisation();
stubBuyer.setName("Buyer-1");
stubInvoice.setBuyer(stubBuyer);
stubInvoice.setLease(mockLease);
stubProperty = new Property();
stubProperty.setReference("XXX");
stubUnit = new Unit();
stubUnit.setName("XXX-123");
stubBrand = new Brand();
stubBrand.setName("Brandino");
// expect
context.checking(new Expectations() {
{
allowing(mockPaperclipRepository).paperclipAttaches(mockDocument, InvoiceForLease.class);
will(returnValue(stubInvoice));
allowing(mockLease).getProperty();
will(returnValue(stubProperty));
allowing(mockLease).getReference();
will(returnValue("XXX-ABC-789"));
allowing(mockDocument).getType();
will(returnValue(stubDocumentType));
}
});
// expecting
context.checking(new Expectations() {
{
allowing(mockConfigurationService).getProperty("isis.deploymentType");
will(returnValue("prototyping"));
}
});
rendererModelFactory = new FreemarkerModelOfPrelimLetterOrInvoiceDocForEmailCover();
inject(rendererModelFactory, "paperclipRepository", mockPaperclipRepository);
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class IncomingInvoice method getPropertySummary.
@Programmatic
public String getPropertySummary() {
List<Property> distinctProperties = new ArrayList<>();
for (InvoiceItem item : getItems()) {
IncomingInvoiceItem iitem = (IncomingInvoiceItem) item;
if (iitem.getFixedAsset() != null && !distinctProperties.contains(iitem.getFixedAsset())) {
distinctProperties.add((Property) iitem.getFixedAsset());
}
}
StringBuffer summary = new StringBuffer();
for (Property property : distinctProperties) {
if (summary.length() > 0) {
summary.append(" | ");
}
summary.append(property.getName());
}
return summary.toString();
}
use of org.estatio.module.asset.dom.Property 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.asset.dom.Property 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.asset.dom.Property in project estatio by estatio.
the class BudgetImportExport method removeExistingBudgetItemsIfNotLinked.
private void removeExistingBudgetItemsIfNotLinked() {
Property property = propertyRepository.findPropertyByReference(getPropertyReference());
Budget budget = budgetRepository.findOrCreateBudget(property, getBudgetStartDate(), getBudgetEndDate());
for (BudgetItem item : budget.getItems()) {
if (orderItemRepository.findByBudgetItem(item).size() == 0 && incomingInvoiceItemRepository.findByBudgetItem(item).size() == 0) {
for (PartitionItem pItem : item.getPartitionItems()) {
pItem.remove();
}
repositoryService.removeAndFlush(item);
}
}
}
Aggregations