Added constructor with default Propagation Constraint

This commit is contained in:
Luca Frosini 2020-10-14 16:23:23 +02:00
parent 5b1ffb6c88
commit 324e09049c
2 changed files with 32 additions and 0 deletions

View File

@ -4,9 +4,12 @@
package org.gcube.informationsystem.model.impl.relations; package org.gcube.informationsystem.model.impl.relations;
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName; import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; 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;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
/** /**
@ -25,8 +28,21 @@ public class ConsistsOfImpl<S extends Resource, T extends Facet> extends
super(); super();
} }
public ConsistsOfImpl(S source, T target) {
super(source, target, null);
propagationConstraint = new PropagationConstraintImpl();
propagationConstraint.setAddConstraint(AddConstraint.propagate);
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascadeWhenOrphan);
}
public ConsistsOfImpl(S source, T target, public ConsistsOfImpl(S source, T target,
PropagationConstraint propagationConstraint) { PropagationConstraint propagationConstraint) {
super(source, target, propagationConstraint); super(source, target, propagationConstraint);
if(this.propagationConstraint==null) {
this.propagationConstraint = new PropagationConstraintImpl();
this.propagationConstraint.setAddConstraint(AddConstraint.propagate);
this.propagationConstraint.setRemoveConstraint(RemoveConstraint.cascadeWhenOrphan);
}
} }
} }

View File

@ -4,8 +4,11 @@
package org.gcube.informationsystem.model.impl.relations; package org.gcube.informationsystem.model.impl.relations;
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName; import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; 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;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
/** /**
@ -24,8 +27,21 @@ public abstract class IsRelatedToImpl<S extends Resource, T extends Resource> ex
super(); super();
} }
public IsRelatedToImpl(S source, T target) {
super(source, target, null);
propagationConstraint = new PropagationConstraintImpl();
propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
propagationConstraint.setRemoveConstraint(RemoveConstraint.keep);
}
public IsRelatedToImpl(S source, T target, public IsRelatedToImpl(S source, T target,
PropagationConstraint propagationConstraint) { PropagationConstraint propagationConstraint) {
super(source, target, propagationConstraint); super(source, target, propagationConstraint);
if(this.propagationConstraint==null) {
this.propagationConstraint = new PropagationConstraintImpl();
this.propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
this.propagationConstraint.setRemoveConstraint(RemoveConstraint.keep);
}
} }
} }