Fixed addtoContext and removeFromContext
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141413 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7cfce46fa4
commit
0bcdd8a260
|
@ -367,8 +367,7 @@ public abstract class RelationManagement<R extends Relation> {
|
|||
|
||||
public boolean reallyAddToContext() throws ContextException,
|
||||
ResourceRegistryException {
|
||||
|
||||
ContextUtility.addToActualContext(orientGraph, getEdge());
|
||||
getEdge();
|
||||
|
||||
AddConstraint addConstraint = AddConstraint.unpropagate;
|
||||
|
||||
|
@ -391,6 +390,12 @@ public abstract class RelationManagement<R extends Relation> {
|
|||
|
||||
switch (addConstraint) {
|
||||
case propagate:
|
||||
/*
|
||||
* The relation must be added only in the case the target vertex
|
||||
* must be added. Otherwise we have a relation which point
|
||||
* to an entity outside of the context.
|
||||
*/
|
||||
ContextUtility.addToActualContext(orientGraph, getEdge());
|
||||
EntityManagement entityManagement = EntityManagement
|
||||
.getEntityManagement(orientGraph, target);
|
||||
entityManagement.reallyAddToContext();
|
||||
|
@ -440,6 +445,11 @@ public abstract class RelationManagement<R extends Relation> {
|
|||
}
|
||||
|
||||
Vertex target = edge.getVertex(Direction.IN);
|
||||
|
||||
/*
|
||||
* In any removeConstraint value the relation MUSt be removed from
|
||||
* context to avoid to have edge having a source outside of the context.
|
||||
*/
|
||||
ContextUtility.removeFromActualContext(orientGraph, edge);
|
||||
|
||||
switch (removeConstraint) {
|
||||
|
|
|
@ -279,7 +279,7 @@ public class MultiContextTest extends ScopedTest {
|
|||
resourceManagement.setUUID(eServiceUUID);
|
||||
resourceManagement.delete();
|
||||
} catch (ResourceNotFoundException e) {
|
||||
logger.debug("Resource with {} Not Found as Expected",
|
||||
logger.debug("Resource with {} Not Deleted as Expected",
|
||||
eServiceUUID);
|
||||
}
|
||||
|
||||
|
@ -298,6 +298,7 @@ public class MultiContextTest extends ScopedTest {
|
|||
deleted = resourceManagement.delete();
|
||||
Assert.assertTrue(deleted);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
|
||||
<logger name="org.gcube" level="INFO" />
|
||||
<logger name="org.gcube.informationsystem" level="DEBUG" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.context" level="INFO" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.resources.utils" level="INFO" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.resources.impl" level="TRACE" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry" level="DEBUG" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.context" level="DEBUG" />
|
||||
<logger name="org.gcube.informationsystem.impl.utils.discovery" level="ERROR" />
|
||||
|
||||
<root level="WARN">
|
||||
|
|
Loading…
Reference in New Issue