Skip to content

Commit

Permalink
[2796] Convert flow to view DSL
Browse files Browse the repository at this point in the history
Bug: #2796
Signed-off-by: Florian ROUËNÉ <florian.rouene@obeosoft.com>
  • Loading branch information
frouene committed Jan 10, 2024
1 parent cac612f commit 12ed706
Show file tree
Hide file tree
Showing 71 changed files with 4,062 additions and 195 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The GraphQL type `NodeDescription` has a new field `childNodeDescriptionIds`, re
The GraphQL type `NodeDescription` has a new field `borderNodeDescriptionIds`, returning a list of Ids and replacing the field `borderNodeDescriptions` which has been deleted.
- https://github.com/eclipse-sirius/sirius-web/issues/2872[#2872] [diagram] Change the signature of the node converters in order to leverage the diagram description to resolve the reuse descriptions.
Additional changes to this interface will propably occur in the near future in order to support more complex use cases.
- https://github.com/eclipse-sirius/sirius-web/issues/2796[#2796] [sirius-web] All Flow related configurations have been moved to `sirius-components-flow-starter` module.

=== Dependency update

Expand Down Expand Up @@ -141,6 +142,7 @@ This is a preliminary work to add some proper support for outside labels in the
- https://github.com/eclipse-sirius/sirius-web/issues/2869[#2869] [diagram] Add `diagramContext` variable to accessible variables when computing semantic candidates expression.
- https://github.com/eclipse-sirius/sirius-web/issues/2774[#2774] [gantt] Rework the gantt representation front-end to follow best practises.
- https://github.com/eclipse-sirius/sirius-web/issues/2872[#2872] [diagram] Reduce the time needed to retrieve a diagram description, thus leading to reduce the duration of diagrams opening.
- https://github.com/eclipse-sirius/sirius-web/issues/2796[#2796] [sirius-web] Flow diagram description has been converted to the view DSL.

== v2023.12.0

Expand Down
55 changes: 55 additions & 0 deletions integration-tests/cypress/e2e/project/flow/flow.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 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
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/

import { Project } from '../../../pages/Project';
import { Flow } from '../../../usecases/Flow';
import { Explorer } from '../../../workbench/Explorer';
import { Diagram } from '../../../workbench/Diagram';

const projectName = 'Cypress - flow';

describe('Flow', () => {
context('Given a flow project with a robot document', () => {
let projectId: string = '';
beforeEach(() =>
new Flow().createRobotProject(projectName).then((createdProjectData) => {
projectId = createdProjectData.projectId;
new Project().visit(projectId);
})
);

afterEach(() => cy.deleteProject(projectId));

context('When we interact with the flow diagram', () => {
it('Then I can create a topography diagram', () => {
const explorer = new Explorer();
const diagram = new Diagram();
explorer.getExplorerView().contains('robot');
explorer.expand('robot');
explorer.createRepresentation('Robot', 'Topography', 'diagramTopography');
diagram.getDiagram('diagramTopography').should('exist');
diagram.getNodes('diagramTopography', 'Central_Unit').should('exist');
});

it('Then I can create a topography unsynchronized diagram', () => {
const explorer = new Explorer();
const diagram = new Diagram();
explorer.getExplorerView().contains('robot');
explorer.expand('robot');
explorer.createRepresentation('Robot', 'Topography unsynchronized', 'diagramTopographyUnsynchronized');
diagram.getDiagram('diagramTopographyUnsynchronized').should('exist');
diagram.getNodes('diagramTopographyUnsynchronized', 'Central_Unit').should('not.exist');
});
});
});
});
35 changes: 12 additions & 23 deletions packages/sirius-web/backend/sirius-web-sample-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

<properties>
<java.version>17</java.version>
<flow.version>1.0.11-SNAPSHOT</flow.version>
<bpmn.version>4.0.3-SNAPSHOT</bpmn.version>
<eef.version>2.1.5-SNAPSHOT</eef.version>
</properties>
Expand Down Expand Up @@ -156,23 +155,13 @@
</dependency>
<dependency>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-view-deck</artifactId>
<version>2023.12.7</version>
</dependency>
<dependency>
<groupId>fr.obeo.dsl.designer.sample.flow</groupId>
<artifactId>fr.obeo.dsl.designer.sample.flow</artifactId>
<version>${flow.version}</version>
</dependency>
<dependency>
<groupId>fr.obeo.dsl.designer.sample.flow</groupId>
<artifactId>fr.obeo.dsl.designer.sample.flow.edit</artifactId>
<version>${flow.version}</version>
<artifactId>sirius-components-flow-starter</artifactId>
<version>2023.12.7</version>
</dependency>
<dependency>
<groupId>fr.obeo.dsl.designer.sample.flow</groupId>
<artifactId>fr.obeo.dsl.designer.sample.flow.design</artifactId>
<version>${flow.version}</version>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-view-deck</artifactId>
<version>2023.12.7</version>
</dependency>
<dependency>
<groupId>BPMN2</groupId>
Expand Down Expand Up @@ -269,13 +258,13 @@
<version>2023.12.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-view-deck-edit</artifactId>
<version>2023.12.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-view-deck-edit</artifactId>
<version>2023.12.7</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 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 @@ -12,16 +12,11 @@
*******************************************************************************/
package org.eclipse.sirius.web.sample.configuration;

import fr.obeo.dsl.designer.sample.flow.FlowPackage;
import fr.obeo.dsl.designer.sample.flow.provider.FlowItemProviderAdapterFactory;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.sirius.components.domain.DomainPackage;
import org.eclipse.sirius.components.domain.provider.DomainItemProviderAdapterFactory;
import org.eclipse.sirius.components.emf.configuration.ChildExtenderProvider;
import org.eclipse.sirius.components.emf.services.ILabelFeatureProvider;
import org.eclipse.sirius.components.emf.services.LabelFeatureProvider;
import org.eclipse.sirius.components.view.ViewPackage;
import org.eclipse.sirius.components.view.diagram.DiagramPackage;
import org.eclipse.sirius.components.view.diagram.provider.DiagramItemProviderAdapterFactory;
Expand All @@ -44,21 +39,6 @@
@Configuration
public class SampleEMFConfiguration {

@Bean
public AdapterFactory flowAdapterFactory() {
return new FlowItemProviderAdapterFactory();
}

@Bean
public EPackage flowEPackage() {
return FlowPackage.eINSTANCE;
}

@Bean
public ILabelFeatureProvider flowLabelFeatureProvider() {
return new LabelFeatureProvider(FlowPackage.eINSTANCE.getNsURI(), new FlowLabelFeatureSwitch(), new FlowEditableSwitch());
}

@Bean
@ConditionalOnProperty(prefix = "org.eclipse.sirius.web.features", name = "studioDefinition")
public EPackage domainEPackage() {
Expand Down
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 Down Expand Up @@ -29,7 +29,7 @@ public class SampleSiriusConfiguration implements ISiriusConfiguration {

@Override
public List<String> getODesignPaths() {
return List.of("description/flow.odesign");
return List.of();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 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 @@ -12,8 +12,6 @@
*******************************************************************************/
package org.eclipse.sirius.web.sample.configuration;

import fr.obeo.dsl.designer.sample.flow.FlowFactory;

import java.util.List;
import java.util.UUID;

Expand All @@ -30,7 +28,6 @@
import org.eclipse.sirius.web.sample.papaya.view.PapayaViewProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;

import io.micrometer.core.instrument.MeterRegistry;

Expand All @@ -46,18 +43,6 @@ public class StereotypeDescriptionRegistryConfigurer implements IStereotypeDescr

public static final String EMPTY_LABEL = "Others...";

public static final UUID EMPTY_FLOW_ID = UUID.nameUUIDFromBytes("empty_flow".getBytes());

public static final String EMPTY_FLOW_LABEL = "Flow";

public static final UUID ROBOT_FLOW_ID = UUID.nameUUIDFromBytes("robot_flow".getBytes());

public static final String ROBOT_FLOW_LABEL = "Robot Flow";

public static final UUID BIG_GUY_FLOW_ID = UUID.nameUUIDFromBytes("big_guy_flow".getBytes());

public static final String BIG_GUY_FLOW_LABEL = "Big Guy Flow (17k elements)";

public static final UUID EMPTY_VIEW_ID = UUID.nameUUIDFromBytes("empty_view".getBytes());

public static final String EMPTY_VIEW_LABEL = "View";
Expand Down Expand Up @@ -90,15 +75,12 @@ public StereotypeDescriptionRegistryConfigurer(MeterRegistry meterRegistry, @Val

@Override
public void addStereotypeDescriptions(IStereotypeDescriptionRegistry registry) {
registry.add(new StereotypeDescription(EMPTY_FLOW_ID, EMPTY_FLOW_LABEL, this::getEmptyFlowContent));
if (this.studiosEnabled) {
registry.add(new StereotypeDescription(EMPTY_DOMAIN_ID, EMPTY_DOMAIN_LABEL, this::getEmptyDomainContent));
registry.add(new StereotypeDescription(EMPTY_VIEW_ID, EMPTY_VIEW_LABEL, this::getEmptyViewContent));
registry.add(new StereotypeDescription(PAPAYA_DOMAIN_ID, PAPAYA_DOMAIN_LABEL, this::getPapayaDomainContent));
registry.add(new StereotypeDescription(PAPAYA_VIEW_ID, PAPAYA_VIEW_LABEL, this::getPapayaViewContent));
}
registry.add(new StereotypeDescription(ROBOT_FLOW_ID, ROBOT_FLOW_LABEL, this::getRobotFlowContent));
registry.add(new StereotypeDescription(BIG_GUY_FLOW_ID, BIG_GUY_FLOW_LABEL, this::getBigGuyFlowContent));
registry.add(new StereotypeDescription(EMPTY_ID, EMPTY_LABEL, "New", this::getEmptyContent));
}

Expand Down Expand Up @@ -130,15 +112,4 @@ private String getEmptyContent() {
return this.stereotypeBuilder.getStereotypeBody(List.of());
}

private String getEmptyFlowContent() {
return this.stereotypeBuilder.getStereotypeBody(List.of(FlowFactory.eINSTANCE.createSystem()));
}

private String getRobotFlowContent() {
return this.stereotypeBuilder.getStereotypeBody(new ClassPathResource("robot.flow"));
}

private String getBigGuyFlowContent() {
return this.stereotypeBuilder.getStereotypeBody(new ClassPathResource("Big_Guy.flow"));
}
}
Loading

0 comments on commit 12ed706

Please sign in to comment.