@Override @Nonnull public PresentationModel createPresentationModel (final @Nonnull Object... instanceRoles) { final Styleable styleable = new DefaultStyleable(getStyles()); return jobEvent.findChildren() .stream() .map(jobEvent -> (JobEventSpi)jobEvent) .sorted(comparing(JobEventSpi::getDateTime)) .map(jobEvent -> jobEvent.as(Presentable).createPresentationModel()) .collect(toCompositePresentationModel(aggregateBuilder().create(), styleable)); // FIXME: use SimpleCompositePresentable? }
/******************************************************************************************************************* * * Reacts to the notification that a {@link Project} has been selected by populating the presentation with * its job events. * * @param event the notification event * ******************************************************************************************************************/ @VisibleForTesting void onProjectSelectedEvent (final @Nonnull @ListensTo ProjectSelectedEvent event) { log.info("onProjectSelectedEvent({})", event); presentation.populate(event.getProject().findChildren() .stream() .map(jobEvent -> (JobEventSpi)jobEvent) .sorted(comparing(JobEventSpi::getDateTime)) .map(jobEvent -> jobEvent.as(Presentable).createPresentationModel()) .collect(toCompositePresentationModel())); } }
public ProjectXml (final @Nonnull Project project) { final Project.Builder builder = project.toBuilder(); this.id = builder.getId(); this.customerXml = new CustomerXml(builder.getCustomer()); this.name = builder.getName(); this.number = builder.getNumber(); this.description = builder.getDescription(); this.notes = builder.getNotes(); this.status = builder.getStatus(); this.hourlyRate = builder.getHourlyRate(); this.budget = builder.getBudget(); this.startDate = builder.getStartDate(); this.endDate = builder.getEndDate(); this.jobEventsXml = project.findChildren().stream().map(jobEvent -> new JobEventXml(jobEvent)).collect(toList()); }
final Stream<Id> eventIds = configuration.getIds("jobEventIDs").stream(); final List<JobEvent> events = eventIds.flatMap(id -> projectRegistry.findJobEvents().withId(id).stream()) .collect(toList());