Package ru.vyarus.yaml.updater.report
Class UpdateReport
- java.lang.Object
-
- ru.vyarus.yaml.updater.report.UpdateReport
-
public class UpdateReport extends java.lang.ObjectUpdate report.- Since:
- 31.08.2021
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUpdateReport.PairYaml path - line identity pair.
-
Constructor Summary
Constructors Constructor Description UpdateReport(java.io.File config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdded(CmtNode node)voidaddRemoved(CmtNode node)java.util.List<UpdateReport.Pair>getAdded()intgetAfterLinesCnt()longgetAfterSize()NOTE: size obtained asFile.length()and may be slightly different on different OS.java.util.Map<java.lang.String,java.lang.String>getAppliedVariables()java.io.FilegetBackup()NOTE: in dry run always return null.intgetBeforeLinesCnt()longgetBeforeSize()NOTE: size obtained asFile.length()and may be slightly different on different OS.java.io.FilegetConfig()java.lang.StringgetDryRunResult()NOTE: set ONLY for dry run (isDryRun()), in normal execution you can always read updated file content (in dry run content is not saved).java.util.List<UpdateReport.Pair>getRemoved()intgetUpdateLines()longgetUpdateSize()NOTE: update file length calculated from the content instead of callingFile.length()(which is OS dependent).booleanisConfigChanged()If merged file content is identical to the original file (ignoring leading/trailing whitespaces) then original file is not touched.booleanisDryRun()Changed configuration could be obtained withgetDryRunResult()(because otherwise it is not stored anywhere).voidsetAfterLinesCnt(int afterLinesCnt)voidsetAfterSize(long afterSize)voidsetBackup(java.io.File backup)voidsetBeforeLinesCnt(int beforeLinesCnt)voidsetBeforeSize(long beforeSize)voidsetConfigChanged(boolean configChanged)voidsetDryRun(boolean dryRun)voidsetDryRunResult(java.lang.String dryRunResult)voidsetUpdateLines(int updateLines)voidsetUpdateSize(long updateSize)
-
-
-
Method Detail
-
getConfig
public java.io.File getConfig()
- Returns:
- updating configuration file
-
getBeforeSize
public long getBeforeSize()
NOTE: size obtained asFile.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 asFile.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 callingFile.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 withgetDryRunResult()(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)
-
-