Fixed add to context and remove from context APIs

This commit is contained in:
Luca Frosini 2021-08-25 09:28:03 +02:00
parent 268b9939c8
commit 352709f9dc
3 changed files with 89 additions and 74 deletions

View File

@ -174,29 +174,29 @@ public interface ResourceRegistryPublisher {
/* ----- */ /* ----- */
public List<ERElement> addToContext(String type, UUID instanceUUID, UUID contextUUID) public List<ERElement> addToContext(String type, UUID instanceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException; throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public List<ERElement> addToContext(ERElement er, UUID contextUUID) public List<ERElement> addToContext(ERElement er, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException; throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public List<ERElement> addToCurrentContext(String type, UUID instanceUUID) public List<ERElement> addToCurrentContext(String type, UUID instanceUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException; throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public List<ERElement> addToCurrentContext(ERElement er) public List<ERElement> addToCurrentContext(ERElement er, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException; throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public List<ERElement> removeFromContext(String type, UUID instanceUUID, UUID contextUUID) public List<ERElement> removeFromContext(String type, UUID instanceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException; throws SchemaViolationException, NotFoundException, ResourceRegistryException;
public List<ERElement> removeFromContext(ERElement er, UUID contextUUID) public List<ERElement> removeFromContext(ERElement er, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public List<ERElement> removeFromCurrentContext(String type, UUID instanceUUID) throws SchemaViolationException, public List<ERElement> removeFromCurrentContext(String type, UUID instanceUUID, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException; ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public List<ERElement> removeFromCurrentContext(ERElement er) public List<ERElement> removeFromCurrentContext(ERElement er, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
@ -208,33 +208,33 @@ public interface ResourceRegistryPublisher {
/* ----- */ /* ----- */
public List<ERElement> addResourceToContext(String resourceType, UUID resourceUUID, UUID contextUUID) public List<ERElement> addResourceToContext(String resourceType, UUID resourceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public <R extends Resource> List<ERElement> addResourceToContext(R resource, UUID contextUUID) public <R extends Resource> List<ERElement> addResourceToContext(R resource, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public List<ERElement> addResourceToCurrentContext(String resourceType, UUID resourceUUID) throws SchemaViolationException, public List<ERElement> addResourceToCurrentContext(String resourceType, UUID resourceUUID, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException; ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <R extends Resource> List<ERElement> addResourceToCurrentContext(R resource) throws SchemaViolationException, public <R extends Resource> List<ERElement> addResourceToCurrentContext(R resource, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException; ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public List<ERElement> removeResourceFromContext(String resourceType, UUID resourceUUID, UUID contextUUID) public List<ERElement> removeResourceFromContext(String resourceType, UUID resourceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public <R extends Resource> List<ERElement> removeResourceFromContext(R resource, UUID contextUUID) public <R extends Resource> List<ERElement> removeResourceFromContext(R resource, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public List<ERElement> removeResourceFromCurrentContext(String resourceType, UUID resourceUUID) public List<ERElement> removeResourceFromCurrentContext(String resourceType, UUID resourceUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public <R extends Resource> List<ERElement> removeResourceFromCurrentContext(R resource) throws SchemaViolationException, public <R extends Resource> List<ERElement> removeResourceFromCurrentContext(R resource, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException; ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException;
public Set<UUID> getResourceContexts(String resourceType, UUID resourceUUID) public Set<UUID> getResourceContexts(String resourceType, UUID resourceUUID)
@ -245,29 +245,29 @@ public interface ResourceRegistryPublisher {
/* ----- */ /* ----- */
public List<ERElement> addFacetToContext(String facetType, UUID facetUUID, UUID contextUUID) public List<ERElement> addFacetToContext(String facetType, UUID facetUUID, UUID contextUUID, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <F extends Facet> List<ERElement> addFacetToContext(F facet, UUID contextUUID) public <F extends Facet> List<ERElement> addFacetToContext(F facet, UUID contextUUID, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public List<ERElement> addFacetToCurrentContext(String facetType, UUID facetUUID) public List<ERElement> addFacetToCurrentContext(String facetType, UUID facetUUID, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <F extends Facet> List<ERElement> addFacetToCurrentContext(F facet) public <F extends Facet> List<ERElement> addFacetToCurrentContext(F facet, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public List<ERElement> removeFacetFromContext(String facetType, UUID facetUUID, UUID contextUUID) public List<ERElement> removeFacetFromContext(String facetType, UUID facetUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException, throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException,
ResourceRegistryException; ResourceRegistryException;
public <F extends Facet> List<ERElement> removeFacetFromContext(F facet, UUID contextUUID) throws SchemaViolationException, public <F extends Facet> List<ERElement> removeFacetFromContext(F facet, UUID contextUUID, Boolean dryRun) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public List<ERElement> removeFacetFromCurrentContext(String facetType, UUID facetUUID) throws SchemaViolationException, public List<ERElement> removeFacetFromCurrentContext(String facetType, UUID facetUUID, Boolean dryRun) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public <F extends Facet> List<ERElement> removeFacetFromCurrentContext(F facet) throws SchemaViolationException, public <F extends Facet> List<ERElement> removeFacetFromCurrentContext(F facet, Boolean dryRun) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException; FacetNotFoundException, ContextNotFoundException, ResourceRegistryException;
public Set<UUID> getFacetContexts(String facetType, UUID facetUUID) public Set<UUID> getFacetContexts(String facetType, UUID facetUUID)

View File

@ -34,6 +34,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath; import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath; import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation;
import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility; import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.informationsystem.utils.Utility; import org.gcube.informationsystem.utils.Utility;
@ -751,7 +752,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
} }
@Override @Override
public List<ERElement> addToContext(String type, UUID instanceUUID, UUID contextUUID) public List<ERElement> addToContext(String type, UUID instanceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException { throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try { try {
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", type, instanceUUID, Context.NAME, logger.trace("Going to add {} with UUID {} to {} with UUID {} ", type, instanceUUID, Context.NAME,
@ -764,7 +765,14 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
gxHTTPStringRequest.path(type); gxHTTPStringRequest.path(type);
gxHTTPStringRequest.path(instanceUUID.toString()); gxHTTPStringRequest.path(instanceUUID.toString());
HttpURLConnection httpURLConnection = gxHTTPStringRequest.put();
Map<String, String> queryParams = new HashMap<>();
queryParams.put(SharingPath.OPERATION_QUERY_PARAMETER, SharingOperation.ADD.name());
queryParams.put(SharingPath.DRY_RUN_QUERY_PARAMETER, dryRun.toString());
includeAdditionalQueryParameters(gxHTTPStringRequest, queryParams);
HttpURLConnection httpURLConnection = gxHTTPStringRequest.post();
String jsonArray = HTTPUtility.getResponse(String.class, httpURLConnection); String jsonArray = HTTPUtility.getResponse(String.class, httpURLConnection);
logger.info("{} with UUID {} successfully added to {} with UUID {}", type, instanceUUID, Context.NAME, contextUUID); logger.info("{} with UUID {} successfully added to {} with UUID {}", type, instanceUUID, Context.NAME, contextUUID);
@ -782,13 +790,13 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
} }
@Override @Override
public List<ERElement> addToContext(ERElement er, UUID contextUUID) public List<ERElement> addToContext(ERElement er, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException { throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try { try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(er); .getTypeName(er);
UUID instanceUUID = er.getHeader().getUUID(); UUID instanceUUID = er.getHeader().getUUID();
return addToContext(type, instanceUUID, contextUUID); return addToContext(type, instanceUUID, contextUUID, dryRun);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e); // logger.trace("Error Creating {}", facet, e);
throw e; throw e;
@ -799,21 +807,21 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
} }
@Override @Override
public List<ERElement> addToCurrentContext(String type, UUID instanceUUID) public List<ERElement> addToCurrentContext(String type, UUID instanceUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException { throws SchemaViolationException, NotFoundException, ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID(); UUID contextUUID = getCurrentContextUUID();
return addToContext(type, instanceUUID, contextUUID); return addToContext(type, instanceUUID, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> addToCurrentContext(ERElement er) public List<ERElement> addToCurrentContext(ERElement er, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException { throws SchemaViolationException, NotFoundException, ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID(); UUID contextUUID = getCurrentContextUUID();
return addToContext(er, contextUUID); return addToContext(er, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> removeFromContext(String type, UUID instanceUUID, UUID contextUUID) public List<ERElement> removeFromContext(String type, UUID instanceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, NotFoundException, ResourceRegistryException { throws SchemaViolationException, NotFoundException, ResourceRegistryException {
try { try {
logger.trace("Going to add {} with UUID {} to {} with UUID {} ", type, instanceUUID, Context.NAME, logger.trace("Going to add {} with UUID {} to {} with UUID {} ", type, instanceUUID, Context.NAME,
@ -826,7 +834,14 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
gxHTTPStringRequest.path(type); gxHTTPStringRequest.path(type);
gxHTTPStringRequest.path(instanceUUID.toString()); gxHTTPStringRequest.path(instanceUUID.toString());
HttpURLConnection httpURLConnection = gxHTTPStringRequest.delete(); Map<String, String> queryParams = new HashMap<>();
queryParams.put(SharingPath.OPERATION_QUERY_PARAMETER, SharingOperation.REMOVE.name());
queryParams.put(SharingPath.DRY_RUN_QUERY_PARAMETER, dryRun.toString());
includeAdditionalQueryParameters(gxHTTPStringRequest, queryParams);
HttpURLConnection httpURLConnection = gxHTTPStringRequest.post();
String jsonArray = HTTPUtility.getResponse(String.class, httpURLConnection); String jsonArray = HTTPUtility.getResponse(String.class, httpURLConnection);
logger.info("{} with UUID {} successfully removed from {} with UUID {}", type, instanceUUID, Context.NAME, contextUUID); logger.info("{} with UUID {} successfully removed from {} with UUID {}", type, instanceUUID, Context.NAME, contextUUID);
@ -844,14 +859,14 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
} }
@Override @Override
public List<ERElement> removeFromContext(ERElement er, UUID contextUUID) public List<ERElement> removeFromContext(ERElement er, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
try { try {
String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility String type = org.gcube.informationsystem.resourceregistry.api.utils.Utility
.getTypeName(er); .getTypeName(er);
UUID instanceUUID = er.getHeader().getUUID(); UUID instanceUUID = er.getHeader().getUUID();
return removeFromContext(type, instanceUUID, contextUUID); return removeFromContext(type, instanceUUID, contextUUID, dryRun);
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
// logger.trace("Error Creating {}", facet, e); // logger.trace("Error Creating {}", facet, e);
throw e; throw e;
@ -862,18 +877,18 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
} }
@Override @Override
public List<ERElement> removeFromCurrentContext(String type, UUID instanceUUID) throws SchemaViolationException, public List<ERElement> removeFromCurrentContext(String type, UUID instanceUUID, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID(); UUID contextUUID = getCurrentContextUUID();
return removeFromContext(type, instanceUUID, contextUUID); return removeFromContext(type, instanceUUID, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> removeFromCurrentContext(ERElement er) public List<ERElement> removeFromCurrentContext(ERElement er, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
UUID contextUUID = getCurrentContextUUID(); UUID contextUUID = getCurrentContextUUID();
return removeFromContext(er, contextUUID); return removeFromContext(er, contextUUID, dryRun);
} }
@Override @Override
@ -914,105 +929,105 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
} }
@Override @Override
public List<ERElement> addResourceToContext(String resourceType, UUID resourceUUID, UUID contextUUID) public List<ERElement> addResourceToContext(String resourceType, UUID resourceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
return addToContext(resourceType, resourceUUID, contextUUID); return addToContext(resourceType, resourceUUID, contextUUID, dryRun);
} }
@Override @Override
public <R extends Resource> List<ERElement> addResourceToContext(R resource, UUID contextUUID) public <R extends Resource> List<ERElement> addResourceToContext(R resource, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
return addToContext(resource, contextUUID); return addToContext(resource, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> addResourceToCurrentContext(String resourceType, UUID resourceUUID) throws SchemaViolationException, public List<ERElement> addResourceToCurrentContext(String resourceType, UUID resourceUUID, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToCurrentContext(resourceType, resourceUUID); return addToCurrentContext(resourceType, resourceUUID, dryRun);
} }
@Override @Override
public <R extends Resource> List<ERElement> addResourceToCurrentContext(R resource) throws SchemaViolationException, public <R extends Resource> List<ERElement> addResourceToCurrentContext(R resource, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToCurrentContext(resource); return addToCurrentContext(resource, dryRun);
} }
@Override @Override
public List<ERElement> removeResourceFromContext(String resourceType, UUID resourceUUID, UUID contextUUID) public List<ERElement> removeResourceFromContext(String resourceType, UUID resourceUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
return removeFromContext(resourceType, resourceUUID, contextUUID); return removeFromContext(resourceType, resourceUUID, contextUUID, dryRun);
} }
@Override @Override
public <R extends Resource> List<ERElement> removeResourceFromContext(R resource, UUID contextUUID) public <R extends Resource> List<ERElement> removeResourceFromContext(R resource, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
return removeFromContext(resource, contextUUID); return removeFromContext(resource, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> removeResourceFromCurrentContext(String resourceType, UUID resourceUUID) public List<ERElement> removeResourceFromCurrentContext(String resourceType, UUID resourceUUID, Boolean dryRun)
throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException, throws SchemaViolationException, ResourceNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
return removeFromCurrentContext(resourceType, resourceUUID); return removeFromCurrentContext(resourceType, resourceUUID, dryRun);
} }
@Override @Override
public <R extends Resource> List<ERElement> removeResourceFromCurrentContext(R resource) throws SchemaViolationException, public <R extends Resource> List<ERElement> removeResourceFromCurrentContext(R resource, Boolean dryRun) throws SchemaViolationException,
ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException { ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromCurrentContext(resource); return removeFromCurrentContext(resource, dryRun);
} }
@Override @Override
public List<ERElement> addFacetToContext(String facetType, UUID facetUUID, UUID contextUUID) public List<ERElement> addFacetToContext(String facetType, UUID facetUUID, UUID contextUUID, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToContext(facetType, facetUUID, contextUUID); return addToContext(facetType, facetUUID, contextUUID, dryRun);
} }
@Override @Override
public <F extends Facet> List<ERElement> addFacetToContext(F facet, UUID contextUUID) public <F extends Facet> List<ERElement> addFacetToContext(F facet, UUID contextUUID, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToContext(facet, contextUUID); return addToContext(facet, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> addFacetToCurrentContext(String facetType, UUID facetUUID) public List<ERElement> addFacetToCurrentContext(String facetType, UUID facetUUID, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToCurrentContext(facetType, facetUUID); return addToCurrentContext(facetType, facetUUID, dryRun);
} }
@Override @Override
public <F extends Facet> List<ERElement> addFacetToCurrentContext(F facet) public <F extends Facet> List<ERElement> addFacetToCurrentContext(F facet, Boolean dryRun)
throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { throws FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return addToCurrentContext(facet); return addToCurrentContext(facet, dryRun);
} }
@Override @Override
public List<ERElement> removeFacetFromContext(String facetType, UUID facetUUID, UUID contextUUID) public List<ERElement> removeFacetFromContext(String facetType, UUID facetUUID, UUID contextUUID, Boolean dryRun)
throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException, throws SchemaViolationException, FacetNotFoundException, ContextNotFoundException,
ResourceRegistryException { ResourceRegistryException {
return removeFromContext(facetType, facetUUID, contextUUID); return removeFromContext(facetType, facetUUID, contextUUID, dryRun);
} }
@Override @Override
public <F extends Facet> List<ERElement> removeFacetFromContext(F facet, UUID contextUUID) throws SchemaViolationException, public <F extends Facet> List<ERElement> removeFacetFromContext(F facet, UUID contextUUID, Boolean dryRun) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromContext(facet, contextUUID); return removeFromContext(facet, contextUUID, dryRun);
} }
@Override @Override
public List<ERElement> removeFacetFromCurrentContext(String facetType, UUID facetUUID) throws SchemaViolationException, public List<ERElement> removeFacetFromCurrentContext(String facetType, UUID facetUUID, Boolean dryRun) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromCurrentContext(facetType, facetUUID); return removeFromCurrentContext(facetType, facetUUID, dryRun);
} }
@Override @Override
public <F extends Facet> List<ERElement> removeFacetFromCurrentContext(F facet) throws SchemaViolationException, public <F extends Facet> List<ERElement> removeFacetFromCurrentContext(F facet, Boolean dryRun) throws SchemaViolationException,
FacetNotFoundException, ContextNotFoundException, ResourceRegistryException { FacetNotFoundException, ContextNotFoundException, ResourceRegistryException {
return removeFromCurrentContext(facet); return removeFromCurrentContext(facet, dryRun);
} }
@Override @Override

View File

@ -189,7 +189,7 @@ public class MultiContextTest extends ContextTest {
} }
List<ERElement> affectedInstances = resourceRegistryPublisher.addResourceToCurrentContext(createdHN); List<ERElement> affectedInstances = resourceRegistryPublisher.addResourceToCurrentContext(createdHN, false);
logger.debug("{} added to context. Affected instances are {}", createdHN, affectedInstances); logger.debug("{} added to context. Affected instances are {}", createdHN, affectedInstances);
//Assert.assertTrue(addedToContext); //Assert.assertTrue(addedToContext);