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 |
setCacheable(boolean cacheable)
Sets whether a particular document should be cached by the repository or not.
|
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() |
public FederatedDocumentWriter(DocumentTranslator translator, Document document)
public FederatedDocumentWriter(DocumentTranslator translator)
public FederatedDocumentWriter setId(String id)
DocumentWriter
setId
in interface DocumentWriter
id
- the identifier of the document; may not be nullpublic DocumentWriter setPrimaryType(Name name)
DocumentWriter
setPrimaryType
in interface DocumentWriter
name
- the name of the primary type for the node; may not be nullpublic DocumentWriter setPrimaryType(String name)
DocumentWriter
setPrimaryType
in interface DocumentWriter
name
- the name of the primary type for the node; may not be nullpublic DocumentWriter addMixinType(Name name)
DocumentWriter
addMixinType
in interface DocumentWriter
name
- the name of a node type that should be added as a mixin for the node; may not be nullpublic DocumentWriter addMixinType(String name)
DocumentWriter
addMixinType
in interface DocumentWriter
name
- 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)
DocumentWriter
addPropertyValue
in interface DocumentWriter
name
- 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)
DocumentWriter
addPropertyValue
in interface DocumentWriter
name
- 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)
DocumentWriter
addProperty
in interface DocumentWriter
name
- the name of the property; may not be nullvalue
- the value for the property; may not be nullpublic DocumentWriter addProperty(String name, Object[] values)
DocumentWriter
addProperty
in interface DocumentWriter
name
- 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)
DocumentWriter
addProperty
in interface DocumentWriter
name
- 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)
DocumentWriter
addProperty
in interface DocumentWriter
name
- the name of the property; may not be nullvalue
- a value for the property; may not be nullpublic DocumentWriter addProperty(Name name, Object[] values)
DocumentWriter
addProperty
in interface DocumentWriter
name
- 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)
DocumentWriter
addProperty
in interface DocumentWriter
name
- 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)
DocumentWriter
addProperties
in interface DocumentWriter
properties
- a map of properties keyed by their name; may not be nullpublic DocumentWriter addChild(String id, Name name)
PageWriter
addChild
in interface DocumentWriter
addChild
in interface PageWriter
id
- the new child's id; may not be nullname
- the new child's name; may not be nullpublic DocumentWriter addChild(String id, String name)
PageWriter
addChild
in interface DocumentWriter
addChild
in interface PageWriter
id
- the new child's id; may not be nullname
- the new child's name; may not be nullpublic DocumentWriter removeChild(String id)
PageWriter
removeChild
in interface DocumentWriter
removeChild
in interface PageWriter
id
- the identifier of the childpublic DocumentWriter setProperties(Map<Name,Property> properties)
DocumentWriter
setProperties
in interface DocumentWriter
properties
- a map of properties keyed by their name; may not be nullpublic DocumentWriter setChildren(List<? extends Document> children)
PageWriter
setChildren
in interface DocumentWriter
setChildren
in interface PageWriter
children
- a list of EditableDocument
instances each describing a single child; may not be nullpublic DocumentWriter setChildren(LinkedHashMap<String,Name> children)
PageWriter
The passed map does not contain any explicit information about same name siblings, so a connector would need to handle that logic.
setChildren
in interface DocumentWriter
setChildren
in interface PageWriter
children
- a map of (childId, childName) pairs; may not be nullpublic DocumentWriter setParents(String... parentIds)
DocumentWriter
setParents
in interface DocumentWriter
parentIds
- the array of parent identifierspublic DocumentWriter setParent(String parentId)
DocumentWriter
setParent
in interface DocumentWriter
parentId
- the identifier of the parent; may not be nullpublic DocumentWriter setCacheable(boolean cacheable)
DocumentWriter
setCacheable
in interface DocumentWriter
cacheable
- a boolean
flagpublic DocumentWriter setNotQueryable()
DocumentWriter
setNotQueryable
in interface DocumentWriter
public DocumentWriter setParents(List<String> parentIds)
DocumentWriter
setParents
in interface DocumentWriter
parentIds
- the list of parent identifiers; may not be nullpublic EditableDocument document()
PageWriter
document
in interface PageWriter
EditableDocument
instance; never nullpublic DocumentWriter addPage(String parentId, int nextPageOffset, long blockSize, long totalChildCount)
PageWriter
addPage
in interface DocumentWriter
addPage
in interface PageWriter
parentId
- 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)
PageWriter
addPage
in interface DocumentWriter
addPage
in interface PageWriter
parentId
- 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()
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.