Package overit.geocall.basic.anonymizer
Class Anonymizer
java.lang.Object
overit.geocall.basic.anonymizer.Anonymizer
- All Implemented Interfaces:
Identified
Use this class to anonymize the informations contained into a map, in order to make impossible to link those information
to a specific identity.
Tipically the map that you will pass will contains the row obtained by an AUSER query.
You must forcibly set the context before start to invoke the methods of this class otherwise nothing will happens.
Here is an exmple of usages:
Anonymizer a = Factory.make(Anonymizer.class, this);
a.setContext(user);
a.forText("AUSENAME").anonymize(RandomToken.LOWERCASE) // anonymize the name with a random value
a.forText("AUSESURNAME").setValue("unknown"); // anonymize the surname with a fixed value
a.forLong("AUTEETA").anonymize(25, 50) // anonymyze the age whit a value between 25 and 50
a.forDate("AUSEBIRTHDATE").anonymize(fromRange, toRange); // anonymize the birth date between a given date range
Every methods save the changes directly inside the context map.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classclassAnonymizer used to obfuscate the fields containing the latitude and longitude coordinates.classAnonymizer used to obfuscate a fields containing date values.classAnonymizer used to obfuscate a fields containing double values.classUsed to obfuscate a fields containing string values which respect the email format.classAnonymizer used to obfuscate a fields containing integer values.classAnonymizer used to obfuscate a fields containing user's fiscal code value.classAnonymizer used to obfuscate a fields containing long values.classAnonymizer used to obfuscate a fields containing string values which respect the phone number format.classAnonymizer used to obfuscate a fields containg string values.classAnonymizer used to obfuscate a fields containing time values. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionforCoordinate(String latitudeField, String longitudeField) Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the geographical coordinates defined by the values contained into the two input parameters.Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the date value of the field indicated as parameter.Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the double value of the field indicated as parameter.Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the string value of the field indicated as parameter.forInteger(String field) Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the integer value of the field indicated as parameter.forItalianFiscalCode(String field) Use this method to get the reference of theanonymizerthat contains the methods you can use to generate the user's fiscal code (in the italian format).Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the long value of the field indicated as parameter.Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the value of the field indicated as parameter.Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the string value of the field indicated as parameter.Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the time value of the field indicated as parameter.Returns theIdentityassociated to the componentvoidsetContext(HashGetter context) Set the context whose data that will be used during the anonymisation process.voidsetIdentity(Identity identity) Sets theIdentityto the component
-
Field Details
-
_identity
-
_context
-
-
Constructor Details
-
Anonymizer
public Anonymizer()
-
-
Method Details
-
getIdentity
Description copied from interface:IdentifiedReturns theIdentityassociated to the component- Specified by:
getIdentityin interfaceIdentified- Returns:
- The Identity of the user currently logged in the application
-
setIdentity
Description copied from interface:IdentifiedSets theIdentityto the component- Specified by:
setIdentityin interfaceIdentified- Parameters:
identity- The Identity that must be associated to the component
-
setContext
Set the context whose data that will be used during the anonymisation process.- Parameters:
context- instance of the HashGetter containing the entry that will be anonymized.
-
forText
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the string value of the field indicated as parameter.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains a String value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forEmail
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the string value of the field indicated as parameter. The field must contains a valid email, otherwise nothing will happens.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains a valid email value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forPhone
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the value of the field indicated as parameter. The field must contains a valid phone, otherwise nothing will happens.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains a valid phone value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forInteger
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the integer value of the field indicated as parameter.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains an integer value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forLong
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the long value of the field indicated as parameter.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains an long value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forDouble
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the double value of the field indicated as parameter.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains an double value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forDate
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the date value of the field indicated as parameter.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains an date value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forTime
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the time value of the field indicated as parameter.- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains a Date instance. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forCoordinate
Use this method to get the reference of theanonymizerthat contains the methods you can use to obfuscate the geographical coordinates defined by the values contained into the two input parameters.- Parameters:
latitudeField- string containing the name of the field that will be anonymized. The value ot the field must contains a valid latitude value (a double number included between -90° and +90°) expressed in decimal degrees. Null value will throws an exception.longitudeField- string containing the name of the field that will be anonymized. The value ot the field must contains a valid longitude value (a double number included between -180° and +180°) expressed in decimal degrees. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-
forItalianFiscalCode
Use this method to get the reference of theanonymizerthat contains the methods you can use to generate the user's fiscal code (in the italian format).- Parameters:
field- string containing the name of the field that will be anonymized. The value ot the field must contains an String value. Null value will throws an exception.- Returns:
- the instance of the
anonymizerthat you can use to obfuscate the field's value.
-