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

[932] Introduce the RepresentationMetadata concept #933

Merged
merged 3 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- [core] `IEditService.findClass()` has been removed
- [core] `IRepresentationDescriptionSearchService` has a new `findAll` method to return all the representation descriptions available in a given editing context
- [core] The package containing the concepts related to the editing context has been renamed to remove references to the project
- https://github.com/eclipse-sirius/sirius-components/issues/932[#932] [graphql] Introduce the RepresentationMetadata concept in order to prepare the separation of the metadata from the representation

=== Dependency update

Expand Down
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-components</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>

<name>sirius-components</name>
<description>Sirius Components</description>
Expand Down
2 changes: 1 addition & 1 deletion backend/sirius-web-annotations-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-annotations-spring</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-annotations-spring</name>
<description>Sirius Web Annotations Spring</description>

Expand Down
2 changes: 1 addition & 1 deletion backend/sirius-web-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-annotations</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-annotations</name>
<description>Sirius Web Annotations</description>

Expand Down
10 changes: 5 additions & 5 deletions backend/sirius-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-api</name>
<description>Sirius Web API</description>

Expand All @@ -47,17 +47,17 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-annotations</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-representations</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-forms</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
Expand All @@ -66,7 +66,7 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
20 changes: 10 additions & 10 deletions backend/sirius-web-compatibility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-compatibility</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-compatibility</name>
<description>Sirius Web Compatibility</description>

Expand Down Expand Up @@ -72,7 +72,7 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -82,43 +82,43 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-spring-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-core-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-spring-collaborative-diagrams</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-forms</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-selection</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-trees</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-interpreter</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
Expand Down
4 changes: 2 additions & 2 deletions backend/sirius-web-components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-components</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-components</name>
<description>Sirius Web Components</description>

Expand Down Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions backend/sirius-web-core-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-core-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-core-api</name>
<description>Sirius Web Core API</description>

Expand Down Expand Up @@ -51,17 +51,17 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-annotations</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-representations</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2022 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
*******************************************************************************/
package org.eclipse.sirius.web.core;

import java.text.MessageFormat;
import java.util.Objects;
import java.util.UUID;

/**
* The metadata of a representation.
*
* @author sbegaudeau
*/
public class RepresentationMetadata {
sbegaudeau marked this conversation as resolved.
Show resolved Hide resolved
private final String id;

private final String kind;

private final String label;

private final UUID descriptionId;

public RepresentationMetadata(String id, String kind, String label, UUID descriptionId) {
this.id = Objects.requireNonNull(id);
this.kind = Objects.requireNonNull(kind);
this.label = Objects.requireNonNull(label);
this.descriptionId = Objects.requireNonNull(descriptionId);
}

public String getId() {
return this.id;
}

public String getKind() {
return this.kind;
}

public String getLabel() {
return this.label;
}

public UUID getDescriptionId() {
return this.descriptionId;
}

@Override
public String toString() {
String pattern = "{0} '{'id: {1}, kind: {2}, label: {3}, descriptionId: {4}'}'"; //$NON-NLS-1$
return MessageFormat.format(pattern, this.getClass().getSimpleName(), this.id, this.kind, this.label, this.descriptionId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright (c) 2022 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
*******************************************************************************/
package org.eclipse.sirius.web.core;

import java.util.Optional;

import org.eclipse.sirius.web.core.api.IRepresentationMetadataSearchService;
import org.eclipse.sirius.web.representations.IRepresentation;
import org.springframework.stereotype.Service;

/**
* Used to find the metadata of a representation.
*
* @author sbegaudeau
*/
@Service
public class RepresentationMetadataSearchService implements IRepresentationMetadataSearchService {

@Override
public Optional<RepresentationMetadata> findByRepresentation(IRepresentation representation) {
return Optional.of(new RepresentationMetadata(representation.getId(), representation.getKind(), representation.getLabel(), representation.getDescriptionId()));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2022 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
*******************************************************************************/
package org.eclipse.sirius.web.core.api;

import java.util.Optional;

import org.eclipse.sirius.web.core.RepresentationMetadata;
import org.eclipse.sirius.web.representations.IRepresentation;

/**
* Used to search and retrieve the metadata of a representation.
*
* @author sbegaudeau
*/
public interface IRepresentationMetadataSearchService {
Optional<RepresentationMetadata> findByRepresentation(IRepresentation representation);
}
6 changes: 3 additions & 3 deletions backend/sirius-web-diagrams-layout-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-diagrams-layout-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-diagrams-layout-api</name>
<description>Sirius Web Diagrams Layout API</description>

Expand All @@ -42,12 +42,12 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-diagrams</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-core-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
</dependencies>

Expand Down
14 changes: 7 additions & 7 deletions backend/sirius-web-diagrams-layout/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</parent>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-diagrams-layout</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<name>sirius-web-diagrams-layout</name>
<description>Sirius Web Diagrams layout</description>

Expand Down Expand Up @@ -65,17 +65,17 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-annotations</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-core-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-diagrams-layout-api</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.elk</groupId>
Expand Down Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -127,12 +127,12 @@
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-diagrams</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius.web</groupId>
<artifactId>sirius-web-diagrams-tests</artifactId>
<version>2021.12.10</version>
<version>2021.12.11</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Loading