Class PseudonymDBAccessService

java.lang.Object
org.trustdeck.service.PseudonymDBAccessService

@Service public class PseudonymDBAccessService extends Object
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 Details

    • INSERTION_DUPLICATE_IDENTIFIER

      public static final String 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

      public static final String INSERTION_DUPLICATE_PSEUDONYM
      Represents the duplication status of a requested insertion of a pseudonym into the database.
      See Also:
    • INSERTION_ERROR

      public static final String INSERTION_ERROR
      Represents an erroneous insertion of a record into the database.
      See Also:
    • INSERTION_SUCCESS

      public static final String 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 database
      domainId - the ID of the domain in which the pseudonyms should be created
      multiplePsnAllowed - whether or not multiple pseudonyms per id & idType combination are allowed
      request - the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can pass null.
      Returns:
      INSERTION_SUCCESS when the batch insertion was successful, INSERTION_ERROR otherwise
    • 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 in
      identifierItem - the identifierItem to search for
      psn - the pseudonym to search for
      request - the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can pass null.
      Returns:
      the pseudonymization data element referring to the given information, or null when 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 in
      identifierItem - the identifierItem to search for
      request - the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can pass null.
      Returns:
      the pseudonymization data element referring to the given identifier, or null when 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 in
      psn - the pseudonym to search for
      request - the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can pass null.
      Returns:
      the pseudonymization data element referring to the given pseudonym, or null when 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 database
      request - the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can pass null.
      Returns:
      List of true when the individual update was successful, false otherwise
    • 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 database
      domainId - the ID of the domain in which the pseudonym should be updated
      request - the request object that is needed for creating the audit database-entries. If no auditing should be performed, you can pass null.
      Returns:
      true when the batch deletion was successful, false otherwise