Package org.intermine.dataconversion
Class ObjectStoreItemWriter
- java.lang.Object
-
- org.intermine.dataconversion.ObjectStoreItemWriter
-
- All Implemented Interfaces:
ItemWriter
public class ObjectStoreItemWriter extends java.lang.Object implements ItemWriter
Stores Items in an objectstore.- Author:
- Matthew Wakeling, Mark Woodbridge
-
-
Constructor Summary
Constructors Constructor Description ObjectStoreItemWriter(ObjectStoreWriter osw)
Constructs the ItemWriter with an ObjectStoreWriter.
-
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.
-
-
-
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 interfaceItemWriter
- 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 interfaceItemWriter
- Parameters:
refList
- the ReferenceListitemId
- 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 interfaceItemWriter
- Parameters:
ref
- the ReferenceListitemId
- 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 interfaceItemWriter
- Parameters:
att
- the AttributeitemId
- 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 interfaceItemWriter
- 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 interfaceItemWriter
- 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
-
-