public class DocumentMetadataHandle extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, DocumentMetadataReadHandle, DocumentMetadataWriteHandle
Modifier and Type | Class and Description |
---|---|
static class |
DocumentMetadataHandle.Capability
A document operation restricted to users with a role.
|
static interface |
DocumentMetadataHandle.DocumentCollections
A DocumentCollections represents the collections for a database document
as a POJO (Plain Old Java Object).
|
static interface |
DocumentMetadataHandle.DocumentPermissions
A DocumentPermissions represents the permissions for a database document
as a POJO (Plain Old Java Object).
|
static interface |
DocumentMetadataHandle.DocumentProperties
A DocumentProperties represents the properties for a database document
as a POJO (Plain Old Java Object).
|
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.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 |
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 |
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, setByteLength, setMimetype
public DocumentMetadataHandle()
public DocumentMetadataHandle.DocumentCollections getCollections()
public void setCollections(DocumentMetadataHandle.DocumentCollections collections)
collections
- the document collectionspublic DocumentMetadataHandle withCollections(String... collections)
collections
- the document collectionspublic DocumentMetadataHandle.DocumentPermissions getPermissions()
public void setPermissions(DocumentMetadataHandle.DocumentPermissions permissions)
permissions
- the document permissionspublic DocumentMetadataHandle withPermission(String role, DocumentMetadataHandle.Capability... capabilities)
role
- the role for users permitted to access the documentcapabilities
- the permissions to be granted to users with the rolepublic DocumentMetadataHandle.DocumentProperties getProperties()
public void setProperties(DocumentMetadataHandle.DocumentProperties properties)
properties
- the document propertiespublic DocumentMetadataHandle withProperty(QName name, Object value)
name
- the namespaced QName identifying the propertyvalue
- the value of the propertypublic DocumentMetadataHandle withProperty(String name, Object value)
name
- the simple string name identifying the propertyvalue
- the value of the propertypublic int getQuality()
public void setQuality(int quality)
quality
- the document qualitypublic DocumentMetadataHandle withQuality(int quality)
quality
- the document qualitypublic void setFormat(Format format)
setFormat
in interface ContentDescriptor
setFormat
in class BaseHandle<InputStream,OutputStreamSender>
format
- the format of the contentpublic void fromBuffer(byte[] buffer)
fromBuffer
in interface BufferableHandle
buffer
- the byte arraypublic byte[] toBuffer()
BufferableHandle
toBuffer
in interface BufferableHandle
public String toString()
public void write(OutputStream out) throws IOException
OutputStreamSender
write
in interface OutputStreamSender
out
- the output stream receiving the contentIOException
Copyright © 2013-2015 MarkLogic Corporation.