Class Refactoring.Moving

  • Enclosing class:
    Refactoring

    @OpenApiAll
    public static class Refactoring.Moving
    extends java.lang.Object
    Moves elements in model to a new owner element with or without connected relations An example how to move elements together with their relations:
     // Decide what elements needs to be moved and put them in a collection
     Collection elementsToMove = ...;
    
     // Define new owner to move elements (and relations) into
     Element newOwner = ...;
    
     // Element moving should be wrapped with session create/close calls.
     SessionManager sessionManager = SessionManager.getInstance();
     sessionManager.createSession("Move elements");
    
     // Move elements
     Refactoring.Moving.moveElementsWithRelations(elementsToMove, newOwner);
    
     // Close the session.
     sessionManager.closeSession();
     
    • Constructor Summary

      Constructors 
      Constructor Description
      Moving()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void moveElements​(java.util.Collection<Element> elementsToMove, Element newOwner)
      Moves all elements to the new owner.
      static void moveElementsWithRelations​(java.util.Collection<Element> elementsToMove, Element newOwner)
      Moves all elements to the new owner.
      • Methods inherited from class java.lang.Object

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

      • Moving

        public Moving()
    • Method Detail

      • moveElements

        public static void moveElements​(java.util.Collection<Element> elementsToMove,
                                        Element newOwner)
                                 throws ReadOnlyElementException
        Moves all elements to the new owner. Relations between moved elements are not moved.
        Parameters:
        elementsToMove - elements to move
        newOwner - new owner to move elements into
        Throws:
        ReadOnlyElementException - if newOwner cannot add children or any of moved elements is not editable
        java.lang.IllegalArgumentException - if any of moved elements cannot be added into new owner
      • moveElementsWithRelations

        public static void moveElementsWithRelations​(java.util.Collection<Element> elementsToMove,
                                                     Element newOwner)
                                              throws ReadOnlyElementException
        Moves all elements to the new owner. Relation elements whose client is between moved elements are moved together. Read only relations are not moved. Not locked teamwork relations are locked automatically.
        Parameters:
        elementsToMove - elements to move
        newOwner - new owner to move elements into
        Throws:
        ReadOnlyElementException - if newOwner cannot add children or any of moved elements is not editable
        java.lang.IllegalArgumentException - if any of moved elements cannot be added into new owner