Package io.opencaesar.oml.util
Class OmlDelete
java.lang.Object
io.opencaesar.oml.util.OmlDelete
Utilities to help delete Oml elements
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The enumeration of Cascade directionstatic class
A node in the cascade result treestatic class
A cascade delete rule a) If direction isSOURCE_TO_TARGET
, and the instance to be deleted matches the given source type, the instance to be deleted is related to a target instance with the given relation, the target instance matches the given target type, delete the target instance; a) If direction isTARGET_TO_SOURCE
, and the instance to be deleted matches the given target type, the instance to be deleted is related to a source instance with the given relation, the source instance matches the given source type, delete the source instance; -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic OmlDelete.CascadeResult
cascadeDelete
(NamedInstance instance, List<OmlDelete.CascadeRule> cascadeRules) Determines all the elements that need to be deleted given an instance and a list of cascade rules The elements are returned in a tree of cascade results specifying which elements are to be deleted based on which of the cascade rules.static void
Deletes the given element onlystatic void
recursiveDelete
(Element element) Deletes the given element and recursively all its referencing elementsstatic void
recursiveDelete
(OmlDelete.CascadeResult rootResult) Deletes the given cascade result recursively
-
Constructor Details
-
OmlDelete
public OmlDelete()
-
-
Method Details
-
delete
Deletes the given element only- Parameters:
element
- the given element to delete
-
recursiveDelete
Deletes the given element and recursively all its referencing elements- Parameters:
element
- the given element to delete
-
cascadeDelete
public static OmlDelete.CascadeResult cascadeDelete(NamedInstance instance, List<OmlDelete.CascadeRule> cascadeRules) Determines all the elements that need to be deleted given an instance and a list of cascade rules The elements are returned in a tree of cascade results specifying which elements are to be deleted based on which of the cascade rules. This can be used in the UI to show the user the impact of deleting the element. This function does not actually delete the elements. To do that, subsequently callrecursiveDelete(CascadeResult)
passing it the returned cascade result.- Parameters:
instance
- The given instance to deletecascadeRules
- A list of cascade rules- Returns:
- A root of a tree of cascade results
-
recursiveDelete
Deletes the given cascade result recursively- Parameters:
rootResult
- the given cascade rule to delete
-