2016-11-30 14:52:12 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.informationsystem.orientdb.hooks;
|
|
|
|
|
2019-02-05 11:21:10 +01:00
|
|
|
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
|
|
|
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.RemoveConstraint;
|
2018-09-28 17:58:14 +02:00
|
|
|
import org.gcube.informationsystem.model.reference.relation.ConsistsOf;
|
|
|
|
import org.gcube.informationsystem.model.reference.relation.IsRelatedTo;
|
2016-11-30 14:52:12 +01:00
|
|
|
|
|
|
|
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR)
|
|
|
|
*/
|
|
|
|
public class ConsistsOfHook extends RelationHook {
|
|
|
|
|
2016-12-20 16:51:57 +01:00
|
|
|
public static PropagationConstraint propagationConstraint;
|
|
|
|
|
|
|
|
static {
|
|
|
|
propagationConstraint = new PropagationConstraintImpl();
|
|
|
|
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascadeWhenOrphan);
|
|
|
|
propagationConstraint.setAddConstraint(AddConstraint.propagate);
|
|
|
|
}
|
|
|
|
|
2016-11-30 14:52:12 +01:00
|
|
|
public ConsistsOfHook() {
|
2016-12-27 12:07:40 +01:00
|
|
|
super(ConsistsOf.NAME, propagationConstraint);
|
2016-11-30 14:52:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public ConsistsOfHook(ODatabaseDocument database) {
|
2016-12-20 16:51:57 +01:00
|
|
|
super(database, IsRelatedTo.NAME, propagationConstraint);
|
2016-11-30 14:52:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|