use of org.eclipse.sirius.components.collaborative.forms.api.RepresentationsConfiguration in project sirius-web by eclipse-sirius.
the class SubscriptionRepresentationsEventDataFetcher method get.
@Override
public Publisher<IPayload> get(DataFetchingEnvironment environment) throws Exception {
Object argument = environment.getArgument(SubscriptionTypeProvider.INPUT_ARGUMENT);
var input = this.objectMapper.convertValue(argument, RepresentationsEventInput.class);
RepresentationsConfiguration representationsConfiguration = new RepresentationsConfiguration(input.getObjectId());
// @formatter:off
return this.editingContextEventProcessorRegistry.getOrCreateEditingContextEventProcessor(input.getEditingContextId()).flatMap(processor -> processor.acquireRepresentationEventProcessor(IFormEventProcessor.class, representationsConfiguration, input)).map(representationEventProcessor -> representationEventProcessor.getOutputEvents(input)).orElse(Flux.empty());
// @formatter:on
}
use of org.eclipse.sirius.components.collaborative.forms.api.RepresentationsConfiguration in project sirius-components by eclipse-sirius.
the class RepresentationsEventProcessorFactory method createRepresentationEventProcessor.
@Override
public <T extends IRepresentationEventProcessor> Optional<T> createRepresentationEventProcessor(Class<T> representationEventProcessorClass, IRepresentationConfiguration configuration, IEditingContext editingContext) {
if (IFormEventProcessor.class.isAssignableFrom(representationEventProcessorClass) && configuration instanceof RepresentationsConfiguration) {
RepresentationsConfiguration representationsConfiguration = (RepresentationsConfiguration) configuration;
FormDescription formDescription = this.representationsDescriptionProvider.getRepresentationsDescription();
Optional<Object> optionalObject = this.objectService.getObject(editingContext, representationsConfiguration.getObjectId());
if (optionalObject.isPresent()) {
Object object = optionalObject.get();
// @formatter:off
FormCreationParameters formCreationParameters = FormCreationParameters.newFormCreationParameters(representationsConfiguration.getId()).editingContext(editingContext).formDescription(formDescription).objects(List.of(object)).build();
// @formatter:on
FormEventProcessor formEventProcessor = new FormEventProcessor(formCreationParameters, this.formEventHandlers, this.subscriptionManagerFactory.create(), this.widgetSubscriptionManagerFactory.create(), this.representationRefreshPolicyRegistry);
// @formatter:off
return Optional.of(formEventProcessor).filter(representationEventProcessorClass::isInstance).map(representationEventProcessorClass::cast);
// @formatter:on
}
}
return Optional.empty();
}
Aggregations