Class UpdateReport


  • public class UpdateReport
    extends java.lang.Object
    Update report.
    Since:
    31.08.2021
    • Constructor Detail

      • UpdateReport

        public UpdateReport​(java.io.File config)
    • Method Detail

      • getConfig

        public java.io.File getConfig()
        Returns:
        updating configuration file
      • getBeforeSize

        public long getBeforeSize()
        NOTE: size obtained as File.length() and may be slightly different on different OS.
        Returns:
        original file size
      • setBeforeSize

        public void setBeforeSize​(long beforeSize)
      • getBeforeLinesCnt

        public int getBeforeLinesCnt()
        Returns:
        original file lines count
      • setBeforeLinesCnt

        public void setBeforeLinesCnt​(int beforeLinesCnt)
      • getAfterSize

        public long getAfterSize()
        NOTE: size obtained as File.length() and may be slightly different on different OS.
        Returns:
        merged file size
      • setAfterSize

        public void setAfterSize​(long afterSize)
      • getAfterLinesCnt

        public int getAfterLinesCnt()
        Returns:
        merged file lines count
      • setAfterLinesCnt

        public void setAfterLinesCnt​(int afterLinesCnt)
      • getUpdateSize

        public long getUpdateSize()
        NOTE: update file length calculated from the content instead of calling File.length() (which is OS dependent). So, it could appear that even when file if merged with itself, the size would be a bit different.
        Returns:
        updating file size
      • setUpdateSize

        public void setUpdateSize​(long updateSize)
      • getUpdateLines

        public int getUpdateLines()
        Returns:
        update file lines count
      • setUpdateLines

        public void setUpdateLines​(int updateLines)
      • getAppliedVariables

        public java.util.Map<java.lang.String,​java.lang.String> getAppliedVariables()
        Returns:
        variables replaced in update file
      • getRemoved

        public java.util.List<UpdateReport.Pair> getRemoved()
        Returns:
        removed properties or empty list
      • getAdded

        public java.util.List<UpdateReport.Pair> getAdded()
        Returns:
        added properties or empty list
      • addRemoved

        public void addRemoved​(CmtNode node)
      • addAdded

        public void addAdded​(CmtNode node)
      • isConfigChanged

        public boolean isConfigChanged()
        If merged file content is identical to the original file (ignoring leading/trailing whitespaces) then original file is not touched.

        NOTE: in dry run would correctly indicate if file is changed

        Returns:
        true if configuration file was changed
      • setConfigChanged

        public void setConfigChanged​(boolean configChanged)
      • getBackup

        public java.io.File getBackup()
        NOTE: in dry run always return null.
        Returns:
        created backup file or null if backup not created
      • setBackup

        public void setBackup​(java.io.File backup)
      • isDryRun

        public boolean isDryRun()
        Changed configuration could be obtained with getDryRunResult() (because otherwise it is not stored anywhere).
        Returns:
        true if execution without modifications performed (config will not be changed)
      • setDryRun

        public void setDryRun​(boolean dryRun)
      • getDryRunResult

        public java.lang.String getDryRunResult()
        NOTE: set ONLY for dry run (isDryRun()), in normal execution you can always read updated file content (in dry run content is not saved).
        Returns:
        complete update file text
      • setDryRunResult

        public void setDryRunResult​(java.lang.String dryRunResult)