Class ModelTransaction


  • public class ModelTransaction
    extends java.lang.Object
    One Transaction, objects of this type can be reused.
    • Field Detail

      • LOG

        org.apache.logging.log4j.Logger LOG
      • collectedEvents

        private volatile java.util.Collection<java.beans.PropertyChangeEvent> collectedEvents
        Events fired during transaction.
      • readOnlyMode

        private boolean readOnlyMode
      • transactionsManager

        private final com.nomagic.uml2.transaction.TransactionManagerImpl transactionsManager
      • modelFixTransaction

        private final boolean modelFixTransaction
      • firePostCommit

        private boolean firePostCommit
      • validateModel

        private boolean validateModel
      • changedElements

        private java.util.Map<Element,​java.lang.String> changedElements
        If no fire post commit changed elements are collected in this collection. In other case collection should be empty.
    • Constructor Detail

      • ModelTransaction

        ModelTransaction​(AbstractRepository repository,
                         com.nomagic.uml2.transaction.TransactionManagerImpl manager)
      • ModelTransaction

        private ModelTransaction​(AbstractRepository repository,
                                 com.nomagic.uml2.transaction.TransactionManagerImpl manager,
                                 boolean modelFixTransaction)
    • Method Detail

      • start

        public void start()
        Starts transaction. After transaction started events will be recorded and analyzed.
      • start

        public void start​(boolean readOnly,
                          boolean validateModel)
      • fireEvents

        private java.util.Collection<java.lang.Runnable> fireEvents​(java.util.Collection<java.beans.PropertyChangeEvent> collectedEvents)
      • destroyNestedTransaction

        private void destroyNestedTransaction()
      • createNestedTransaction

        private ModelTransaction createNestedTransaction​(boolean modelFix)
      • modelChanged

        public void modelChanged​(java.beans.PropertyChangeEvent evt)
        Handles model change event.
        Parameters:
        evt - event
      • changed

        public void changed​(javax.jmi.reflect.RefObject object)
        Handles model change event.
        Parameters:
        object - object
      • addAllElementsToChanged

        private void addAllElementsToChanged​(ModifiedElements modifiedElements)
        Marks all objects in the repository as changed by this transaction, which results in that all elements are validated on commit
        Parameters:
        modifiedElements - modified elements.
      • isStarted

        public boolean isStarted()
      • isFirePostCommit

        public boolean isFirePostCommit()
        Determines whether post commit events are fired
        Returns:
        true if events are fired, false otherwise
      • setModelValidator

        public void setModelValidator​(ModelValidator handler)
      • beforeChange

        public void beforeChange()
      • setFirePostCommit

        public void setFirePostCommit​(boolean firePostCommit)
      • getChangedElements

        private java.util.Collection<Element> getChangedElements​(java.util.Collection<java.beans.PropertyChangeEvent> changes)
        Return elements which are sources for property change events, and are still in the project.
        Parameters:
        changes - collected events.
        Returns:
        sources from events which are registered in project.
      • setModifiedElements

        public void setModifiedElements​(ModifiedElements modifiedElements)