public class DataNode
extends java.lang.Object
implements java.lang.Comparable
For the most part you creation of DataNodes and insertion of data into them should be dealt with by the DataManager via the addData methods, but manual creation is also permitted. A manually created DataNode is added to the DataManager via the addDataNode method of the DataManager.
Constructor and Description |
---|
DataNode(RelationalSchema templateSchema)
Generates a new node based on the schema.
|
Modifier and Type | Method and Description |
---|---|
void |
abortWrite() |
void |
addChild(DataNode child)
adds a child to the node
|
void |
addData(java.util.Map<java.lang.String,?> candidateData)
Adds a map of data to the schema, if a key in the map matches up with a key in the node's schema it will store the data, otherwise it will ignore it
|
void |
addData(java.lang.String columnName,
DataObject d) |
void |
addData(java.lang.String columnName,
java.lang.Object value)
Same as other method which takes a Map, except that this one takes only a single name-value pair
|
void |
addParent(DataNode n) |
void |
clearData() |
int |
compareTo(java.lang.Object o)
This is used to compare DataNode by name/commit time so we can sort by the order they were created when they are in the tree.
|
boolean |
equals(java.lang.Object o) |
CacheBlock |
getCacheBlock()
Returns the CacheBlock for the object
|
java.util.Set<DataNode> |
getChildren() |
java.util.SortedSet<DataNode> |
getChildren(java.lang.String table)
returns all the descendants of the current node with the name table
|
java.util.Set<java.lang.String> |
getFieldsWritten()
Returns the FieldsWritten for the node.
|
boolean |
getInserted()
returns whether or not the DataNode was written to the database
|
java.util.Map<java.lang.String,java.lang.Object> |
getObjectMap() |
java.util.Set<DataNode> |
getParents() |
RelationalSchema |
getSchema() |
DataObject |
getValue(java.lang.String column) |
java.util.Map<java.lang.String,DataObject> |
getValues() |
int |
hashCode() |
boolean |
isAborted()
Returns if the node has been aborted
|
boolean |
isCommitted() |
boolean |
isMergeable()
returns whether the DataNode is mergeable
|
boolean |
isUpdateable() |
boolean |
isWriteChildrenOnAbort()
Returns whether or not the children should be written anyway if the node is aborted
|
java.lang.String |
matchCase(java.lang.String inputCase,
RelationalSchema s) |
void |
removeChild(DataNode n) |
void |
removeData(java.lang.String columnName)
Removes a value from the node
|
void |
removeParent(DataNode n) |
void |
setCacheBlock(CacheBlock cacheBlock)
Sets the CacheBlock for the object
|
void |
setCommitted() |
void |
setFieldsWritten(java.util.Set<java.lang.String> fieldsWritten)
Sets the fields that were actually written for this node
|
void |
setInserted()
Sets that this DataNode has been inserted into the Database
|
void |
setMergeable()
Set the DataNode as being mergeable
|
void |
setUpdateable()
if the writer supports it this will update the values instead of rewriting them, for example on a database it will call an UPDATE on a write that returns
a duplicate.
|
java.lang.String |
toString() |
void |
writeChildrenOnAbort()
Call this to indicate even if the write for this node is aborted, the children should still be written
|
public DataNode(RelationalSchema templateSchema)
templateSchema
- AbstractSchema for which this DataNode instantiates@NotNull public java.util.Map<java.lang.String,DataObject> getValues()
@NotNull public java.util.SortedSet<DataNode> getChildren(java.lang.String table)
table
- @Nullable public CacheBlock getCacheBlock()
public void setCacheBlock(@Nullable CacheBlock cacheBlock)
cacheBlock
- The new value for CacheBlockpublic void setCommitted()
public boolean isCommitted()
@Nullable public DataObject getValue(@NotNull java.lang.String column)
public java.util.Set<DataNode> getParents()
public java.util.Set<DataNode> getChildren()
public void addData(@Nullable java.util.Map<java.lang.String,?> candidateData)
candidateData
- Map containing name value pairs to try to add to the schemapublic void addData(@NotNull java.lang.String columnName, java.lang.Object value)
columnName
- Candidate column name to be added to AbstractSchema's datavalue
- Candidate value to be addedpublic void addData(@NotNull java.lang.String columnName, DataObject d)
public void removeData(@NotNull java.lang.String columnName)
columnName
- The column for which to remove data@InternalOnly public java.lang.String matchCase(@NotNull java.lang.String inputCase, @NotNull RelationalSchema s)
public void clearData()
@Nullable public RelationalSchema getSchema()
@NotNull public java.lang.String toString()
toString
in class java.lang.Object
public void setUpdateable()
public boolean isUpdateable()
public void setMergeable()
public boolean isMergeable()
public void setInserted()
public boolean getInserted()
public void abortWrite()
public void writeChildrenOnAbort()
public boolean isAborted()
public boolean isWriteChildrenOnAbort()
@NotNull public java.util.Map<java.lang.String,java.lang.Object> getObjectMap()
@InternalOnly public int compareTo(@NotNull java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- The other objectpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
@InternalOnly public void setFieldsWritten(@NotNull java.util.Set<java.lang.String> fieldsWritten)
fieldsWritten
- The fields that were written (by name)@NotNull public java.util.Set<java.lang.String> getFieldsWritten()