Class MapHashToCreateRef

java.lang.Object
de.elo.ix.client.imfs.MapHashToCreateRef

public class MapHashToCreateRef extends Object
This map temporarily stores a list of parent IDs where a document with a given MD5 hash is to be created. Checking duplicates cannot be exclusively performed via DB, since two documents with the same MD5 hash could be inserted simultaneously. That's why the MD5 hash is stored in this map for the duration of import. If meanwhile other documents with the same MD5 are to be inserted, their parent IDs are mapped to the MD5. After the first document has been inserted, references are created for the others found in the map.
  • Constructor Details

    • MapHashToCreateRef

      public MapHashToCreateRef()
  • Method Details

    • addAndCheckCreateRef

      public boolean addAndCheckCreateRef(String md5, int parentId)
      Add MD5 into map and memorize parentId if MD5 has already been inserted.
      Parameters:
      md5 - MD5
      parentId - Parent ID
      Returns:
      true, if MD5 has already been inserted before. This means that another thread is currently inserting a document with the same MD5.
    • removeAndCreateRefs

      public void removeAndCreateRefs(IXConnection conn, String md5, int excludeParentId, int objId) throws Exception
      Remove MD5 hash from map and create references.
      Parameters:
      conn - IXConnection object
      md5 - MD5
      excludeParentId - Create references except for this parent ID.
      objId - Create references to this object.
      Throws:
      Exception
    • removePreparedRef

      public void removePreparedRef(String md5, int parentId)
      Remove entry added by addAndCheckCreateRef(String, int) from map.
      Parameters:
      md5 - Hash
      parentId - Parent ID