Package org.trustdeck.algorithms
Class RandomNumberPseudonymizer
java.lang.Object
org.trustdeck.algorithms.Pseudonymizer
org.trustdeck.algorithms.RandomNumberPseudonymizer
This class provides a pseudonymization by assigning random numbers as pseudonyms.
- 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
ConstructorsConstructorDescriptionBasic constructor.RandomNumberPseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, String domainName) A constructor that allows to set whether or not the created pseudonyms should be padded as well as the desired pseudonym value length and the character used for padding.RandomNumberPseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, String domainName, int numberOfRetries) A constructor that allows to set whether or not the created pseudonyms should be padded as well as the desired pseudonym value length and the character used for padding.RandomNumberPseudonymizer(boolean paddingWanted, Algorithm algorithm) Basic constructor.RandomNumberPseudonymizer(boolean paddingWanted, Domain domain) Basic constructor.RandomNumberPseudonymizer(String domainName) Basic constructor. -
Method Summary
Modifier and TypeMethodDescriptionpseudonymize(String identifier, String domainPrefix) Creates a random number pseudonym from the given identifier.Methods inherited from class org.trustdeck.algorithms.Pseudonymizer
addCheckDigit, addPadding, correctPseudonymLength, persist
-
Constructor Details
-
RandomNumberPseudonymizer
public RandomNumberPseudonymizer()Basic constructor. Padding is turned off. (The pseudonym value length is automatically set to the default, as well as the padding character.) -
RandomNumberPseudonymizer
Basic constructor. 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
-
RandomNumberPseudonymizer
public RandomNumberPseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, String domainName) A constructor that allows to set whether or not the created pseudonyms should be padded as well as the desired pseudonym value length and the character used for padding.- 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 useddomainName- the name of the domain to which the record belongs to
-
RandomNumberPseudonymizer
public RandomNumberPseudonymizer(boolean paddingWanted, int pseudonymValueLength, char paddingChar, String domainName, int numberOfRetries) A constructor that allows to set whether or not the created pseudonyms should be padded as well as the desired pseudonym value length and the character used for padding.- 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 useddomainName- the name of the domain to which the record belongs tonumberOfRetries- the number of times the method retries finding a random number that is not already in use
-
RandomNumberPseudonymizer
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
-
RandomNumberPseudonymizer
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 random number pseudonym from the given identifier.- 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)
-