Skip to content

Commit

Permalink
[3679] Split representation metadata from content
Browse files Browse the repository at this point in the history
Bug: #3679
Signed-off-by: Guillaume Coutable <guillaume.coutable@obeo.fr>
  • Loading branch information
gcoutable committed Oct 14, 2024
1 parent 2040b3c commit 8c2c366
Show file tree
Hide file tree
Showing 112 changed files with 1,738 additions and 1,213 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ This allows an error to be displayed when there is a problem during uploading
- https://github.com/eclipse-sirius/sirius-web/issues/4037[#4037] [trees] The tree item id passed to `ITreeQueryService.findTreeItem` is no longer a UUID but is now a String.
- https://github.com/eclipse-sirius/sirius-web/issues/4077[#4077] [charts] Remove `interface RepresentationMetadata` from `BarChart.types.ts`.
- https://github.com/eclipse-sirius/sirius-web/issues/3840[#3840] [diagram] Migrate to ReactFlow 12, if you have components that uses the library then you'll need to update them.

- https://github.com/eclipse-sirius/sirius-web/issues/3679[#3679] [core] Split representation metadata from content
+ Remove `org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService` and its implementation.
+ Use `org.eclipse.sirius.web.domain.boundedcontexts.representationdata.services.api.IRepresentationMetadataSearchService#findAllMetadataByTargetObjectId` instead of `org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService#findAllByTargetObjectId`.
- https://github.com/eclipse-sirius/sirius-web/issues/3679[#3679] [sirius-web] aql service `hasChildren` requires the editing context like the aql service `getChildren`.

=== Dependency update

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 THALES GLOBAL SERVICES and others.
* Copyright (c) 2019, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -23,7 +23,6 @@
import org.eclipse.sirius.components.compatibility.emf.diagrams.CanCreateDiagramPredicate;
import org.eclipse.sirius.components.compatibility.emf.modeloperations.ModelOperationHandlerSwitch;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -46,9 +45,9 @@ public ICanCreateDiagramPredicateFactory canCreateDiagramPredicateFactory() {
}

@Bean
public IModelOperationHandlerSwitchProvider modelOperationHandlerSwitchProvider(IObjectService objectService, IRepresentationMetadataSearchService representationMetadataSearchService,
public IModelOperationHandlerSwitchProvider modelOperationHandlerSwitchProvider(IObjectService objectService,
IIdentifierProvider identifierProvider, List<IExternalJavaActionProvider> externalJavaActionProviders) {
return (interpreter) -> new ModelOperationHandlerSwitch(objectService, representationMetadataSearchService, identifierProvider, externalJavaActionProviders, interpreter);
return (interpreter) -> new ModelOperationHandlerSwitch(objectService, identifierProvider, externalJavaActionProviders, interpreter);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Obeo.
* Copyright (c) 2019, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -21,7 +21,6 @@
import org.eclipse.sirius.components.compatibility.api.IIdentifierProvider;
import org.eclipse.sirius.components.compatibility.api.IModelOperationHandler;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.components.interpreter.AQLInterpreter;
import org.eclipse.sirius.components.representations.IStatus;
import org.eclipse.sirius.components.representations.VariableManager;
Expand All @@ -37,8 +36,6 @@ public class ChangeContextOperationHandler implements IModelOperationHandler {

private final IObjectService objectService;

private final IRepresentationMetadataSearchService representationMetadataSearchService;

private final IIdentifierProvider identifierProvider;

private final AQLInterpreter interpreter;
Expand All @@ -47,10 +44,9 @@ public class ChangeContextOperationHandler implements IModelOperationHandler {

private final ChangeContext changeContext;

public ChangeContextOperationHandler(IObjectService objectService, IRepresentationMetadataSearchService representationMetadataSearchService, IIdentifierProvider identifierProvider,
public ChangeContextOperationHandler(IObjectService objectService, IIdentifierProvider identifierProvider,
AQLInterpreter interpreter, ChildModelOperationHandler childModelOperationHandler, ChangeContext changeContext) {
this.objectService = Objects.requireNonNull(objectService);
this.representationMetadataSearchService = Objects.requireNonNull(representationMetadataSearchService);
this.identifierProvider = Objects.requireNonNull(identifierProvider);
this.interpreter = Objects.requireNonNull(interpreter);
this.childModelOperationHandler = Objects.requireNonNull(childModelOperationHandler);
Expand All @@ -67,7 +63,7 @@ public IStatus handle(Map<String, Object> variables) {
}

List<ModelOperation> subModelOperations = this.changeContext.getSubModelOperations();
return this.childModelOperationHandler.handle(this.objectService, this.representationMetadataSearchService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
return this.childModelOperationHandler.handle(this.objectService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Obeo and others.
* Copyright (c) 2019, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -21,7 +21,6 @@
import org.eclipse.sirius.components.compatibility.api.IModelOperationHandler;
import org.eclipse.sirius.components.compatibility.emf.api.IExternalJavaActionProvider;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.components.interpreter.AQLInterpreter;
import org.eclipse.sirius.components.representations.Failure;
import org.eclipse.sirius.components.representations.IStatus;
Expand All @@ -42,12 +41,12 @@ public ChildModelOperationHandler(List<IExternalJavaActionProvider> externalJava
this.externalJavaActionProviders = Objects.requireNonNull(externalJavaActionProviders);
}

public IStatus handle(IObjectService objectService, IRepresentationMetadataSearchService representationMetadataSearchService, IIdentifierProvider identifierProvider, AQLInterpreter interpreter,
public IStatus handle(IObjectService objectService, IIdentifierProvider identifierProvider, AQLInterpreter interpreter,
Map<String, Object> variables, List<ModelOperation> modelOperations) {
Success success = new Success();
boolean hasBeenSuccessfullyExecuted = true;

ModelOperationHandlerSwitch modelOperationHandlerSwitch = new ModelOperationHandlerSwitch(objectService, representationMetadataSearchService, identifierProvider,
ModelOperationHandlerSwitch modelOperationHandlerSwitch = new ModelOperationHandlerSwitch(objectService, identifierProvider,
this.externalJavaActionProviders, interpreter);
for (ModelOperation modelOperation : modelOperations) {
Optional<IModelOperationHandler> optionalModelOperationHandler = modelOperationHandlerSwitch.apply(modelOperation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.sirius.components.compatibility.api.IIdentifierProvider;
import org.eclipse.sirius.components.compatibility.api.IModelOperationHandler;
import org.eclipse.sirius.components.emf.EPackageService;
import org.eclipse.sirius.components.core.api.IEditingContext;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.components.emf.EPackageService;
import org.eclipse.sirius.components.emf.services.api.IEMFEditingContext;
import org.eclipse.sirius.components.interpreter.AQLInterpreter;
import org.eclipse.sirius.components.representations.IStatus;
Expand Down Expand Up @@ -57,8 +56,6 @@ public class CreateInstanceOperationHandler implements IModelOperationHandler {

private final IObjectService objectService;

private final IRepresentationMetadataSearchService representationMetadataSearchService;

private final IIdentifierProvider identifierProvider;

private final AQLInterpreter interpreter;
Expand All @@ -69,11 +66,10 @@ public class CreateInstanceOperationHandler implements IModelOperationHandler {

private final CreateInstance createInstance;

public CreateInstanceOperationHandler(IObjectService objectService, IRepresentationMetadataSearchService representationMetadataSearchService, IIdentifierProvider identifierProvider,
public CreateInstanceOperationHandler(IObjectService objectService, IIdentifierProvider identifierProvider,
AQLInterpreter interpreter, EPackageService ePackageService, ChildModelOperationHandler childModelOperationHandler, CreateInstance createInstance) {
this.objectService = Objects.requireNonNull(objectService);
this.identifierProvider = Objects.requireNonNull(identifierProvider);
this.representationMetadataSearchService = Objects.requireNonNull(representationMetadataSearchService);
this.interpreter = Objects.requireNonNull(interpreter);
this.ePackageService = Objects.requireNonNull(ePackageService);
this.childModelOperationHandler = Objects.requireNonNull(childModelOperationHandler);
Expand Down Expand Up @@ -133,6 +129,6 @@ public IStatus handle(Map<String, Object> variables) {
}

List<ModelOperation> subModelOperations = this.createInstance.getSubModelOperations();
return this.childModelOperationHandler.handle(this.objectService, this.representationMetadataSearchService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
return this.childModelOperationHandler.handle(this.objectService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2023 Obeo.
* Copyright (c) 2021, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -23,7 +23,6 @@
import org.eclipse.sirius.components.compatibility.api.IIdentifierProvider;
import org.eclipse.sirius.components.compatibility.api.IModelOperationHandler;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.components.diagrams.Diagram;
import org.eclipse.sirius.components.diagrams.Node;
import org.eclipse.sirius.components.diagrams.ViewCreationRequest;
Expand All @@ -50,8 +49,6 @@ public class CreateViewOperationHandler implements IModelOperationHandler {

private final IObjectService objectService;

private final IRepresentationMetadataSearchService representationMetadataSearchService;

private final IIdentifierProvider identifierProvider;

private final AQLInterpreter interpreter;
Expand All @@ -60,10 +57,9 @@ public class CreateViewOperationHandler implements IModelOperationHandler {

private final CreateView createView;

public CreateViewOperationHandler(IObjectService objectService, IRepresentationMetadataSearchService representationSearchService, IIdentifierProvider identifierProvider,
public CreateViewOperationHandler(IObjectService objectService, IIdentifierProvider identifierProvider,
AQLInterpreter interpreter, ChildModelOperationHandler childModelOperationHandler, CreateView createView) {
this.objectService = Objects.requireNonNull(objectService);
this.representationMetadataSearchService = Objects.requireNonNull(representationSearchService);
this.identifierProvider = Objects.requireNonNull(identifierProvider);
this.interpreter = Objects.requireNonNull(interpreter);
this.childModelOperationHandler = Objects.requireNonNull(childModelOperationHandler);
Expand All @@ -77,11 +73,9 @@ public IStatus handle(Map<String, Object> variables) {
var optionalParentElement = this.interpreter.evaluateExpression(variables, containerViewExpression).asObject();
var optionalParentElementId = optionalParentElement.flatMap(parentElement -> {
Optional<String> optionalElementId = Optional.empty();
if (parentElement instanceof Diagram) {
Diagram diagram = (Diagram) parentElement;
if (parentElement instanceof Diagram diagram) {
optionalElementId = Optional.of(diagram.getId());
} else if (parentElement instanceof Node) {
Node node = (Node) parentElement;
} else if (parentElement instanceof Node node) {
optionalElementId = Optional.of(node.getId());
}
return optionalElementId;
Expand Down Expand Up @@ -119,7 +113,7 @@ public IStatus handle(Map<String, Object> variables) {

Map<String, Object> childVariables = new HashMap<>(variables);
List<ModelOperation> subModelOperations = this.createView.getSubModelOperations();
return this.childModelOperationHandler.handle(this.objectService, this.representationMetadataSearchService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
return this.childModelOperationHandler.handle(this.objectService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 Obeo.
* Copyright (c) 2021, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -22,7 +22,6 @@
import org.eclipse.sirius.components.compatibility.api.IIdentifierProvider;
import org.eclipse.sirius.components.compatibility.api.IModelOperationHandler;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.components.diagrams.Node;
import org.eclipse.sirius.components.diagrams.ViewDeletionRequest;
import org.eclipse.sirius.components.interpreter.AQLInterpreter;
Expand All @@ -41,8 +40,6 @@ public class DeleteViewOperationHandler implements IModelOperationHandler {

private final IObjectService objectService;

private final IRepresentationMetadataSearchService representationMetadataSearchService;

private final IIdentifierProvider identifierProvider;

private final AQLInterpreter interpreter;
Expand All @@ -51,10 +48,9 @@ public class DeleteViewOperationHandler implements IModelOperationHandler {

private final DeleteView deleteView;

public DeleteViewOperationHandler(IObjectService objectService, IRepresentationMetadataSearchService representationSearchService, IIdentifierProvider identifierProvider,
public DeleteViewOperationHandler(IObjectService objectService, IIdentifierProvider identifierProvider,
AQLInterpreter interpreter, ChildModelOperationHandler childModelOperationHandler, DeleteView deleteView) {
this.objectService = Objects.requireNonNull(objectService);
this.representationMetadataSearchService = Objects.requireNonNull(representationSearchService);
this.identifierProvider = Objects.requireNonNull(identifierProvider);
this.interpreter = Objects.requireNonNull(interpreter);
this.childModelOperationHandler = Objects.requireNonNull(childModelOperationHandler);
Expand All @@ -79,7 +75,7 @@ public IStatus handle(Map<String, Object> variables) {

Map<String, Object> childVariables = new HashMap<>(variables);
List<ModelOperation> subModelOperations = this.deleteView.getSubModelOperations();
return this.childModelOperationHandler.handle(this.objectService, this.representationMetadataSearchService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
return this.childModelOperationHandler.handle(this.objectService, this.identifierProvider, this.interpreter, childVariables, subModelOperations);
}
return new Failure("");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021, 2022 Obeo and others.
* Copyright (c) 2021, 2024 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -23,7 +23,6 @@
import org.eclipse.sirius.components.compatibility.api.IModelOperationHandler;
import org.eclipse.sirius.components.compatibility.emf.api.IExternalJavaActionProvider;
import org.eclipse.sirius.components.core.api.IObjectService;
import org.eclipse.sirius.components.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.components.interpreter.AQLInterpreter;
import org.eclipse.sirius.components.representations.Failure;
import org.eclipse.sirius.components.representations.IStatus;
Expand All @@ -46,8 +45,6 @@ public class ExternalJavaActionOperationHandler implements IModelOperationHandle

private final IObjectService objectService;

private final IRepresentationMetadataSearchService representationMetadataSearchService;

private final IIdentifierProvider identifierProvider;

private final AQLInterpreter interpreter;
Expand All @@ -58,10 +55,9 @@ public class ExternalJavaActionOperationHandler implements IModelOperationHandle

private final ExternalJavaAction externalJavaAction;

public ExternalJavaActionOperationHandler(IObjectService objectService, IRepresentationMetadataSearchService representationSearchService, IIdentifierProvider identifierProvider,
public ExternalJavaActionOperationHandler(IObjectService objectService, IIdentifierProvider identifierProvider,
AQLInterpreter interpreter, ChildModelOperationHandler childModelOperationHandler, List<IExternalJavaActionProvider> externalJavaActionProviders, ExternalJavaAction externalJavaAction) {
this.objectService = Objects.requireNonNull(objectService);
this.representationMetadataSearchService = Objects.requireNonNull(representationSearchService);
this.identifierProvider = Objects.requireNonNull(identifierProvider);
this.interpreter = Objects.requireNonNull(interpreter);
this.childModelOperationHandler = Objects.requireNonNull(childModelOperationHandler);
Expand Down Expand Up @@ -98,7 +94,7 @@ public IStatus handle(Map<String, Object> variables) {
}

List<ModelOperation> subModelOperations = this.externalJavaAction.getSubModelOperations();
return this.childModelOperationHandler.handle(this.objectService, this.representationMetadataSearchService, this.identifierProvider, this.interpreter, variables, subModelOperations);
return this.childModelOperationHandler.handle(this.objectService, this.identifierProvider, this.interpreter, variables, subModelOperations);
}

}
Loading

0 comments on commit 8c2c366

Please sign in to comment.