Package org.intermine.dataloader
Class ObjectDescription
- java.lang.Object
-
- org.intermine.dataloader.ObjectDescription
-
public class ObjectDescription extends java.lang.Object
Object class used by DataTracker for data tracking.- Author:
- Matthew Wakeling
-
-
Constructor Summary
Constructors Constructor Description ObjectDescription()
Constructs a new ObjectDescription.ObjectDescription(ObjectDescription desc)
Constructs a new ObjectDescription from an existing one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clean()
Marks the ObjectDescription as clean - that is all the data has been flushed to the backing database.protected java.util.Map<java.lang.String,Source>
getNewData()
Returns the new data, which needs to be written back into the backing database.protected java.util.Map<java.lang.String,Source>
getOrig()
Returns the original data, as reflected in the backing database.Source
getSource(java.lang.String fieldName)
Gets the source associated with the given fieldname.boolean
isDirty()
Returns whether this ObjectDescription is dirty.void
put(java.lang.String fieldName, Source source)
Adds a fieldname-source mapping for this ObjectDescription that is not present in the backing database.void
putClean(java.lang.String fieldName, Source source)
Adds a fieldname-source mapping for this ObjectDescription while keeping it clean.
-
-
-
Constructor Detail
-
ObjectDescription
public ObjectDescription()
Constructs a new ObjectDescription.
-
ObjectDescription
public ObjectDescription(ObjectDescription desc)
Constructs a new ObjectDescription from an existing one. This is used for copy-on-write for the write-back cache in the DataTracker.- Parameters:
desc
- an existing description
-
-
Method Detail
-
putClean
public void putClean(java.lang.String fieldName, Source source)
Adds a fieldname-source mapping for this ObjectDescription while keeping it clean.- Parameters:
fieldName
- the name of the fieldsource
- the Source to map onto- Throws:
java.lang.IllegalStateException
- if this ObjectDescription is already dirty
-
put
public void put(java.lang.String fieldName, Source source)
Adds a fieldname-source mapping for this ObjectDescription that is not present in the backing database. This makes the ObjectDescription dirty, so that the change is written back.- Parameters:
fieldName
- the name of the fieldsource
- the Source to map onto
-
getSource
public Source getSource(java.lang.String fieldName)
Gets the source associated with the given fieldname.- Parameters:
fieldName
- the fieldname to look up- Returns:
- the Source, or null if it doesn't exist
-
isDirty
public boolean isDirty()
Returns whether this ObjectDescription is dirty.- Returns:
- true if the ObjectDescriptor is dirty
-
clean
public void clean()
Marks the ObjectDescription as clean - that is all the data has been flushed to the backing database.
-
getOrig
protected java.util.Map<java.lang.String,Source> getOrig()
Returns the original data, as reflected in the backing database.- Returns:
- a Map
-
getNewData
protected java.util.Map<java.lang.String,Source> getNewData()
Returns the new data, which needs to be written back into the backing database.- Returns:
- a Map
-
-