Class ConsolidatedDocument

java.lang.Object
ch.tocco.nice2.dbrefactoring.impl.xml.ConsolidatedDocument

public class ConsolidatedDocument extends Object

Consolidates the changelog files from other modules to one big changelog file.

It creates a new xml document containing all changelogs from modules in correct order.

Usage:

   ConsolidatedDocument doc = new ConsolidatedDocument();
   doc.appendModuleChangelog(resource1.toURL(), module1);
   doc.appendModuleChangelog(resource2.toURL(), module2);
   ...
   //after all changelogs have been added, the new document is available
   doc.getChangelog().writeXml(new PrintWriter(System.out));
 
While it preserves the order of the calls to appendModuleChangelog(MetaChangelog, AppModule, ChangelogType, Nice2Version, boolean, boolean), changesets are grouped by version of nice2. At first all changesets of the lowest nice2 version are added for all modules, then all changesets for the next higher version are added, etc.

  • Constructor Details

    • ConsolidatedDocument

      public ConsolidatedDocument(PostProcessor postProcessor, ModuleManager moduleManager)
      Creates a new document with an empty root node ready for inserting changelog documents from other modules.
      Parameters:
      postProcessor - processor to modify incoming changelogs
  • Method Details

    • getChangelog

      public Changelog getChangelog()
    • getAffectedVersions

      public List<Nice2Version> getAffectedVersions()
    • appendModuleChangelog

      public void appendModuleChangelog(ChangelogServiceImpl.MetaChangelog meta, AppModule module, ChangelogType type, @Nullable @Nullable Nice2Version version, boolean applyFinalizer, boolean ignoreErrors)
      Immediately adds the contents of the document located at the specified url to this document. All changesets below version are discarded (if version is not null).
      Parameters:
      module - the module which is contributing the changelog
      type - the changelog type for controlling post-processing
      version - the version from which on the changesets are added. Only changeset with a higher or equal version to this are considered