throwing exception instead of ignoring it
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146910 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b559d2f546
commit
727d39b388
|
@ -301,13 +301,24 @@ public abstract class RelationManagement<R extends Relation> extends
|
||||||
Relation.PROPAGATION_CONSTRAINT);
|
Relation.PROPAGATION_CONSTRAINT);
|
||||||
if (propagationConstraint.getAddConstraint() != null) {
|
if (propagationConstraint.getAddConstraint() != null) {
|
||||||
addConstraint = propagationConstraint.getAddConstraint();
|
addConstraint = propagationConstraint.getAddConstraint();
|
||||||
|
}else {
|
||||||
|
String error = String.format("%s in %s is null"
|
||||||
|
+ "This is really strange and should not occur. "
|
||||||
|
+ "Please Investigate it.",
|
||||||
|
Relation.ADD_CONSTRAINT,
|
||||||
|
Relation.PROPAGATION_CONSTRAINT,
|
||||||
|
Utility.toJsonString(element, true));
|
||||||
|
logger.error(error);
|
||||||
|
throw new ResourceRegistryException(error);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Error while getting {} from {}. Assuming {}. "
|
String error = String.format("Error while getting %s from %s while performing AddToContext."
|
||||||
+ "This is really strange and should not occur. "
|
+ "This is really strange and should not occur. "
|
||||||
+ "Please Investigate it.",
|
+ "Please Investigate it.",
|
||||||
Relation.PROPAGATION_CONSTRAINT,
|
Relation.PROPAGATION_CONSTRAINT,
|
||||||
Utility.toJsonString(element, true), addConstraint);
|
Utility.toJsonString(element, true));
|
||||||
|
logger.warn(error);
|
||||||
|
throw new ResourceRegistryException(error, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex target = element.getVertex(Direction.IN);
|
Vertex target = element.getVertex(Direction.IN);
|
||||||
|
@ -319,10 +330,11 @@ public abstract class RelationManagement<R extends Relation> extends
|
||||||
* must be added. Otherwise we have a relation which point to an
|
* must be added. Otherwise we have a relation which point to an
|
||||||
* entity outside of the context.
|
* entity outside of the context.
|
||||||
*/
|
*/
|
||||||
ContextUtility.addToActualContext(orientGraph, getElement());
|
|
||||||
EntityManagement entityManagement = EntityManagement
|
EntityManagement entityManagement = EntityManagement
|
||||||
.getEntityManagement(orientGraph, target);
|
.getEntityManagement(orientGraph, target);
|
||||||
entityManagement.reallyAddToContext();
|
entityManagement.reallyAddToContext();
|
||||||
|
ContextUtility.addToActualContext(orientGraph, getElement());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case unpropagate:
|
case unpropagate:
|
||||||
|
@ -382,13 +394,25 @@ public abstract class RelationManagement<R extends Relation> extends
|
||||||
Relation.PROPAGATION_CONSTRAINT);
|
Relation.PROPAGATION_CONSTRAINT);
|
||||||
if (propagationConstraint.getRemoveConstraint() != null) {
|
if (propagationConstraint.getRemoveConstraint() != null) {
|
||||||
removeConstraint = propagationConstraint.getRemoveConstraint();
|
removeConstraint = propagationConstraint.getRemoveConstraint();
|
||||||
|
}else{
|
||||||
|
String error = String.format("%s in %s is null"
|
||||||
|
+ "This is really strange and should not occur. "
|
||||||
|
+ "Please Investigate it.",
|
||||||
|
Relation.REMOVE_CONSTRAINT,
|
||||||
|
Relation.PROPAGATION_CONSTRAINT,
|
||||||
|
Utility.toJsonString(element, true));
|
||||||
|
logger.error(error);
|
||||||
|
throw new ResourceRegistryException(error);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Error while getting {} from {}. Assuming {}. "
|
String error = String.format("Error while getting %s from %s while performing RemoveFromContext."
|
||||||
+ "This is really strange and should not occur. "
|
+ "This is really strange and should not occur. "
|
||||||
+ "Please Investigate it.",
|
+ "Please Investigate it.",
|
||||||
Relation.PROPAGATION_CONSTRAINT,
|
Relation.PROPAGATION_CONSTRAINT,
|
||||||
Utility.toJsonString(element, true), removeConstraint);
|
Utility.toJsonString(element, true));
|
||||||
|
logger.error(error);
|
||||||
|
throw new ResourceRegistryException(error, e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex target = element.getVertex(Direction.IN);
|
Vertex target = element.getVertex(Direction.IN);
|
||||||
|
@ -416,9 +440,12 @@ public abstract class RelationManagement<R extends Relation> extends
|
||||||
if(thisOrientEdge.getOutVertex().compareTo(edge.getOutVertex())!=0){
|
if(thisOrientEdge.getOutVertex().compareTo(edge.getOutVertex())!=0){
|
||||||
count++;
|
count++;
|
||||||
break;
|
break;
|
||||||
}else{
|
}
|
||||||
|
/*
|
||||||
|
else{
|
||||||
ContextUtility.removeFromActualContext(orientGraph, edge);
|
ContextUtility.removeFromActualContext(orientGraph, edge);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,6 +549,15 @@ public abstract class RelationManagement<R extends Relation> extends
|
||||||
Relation.PROPAGATION_CONSTRAINT);
|
Relation.PROPAGATION_CONSTRAINT);
|
||||||
if (propagationConstraint.getRemoveConstraint() != null) {
|
if (propagationConstraint.getRemoveConstraint() != null) {
|
||||||
removeConstraint = propagationConstraint.getRemoveConstraint();
|
removeConstraint = propagationConstraint.getRemoveConstraint();
|
||||||
|
}else{
|
||||||
|
String error = String.format("%s in %s is null"
|
||||||
|
+ "This is really strange and should not occur. "
|
||||||
|
+ "Please Investigate it.",
|
||||||
|
Relation.REMOVE_CONSTRAINT,
|
||||||
|
Relation.PROPAGATION_CONSTRAINT,
|
||||||
|
Utility.toJsonString(element, true));
|
||||||
|
logger.error(error);
|
||||||
|
throw new ResourceRegistryException(error);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("Error while getting {} from {}. Assuming {}. "
|
logger.warn("Error while getting {} from {}. Assuming {}. "
|
||||||
|
|
Loading…
Reference in New Issue