Skip to content
Open
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
14 changes: 14 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
= Changelog

== v2026.5.0

=== Dependency update

=== New features

=== Improvements

- https://github.com/ObeoNetwork/pepper/issues/43[#43] Add an empty pepper template to the home menu
- https://github.com/ObeoNetwork/pepper/issues/44[#44] Add a Gantt Diagram to the first workpackage of the Gantt Sample Template

=== Bug fixes


== v2026.3.0

=== Dependency update
Expand Down
5 changes: 5 additions & 0 deletions backend/pepper-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@
<artifactId>sirius-components-collaborative</artifactId>
<version>${sirius.web.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-collaborative-gantt</artifactId>
<version>${sirius.web.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-collaborative-trees</artifactId>
Expand Down
6 changes: 5 additions & 1 deletion backend/pepper-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
<artifactId>sirius-components-tests</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.eclipse.sirius</groupId>
<artifactId>sirius-components-collaborative-gantt</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,34 @@
******************************************************************************/
package pepper.starter.services;

import pepper.peppermm.Organization;
import pepper.peppermm.Workpackage;

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

import org.eclipse.sirius.components.collaborative.api.IRepresentationMetadataPersistenceService;
import org.eclipse.sirius.components.collaborative.api.IRepresentationPersistenceService;
import org.eclipse.sirius.components.collaborative.gantt.api.IGanttCreationService;
import org.eclipse.sirius.components.core.RepresentationMetadata;
import org.eclipse.sirius.components.core.api.IEditingContext;
import org.eclipse.sirius.components.core.api.IEditingContextPersistenceService;
import org.eclipse.sirius.components.core.api.IRepresentationDescriptionSearchService;
import org.eclipse.sirius.components.emf.ResourceMetadataAdapter;
import org.eclipse.sirius.components.emf.services.JSONResourceFactory;
import org.eclipse.sirius.components.emf.services.api.IEMFEditingContext;
import org.eclipse.sirius.components.events.ICause;
import org.eclipse.sirius.components.gantt.Gantt;
import org.eclipse.sirius.components.gantt.description.GanttDescription;
import org.eclipse.sirius.components.representations.VariableManager;
import org.eclipse.sirius.emfjson.resource.JsonResource;
import org.eclipse.sirius.web.application.project.services.api.ISemanticDataInitializer;
import org.springframework.stereotype.Service;

import static pepper.starter.services.PepperMMProjectTemplateProvider.PEPPERMM_EMPTY;
import static pepper.starter.services.PepperMMProjectTemplateProvider.PEPPERMM_PEPPER_SAMPLE;
import static pepper.starter.services.view.ViewGanttDescriptionBuilder.WORKPACKAGE_GANTT_REP_DESC_NAME;

/**
* Provides Pepper meta model specific project templates initializers.
*
Expand All @@ -32,28 +49,78 @@
public class PepperMMProjectTemplateInitializer implements ISemanticDataInitializer {

private final IEditingContextPersistenceService editingContextPersistenceService;
private final IRepresentationPersistenceService representationPersistenceService;
private final IGanttCreationService ganttCreationService;
private final IRepresentationDescriptionSearchService representationDescriptionSearchService;
private final IRepresentationMetadataPersistenceService representationMetadataPersistenceService;

public PepperMMProjectTemplateInitializer(IEditingContextPersistenceService editingContextPersistenceService) {
public PepperMMProjectTemplateInitializer(IEditingContextPersistenceService editingContextPersistenceService, IRepresentationPersistenceService representationPersistenceService,
IGanttCreationService ganttCreationService, IRepresentationDescriptionSearchService representationDescriptionSearchService,
IRepresentationMetadataPersistenceService representationMetadataPersistenceService) {
this.editingContextPersistenceService = editingContextPersistenceService;
this.representationPersistenceService = representationPersistenceService;
this.ganttCreationService = ganttCreationService;
this.representationDescriptionSearchService = representationDescriptionSearchService;
this.representationMetadataPersistenceService = representationMetadataPersistenceService;
}

@Override
public boolean canHandle(String projectTemplateId) {
return PepperMMProjectTemplateProvider.PEPPERMM_EXAMPLE_TEMPLATE_ID.equals(projectTemplateId);
return PepperMMProjectTemplateProvider.PEPPERMM_EXAMPLE_TEMPLATE_ID.equals(projectTemplateId) || PepperMMProjectTemplateProvider.PEPPERMM_EMPTY_TEMPLATE_ID.equals(projectTemplateId);
}

@Override
public void handle(ICause cause, IEditingContext editingContext, String projectTemplateId) {
if (PepperMMProjectTemplateProvider.PEPPERMM_EXAMPLE_TEMPLATE_ID.equals(projectTemplateId) && editingContext instanceof IEMFEditingContext emfEditingContext) {
var documentId = UUID.randomUUID();
var resource = new JSONResourceFactory().createResourceFromPath(documentId.toString());
var resourceMetadataAdapter = new ResourceMetadataAdapter("Pepper");
var resourceMetadataAdapter = new ResourceMetadataAdapter(PEPPERMM_PEPPER_SAMPLE);
resource.eAdapters().add(resourceMetadataAdapter);
emfEditingContext.getDomain().getResourceSet().getResources().add(resource);

resource.getContents().add(new PepperMMSampleBuilder().getSampleContent());

this.editingContextPersistenceService.persist(cause, editingContext);

this.createGanttOfWorkpackage(cause, editingContext, resource);
} else if (PepperMMProjectTemplateProvider.PEPPERMM_EMPTY_TEMPLATE_ID.equals(projectTemplateId) && editingContext instanceof IEMFEditingContext emfEditingContext) {
var documentId = UUID.randomUUID();
var resource = new JSONResourceFactory().createResourceFromPath(documentId.toString());
var resourceMetadataAdapter = new ResourceMetadataAdapter(PEPPERMM_EMPTY);
resource.eAdapters().add(resourceMetadataAdapter);
emfEditingContext.getDomain().getResourceSet().getResources().add(resource);

resource.getContents().add(new PepperMMSampleBuilder().getEmptySampleContent());

this.editingContextPersistenceService.persist(cause, editingContext);
}
}

private void createGanttOfWorkpackage(ICause cause, IEditingContext editingContext, JsonResource resource) {
var optionalGanttDescription = this.representationDescriptionSearchService.findAll(editingContext)
.values()
.stream()
.filter(GanttDescription.class::isInstance)
.map(GanttDescription.class::cast)
.filter(desc -> WORKPACKAGE_GANTT_REP_DESC_NAME.equals(desc.getLabel()))
.findFirst();
if (optionalGanttDescription.isPresent()) {
GanttDescription ganttDescription = optionalGanttDescription.get();
Workpackage workpackage = ((Organization) resource.getContents().get(0)).getOwnedProjects().get(0).getOwnedWorkpackages().get(0);
var variableManager = new VariableManager();
variableManager.put(VariableManager.SELF, workpackage);
String label = ganttDescription.labelProvider().apply(variableManager);
List<String> iconURLs = ganttDescription.getIconURLsProvider().apply(variableManager);

Gantt gantt = this.ganttCreationService.create(workpackage, ganttDescription, editingContext);
var representationMetadata = RepresentationMetadata.newRepresentationMetadata(gantt.getId())
.kind(gantt.getKind())
.label(label)
.descriptionId(gantt.descriptionId())
.iconURLs(iconURLs)
.build();
this.representationMetadataPersistenceService.save(cause, editingContext, representationMetadata, gantt.targetObjectId());
this.representationPersistenceService.save(cause, editingContext, gantt);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@
@Service
public class PepperMMProjectTemplateProvider implements IProjectTemplateProvider {

public static final String PEPPERMM_EXAMPLE_TEMPLATE_ID = "pepper-template";
public static final String PEPPERMM_EXAMPLE_TEMPLATE_ID = "pepper-sample";
public static final String PEPPERMM_PEPPER_SAMPLE = "Pepper Sample";

public static final String PEPPERMM_EMPTY_TEMPLATE_ID = "pepper-empty-project";
public static final String PEPPERMM_EMPTY = "Pepper Empty Project";

public static final String PEPPERMM_NATURE = "siriusWeb://nature?kind=peppermm";

@Override
public List<ProjectTemplate> getProjectTemplates() {
var pepperMMTemplate = new ProjectTemplate(PEPPERMM_EXAMPLE_TEMPLATE_ID, "Pepper", "/project-templates/PepperMM-Template.png", List.of(new ProjectTemplateNature(PEPPERMM_NATURE)));
return List.of(pepperMMTemplate);
var pepperMMTemplate = new ProjectTemplate(PEPPERMM_EXAMPLE_TEMPLATE_ID, PEPPERMM_PEPPER_SAMPLE, "/project-templates/PepperMM-Sample.png", List.of(new ProjectTemplateNature(PEPPERMM_NATURE)));
var pepperMMEmptyTemplate = new ProjectTemplate(PEPPERMM_EMPTY_TEMPLATE_ID, PEPPERMM_EMPTY, "/project-templates/PepperMM-EmptyProject.png", List.of(new ProjectTemplateNature(PEPPERMM_NATURE)));
return List.of(pepperMMTemplate, pepperMMEmptyTemplate);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading