use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class PropertyMenu2_Test method setup.
@Before
public void setup() {
propertyRepository = new PropertyRepository() {
@Override
protected <T> T uniqueMatch(Query<T> query) {
finderInteraction = new FinderInteraction(query, FinderMethod.UNIQUE_MATCH);
return (T) new Property();
}
@Override
protected List<Property> 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;
}
};
propertyMenu = new PropertyMenu();
propertyMenu.propertyRepository = propertyRepository;
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class ProjectImport method importData.
@Programmatic
@Override
public List<Object> importData(final Object previousRow) {
if (previousRow != null) {
// TODO: support sparse sheets ?
}
Project parent = null;
if (getParentReference() != null) {
parent = projectRepository.findByReference(getParentReference());
if (parent == null) {
throw new ApplicationException(String.format("Parent with reference %s not found.", getParentReference()));
}
if (!parent.getAtPath().equals(getAtPath())) {
throw new ApplicationException(String.format("AtPath parent %s does not match %s.", getParentReference(), getAtPath()));
}
if (!parent.getItems().isEmpty()) {
// TODO: (ECP-438) until we find out more about the process, prevent a the choice of a project having items
throw new ApplicationException(String.format("Parent with reference %s has items and cannot be a parent therefore.", getAtPath()));
}
}
Project project = findOrCreateProjectAndUpdateParent(getReference(), getName(), getStartDate(), getEndDate(), getAtPath(), parent);
if (getItemChargeReference() != null) {
Charge charge = chargeRepository.findByReference(getItemChargeReference());
Property property = propertyRepository.findPropertyByReference(getItemPropertyReference());
Tax tax = taxRepository.findByReference(getItemTaxReference());
wrapperFactory.wrap(project).addItem(charge, getItemDescription(), getItemBudgetedAmount(), getItemStartDate(), getItemEndDate(), property, tax);
}
return Lists.newArrayList(project);
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class DebtorBankAccountService_Test method unique_Debtor_Account_To_Pay_works_when_no_bankaccount_and_property.
@Test
public void unique_Debtor_Account_To_Pay_works_when_no_bankaccount_and_property() throws Exception {
// given
DebtorBankAccountService service = new DebtorBankAccountService();
service.bankAccountRepository = mockBankAccountRepository;
service.fixedAssetFinancialAccountRepository = mockFixedAssetFinancialAccountRepository;
IncomingInvoice invoice = new IncomingInvoice();
Party debtor = new Organisation();
invoice.setBuyer(debtor);
Property property = new Property();
invoice.setProperty(property);
// expect
context.checking(new Expectations() {
{
oneOf(mockBankAccountRepository).findBankAccountsByOwner(debtor);
oneOf(mockFixedAssetFinancialAccountRepository).findByFixedAsset(property);
}
});
// when, then
assertThat(service.uniqueDebtorAccountToPay(invoice)).isNull();
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class Order_Test method minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem.
@Test
public void minimalRequiredDataToComplete_consitent_dimensions_for_project_budgetItem() throws Exception {
// given
Order order = new Order();
OrderItem item1 = new OrderItem();
order.getItems().add(item1);
order.setOrderNumber("123");
order.setBuyer(new Organisation());
order.setSeller(new Organisation());
item1.setNetAmount(new BigDecimal("100"));
item1.setDescription("blah");
item1.setGrossAmount(BigDecimal.ZERO);
item1.setCharge(new Charge());
item1.setStartDate(new LocalDate());
item1.setEndDate(new LocalDate());
item1.setProperty(new Property());
// when
item1.setBudgetItem(new BudgetItem());
item1.setProject(new Project());
String result = order.reasonIncomplete();
// then
assertThat(result).isEqualTo("(on item) either project or budget item - not both required");
}
use of org.estatio.module.asset.dom.Property in project estatio by estatio.
the class Order_Test method splitItem_mixin_works.
@Test
public void splitItem_mixin_works() throws Exception {
// given
Order order = new Order();
order.orderItemRepository = mockOrderItemRepository;
String description = "some description";
Tax tax = new Tax();
Charge charge = new Charge();
Property property = new Property();
Project project = new Project();
BudgetItem budgetItem = new BudgetItem();
String period = "F2018";
OrderItem itemToSplit = new OrderItem();
BigDecimal newItemNetAmount = new BigDecimal("50.00");
BigDecimal newItemVatAmount = new BigDecimal("10");
BigDecimal newItemGrossAmount = new BigDecimal("60.00");
// expect
context.checking(new Expectations() {
{
oneOf(mockOrderItemRepository).upsert(order, charge, description, newItemNetAmount, newItemVatAmount, newItemGrossAmount, tax, PeriodUtil.yearFromPeriod(period).startDate(), PeriodUtil.yearFromPeriod(period).endDate(), property, project, budgetItem);
}
});
// when
order.splitItem(itemToSplit, description, newItemNetAmount, newItemVatAmount, tax, newItemGrossAmount, charge, property, project, budgetItem, period);
}
Aggregations