diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 83aa957..8929648 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -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
diff --git a/backend/pepper-parent/pom.xml b/backend/pepper-parent/pom.xml
index 730b797..a0fe645 100644
--- a/backend/pepper-parent/pom.xml
+++ b/backend/pepper-parent/pom.xml
@@ -168,6 +168,11 @@
sirius-components-collaborative
${sirius.web.version}
+
+ org.eclipse.sirius
+ sirius-components-collaborative-gantt
+ ${sirius.web.version}
+
org.eclipse.sirius
sirius-components-collaborative-trees
diff --git a/backend/pepper-starter/pom.xml b/backend/pepper-starter/pom.xml
index 52b94b0..14cd793 100644
--- a/backend/pepper-starter/pom.xml
+++ b/backend/pepper-starter/pom.xml
@@ -71,7 +71,11 @@
sirius-components-tests
test
-
+
+ org.eclipse.sirius
+ sirius-components-collaborative-gantt
+
+
diff --git a/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateInitializer.java b/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateInitializer.java
index 93a3f26..c839964 100644
--- a/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateInitializer.java
+++ b/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateInitializer.java
@@ -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.
*
@@ -32,14 +49,24 @@
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
@@ -47,13 +74,53 @@ public void handle(ICause cause, IEditingContext editingContext, String projectT
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 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);
}
}
}
diff --git a/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateProvider.java b/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateProvider.java
index 7afa81d..5354055 100644
--- a/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateProvider.java
+++ b/backend/pepper-starter/src/main/java/pepper/starter/services/PepperMMProjectTemplateProvider.java
@@ -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 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);
}
}
diff --git a/backend/pepper-starter/src/main/resources/project-templates/PepperMM-EmptyProject.png b/backend/pepper-starter/src/main/resources/project-templates/PepperMM-EmptyProject.png
new file mode 100644
index 0000000..423b751
Binary files /dev/null and b/backend/pepper-starter/src/main/resources/project-templates/PepperMM-EmptyProject.png differ
diff --git a/backend/pepper-starter/src/main/resources/project-templates/PepperMM-Template.png b/backend/pepper-starter/src/main/resources/project-templates/PepperMM-Sample.png
similarity index 100%
rename from backend/pepper-starter/src/main/resources/project-templates/PepperMM-Template.png
rename to backend/pepper-starter/src/main/resources/project-templates/PepperMM-Sample.png