refs #6086: Resoure Registry MUST automatically add to Relation default Referential Integrity directive when the client does not specify anything
https://support.d4science.org/issues/6086 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-orientdb-hooks@135137 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
05a4df55ff
commit
0e2daf1f07
|
@ -49,8 +49,7 @@ public abstract class RelationHook extends ODocumentHookAbstract implements
|
||||||
return DISTRIBUTED_EXECUTION_MODE.BOTH;
|
return DISTRIBUTED_EXECUTION_MODE.BOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected RESULT checkRelationProperty(final ODocument iDocument) {
|
||||||
public RESULT onRecordBeforeCreate(final ODocument iDocument) {
|
|
||||||
OLogManager.instance().info(this, "Checking %s on %s",
|
OLogManager.instance().info(this, "Checking %s on %s",
|
||||||
RelationProperty.NAME, iDocument.toJSON());
|
RelationProperty.NAME, iDocument.toJSON());
|
||||||
|
|
||||||
|
@ -67,6 +66,8 @@ public abstract class RelationHook extends ODocumentHookAbstract implements
|
||||||
oDocument.field(RelationProperty.REFERENTIAL_INTEGRITY,
|
oDocument.field(RelationProperty.REFERENTIAL_INTEGRITY,
|
||||||
referentiaIntegrity.toString());
|
referentiaIntegrity.toString());
|
||||||
|
|
||||||
|
iDocument.field(Relation.RELATION_PROPERTY, oDocument);
|
||||||
|
|
||||||
OLogManager.instance().debug(this, "%s has now an %s",
|
OLogManager.instance().debug(this, "%s has now an %s",
|
||||||
iDocument.toJSON(), RelationProperty.NAME);
|
iDocument.toJSON(), RelationProperty.NAME);
|
||||||
result = RESULT.RECORD_CHANGED;
|
result = RESULT.RECORD_CHANGED;
|
||||||
|
@ -111,6 +112,18 @@ public abstract class RelationHook extends ODocumentHookAbstract implements
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RESULT onRecordBeforeCreate(final ODocument iDocument) {
|
||||||
|
return checkRelationProperty(iDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RESULT onRecordBeforeUpdate(final ODocument iDocument) {
|
||||||
|
return checkRelationProperty(iDocument);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PRIORITY getPriority() {
|
public PRIORITY getPriority() {
|
||||||
return PRIORITY.REGULAR;
|
return PRIORITY.REGULAR;
|
||||||
|
|
Reference in New Issue