com.ibm.commerce.foundation.dataload.idresolve

Class IDResolverImpl

  • java.lang.Object
    • com.ibm.commerce.foundation.dataload.idresolve.IDResolverImpl
  • All Implemented Interfaces:
    IDResolver


    public class IDResolverImpl
    extends java.lang.Object
    implements IDResolver
    This is a default implementation of IDResolver interface.
    • Constructor Summary

      Constructors 
      Constructor and Description
      IDResolverImpl()
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean checkId(java.lang.String tableName, java.util.List primaryKeyData)
      Check to see if the primary 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 is in the database
      void clearAllCache()
      Clear cache for all tables.
      void clearAllSecondaryCache()
      Clear 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)
      This method obtains the data from IDResolveRequest, processes it and then creates an IDResolveResponse object and returns it.
      void setCacheSize(long size)
      Set the max total map size allowed.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IDResolverImpl

        public IDResolverImpl()
        Default constructor
    • Method Detail

      • getIDResolversInUseForResolveId

        public 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.
        Specified by:
        getIDResolversInUseForResolveId in interface IDResolver
        Parameters:
        tableName - a table name
        Returns:
        list of ID resolvers getting the ID resolvers.
      • getIDResolverInUseForCheckId

        public com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable getIDResolverInUseForCheckId(java.lang.String tableName)
                                                                                                          throws DataLoadException
        Get the ID resolver in use for checkId.
        Specified by:
        getIDResolverInUseForCheckId in interface IDResolver
        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

        public java.util.SortedSet<java.lang.String> getIDResolverTableNames()
        Get the ID resolver table names in sorted alphabetic order.
        Specified by:
        getIDResolverTableNames in interface IDResolver
        Returns:
        SortedSet of ID resolver table names getting the ID resolvers.
      • checkId

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

        public 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 is in the database
        Specified by:
        checkId in interface IDResolver
        Parameters:
        tableName - the table name
        primaryKeyData - a list of data which forms a primary key. The size of the list is the same as the number of columns in the primary key. The order of the list is the same as the primary key defined.
        schema - a schema name
        Returns:
        true if the primary key is in the database already, false otherwise.
        Throws:
        DataLoadException - this exception is thrown if there are some errors during the checking primary key data in the database.
      • setCacheSize

        public void setCacheSize(long size)
        Set the max total map size allowed.
        Specified by:
        setCacheSize in interface IDResolver
        Parameters:
        size - a long number
      • getCacheSize

        public long getCacheSize()
        Get the max cache size for the IDResolver.
        Specified by:
        getCacheSize in interface IDResolver
        Returns:
        the max cache size for the IDResolver.
      • clearAllCache

        public void clearAllCache()
        Clear cache for all tables.
        Specified by:
        clearAllCache in interface IDResolver
      • clearAllSecondaryCache

        public void clearAllSecondaryCache()
        Clear secondary cache for all tables.
        Specified by:
        clearAllSecondaryCache in interface IDResolver
      • resolveId

        public IDResolveResponse resolveId(IDResolveRequest request)
                                    throws DataLoadException
        This method obtains the data from IDResolveRequest, processes it and then creates an IDResolveResponse object and returns it.
        Specified by:
        resolveId in interface IDResolver
        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.