Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleanup] Dispose editing context immediately when a project is deleted #3901

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Objects;

import org.eclipse.sirius.components.annotations.spring.graphql.MutationDataFetcher;
import org.eclipse.sirius.components.collaborative.api.IEditingContextEventProcessorRegistry;
import org.eclipse.sirius.components.core.api.IPayload;
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates;
import org.eclipse.sirius.web.application.project.dto.DeleteProjectInput;
Expand All @@ -38,15 +39,19 @@ public class MutationDeleteProjectDataFetcher implements IDataFetcherWithFieldCo

private final IProjectApplicationService projectApplicationService;

public MutationDeleteProjectDataFetcher(ObjectMapper objectMapper, IProjectApplicationService projectApplicationService) {
private final IEditingContextEventProcessorRegistry editingContextEventProcessorRegistry;

public MutationDeleteProjectDataFetcher(ObjectMapper objectMapper, IProjectApplicationService projectApplicationService, IEditingContextEventProcessorRegistry editingContextEventProcessorRegistry) {
this.objectMapper = Objects.requireNonNull(objectMapper);
this.projectApplicationService = Objects.requireNonNull(projectApplicationService);
this.editingContextEventProcessorRegistry = Objects.requireNonNull(editingContextEventProcessorRegistry);
}

@Override
public IPayload get(DataFetchingEnvironment environment) throws Exception {
Object argument = environment.getArgument(INPUT_ARGUMENT);
var input = this.objectMapper.convertValue(argument, DeleteProjectInput.class);
this.editingContextEventProcessorRegistry.disposeEditingContextEventProcessor(input.projectId().toString());
return this.projectApplicationService.deleteProject(input);
}
}