2019-03-22 15:18:23 +01:00
/ * *
*
* /
package org.gcube.informationsystem.model.reference.properties ;
2020-07-07 17:04:25 +02:00
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize ;
2019-03-22 15:18:23 +01:00
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl ;
import org.gcube.informationsystem.types.annotations.ISProperty ;
2020-12-15 11:28:34 +01:00
import org.gcube.informationsystem.types.reference.Change ;
import org.gcube.informationsystem.types.reference.TypeMetadata ;
import org.gcube.informationsystem.utils.TypeVersion ;
2019-03-22 15:18:23 +01:00
/ * *
* @author Luca Frosini ( ISTI - CNR )
2021-01-20 17:03:02 +01:00
*
2020-12-18 12:06:31 +01:00
* At any time entities and relations can be added or removed to / from a context or deleted .
* The PropagationConstraint property contained in each relation is a predefined Property type
* which indicates the behaviour to be held on a target entity when an event related to a context occurs
* in the source resource or directly to the relation .
*
* The default values of propagation constraints are :
* - IsRelatedTo : remove = keep , add = unpropagate ;
* - ConsistsOf : remove = cascadeWhenOrphan , add = propagate .
*
2019-03-22 15:18:23 +01:00
* https : //wiki.gcube-system.org/gcube/Facet_Based_Resource_Model#Propagation_Constraint
* /
@JsonDeserialize ( as = PropagationConstraintImpl . class )
2020-12-15 11:28:34 +01:00
@TypeMetadata ( name = PropagationConstraint . NAME , description = " This class provides propation constraint for Relation " , version = TypeVersion . MINIMAL_VERSION_STRING )
@Change ( version = TypeVersion . MINIMAL_VERSION_STRING , description = TypeVersion . MINIMAL_VERSION_DESCRIPTION )
2019-03-22 15:18:23 +01:00
public interface PropagationConstraint extends Property {
2020-02-03 11:24:55 +01:00
public static final String NAME = " PropagationConstraint " ; // PropagationConstraint.class.getSimpleName();
2019-03-22 15:18:23 +01:00
public static final String REMOVE_PROPERTY = " remove " ;
public static final String ADD_PROPERTY = " add " ;
public enum RemoveConstraint {
/ * *
2020-12-18 12:06:31 +01:00
* When a remove action is performed on the source Entity of the relation ,
* or directly on the relation , then the same remove action apart on
* the relation is performed to the target entity if it has no other incoming relations
2019-03-22 15:18:23 +01:00
* /
cascadeWhenOrphan ,
/ * *
2020-12-18 12:06:31 +01:00
* When a remove action is performed on the source Entity of the relation ,
* or directly on the relation , then the same remove action is performed on
* the relation and its target entity ;
2019-03-22 15:18:23 +01:00
* /
cascade ,
/ * *
2020-12-18 12:06:31 +01:00
* When a remove action is performed on the source Entity of the relation ,
* or directly on the relation , then the same remove action is performed on
* relation but never to the target entity .
2019-03-22 15:18:23 +01:00
* /
keep
}
public enum AddConstraint {
2020-12-18 12:06:31 +01:00
/ * *
* When an ' add ' action is performed on the source Entity of the relation ,
* or directly on the relation , then the same add action is performed on
* the relation and its target Entity .
* /
2019-03-22 15:18:23 +01:00
propagate ,
2020-12-18 12:06:31 +01:00
/ * *
* When an ' add ' action is performed on the source Entity of the relation ,
* is performed on source relation only . Trying to perform an ' add ' action on
* the relation has no effects .
* /
2019-03-22 15:18:23 +01:00
unpropagate
}
2020-12-18 12:06:31 +01:00
@ISProperty ( name = REMOVE_PROPERTY , description = " It indicates the behaviour to implement for the target Entity when a 'remove' action is performed on the source Resource. Remove actions are: (i) the operation of removing an instance from a context; (ii) the operation of deleting an instance (it has an impact on all contexts). " , mandatory = true , nullable = false )
2019-03-22 15:18:23 +01:00
public RemoveConstraint getRemoveConstraint ( ) ;
public void setRemoveConstraint ( RemoveConstraint removeConstraint ) ;
2020-12-18 12:06:31 +01:00
@ISProperty ( name = ADD_PROPERTY , description = " It indicates the behaviour to implement for the target Entity when an 'add' action is performed on the source Resource. Add action is the operation of adding an instance to a context. " , mandatory = true , nullable = false )
2019-03-22 15:18:23 +01:00
public AddConstraint getAddConstraint ( ) ;
public void setAddConstraint ( AddConstraint addConstraint ) ;
}