public class FederatedDocumentWriter extends Object implements DocumentWriter
DocumentWriter interface.UNKNOWN_TOTAL_SIZE| Constructor and Description |
|---|
FederatedDocumentWriter(DocumentTranslator translator) |
FederatedDocumentWriter(DocumentTranslator translator,
Document document) |
| Modifier and Type | Method and Description |
|---|---|
DocumentWriter |
addChild(String id,
Name name)
Add a child with the given id and name to the underlying document.
|
DocumentWriter |
addChild(String id,
String name)
Add a child with the given id and name to the underlying document.
|
DocumentWriter |
addMixinType(Name name)
Adds a mixin type to the underlying document.
|
DocumentWriter |
addMixinType(String name)
Adds a mixin type to the underlying document.
|
DocumentWriter |
addPage(String parentId,
int nextPageOffset,
long blockSize,
long totalChildCount)
Create a reference to a separate page of children in its underlying document.
|
DocumentWriter |
addPage(String parentId,
String nextPageOffset,
long blockSize,
long totalChildCount)
Create a reference to a separate page of children in its underlying document.
|
DocumentWriter |
addProperties(Map<Name,Property> properties)
Adds a map of properties to the the underlying document's properties.
|
DocumentWriter |
addProperty(Name name,
Object value)
Adds a property with the given name and value to the underlying document's properties.
|
DocumentWriter |
addProperty(Name name,
Object[] values)
Adds a multi-value property with the given name to the underlying document's properties.
|
DocumentWriter |
addProperty(Name name,
Object firstValue,
Object... additionalValues)
Adds a multi-value property with the given name to the underlying document's properties.
|
DocumentWriter |
addProperty(String name,
Object value)
Adds a property with the given name and value to the underlying document's properties.
|
DocumentWriter |
addProperty(String name,
Object[] values)
Adds a multi-value property with the given name to the underlying document's properties.
|
DocumentWriter |
addProperty(String name,
Object firstValue,
Object... additionalValues)
Adds a multi-value property with the given name to the underlying document's properties.
|
DocumentWriter |
addPropertyValue(Name name,
Object value)
Adds an additional value to an existing property with the given name.
|
DocumentWriter |
addPropertyValue(String name,
Object value)
Adds an additional value to an existing property with the given name.
|
EditableDocument |
document()
Returns the underlying document.
|
protected Name |
nameFrom(String name) |
DocumentWriter |
removeChild(String id)
Remove a child from this document.
|
DocumentWriter |
setCacheTtlSeconds(int seconds)
Sets the value, in seconds, of the amount of the time the underlying document should be cached.
|
DocumentWriter |
setChildren(LinkedHashMap<String,Name> children)
Set an ordered of (childId, childName) for the underlying document.
|
DocumentWriter |
setChildren(List<? extends Document> children)
Set the list of children for the underlying document.
|
FederatedDocumentWriter |
setId(String id)
Sets an identifier string on the underlying document.
|
DocumentWriter |
setNotQueryable()
Sets a flag on the underlying document which indicates that it should not be indexed (and therefore will not appear in
queries) by the repository.
|
DocumentWriter |
setParent(String parentId)
Sets the id of the parent of the underlying document.
|
DocumentWriter |
setParents(List<String> parentIds)
Sets the ids of one or more parents on the underlying document.
|
DocumentWriter |
setParents(String... parentIds)
Sets the ids of one or more parents on the underlying document.
|
DocumentWriter |
setPrimaryType(Name name)
Sets the primary type of the underlying document.
|
DocumentWriter |
setPrimaryType(String name)
Sets the primary type of the underlying document.
|
DocumentWriter |
setProperties(Map<Name,Property> properties)
Replaces the underlying document's properties with the one from the given map.
|
protected DocumentTranslator |
translator() |
DocumentWriter |
writeAdditionalDocument(String id)
Some connectors may want to pre-generate additional documents when
Connector.getDocumentById(String) is called. |
public FederatedDocumentWriter(DocumentTranslator translator, Document document)
public FederatedDocumentWriter(DocumentTranslator translator)
public FederatedDocumentWriter setId(String id)
DocumentWritersetId in interface DocumentWriterid - the identifier of the document; may not be nullpublic DocumentWriter setPrimaryType(Name name)
DocumentWritersetPrimaryType in interface DocumentWritername - the name of the primary type for the node; may not be nullpublic DocumentWriter setPrimaryType(String name)
DocumentWritersetPrimaryType in interface DocumentWritername - the name of the primary type for the node; may not be nullpublic DocumentWriter addMixinType(Name name)
DocumentWriteraddMixinType in interface DocumentWritername - the name of a node type that should be added as a mixin for the node; may not be nullpublic DocumentWriter addMixinType(String name)
DocumentWriteraddMixinType in interface DocumentWritername - the name of a node type that should be added as a mixin for the node; may not be nullpublic DocumentWriter addPropertyValue(Name name, Object value)
DocumentWriteraddPropertyValue in interface DocumentWritername - the name of the property; may not be nullvalue - the new value that should be added to the property; may not be nullpublic DocumentWriter addPropertyValue(String name, Object value)
DocumentWriteraddPropertyValue in interface DocumentWritername - the name of the property; may not be nullvalue - the new value that should be added to the property; may not be nullpublic DocumentWriter addProperty(String name, Object value)
DocumentWriteraddProperty in interface DocumentWritername - the name of the property; may not be nullvalue - the value for the property; may not be nullpublic DocumentWriter addProperty(String name, Object[] values)
DocumentWriteraddProperty in interface DocumentWritername - a name of the property; may not be nullvalues - the values for the property; may not be null but may be emptypublic DocumentWriter addProperty(String name, Object firstValue, Object... additionalValues)
DocumentWriteraddProperty in interface DocumentWritername - the name of the property; may not be nullfirstValue - the first value for the property; may not be nulladditionalValues - additional values for the propertypublic DocumentWriter addProperty(Name name, Object value)
DocumentWriteraddProperty in interface DocumentWritername - the name of the property; may not be nullvalue - a value for the property; may not be nullpublic DocumentWriter addProperty(Name name, Object[] values)
DocumentWriteraddProperty in interface DocumentWritername - the name of the property; may not be nullvalues - the values for the property; may not be null but may be emptypublic DocumentWriter addProperty(Name name, Object firstValue, Object... additionalValues)
DocumentWriteraddProperty in interface DocumentWritername - the name of the property; may not be nullfirstValue - the first value for the property; may not be nulladditionalValues - additional values for the propertypublic DocumentWriter addProperties(Map<Name,Property> properties)
DocumentWriteraddProperties in interface DocumentWriterproperties - a map of properties keyed by their name; may not be nullpublic DocumentWriter addChild(String id, Name name)
PageWriteraddChild in interface DocumentWriteraddChild in interface PageWriterid - the new child's id; may not be nullname - the new child's name; may not be nullpublic DocumentWriter addChild(String id, String name)
PageWriteraddChild in interface DocumentWriteraddChild in interface PageWriterid - the new child's id; may not be nullname - the new child's name; may not be nullpublic DocumentWriter removeChild(String id)
PageWriterremoveChild in interface DocumentWriterremoveChild in interface PageWriterid - the identifier of the childpublic DocumentWriter setProperties(Map<Name,Property> properties)
DocumentWritersetProperties in interface DocumentWriterproperties - a map of properties keyed by their name; may not be nullpublic DocumentWriter setChildren(List<? extends Document> children)
PageWritersetChildren in interface DocumentWritersetChildren in interface PageWriterchildren - a list of EditableDocument instances each describing a single child; may not be nullpublic DocumentWriter setChildren(LinkedHashMap<String,Name> children)
PageWriterThe passed map does not contain any explicit information about same name siblings, so a connector would need to handle that logic.
setChildren in interface DocumentWritersetChildren in interface PageWriterchildren - a map of (childId, childName) pairs; may not be nullpublic DocumentWriter setParents(String... parentIds)
DocumentWritersetParents in interface DocumentWriterparentIds - the array of parent identifierspublic DocumentWriter setParent(String parentId)
DocumentWritersetParent in interface DocumentWriterparentId - the identifier of the parent; may not be nullpublic DocumentWriter setCacheTtlSeconds(int seconds)
DocumentWritersetCacheTtlSeconds in interface DocumentWriterseconds - the number of seconds the document should be cached by the repository.public DocumentWriter setNotQueryable()
DocumentWritersetNotQueryable in interface DocumentWriterpublic DocumentWriter setParents(List<String> parentIds)
DocumentWritersetParents in interface DocumentWriterparentIds - the list of parent identifiers; may not be nullpublic EditableDocument document()
PageWriterdocument in interface PageWriterEditableDocument instance; never nullpublic DocumentWriter addPage(String parentId, int nextPageOffset, long blockSize, long totalChildCount)
PageWriteraddPage in interface DocumentWriteraddPage in interface PageWriterparentId - a non-null String representing the identifier of the parent (owning) documentnextPageOffset - a non-null int representing a numeric offset of the next page.blockSize - an integer which indicates the size of the next block of childrentotalChildCount - an integer which indicates the total number of children; should be PageWriter.UNKNOWN_TOTAL_SIZE if
the number of children is unknown, too large to compute efficiently, or to signal that the repository should use the
Connector.getChildReference(String, String) method to find the child reference for a parent and a (supposed)
child node.Connector.getChildReference(String, String)public DocumentWriter addPage(String parentId, String nextPageOffset, long blockSize, long totalChildCount)
PageWriteraddPage in interface DocumentWriteraddPage in interface PageWriterparentId - a non-null String representing the identifier of the parent (owning) documentnextPageOffset - a non-null String representing the offset of the next page. The meaning of the offset isn't
defined and it's up to each connector to define it.blockSize - an integer which indicates the size of the next block of childrentotalChildCount - an integer which indicates the total number of children; should be PageWriter.UNKNOWN_TOTAL_SIZE if
the number of children is unknown, too large to compute efficiently, or to signal that the repository should use the
Connector.getChildReference(String, String) method to find the child reference for a parent and a (supposed)
child node.Connector.getChildReference(String, String)protected DocumentTranslator translator()
public DocumentWriter writeAdditionalDocument(String id)
Connector.getDocumentById(String) is called. In
such a case, the connector can use this method to obtain a writer for an additional document and use it in much the same
was as Connector.newDocument(java.lang.String).writeAdditionalDocument in interface DocumentWriterid - the identifier of the additional document; may not be nullCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.