net.xqj.marklogic
Class MarkLogicXQInsertOptions

java.lang.Object
  extended by net.xqj.marklogic.MarkLogicXQInsertOptions
All Implemented Interfaces:
XQInsertOptions

public class MarkLogicXQInsertOptions
extends Object
implements XQInsertOptions

MarkLogic specific extensions to the XQJ2 XQInsertOptions class.

This class is uesd to describe metadata about content when inserting into MarkLogic Server.

For instance when inserting a document, you may describe:

Use an instance of this class when using XQConnection2.insertItem(java.lang.String, javax.xml.xquery.XQItem, com.xqj2.XQInsertOptions).

Author:
Charles Foster

Field Summary
static int DOCUMENT_REPAIR_DEFAULT
           
static int DOCUMENT_REPAIR_FULL
           
static int DOCUMENT_REPAIR_NONE
           
 
Fields inherited from interface com.xqj2.XQInsertOptions
DEFAULT_ENCODING
 
Constructor Summary
MarkLogicXQInsertOptions()
          Create a new instance of a MarkLogicXQInsertOptions.
 
Method Summary
 String[] getCollections()
          Gets the document collections for this MarkLogicXQInsertOptions instance.
 int getDocumentRepairLevel()
          Gets the document repair level associated with this MarkLogicXQInsertOptions instance.
 String getEncoding()
          Gets the document encoding for this MarkLogicXQInsertOptions instance.
 BigInteger[] getForestIds()
          Gets the Forest ID keys associated with this MarkLogicXQInsertOptions instance.
 String getLanguage()
          Gets the language associated with this MarkLogicXQInsertOptions instance.
 Locale getLocale()
          Gets the Locale of this MarkLogicXQInsertOptions instance.
 String getNamespace()
          Gets the namespace associated with this MarkLogicXQInsertOptions instance.
 Permission[] getPermissions()
          Return document permissions currently in effect for this MarkLogicXQInsertOptions instance.
 int getQuality()
          Gets the document quality value which is currently associated with this MarkLogicXQInsertOptions instance.
 Permission newExecutePermission(String role)
          Creates a new "execute" Permission instance.
 Permission newInsertPermission(String role)
          Creates a new "insert" Permission instance.
 Permission newReadPermission(String role)
          Creates a new "read" Permission instance.
 Permission newUpdatePermission(String role)
          Creates a new "update" Permission instance.
 void setCollections(String[] collections)
          Sets the collection URIs associated with this MarkLogicXQInsertOptions instance.
 void setDocumentRepairLevel(int documentRepairLevel)
          Sets the document repair level of this MarkLogicXQInsertOptions instance.
 void setEncoding(String encoding)
          Sets the document encoding of this MarkLogicXQInsertOptions instance.
 void setForestIds(BigInteger[] forestIds)
          Sets the Forest IDs associated with this MarkLogicXQInsertOptions instance.
 void setLanguage(String language)
          Sets the language associated with this MarkLogicXQInsertOptions instance.
 void setLocale(Locale locale)
          Sets the Locale for this MarkLogicXQInsertOptions instance.
 void setNamespace(String namespace)
          Sets the namespace associated with this MarkLogicXQInsertOptions instance.
 void setPermissions(Permission[] permissions)
          Sets the document permissions of this MarkLogicXQInsertOptions instance.
 void setQuality(int quality)
          Sets the document quality value associated with this MarkLogicXQInsertOptions instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT_REPAIR_DEFAULT

public static final int DOCUMENT_REPAIR_DEFAULT
See Also:
Constant Field Values

DOCUMENT_REPAIR_FULL

public static final int DOCUMENT_REPAIR_FULL
See Also:
Constant Field Values

DOCUMENT_REPAIR_NONE

public static final int DOCUMENT_REPAIR_NONE
See Also:
Constant Field Values
Constructor Detail

MarkLogicXQInsertOptions

public MarkLogicXQInsertOptions()
Create a new instance of a MarkLogicXQInsertOptions.

Method Detail

getPermissions

public Permission[] getPermissions()
Return document permissions currently in effect for this MarkLogicXQInsertOptions instance.

Returns:
An array of Permission objects, or null.

setPermissions

public void setPermissions(Permission[] permissions)
Sets the document permissions of this MarkLogicXQInsertOptions instance.

Parameters:
permissions - an array of Permission objects, null is allowed.

newExecutePermission

public Permission newExecutePermission(String role)
Creates a new "execute" Permission instance.

Parameters:
role - the role name of the "execute" Permission instance.
Returns:
a Permission instance.

newInsertPermission

public Permission newInsertPermission(String role)
Creates a new "insert" Permission instance.

Parameters:
role - the role name of the "insert" Permission instance.
Returns:
a Permission instance.

newReadPermission

public Permission newReadPermission(String role)
Creates a new "read" Permission instance.

Parameters:
role - the role name of the "read" Permission instance.
Returns:
a Permission instance.

newUpdatePermission

public Permission newUpdatePermission(String role)
Creates a new "update" Permission instance.

Parameters:
role - the role name of the "update" Permission instance.
Returns:
a Permission instance.

setCollections

public void setCollections(String[] collections)

Sets the collection URIs associated with this MarkLogicXQInsertOptions instance.

If the collections parameter is null, documents will be added to the current user's default collections.

For each collection passed that is protected, the user must have appropriate permissions to update that collection or have the any-collection privilege.

For each collection given that is unprotected, the user must have the unprotected-collections privilege.

Parameters:
collections - an array of String items, null is allowed.

getCollections

public String[] getCollections()
Gets the document collections for this MarkLogicXQInsertOptions instance.

Returns:
an array of collections for this XQMarkLogicXQInsertOptions instance, may be null.

setEncoding

public void setEncoding(String encoding)
Sets the document encoding of this MarkLogicXQInsertOptions instance.

Specified by:
setEncoding in interface XQInsertOptions
Parameters:
encoding - a String representing the encoding used by MarkLogicXQInsertOptions instance.

getEncoding

public String getEncoding()
Gets the document encoding for this MarkLogicXQInsertOptions instance.

Specified by:
getEncoding in interface XQInsertOptions
Returns:
the encoding used by this MarkLogicXQInsertOptions instance.

getLocale

public Locale getLocale()
Gets the Locale of this MarkLogicXQInsertOptions instance.

Returns:
a Locale instance currently used by this MarkLogicXQInsertOptions instance.

setLocale

public void setLocale(Locale locale)
Sets the Locale for this MarkLogicXQInsertOptions instance.

Parameters:
locale - an instance of Locale.

getNamespace

public String getNamespace()

Gets the namespace associated with this MarkLogicXQInsertOptions instance.

May be null, which is the default namespace.

Returns:
the namespace associated with this MarkLogicXQInsertOptions instance.

setNamespace

public void setNamespace(String namespace)

Sets the namespace associated with this MarkLogicXQInsertOptions instance.

May be null, which is the default namespace.

Parameters:
namespace - the namespace to associate with this MarkLogicXQInsertOptions instance.

setDocumentRepairLevel

public void setDocumentRepairLevel(int documentRepairLevel)

Sets the document repair level of this MarkLogicXQInsertOptions instance.

value must be one of:

Parameters:
documentRepairLevel - the document repair level to associate with this MarkLogicXQInsertOptions instance.

getDocumentRepairLevel

public int getDocumentRepairLevel()
Gets the document repair level associated with this MarkLogicXQInsertOptions instance.

Returns:
the document repair level associated with this MarkLogicXQInsertOptions instance.

getForestIds

public BigInteger[] getForestIds()
Gets the Forest ID keys associated with this MarkLogicXQInsertOptions instance.

Returns:
an array of BigInteger values, or null.

setForestIds

public void setForestIds(BigInteger[] forestIds)

Sets the Forest IDs associated with this MarkLogicXQInsertOptions instance.

Inserted documents will be placed in any one of the given forest IDs.

If an inserted documents exists in the database and forestIds is not specified, the document will remain in its existing forest.

When inserting, if the given Forest IDs do not exist, i.e. they are not attached to the database, an XQException will be thrown.

If a document exists and the forest in which it is stored is set to delete-only, then you must pass forest ids to include one or more forests that allow updates.

Parameters:
forestIds - an array of BigInteger, which may be null, in which case there will be no forest preference.

getQuality

public int getQuality()
Gets the document quality value which is currently associated with this MarkLogicXQInsertOptions instance.

Returns:
an primitive int describing this MarkLogicXQInsertOptions instance's document quality.

setQuality

public void setQuality(int quality)
Sets the document quality value associated with this MarkLogicXQInsertOptions instance.

Parameters:
quality - the document quality to associate with this MarkLogicXQInsertOptions instance, default is 0.

getLanguage

public String getLanguage()
Gets the language associated with this MarkLogicXQInsertOptions instance.

Returns:
the language associated with this MarkLogicXQInsertOptions instance.

setLanguage

public void setLanguage(String language)
Sets the language associated with this MarkLogicXQInsertOptions instance.

Parameters:
language - the language which will be associated with this MarkLogicXQInsertOptions instance.