java.lang.Object
fr.paris.lutece.plugins.identitystore.business.identity.IdentityHome

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

    • 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
    • resetUnicityHashCode

      public static Identity resetUnicityHashCode(Identity identity)
      Reset unicityHashCode to random value
      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
    • findAll

      public static List<Identity> findAll()
      Select All Identity
      Returns:
      The 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, String authorType, Date modificationDate, Map<String,String> metadata, Integer nbDaysFrom, org.apache.commons.lang3.tuple.Pair<Date,Date> modificationDateInterval, int max) 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
    • findByCustomerId

      public static Identity findByCustomerId(String strCustomerId, boolean loadAttributes)
      Find by customer ID
      Parameters:
      strCustomerId - The customer ID
      loadAttributes - if true, return identity with its attributes
      Returns:
      The Identity
    • findMasterIdentityByCustomerId

      public static Identity findMasterIdentityByCustomerId(String strCustomerId, boolean loadAttributes)
      Get the master identity from a given customerId. The master identity is search recursively over the masterIdentityId. It means that id identity A is merged into identity B, if A is found with the given customerId, it will return B.
      Parameters:
      strCustomerId - The customer ID
      loadAttributes - if true, return identity with its attributes
      Returns:
      The Identity
    • findMasterIdentityByConnectionId

      public static Identity findMasterIdentityByConnectionId(String strConnectionId, boolean loadAttributes)
      Get the master identity from a given connectionId. The master identity is search recursively over the masterIdentityId. It means that id identity A is merged into identity B, if A is found with the given connectionId, it will return B.
      Parameters:
      strConnectionId - The connection ID
      loadAttributes - if true, return identity with its attributes
      Returns:
      The Identity
    • findByAttributesValueForApiSearch

      public static List<Identity> findByAttributesValueForApiSearch(List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.SearchAttribute> searchAttributes, 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:
      searchAttributes - A map that associates the id of each attribute 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, boolean withGuidOnly)
      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
    • findNotMergedNotConnectedWithNonCertifiedAttributeCustomerIds

      public static List<String> findNotMergedNotConnectedWithNonCertifiedAttributeCustomerIds(String attributeKey, String certProcess, int limit)
      Search for identity customer IDs that are not connected, not merged, and have the specified attribute non-certified.
      Parameters:
      attributeKey - the attribute key to be present and non-certified
      limit - the max number of returned identities
      Returns:
      a list of customer IDs
    • 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
    • getCountIdentities

      public static Integer getCountIdentities()
      Count All Identities.
    • getCountDeletedIdentities

      public static Integer getCountDeletedIdentities(boolean deleted)
      Count All identities that has been deleted or not.
      Parameters:
      deleted - define if the dao count deleted or not deleted identities
    • getCountMergedIdentities

      public static Integer getCountMergedIdentities(boolean merged)
      Count All identities that has been merged or not.
      Parameters:
      merged - define if the dao count merged or not merged identities
    • getCountActiveMonParisdentities

      public static Integer getCountActiveMonParisdentities(boolean monParisActive)
      Count All identities that has been connected or not.
      Parameters:
      monParisActive - define if the dao count connected or not connected identities
    • getCountAttributesByIdentities

      public static Map<Integer,Integer> getCountAttributesByIdentities()
      Count how many attributes each entity has.
    • getCountUnmergedIdentitiesWithoutAttributes

      public static Integer getCountUnmergedIdentitiesWithoutAttributes()
      Count how many attributes has no attribute and isn't merged.
    • getCountIndexEligibleIdentities

      public static Integer getCountIndexEligibleIdentities()
    • getCountIndexNotEligibleIdentities

      public static Integer getCountIndexNotEligibleIdentities()
    • getActionsTypesDuringInterval

      public static List<IndicatorsActionsType> getActionsTypesDuringInterval(int interval)
    • getHistoryStatusList

      public static List<String> getHistoryStatusList()