com.ibm.commerce.foundation.dataload.idresolve

Interface IDResolver

  • All Known Implementing Classes:
    IDResolverImpl


    public interface IDResolver
    The ID resolver is used to resolve ID and check ID. Resolving ID means that from a unique index data, it returns the corresponding primary key in the database or return a new primary key if the unique index data is not in the database yet and the generate new key flag is set to true. Checking ID means that from a give primary key data, it checks that if the primary key is in the database or not.

    All custom implementation classes of this interface should extend the out of box implementation class: IDResolverImpl.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      boolean checkId(java.lang.String tableName, java.util.List primaryKeyData)
      Check to see if the primary key or unique-index key is in the database.
      boolean checkId(java.lang.String tableName, java.util.List primaryKeyData, java.lang.String schema)
      Check ID for a specific schema to see if the primary key or unique-index key is in the database.
      void clearAllCache()
      Clear cache for all tables.
      void clearAllSecondaryCache()
      Clear the secondary cache for all tables.
      long getCacheSize()
      Get the max cache size for the IDResolver.
      com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable getIDResolverInUseForCheckId(java.lang.String tableName)
      Get the ID resolver in use for checkId.
      java.util.List<com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable> getIDResolversInUseForResolveId(java.lang.String tableName)
      Get the ID resolvers in use for resolveId.
      java.util.SortedSet<java.lang.String> getIDResolverTableNames()
      Get the ID resolver table names in sorted alphabetic order.
      IDResolveResponse resolveId(IDResolveRequest request)
      Resolve ID to check if the unique index data exists in the database.
      void setCacheSize(long size)
      Set max cache size for the IDResolver.
    • Field Detail

      • COPYRIGHT

        static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Method Detail

      • resolveId

        IDResolveResponse resolveId(IDResolveRequest request)
                             throws DataLoadException
        Resolve ID to check if the unique index data exists in the database.
        Parameters:
        request - an IDResolveRequest object containing the request info
        Returns:
        IDResolveResponse containing the response info.
        Throws:
        DataLoadException - the exception is thrown if the ID cannot be resolved and the generate new key is set to false in the request.
      • checkId

        boolean checkId(java.lang.String tableName,
                        java.util.List primaryKeyData)
                 throws DataLoadException
        Check to see if the primary key or unique-index key is in the database.
        Parameters:
        tableName - the table name
        primaryKeyData - a list of data which forms a primary key or a list of data which forms a unique-index key. The size of the list is the same as the number of columns in the primary key or unique-index key. The order of the list is the same as the primary key defined or unique-index key defined.
        Returns:
        true if the primary key or unique-index key is in the database already, false otherwise.
        Throws:
        DataLoadException - this exception is thrown if there are some errors during the checking primary key or unique-index key data in the database.
      • checkId

        boolean checkId(java.lang.String tableName,
                        java.util.List primaryKeyData,
                        java.lang.String schema)
                 throws DataLoadException
        Check ID for a specific schema to see if the primary key or unique-index key is in the database.
        Parameters:
        tableName - the table name
        primaryKeyData - a list of data which forms a primary key or a list of data which forms a unique-index key. The size of the list is the same as the number of columns in the primary key or unique-index key. The order of the list is the same as the primary key or unique-index key defined.
        schema - a schema name
        Returns:
        true if the primary key or unique-index key is in the database already, false otherwise.
        Throws:
        DataLoadException - this exception is thrown if there are some errors during the checking primary key or unique-index key data in the database.
      • setCacheSize

        void setCacheSize(long size)
        Set max cache size for the IDResolver. It is called at the initialization time.
        Parameters:
        size - the cache size
      • getCacheSize

        long getCacheSize()
        Get the max cache size for the IDResolver.
        Returns:
        the max cache size for the IDResolver.
      • clearAllCache

        void clearAllCache()
        Clear cache for all tables. It is usually called at the end of each load item
      • clearAllSecondaryCache

        void clearAllSecondaryCache()
        Clear the secondary cache for all tables. It should be called often to prevent it keeping growing. It is usually called at the end of each jdbc batch execute.
      • getIDResolversInUseForResolveId

        java.util.List<com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable> getIDResolversInUseForResolveId(java.lang.String tableName)
        Get the ID resolvers in use for resolveId. A table may have multiple unique indexes. There is an ID resolver for each unique index.
        Parameters:
        tableName - a table name
        Returns:
        list of ID resolvers
      • getIDResolverInUseForCheckId

        com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable getIDResolverInUseForCheckId(java.lang.String tableName)
                                                                                                   throws DataLoadException
        Get the ID resolver in use for checkId.
        Parameters:
        tableName - a table name
        Returns:
        the ID resolver
        Throws:
        DataLoadException - this exception is thrown if there are some problems getting the ID resolver.
      • getIDResolverTableNames

        java.util.SortedSet<java.lang.String> getIDResolverTableNames()
        Get the ID resolver table names in sorted alphabetic order.
        Returns:
        SortedSet of ID resolver table names getting the ID resolvers.