Search in sources :

Example 1 with ValidationRefreshedEventPayload

use of org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload in project sirius-components by eclipse-sirius.

the class ValidationEventProcessor method refresh.

@Override
public void refresh(ChangeDescription changeDescription) {
    if (this.shouldRefresh(changeDescription)) {
        long start = System.currentTimeMillis();
        Validation validation = this.refreshValidation();
        this.validationContext.update(validation);
        if (this.sink.currentSubscriberCount() > 0) {
            EmitResult emitResult = this.sink.tryEmitNext(new ValidationRefreshedEventPayload(changeDescription.getInput().getId(), validation));
            if (emitResult.isFailure()) {
                // $NON-NLS-1$
                String pattern = "An error has occurred while emitting a ValidationRefreshedEventPayload: {}";
                this.logger.warn(pattern, emitResult);
            }
        }
        long end = System.currentTimeMillis();
        this.timer.record(end - start, TimeUnit.MILLISECONDS);
    }
}
Also used : Validation(org.eclipse.sirius.components.validation.Validation) ValidationRefreshedEventPayload(org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload) EmitResult(reactor.core.publisher.Sinks.EmitResult)

Example 2 with ValidationRefreshedEventPayload

use of org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload in project sirius-components by eclipse-sirius.

the class ValidationEventProcessor method getOutputEvents.

@Override
public Flux<IPayload> getOutputEvents(IInput input) {
    var initialRefresh = Mono.fromCallable(() -> new ValidationRefreshedEventPayload(input.getId(), this.validationContext.getValidation()));
    var refreshEventFlux = Flux.concat(initialRefresh, this.sink.asFlux());
    // @formatter:off
    return Flux.merge(refreshEventFlux, this.subscriptionManager.getFlux(input));
// @formatter:on
}
Also used : ValidationRefreshedEventPayload(org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload)

Aggregations

ValidationRefreshedEventPayload (org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload)2 Validation (org.eclipse.sirius.components.validation.Validation)1 EmitResult (reactor.core.publisher.Sinks.EmitResult)1