@Nonnull public Project.Builder toBuilder (final @Nonnull Accounting accounting) { try { final Customer customer = accounting.getCustomerRegistry().findCustomers().withId(customerXml.getId()).result(); return new Project.Builder().withId(id) .withCustomer(customer) .withName(name) .withNumber(number) .withDescription(description) .withNotes(notes) .withStatus(status) .withHourlyRate(hourlyRate) .withBudget(budget) .withStartDate(startDate) .withEndDate(endDate) .withEvents(JobEventXml.toJobEvents(jobEventsXml)); } catch (NotFoundException e) { throw new RuntimeException(e); } } }
projectRegistry.addProject().withId(projectConfig.getId("uniqueIdentifier")) .withBudget(projectConfig.getMoney("projectEstimate")) .withCustomer(customer)
.withBillingAddress(a1) .create(); final Project p = Project.builder().withId(new Id("2")) .withBudget(new Money(10500, "EUR")) .withCustomer(c1)
.withId(new Id("" + nextId++)) .withCustomer(acmeConsulting) .withDescription("Acme Consulting Project 1") final Project acmeConsultingProject2 = projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeConsulting) .withDescription("Acme Consulting Project 2") final Project acmeFinancingProject1 = projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeFinancing) .withDescription("Acme Financing Project 1") final Project acmeFinancingProject2 = projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeFinancing) .withDescription("Acme Financing Project 2")