public void fill (final @Nonnull Accounting accounting) { final CustomerRegistry customerRegistry = accounting.getCustomerRegistry(); final ProjectRegistry projectRegistry = accounting.getProjectRegistry(); final InvoiceRegistry invoiceRegistry = accounting.getInvoiceRegistry(); customersXml.forEach(customer -> customerRegistry.addCustomer().with(customer.toBuilder()).create()); projectsXml.forEach(project -> projectRegistry.addProject().with(project.toBuilder(accounting)).create()); invoicesxml.forEach(invoice -> invoiceRegistry.addInvoice().with(invoice.toBuilder(accounting)).create()); } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override public void importCustomers() throws IOException { log.debug("importCustomers()"); final NativeAddressBook addressBook = NativeAddressBook.instance(); IBizUtils.loadConfiguration(path.resolve("clients")).getStream("clients").forEach(customerConfig -> { final String firstName = trim(customerConfig.getString("firstName")); final String clientCompany = customerConfig.getString("clientCompany"); final Contact contact = getContact(addressBook, firstName, clientCompany); customerRegistry.addCustomer().withId(customerConfig.getId("addressBookId")) .withName(firstName) .withBillingAddress(getAddress(contact)) .withVatNumber(getVatNumber(contact)) .create(); }); }
customerRegistry.addCustomer() .withId(new Id("" + nextId++)) .withName("ACME Consulting") .create(); final Customer acmeFinancing = customerRegistry.addCustomer() .withId(new Id("" + nextId++)) .withName("ACME Financing")