public class RuleDefinition extends BaseHandle<InputStream,OutputStreamSender> implements OutputStreamSender, RuleReadHandle, RuleWriteHandle
A RuleDefinition represents a set of criteria that describe a named condition.
| Modifier and Type | Class and Description |
|---|---|
static interface |
RuleDefinition.RuleMetadata
A RuleMetadata represents optional client-supplied metadata that is stored alongside a RuleDefinition.
|
UNKNOWN_LENGTH| Constructor and Description |
|---|
RuleDefinition()
Make a new rule definition, no argument constructor.
|
RuleDefinition(String name,
String description)
Make a new rule definition
|
| Modifier and Type | Method and Description |
|---|---|
<T extends XMLReadHandle> |
exportQueryDefinition(T handle)
Exports the embedded query definitions and options to a handle
|
String |
getDescription()
Returns the rule’s definition.
|
RuleDefinition.RuleMetadata |
getMetadata()
Gets the metadata object associated with this rule
|
String |
getName()
Gets the name of the rule.
|
void |
importQueryDefinition(XMLWriteHandle queryDef)
Imports an XML combined search definition that defines the matching criteria for this rule.
|
void |
setDescription(String description)
Sets the description of the rule.
|
void |
setMetadata(RuleDefinition.RuleMetadata metadata)
Sets the metadata object for this rule.
|
void |
setName(String name)
Sets the name of the rule.
|
void |
write(OutputStream out)
Writes a serialized RuleDefinition to an OutputStream as XML.
|
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setFormat, setMimetype, setServerTimestamppublic RuleDefinition(String name, String description)
Make a new rule definition
name - The name of the rule. Should be unique among rule names on the REST server.description - Text description of the rule.public RuleDefinition()
Make a new rule definition, no argument constructor.
public void setName(String name)
Sets the name of the rule.
name - The rule’s name.public String getName()
Gets the name of the rule.
public void setDescription(String description)
Sets the description of the rule.
description - The rule’s description.public String getDescription()
Returns the rule’s definition.
public void importQueryDefinition(XMLWriteHandle queryDef)
Imports an XML combined search definition that defines the matching criteria for this rule.
queryDef - A combined raw query definition serialized as XML.public <T extends XMLReadHandle> T exportQueryDefinition(T handle)
Exports the embedded query definitions and options to a handle
T - the type of XMLReadHandle to returnhandle - The handle to use for export.public RuleDefinition.RuleMetadata getMetadata()
Gets the metadata object associated with this rule
public void setMetadata(RuleDefinition.RuleMetadata metadata)
Sets the metadata object for this rule.
metadata - The metadatapublic void write(OutputStream out) throws IOException
Writes a serialized RuleDefinition to an OutputStream as XML.
write in interface OutputStreamSenderout - the output stream receiving the contentIOException - if io problems ariseCopyright © 2013-2017 MarkLogic Corporation.