From 4bd70bc54d1bf24315d6724f686c333f22ec9f65 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 2 Feb 2023 21:20:04 +0100 Subject: [PATCH] Added delete propagation constraint --- .../executor/ispublisher/RestISPublisher.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/vremanagement/executor/ispublisher/RestISPublisher.java b/src/main/java/org/gcube/vremanagement/executor/ispublisher/RestISPublisher.java index 55164f6..f386b28 100644 --- a/src/main/java/org/gcube/vremanagement/executor/ispublisher/RestISPublisher.java +++ b/src/main/java/org/gcube/vremanagement/executor/ispublisher/RestISPublisher.java @@ -15,6 +15,7 @@ import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; +import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.DeleteConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; @@ -177,6 +178,7 @@ public class RestISPublisher extends ISPublisher { PropagationConstraint usesPropagationConstraint = new PropagationConstraintImpl(); usesPropagationConstraint.setAddConstraint(AddConstraint.propagate); usesPropagationConstraint.setRemoveConstraint(RemoveConstraint.cascade); + usesPropagationConstraint.setDeleteConstraint(DeleteConstraint.cascade); AccessPointFacet smartExecutorAccessPointFacet = getSmartExecutorAccessPointFacet(smartExecutorEService); URI smartExecutorEndpoint = getSmartExecutorEndpoint(smartExecutorAccessPointFacet); @@ -206,11 +208,19 @@ public class RestISPublisher extends ISPublisher { throw e; } + // TODO Retrieve Plugin (Software) to create the relation org.gcube.resourcemanagement.model.reference.entities.resources.Plugin pluginResource = null; - if(pluginResource!=null) { // The if allows not commenting the following code in the meanwhile the pluginResource retrieving is properly coded + if(pluginResource!=null) { + /* + * The if allows not commenting the following code so that + * the creation of the relation between RunningPlugin and the Plugin (Software) + * is properly developed + */ PropagationConstraint enablesPropagationConstraint = new PropagationConstraintImpl(); enablesPropagationConstraint.setAddConstraint(AddConstraint.propagate); enablesPropagationConstraint.setRemoveConstraint(RemoveConstraint.keep); + enablesPropagationConstraint.setDeleteConstraint(DeleteConstraint.keep); + Enables enables = new EnablesImpl(runningPlugin, pluginResource, enablesPropagationConstraint); try { resourceRegistryPublisher.createIsRelatedTo(enables);