Package org.trustdeck.service
Class PseudonymDBAccessService
java.lang.Object
org.trustdeck.service.PseudonymDBAccessService
This class is used to encapsulate all methods needed to access the database for handling pseudonym-records.
- Author:
- Armin Müller and Eric Wündisch
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRepresents the duplication status of a requested insertion of an identifier and idType combination into the database.static final StringRepresents the duplication status of a requested insertion of a pseudonym into the database.static final StringRepresents an erroneous insertion of a record into the database.static final StringRepresents a successful insertion of a record into the database. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreatePseudonyms(List<PseudonymDTO> pseudonyms, int domainId, boolean multiplePsnAllowed, jakarta.servlet.http.HttpServletRequest request) Method to insert multiple pseudonyms at once in a batch.deletePseudonyms(List<PseudonymDTO> pseudonyms, int domainId, jakarta.servlet.http.HttpServletRequest request) Method to delete multiple pseudonyms at once in a batch.getPseudonym(String domainName, IdentifierItem identifierItem, String psn, jakarta.servlet.http.HttpServletRequest request) Method to retrieve pseudonym-records.getPseudonymFromIdentifier(String domainName, IdentifierItem identifierItem, jakarta.servlet.http.HttpServletRequest request) Retrieves a pseudonym-record from a specified identifier.getPseudonymFromPsn(String domainName, String psn, jakarta.servlet.http.HttpServletRequest request) Retrieves a pseudonym-record from a specified pseudonym.updatePseudonyms(List<PseudonymUpdateDTO> pseudonymUpdates, jakarta.servlet.http.HttpServletRequest request) Method to update multiple pseudonyms at once in a single batch.
-
Field Details
-
INSERTION_DUPLICATE_IDENTIFIER
Represents the duplication status of a requested insertion of an identifier and idType combination into the database.- See Also:
-
INSERTION_DUPLICATE_PSEUDONYM
Represents the duplication status of a requested insertion of a pseudonym into the database.- See Also:
-
INSERTION_ERROR
Represents an erroneous insertion of a record into the database.- See Also:
-
INSERTION_SUCCESS
Represents a successful insertion of a record into the database.- See Also:
-
-
Constructor Details
-
PseudonymDBAccessService
public PseudonymDBAccessService()
-
-
Method Details
-
createPseudonyms
@Transactional public List<String> createPseudonyms(List<PseudonymDTO> pseudonyms, int domainId, boolean multiplePsnAllowed, jakarta.servlet.http.HttpServletRequest request) Method to insert multiple pseudonyms at once in a batch. Duplicates will be ignored.- Parameters:
pseudonyms- a list of pseudonyms to insert into the databasedomainId- the ID of the domain in which the pseudonyms should be createdmultiplePsnAllowed- whether or not multiple pseudonyms per id & idType combination are allowedrequest- the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can passnull.- Returns:
INSERTION_SUCCESSwhen the batch insertion was successful,INSERTION_ERRORotherwise
-
getPseudonym
@Transactional public List<PseudonymDTO> getPseudonym(String domainName, IdentifierItem identifierItem, String psn, jakarta.servlet.http.HttpServletRequest request) Method to retrieve pseudonym-records. This method actually only evaluates the given information and delegates the getting-process.- Parameters:
domainName- the name of the domain to search inidentifierItem- the identifierItem to search forpsn- the pseudonym to search forrequest- the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can passnull.- Returns:
- the pseudonymization data element referring to the given information, or
nullwhen nothing is found or an error occurs
-
getPseudonymFromIdentifier
@Transactional public List<PseudonymDTO> getPseudonymFromIdentifier(String domainName, IdentifierItem identifierItem, jakarta.servlet.http.HttpServletRequest request) Retrieves a pseudonym-record from a specified identifier.- Parameters:
domainName- the name of the domain to search inidentifierItem- the identifierItem to search forrequest- the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can passnull.- Returns:
- the pseudonymization data element referring to the given identifier, or
nullwhen nothing is found or an error occurs
-
getPseudonymFromPsn
@Transactional public PseudonymDTO getPseudonymFromPsn(String domainName, String psn, jakarta.servlet.http.HttpServletRequest request) Retrieves a pseudonym-record from a specified pseudonym.- Parameters:
domainName- the name of the domain to search inpsn- the pseudonym to search forrequest- the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can passnull.- Returns:
- the pseudonymization data element referring to the given pseudonym, or
nullwhen nothing is found or an error occurs
-
updatePseudonyms
@Transactional public List<Boolean> updatePseudonyms(List<PseudonymUpdateDTO> pseudonymUpdates, jakarta.servlet.http.HttpServletRequest request) Method to update multiple pseudonyms at once in a single batch. Not found pseudonyms will be ignored. Can also update a single pseudonym (given as a list).- Parameters:
pseudonymUpdates- a list of pseudonyms that are to be updated in the databaserequest- the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can passnull.- Returns:
- List of
truewhen the individual update was successful,falseotherwise
-
deletePseudonyms
@Transactional public List<Boolean> deletePseudonyms(List<PseudonymDTO> pseudonyms, int domainId, jakarta.servlet.http.HttpServletRequest request) Method to delete multiple pseudonyms at once in a batch. Not found pseudonyms will be ignored.- Parameters:
pseudonyms- a list of pseudonyms that are to be deleted from the databasedomainId- the ID of the domain in which the pseudonym should be updatedrequest- the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can passnull.- Returns:
truewhen the batch deletion was successful,falseotherwise
-