Class IdentityHome


  • public final class IdentityHome
    extends Object
    This class provides instances management methods (create, find, ...) for Identity objects
    • Method Detail

      • create

        public static Identity create​(Identity identity,
                                      int dataRetentionPeriodInMonth)
        Create an instance of the identity class
        Parameters:
        identity - The instance of the Identity which contains the informations to store
        Returns:
        The instance of identity which has been created with its primary key.
      • update

        public static Identity update​(Identity identity)
        Update of the identity which is specified in parameter
        Parameters:
        identity - The instance of the Identity which contains the data to store
        Returns:
        The instance of the identity which has been updated
      • merge

        public static Identity merge​(Identity identity)
        Archive identities which have been merge as secondary
        Parameters:
        identity -
        Returns:
      • cancelMerge

        public static void cancelMerge​(Identity identity)
      • hardRemove

        public static void hardRemove​(int nIdentityId)
        Remove the identity whose identifier is specified in parameter
        Parameters:
        nIdentityId - The identity Id
      • softRemove

        public static void softRemove​(String strCuid)
      • findIdByCustomerId

        public static int findIdByCustomerId​(String strCustomerId)
        Find an identity ID from the specified customer ID
        Parameters:
        strCustomerId - the customer ID
        Returns:
        the identity ID
      • findByPrimaryKey

        public static Identity findByPrimaryKey​(int nKey)
        Returns an instance of a identity whose identifier is specified in parameter
        Parameters:
        nKey - The identity primary key
        Returns:
        an instance of Identity
      • findByConnectionId

        public static Identity findByConnectionId​(String strConnectionId)
        Find by connection ID
        Parameters:
        strConnectionId - The connection ID
        Returns:
        The Identity
      • findHistoryByCustomerId

        public static List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityChange> findHistoryByCustomerId​(String strCustomerId)
                                                                                                                        throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
        Find history by customer ID
        Parameters:
        strCustomerId - The customer ID
        Returns:
        The Identity
        Throws:
        fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
      • findHistoryBySearchParameters

        public static List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityChange> findHistoryBySearchParameters​(String strCustomerId,
                                                                                                                                     String clientCode,
                                                                                                                                     String authorName,
                                                                                                                                     fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityChangeType changeType,
                                                                                                                                     String changeStatus,
                                                                                                                                     Map<String,​String> metadata,
                                                                                                                                     Integer nbDaysFrom,
                                                                                                                                     org.apache.commons.lang3.tuple.Pair<Date,​Date> modificationDateInterval)
                                                                                                                              throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
        Find history by customer search parameters
        Parameters:
        strCustomerId - The customer ID
        Returns:
        The Identity
        Throws:
        fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
      • findByCustomerId

        public static Identity findByCustomerId​(String strCustomerId)
        Find by customer ID
        Parameters:
        strCustomerId - The customer ID
        Returns:
        The Identity
      • findByCustomerIdNoAttributes

        public static Identity findByCustomerIdNoAttributes​(String strCustomerId)
        Find by customer ID. Does not load the attributes.
        Parameters:
        strCustomerId - The customer ID
        Returns:
        The Identity without attributes
      • findMasterIdentityByCustomerId

        public static Identity findMasterIdentityByCustomerId​(String strCustomerId)
        Find by customer ID
        Parameters:
        strCustomerId - The customer ID
        Returns:
        The Identity
      • getMasterIdentityLastUpdateDate

        public static Timestamp getMasterIdentityLastUpdateDate​(String customerId)
        Get the master identity last update date coresponding to the given customer ID
        Parameters:
        customerId - the customer ID
        Returns:
        the last update date or null if the identity doesn't exist for the provided CUID
      • findMasterIdentityByConnectionId

        public static Identity findMasterIdentityByConnectionId​(String strConnectionId)
        Find by connection ID
        Parameters:
        strConnectionId - The customer ID
        Returns:
        The Identity
      • getMasterIdentityNoAttributesByConnectionId

        public static Identity getMasterIdentityNoAttributesByConnectionId​(String connectionId)
        Get the master identity without attributes coresponding to the given connection ID
        Parameters:
        connectionId - the connection ID
        Returns:
        the identity or null if the identity doesn't exist for the provided connection ID
      • findByAttributesValueForApiSearch

        public static List<Identity> findByAttributesValueForApiSearch​(Map<String,​List<String>> mapAttributes,
                                                                       int max)
        Find all identities matching one of the values defined on each of the selected Attributes. One value must be found for all selected attributes. Always performs an exact search.
        Parameters:
        mapAttributes - A map that associates the id of each attributes selected with the list of values
        Returns:
        list of Identity
      • findByAttributeExisting

        public static List<String> findByAttributeExisting​(List<Integer> idAttributeList,
                                                           int nbFilledAttributes,
                                                           boolean notMerged,
                                                           boolean notSuspicious,
                                                           int rulePriority)
        Find all identities that have all attributes specified in the list in parameters.
        Identities MUST have all those attributes in order to be returned.
        Parameters:
        idAttributeList - the attributes id
        notMerged - if the returned identities have to be not merged
        notSuspicious - if the returned identities have to not be suspicious
        nbFilledAttributes - minimum number of filled attributes over idAttributeList
        Returns:
        A list of matching customer IDs
      • addIdentityChangeHistory

        public static void addIdentityChangeHistory​(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityChange identityChange)
                                             throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
        add an identity change event in history table
        Parameters:
        identityChange - identity change event
        Throws:
        fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
      • findUpdatedIdentities

        public static List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.UpdatedIdentityDto> findUpdatedIdentities​(Integer days,
                                                                                                                              List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityChangeType> identityChangeTypes,
                                                                                                                              List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.SearchUpdatedAttribute> updatedAttributes,
                                                                                                                              Integer max)
        get identities that have been updated during the previous `days`.
        Parameters:
        days - max number of days since the last update
        identityChangeTypes - filters on specific change types
        updatedAttributes - filters on specific updated attributes
        Returns:
        the list of identities
      • findUpdatedIdentityIds

        public static List<Integer> findUpdatedIdentityIds​(Integer days,
                                                           List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.history.IdentityChangeType> identityChangeTypes,
                                                           List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.SearchUpdatedAttribute> updatedAttributes,
                                                           Integer max)
        get identity IDs that have been updated during the previous `days`.
        Parameters:
        days - max number of days since the last update
        identityChangeTypes - filters on specific change types
        updatedAttributes - filters on specific updated attributes
        Returns:
        the list of identities
      • getUpdatedIdentitiesFromIds

        public static List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.UpdatedIdentityDto> getUpdatedIdentitiesFromIds​(List<Integer> identityIds)
        get updated identities from their IDs.
        Parameters:
        identityIds - list of desired identity IDs
        Returns:
        the list of identities
      • findExpiredNotMergedAndNotConnectedIdentities

        public static List<Identity> findExpiredNotMergedAndNotConnectedIdentities​(int limit)
        Search for identities that are not connected, and have a past expirationDate.
        Parameters:
        limit - the max number of returned results
        Returns:
        a list of expired Identity
      • findMergedIdentities

        public static List<Identity> findMergedIdentities​(int identityId)
        Search for identities that are merged to the provided identity ID.
        Parameters:
        identityId - the 'master' identity ID
        Returns:
        a list of Identity
      • deleteAttributeHistory

        public static void deleteAttributeHistory​(int identityId)
        Delete all attribute history of the identity's provided id.
        Parameters:
        identityId - the identity id