Interface ItemWriter

  • All Known Implementing Classes:
    MockItemWriter, ObjectStoreItemWriter

    public interface ItemWriter
    Stores Items in something - an objectstore or otherwise.
    Author:
    Matthew Wakeling, Mark Woodbridge
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Flushes any store queue, closes transactions, and generally makes sure that every Item passed to the store() method is committed to the destination.
      void store​(Attribute att, java.lang.Integer itemId)
      Stores the given Attribute after setting its item id.
      java.lang.Integer store​(Item item)
      Stores the given Item and all its associated attributes, references, and referencelists.
      void store​(ReferenceList refList, java.lang.Integer itemId)
      Stores the given ReferenceList after setting its item id.
      void store​(Reference ref, java.lang.Integer itemId)
      Stores the given Reference after setting its item id.
      void storeAll​(java.util.Collection<Item> items)
      Stores the given Collection of Items and all their associated attributes, references, and referencelists.
    • Method Detail

      • store

        java.lang.Integer store​(Item item)
                         throws ObjectStoreException
        Stores the given Item and all its associated attributes, references, and referencelists.
        Parameters:
        item - the Item to store
        Returns:
        the database id of the Item - created when storing
        Throws:
        ObjectStoreException - if something goes wrong. Note that for performance reasons, not all implementations of ItemWriter necessarily actually perform the store before this method terminates, therefore a problem could result in an ObjectStoreException being thrown at a later time
      • store

        void store​(ReferenceList refList,
                   java.lang.Integer itemId)
            throws ObjectStoreException
        Stores the given ReferenceList after setting its item id.
        Parameters:
        refList - the ReferenceList
        itemId - the ID of the Item that contains the ReferenceList
        Throws:
        ObjectStoreException - if something goes wrong
      • store

        void store​(Reference ref,
                   java.lang.Integer itemId)
            throws ObjectStoreException
        Stores the given Reference after setting its item id.
        Parameters:
        ref - the ReferenceList
        itemId - the ID of the Item that contains the Reference
        Throws:
        ObjectStoreException - if something goes wrong
      • store

        void store​(Attribute att,
                   java.lang.Integer itemId)
            throws ObjectStoreException
        Stores the given Attribute after setting its item id.
        Parameters:
        att - the Attribute
        itemId - the ID of the Item that contains the Attribute
        Throws:
        ObjectStoreException - if something goes wrong
      • storeAll

        void storeAll​(java.util.Collection<Item> items)
               throws ObjectStoreException
        Stores the given Collection of Items and all their associated attributes, references, and referencelists.
        Parameters:
        items - the Collection of Items to store
        Throws:
        ObjectStoreException - if something goes wrong. Note that for performance reasons, not all implementations of ItemWriter necessarily actually perform the store before this method terminates, therefore a problem could result in an ObjectStoreException being thrown at a later time
      • close

        void close()
            throws ObjectStoreException
        Flushes any store queue, closes transactions, and generally makes sure that every Item passed to the store() method is committed to the destination.
        Throws:
        ObjectStoreException - if something goes wrong. If a problem has occurred with ANY of the previously store()ed Items that has not already caused an ObjectStoreException to be thrown, then this method MUST throw an ObjectStoreException