Class OmlDelete

java.lang.Object
io.opencaesar.oml.util.OmlDelete

public class OmlDelete extends Object
Utilities to help delete Oml elements
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The enumeration of Cascade direction
    static class 
    A node in the cascade result tree
    static class 
    A cascade delete rule a) If direction is SOURCE_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 is TARGET_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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    delete(Element element)
    Deletes the given element only
    static void
    Deletes the given element and recursively all its referencing elements
    static void
    Deletes the given cascade result recursively

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OmlDelete

      public OmlDelete()
  • Method Details

    • delete

      public static void delete(Element element)
      Deletes the given element only
      Parameters:
      element - the given element to delete
    • recursiveDelete

      public static void recursiveDelete(Element element)
      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 call recursiveDelete(CascadeResult) passing it the returned cascade result.
      Parameters:
      instance - The given instance to delete
      cascadeRules - A list of cascade rules
      Returns:
      A root of a tree of cascade results
    • recursiveDelete

      public static void recursiveDelete(OmlDelete.CascadeResult rootResult)
      Deletes the given cascade result recursively
      Parameters:
      rootResult - the given cascade rule to delete