Search in sources :

Example 1 with IValidationEventHandler

use of org.eclipse.sirius.components.collaborative.validation.api.IValidationEventHandler in project sirius-components by eclipse-sirius.

the class ValidationEventProcessor method handle.

@Override
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IRepresentationInput representationInput) {
    if (representationInput instanceof IValidationInput) {
        IValidationInput validationInput = (IValidationInput) representationInput;
        // @formatter:off
        Optional<IValidationEventHandler> optionalValidationEventHandler = this.validationEventHandlers.stream().filter(handler -> handler.canHandle(validationInput)).findFirst();
        if (optionalValidationEventHandler.isPresent()) {
            IValidationEventHandler validationEventHandler = optionalValidationEventHandler.get();
            validationEventHandler.handle(payloadSink, changeDescriptionSink, this.validationContext.getValidation(), validationInput);
        } else {
            // $NON-NLS-1$
            this.logger.warn("No handler found for event: {}", validationInput);
        }
    }
}
Also used : ValidationComponent(org.eclipse.sirius.components.validation.components.ValidationComponent) Sinks(reactor.core.publisher.Sinks) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) LoggerFactory(org.slf4j.LoggerFactory) One(reactor.core.publisher.Sinks.One) IInput(org.eclipse.sirius.components.core.api.IInput) Timer(io.micrometer.core.instrument.Timer) Monitoring(org.eclipse.sirius.components.collaborative.api.Monitoring) IRepresentation(org.eclipse.sirius.components.representations.IRepresentation) IRepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry) EmitResult(reactor.core.publisher.Sinks.EmitResult) ValidationRenderer(org.eclipse.sirius.components.validation.render.ValidationRenderer) IValidationEventHandler(org.eclipse.sirius.components.collaborative.validation.api.IValidationEventHandler) IValidationInput(org.eclipse.sirius.components.collaborative.validation.api.IValidationInput) IValidationEventProcessor(org.eclipse.sirius.components.collaborative.validation.api.IValidationEventProcessor) ChangeKind(org.eclipse.sirius.components.collaborative.api.ChangeKind) ISubscriptionManager(org.eclipse.sirius.components.collaborative.api.ISubscriptionManager) Logger(org.slf4j.Logger) ChangeDescription(org.eclipse.sirius.components.collaborative.api.ChangeDescription) ValidationDescription(org.eclipse.sirius.components.validation.description.ValidationDescription) Mono(reactor.core.publisher.Mono) ValidationRefreshedEventPayload(org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload) IRepresentationInput(org.eclipse.sirius.components.core.api.IRepresentationInput) IRepresentationRefreshPolicy(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicy) Element(org.eclipse.sirius.components.representations.Element) Validation(org.eclipse.sirius.components.validation.Validation) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) Flux(reactor.core.publisher.Flux) List(java.util.List) IPayload(org.eclipse.sirius.components.core.api.IPayload) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) ValidationComponentProps(org.eclipse.sirius.components.validation.components.ValidationComponentProps) Many(reactor.core.publisher.Sinks.Many) Optional(java.util.Optional) VariableManager(org.eclipse.sirius.components.representations.VariableManager) IValidationEventHandler(org.eclipse.sirius.components.collaborative.validation.api.IValidationEventHandler) IValidationInput(org.eclipse.sirius.components.collaborative.validation.api.IValidationInput)

Aggregations

MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 Timer (io.micrometer.core.instrument.Timer)1 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 TimeUnit (java.util.concurrent.TimeUnit)1 ChangeDescription (org.eclipse.sirius.components.collaborative.api.ChangeDescription)1 ChangeKind (org.eclipse.sirius.components.collaborative.api.ChangeKind)1 IRepresentationRefreshPolicy (org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicy)1 IRepresentationRefreshPolicyRegistry (org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry)1 ISubscriptionManager (org.eclipse.sirius.components.collaborative.api.ISubscriptionManager)1 Monitoring (org.eclipse.sirius.components.collaborative.api.Monitoring)1 IValidationEventHandler (org.eclipse.sirius.components.collaborative.validation.api.IValidationEventHandler)1 IValidationEventProcessor (org.eclipse.sirius.components.collaborative.validation.api.IValidationEventProcessor)1 IValidationInput (org.eclipse.sirius.components.collaborative.validation.api.IValidationInput)1 ValidationRefreshedEventPayload (org.eclipse.sirius.components.collaborative.validation.dto.ValidationRefreshedEventPayload)1 IEditingContext (org.eclipse.sirius.components.core.api.IEditingContext)1 IInput (org.eclipse.sirius.components.core.api.IInput)1 IPayload (org.eclipse.sirius.components.core.api.IPayload)1 IRepresentationInput (org.eclipse.sirius.components.core.api.IRepresentationInput)1