Class ObjectStoreItemWriter

  • All Implemented Interfaces:
    ItemWriter

    public class ObjectStoreItemWriter
    extends java.lang.Object
    implements ItemWriter
    Stores Items in an objectstore.
    Author:
    Matthew Wakeling, Mark Woodbridge
    • Method Summary

      All Methods Instance Methods Concrete 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.
      • Methods inherited from class java.lang.Object

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

      • ObjectStoreItemWriter

        public ObjectStoreItemWriter​(ObjectStoreWriter osw)
                              throws ObjectStoreException
        Constructs the ItemWriter with an ObjectStoreWriter.
        Parameters:
        osw - the ObjectStoreWriter in which to store the Items
        Throws:
        ObjectStoreException - if the ObjectStore is already in a transaction
    • Method Detail

      • store

        public java.lang.Integer store​(Item item)
                                throws ObjectStoreException
        Stores the given Item and all its associated attributes, references, and referencelists.
        Specified by:
        store in interface ItemWriter
        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

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

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

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

        public void storeAll​(java.util.Collection<Item> items)
                      throws ObjectStoreException
        Stores the given Collection of Items and all their associated attributes, references, and referencelists.
        Specified by:
        storeAll in interface ItemWriter
        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

        public 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.
        Specified by:
        close in interface ItemWriter
        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