@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); } } }
.withCustomer(c1) .withName("Project 1") .withDescription("description of project 1") .withStartDate(parseDate("2014-01-03")) .withEndDate(parseDate("2014-02-12"))
.withId(new Id("" + nextId++)) .withCustomer(acmeConsulting) .withDescription("Acme Consulting Project 1") .withName("Acme Consulting Project 1") .withStartDate(project1StartDate) .withId(new Id("" + nextId++)) .withCustomer(acmeConsulting) .withDescription("Acme Consulting Project 2") .withName("Acme Consulting Project 2") .withStartDate(project2StartDate) .withId(new Id("" + nextId++)) .withCustomer(acmeFinancing) .withDescription("Acme Financing Project 1") .withName("Acme Financing Project 1") .withStartDate(project3StartDate) .withId(new Id("" + nextId++)) .withCustomer(acmeFinancing) .withDescription("Acme Financing Project 2") .withName("Acme Financing Project 2") .withStartDate(project4StartDate)