Package org.trustdeck.algorithms
Class ConsecutivePseudonymizer
java.lang.Object
org.trustdeck.algorithms.Pseudonymizer
org.trustdeck.algorithms.ConsecutivePseudonymizer
This class provides a pseudonymization by assigning consecutive numbers as pseudonyms.
This class is not thread safe.
- Author:
- Armin Müller
-
Field Summary
Fields inherited from class org.trustdeck.algorithms.Pseudonymizer
DEFAULT_NUMBER_OF_RETRIES, DEFAULT_PADDING_CHAR, DEFAULT_VALUE_LENGTH, DOMAIN_FULL, PSEUDONYMIZATION_FAILED -
Constructor Summary
ConstructorsConstructorDescriptionConsecutivePseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, long startValue, String domainName) A constructor where everything padding-related as well as the start value for the consecutive numbering can be set manually.ConsecutivePseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, String domainName) A constructor where everything padding-related can be set manually.ConsecutivePseudonymizer(boolean paddingWanted, Algorithm algorithm) Basic constructor.ConsecutivePseudonymizer(boolean paddingWanted, Domain domain) Basic constructor.ConsecutivePseudonymizer(String domainName) Basic constructor. -
Method Summary
Modifier and TypeMethodDescriptionpseudonymize(String identifier, String domainPrefix) Creates a consecutive pseudonym.Methods inherited from class org.trustdeck.algorithms.Pseudonymizer
addCheckDigit, addPadding, correctPseudonymLength, persist
-
Constructor Details
-
ConsecutivePseudonymizer
Basic constructor. Initializes the values needed for pseudonymization. The consecutive value used for pseudonymization is retrieved from the domain in the database. Padding is turned off. (The pseudonym value length is automatically set to the default, as well as the padding character.)- Parameters:
domainName- the name of the domain to which the record belongs to
-
ConsecutivePseudonymizer
public ConsecutivePseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, String domainName) A constructor where everything padding-related can be set manually. The consecutive value used for pseudonymization is retrieved from the domain in the database.- Parameters:
paddingWanted- whether or not the pseudonyms should be padded to a certain lengthpseudonymValueLength- the desired length of the pseudonym valuepaddingChar- the character that should be used for paddingdomainName- the name of the domain to which the record belongs to
-
ConsecutivePseudonymizer
public ConsecutivePseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, long startValue, String domainName) A constructor where everything padding-related as well as the start value for the consecutive numbering can be set manually. USE WITH CAUTION.- Parameters:
paddingWanted- whether or not the pseudonyms should be padded to a certain lengthpseudonymValueLength- the desired length of the pseudonym valuepaddingChar- the character that should be used for paddingstartValue- the value for the first pseudonymdomainName- the name of the domain to which the record belongs to
-
ConsecutivePseudonymizer
Basic constructor. All necessary variables are directly retrieved from the domain object.- Parameters:
paddingWanted- whether or not the pseudonyms should be padded to a certain lengthdomain- the domain object
-
ConsecutivePseudonymizer
Basic constructor. All necessary variables are directly retrieved from the algorithm object.- Parameters:
paddingWanted- whether or not the pseudonyms should be padded to a certain lengthalgorithm- the algorithm object
-
-
Method Details
-
pseudonymize
Creates a consecutive pseudonym. The identifier, however, is not actively used here.- Specified by:
pseudonymizein classPseudonymizer- Parameters:
identifier- the value to be pseudonymizeddomainPrefix- the prefix for the domain- Returns:
- a pseudonym in the form of domainPrefix-pseudonymValue (e.g. TST-a1cd75fe29c449248cabfae)
-