public class DocumentMetadataHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, DocumentMetadataReadHandle, DocumentMetadataWriteHandle
A DocumentMetadataHandle represents the metadata for a database document.
| Modifier and Type | Class and Description |
|---|---|
static class |
DocumentMetadataHandle.Capability
A document operation restricted to users with a role.
|
static interface |
DocumentMetadataHandle.DocumentCollections
Represents the collections for a database document.
|
static interface |
DocumentMetadataHandle.DocumentMetadataValues
Represents the metadata-values for a database document.
|
static interface |
DocumentMetadataHandle.DocumentPermissions
Represents the permissions for a database document.
|
static interface |
DocumentMetadataHandle.DocumentProperties
Represents the properties for a database document.
|
UNKNOWN_LENGTH| Constructor and Description |
|---|
DocumentMetadataHandle()
Zero-argument constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fromBuffer(byte[] buffer)
fromBuffer() populates DocumentMetadataHandle from a byte array buffer.
|
DocumentMetadataHandle.DocumentCollections |
getCollections()
Returns a container for the collections for the document as read from the server or modified locally.
|
DocumentMetadataHandle.DocumentMetadataValues |
getMetadataValues()
Returns a container for the metadata-values for the document as read from the server or modified locally.
|
DocumentMetadataHandle.DocumentPermissions |
getPermissions()
Returns a container for the permissions on the document as read from the server or modified locally.
|
DocumentMetadataHandle.DocumentProperties |
getProperties()
Returns a container for the properties of the document as read from the server or modified locally.
|
int |
getQuality()
Returns the quality of the document.
|
void |
setCollections(DocumentMetadataHandle.DocumentCollections collections)
Locally assigns a container with document collections.
|
void |
setFormat(Format format)
Restricts the format used parsing and serializing the metadata.
|
void |
setMetadataValues(DocumentMetadataHandle.DocumentMetadataValues metadataValues)
Locally assigns a container with document metadata-values.
|
void |
setPermissions(DocumentMetadataHandle.DocumentPermissions permissions)
Locally assigns a container with document permissions.
|
void |
setProperties(DocumentMetadataHandle.DocumentProperties properties)
Locally assigns a container with document properties.
|
void |
setQuality(int quality)
Specifies the quality of the document, which affects search weighting.
|
byte[] |
toBuffer()
Copies the content of the handle to a byte array buffer encoded in UTF-8.
|
String |
toString()
Returns the document metadata as an XML string.
|
DocumentMetadataHandle |
withCollections(String... collections)
Locally adds the collections to the current collections for the document.
|
DocumentMetadataHandle |
withMetadataValue(String key,
String value)
Locally adds the metadata-value to the current metadata-values for the document.
|
DocumentMetadataHandle |
withPermission(String role,
DocumentMetadataHandle.Capability... capabilities)
Locally adds the role and its capabilities to the current permissions for the document.
|
DocumentMetadataHandle |
withProperty(QName name,
Object value)
Locally adds the property name and value to the current properties for the document.
|
DocumentMetadataHandle |
withProperty(String name,
Object value)
Locally adds the property name and value to the current properties for the document.
|
DocumentMetadataHandle |
withQuality(int quality)
Locally specifies the match quality for the document.
|
void |
write(OutputStream out)
Implements a callback to write content to the provided output stream for sending to the database server.
|
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setMimetype, setServerTimestamppublic DocumentMetadataHandle()
Zero-argument constructor.
public DocumentMetadataHandle.DocumentCollections getCollections()
Returns a container for the collections for the document as read from the server or modified locally.
public void setCollections(DocumentMetadataHandle.DocumentCollections collections)
Locally assigns a container with document collections. Ordinarily, you never change the container but, instead, modify the collections stored by the container.
collections - the document collectionspublic DocumentMetadataHandle withCollections(String... collections)
Locally adds the collections to the current collections for the document.
collections - the document collectionspublic DocumentMetadataHandle.DocumentPermissions getPermissions()
Returns a container for the permissions on the document as read from the server or modified locally.
public void setPermissions(DocumentMetadataHandle.DocumentPermissions permissions)
Locally assigns a container with document permissions. Ordinarily, you never change the container but, instead, modify the permissions stored by the container.
permissions - the document permissionspublic DocumentMetadataHandle withPermission(String role, DocumentMetadataHandle.Capability... capabilities)
Locally adds the role and its capabilities to the current permissions for the document.
role - the role for users permitted to access the documentcapabilities - the permissions to be granted to users with the rolepublic DocumentMetadataHandle.DocumentProperties getProperties()
Returns a container for the properties of the document as read from the server or modified locally.
public void setProperties(DocumentMetadataHandle.DocumentProperties properties)
Locally assigns a container with document properties. Ordinarily, you never change the container but, instead, modify the properties stored by the container.
properties - the document propertiespublic DocumentMetadataHandle withProperty(QName name, Object value)
Locally adds the property name and value to the current properties for the document.
name - the namespaced QName identifying the propertyvalue - the value of the propertypublic DocumentMetadataHandle withProperty(String name, Object value)
Locally adds the property name and value to the current properties for the document.
name - the simple string name identifying the propertyvalue - the value of the propertypublic int getQuality()
Returns the quality of the document.
public void setQuality(int quality)
Specifies the quality of the document, which affects search weighting.
quality - the document qualitypublic DocumentMetadataHandle withQuality(int quality)
Locally specifies the match quality for the document.
quality - the document qualitypublic DocumentMetadataHandle.DocumentMetadataValues getMetadataValues()
Returns a container for the metadata-values for the document as read from the server or modified locally.
public void setMetadataValues(DocumentMetadataHandle.DocumentMetadataValues metadataValues)
Locally assigns a container with document metadata-values. Ordinarily, you never change the container but, instead, modify the metadata-values stored by the container.
metadataValues - the document metadata-valuespublic DocumentMetadataHandle withMetadataValue(String key, String value)
Locally adds the metadata-value to the current metadata-values for the document.
key - the key of metadata-valuevalue - the value of metadata-valuepublic void setFormat(Format format)
Restricts the format used parsing and serializing the metadata.
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<InputStream,OutputStreamSender>format - the format of the contentpublic void fromBuffer(byte[] buffer)
fromBuffer() populates DocumentMetadataHandle from a byte array buffer. The buffer must store document metadata in XML format in the UTF-8 encoding.
fromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandleCopies the content of the handle to a byte array buffer encoded in UTF-8.
toBuffer in interface BufferableHandlepublic String toString()
Returns the document metadata as an XML string.
public void write(OutputStream out) throws IOException
OutputStreamSenderImplements a callback to write content to the provided output stream for sending to the database server.
write in interface OutputStreamSenderout - the output stream receiving the contentIOException - if io problems ariseCopyright © 2013-2017 MarkLogic Corporation.