Class CustomChangelog

java.lang.Object
ch.tocco.nice2.dbrefactoring.spi.CustomChangelog

public class CustomChangelog extends Object
Interface to modify a database changelog. It manages two changesets, one for schema definitions and one for schema constraints. They both are marked by different context names to have them run independently.
  • Method Details

    • create

      public static CustomChangelog create(Changelog.Xsd xsd)
    • createFromChangelog

      public static CustomChangelog createFromChangelog(Changelog log)
    • getChangelog

      public Changelog getChangelog()
      Returns the changelog document.
    • createChangeset

      public Changeset createChangeset(String name)
      Creates a new changeset and adds it to the root node.
      Parameters:
      name - the name of the changeset, which is part of its id attribute
      Returns:
      this
    • createChangeset

      public Changeset createChangeset(String name, @Nullable @Nullable String context)
      Creates a new changeset and adds it to the root node.
      Parameters:
      name - the name of the changeset, which is part of its id attribute
      context - the context of the changeset
      Returns:
      this
    • createChangeset

      public Changeset createChangeset(String name, boolean addToRoot)
      Creates a new changeset which is set as "current changeset". All other operations use this changeset to add tags.
      Parameters:
      name - the name of the changeset, this is part of the id attribute
      addToRoot - if true, the new changeset is added to the root node of the document immediately @return this
    • createChangeset

      public Changeset createChangeset(String name, @Nullable @Nullable String context, boolean addToRoot) throws DbRefactoringException
      Creates a new changeset which is set as "current changeset". All other operations use this changeset to add tags.
      Parameters:
      name - the name of the changeset, this is part of the id attribute
      context - the context of the changeset
      addToRoot - if true, the new changeset is added to the root node of the document immediately @return this
      Throws:
      DbRefactoringException
    • appendChangeset

      public void appendChangeset(String name)
      If the current changeset has been created with addToRoot=false, use this to finally append the changeset to the root node. After this, a new changeset can be created using createChangeset(String) or createChangeset(String, boolean), resp. A runtime exception is thrown, if the changeset has already added to the root node. Use isChangesetAppended(String) to check, if unsure.
    • changesetExists

      public boolean changesetExists(String name)
    • isChangesetAppended

      public boolean isChangesetAppended(String name)
      Checks whether the current changeset is appended to the root node of the document.
    • getChangeset

      public Changeset getChangeset(String name) throws DbRefactoringException
      Throws:
      DbRefactoringException
    • addCommentNode

      public void addCommentNode(String text)
      Adds a xml comment node to the current changeset, or if this is null, to the root node.
    • addInclude

      public void addInclude(String file)
    • getChangesets

      public Collection<? extends Changeset> getChangesets()
    • addChangeset

      public void addChangeset(Changeset cs)