Added delete propagation constraint

This commit is contained in:
Luca Frosini 2023-02-02 21:20:04 +01:00
parent a7e2fbb312
commit 4bd70bc54d
1 changed files with 11 additions and 1 deletions

View File

@ -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<Service, Software> enables = new EnablesImpl<Service, Software>(runningPlugin, pluginResource, enablesPropagationConstraint);
try {
resourceRegistryPublisher.createIsRelatedTo(enables);