Package com.ibm.fhir.persistence.util
Class ResourceFingerprintVisitor
- java.lang.Object
-
- com.ibm.fhir.model.visitor.DefaultVisitor
-
- com.ibm.fhir.model.visitor.PathAwareVisitor
-
- com.ibm.fhir.persistence.util.ResourceFingerprintVisitor
-
- All Implemented Interfaces:
Visitor
public class ResourceFingerprintVisitor extends PathAwareVisitor
Compute a cryptographic hash of the visited nodes, skipping those which may be altered by the persistence layer.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
index
-
Fields inherited from class com.ibm.fhir.model.visitor.DefaultVisitor
visitChildren
-
-
Constructor Summary
Constructors Constructor Description ResourceFingerprintVisitor()
Public constructor.ResourceFingerprintVisitor(byte[] salt)
Public constructor.ResourceFingerprintVisitor(SaltHash baseline)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doVisit(String elementName, String value)
protected void
doVisitStart(String elementName, int elementIndex, Resource resource)
SaltHash
getSaltAndHash()
Compute the digest and return the result along with the salt that was usedprotected boolean
includePath()
Test whether or not the current path value should be included in the fingerprintprotected void
updateDigest(String name, String value)
Update the digest with the name/value pairvoid
visit(String elementName, byte[] value)
void
visit(String elementName, Boolean value)
void
visit(String elementName, Integer value)
void
visit(String elementName, BigDecimal value)
void
visit(String elementName, LocalDate value)
void
visit(String elementName, LocalTime value)
void
visit(String elementName, Year value)
void
visit(String elementName, YearMonth value)
void
visit(String elementName, ZonedDateTime value)
-
Methods inherited from class com.ibm.fhir.model.visitor.PathAwareVisitor
doVisitEnd, doVisitEnd, doVisitStart, getPath, reset, visit, visitEnd, visitEnd, visitStart, visitStart
-
Methods inherited from class com.ibm.fhir.model.visitor.DefaultVisitor
postVisit, postVisit, preVisit, preVisit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitEnd, visitStart
-
-
-
-
Constructor Detail
-
ResourceFingerprintVisitor
public ResourceFingerprintVisitor(byte[] salt)
Public constructor. Uses the given salt- Parameters:
salt
-
-
ResourceFingerprintVisitor
public ResourceFingerprintVisitor(SaltHash baseline)
Public constructor. Uses the salt from the given SaltHash Preferred, to avoid confusion between salt and hash- Parameters:
baseline
-
-
ResourceFingerprintVisitor
public ResourceFingerprintVisitor()
Public constructor. Generates a new salt
-
-
Method Detail
-
getSaltAndHash
public SaltHash getSaltAndHash()
Compute the digest and return the result along with the salt that was used- Returns:
-
doVisitStart
protected void doVisitStart(String elementName, int elementIndex, Resource resource)
- Overrides:
doVisitStart
in classPathAwareVisitor
-
visit
public void visit(String elementName, byte[] value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, BigDecimal value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, Boolean value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, Integer value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, LocalDate value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, LocalTime value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
doVisit
public void doVisit(String elementName, String value)
- Overrides:
doVisit
in classPathAwareVisitor
-
visit
public void visit(String elementName, Year value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, YearMonth value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
visit
public void visit(String elementName, ZonedDateTime value)
- Specified by:
visit
in interfaceVisitor
- Overrides:
visit
in classDefaultVisitor
-
updateDigest
protected void updateDigest(String name, String value)
Update the digest with the name/value pair- Parameters:
name
-value
-
-
includePath
protected boolean includePath()
Test whether or not the current path value should be included in the fingerprint- Returns:
-
-