站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

VersionableItem (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.repository
Class VersionableItem

java.lang.Object
  extended by org.drools.repository.Item
      extended by org.drools.repository.VersionableItem
Direct Known Subclasses:
CategorisableItem, PackageItem

public abstract class VersionableItem
extends Item

This is the parent class for versionable assets. Contains standard fields based on Dublin Core, and stuff required for versioning. For dublin core, refer to Here

Author:
Ben Truitt, Michael Neale
See Also:
for more attributes to do with BRMS resources.

Field Summary
static String CATEGORY_PROPERTY_NAME
          The name of the tag property on the rule node type
static String CHECKIN_COMMENT
           
static String CONTENT_PROPERTY_ARCHIVE_FLAG
           
static String COVERAGE_PROPERTY_NAME
           
static String CREATOR_PROPERTY_NAME
           
static String DEFAULT_CONTENT_FORMAT
          The possible formats for the format property of the node
static String DESCRIPTION_PROPERTY_NAME
           
static String FORMAT_PROPERTY_NAME
           
static String LAST_CONTRIBUTOR_PROPERTY_NAME
          Dublin core based fields.
static String LAST_MODIFIED_PROPERTY_NAME
           
static String PUBLISHER_PROPERTY_NAME
           
static String RELATION_PROPERTY_NAME
           
static String RIGHTS_PROPERTY_NAME
           
static String SOURCE_PROPERTY_NAME
           
static String STATE_PROPERTY_NAME
          The name of the state property on the rule node type
static String SUBJECT_PROPERTY_NAME
           
static String TITLE_PROPERTY_NAME
          Property names for this node type.
static String TYPE_PROPERTY_NAME
           
static String VERSION_NUMBER_PROPERTY_NAME
           
 
Fields inherited from class org.drools.repository.Item
node, rulesRepository
 
Constructor Summary
VersionableItem(RulesRepository rulesRepository, javax.jcr.Node node)
          Sets this object's node attribute to the specified node
 
Method Summary
 VersionableItem archiveItem(boolean data)
           
 void checkin(String comment)
          This will save the content (if it hasn't been already) and then check it in to create a new version.
protected  void checkIsUpdateable()
          This will check to see if the node is the "head" and so can be updated (you can't update historical nodes ).
 void checkout()
          This will check out the node prior to editing.
 String getCheckinComment()
          This will return the checkin comment for the latest revision.
 String getCoverage()
          Typically, Coverage will include spatial location (a place name or geographic coordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity).
 Calendar getCreatedDate()
          This returns the date/time on which the asset was "ORIGINALLY CREATED".
 String getCreator()
          This is the person who initially created the resource.
 String getDescription()
          See the Dublin Core documentation for more explanation: http://dublincore.org/documents/dces/
 String getExternalRelation()
          A reference to a EXTERNAL related resource.
 String getExternalSource()
          This is the source of the asset/rule.
 String getFormat()
          This returns the format of an item.
 String getLastContributor()
          Returns the last contributors name.
 Calendar getLastModified()
           
protected  long getLongProperty(String property)
           
 String getName()
          Need to get the name from the content node, not the version node if it is in fact a version !
abstract  VersionableItem getPrecedingVersion()
          Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g.
protected  javax.jcr.Node getPrecedingVersionNode()
           
 String getPublisher()
          Examples of Publisher include a person, an organization, or a service.
protected  javax.jcr.Node getRealContentFromVersion(javax.jcr.Node node)
          This deals with a node which *may* be a version, if it is, it grabs the frozen copy.
 String getRights()
          Optionally contains any copyright/ownership rights for the asset.
 StateItem getState()
          Gets StateItem object corresponding to the state property of this object's node
 String getStateDescription()
          This will return the current state item as a displayable thing.
protected  String getStringProperty(String property)
           
 String getSubject()
          Typically, Subject will be expressed as keywords, key phrases or classification codes that describe a topic of the resource.
abstract  VersionableItem getSucceedingVersion()
          Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g.
protected  javax.jcr.Node getSucceedingVersionNode()
           
 String getTitle()
          Gets the Title of the versionable node.
 String getType()
          This is the Dublin Core field of type (a broad classification of resource type).
 String getUUID()
           
 javax.jcr.Node getVersionContentNode()
          When retrieving content, if we are dealing with a version in the history, we need to get the actual content node to retrieve values.
 long getVersionNumber()
          get this version number (default is incrementing integer, but you can provide an implementation of VersionNumberGenerator if needed).
 String getVersionSnapshotUUID()
          This returns the id of the exact version node (as opposed to the "main" node).
 boolean isArchived()
          Test if the VersionableItem is archived
 boolean isHistoricalVersion()
          This will return true if the current entity is actually a historical version (which means is effectively read only).
 boolean sameState(StateItem other)
          Compare this rules state with some other state
 void updateCoverage(String cov)
           
 void updateDescription(String newDescriptionContent)
          Creates a new version of this object's node, updating the description content for the node.
 void updateExternalRelation(String rel)
           
 void updateExternalSource(String source)
           
 void updateFormat(String newFormat)
          This sets the format (or "file extension" of the resource).
 void updatePublisher(String pub)
           
 void updateRights(String rights)
           
 void updateState(StateItem stateItem)
          Sets this object's rule node's state property to refer to the specified StateItem's node
 void updateState(String stateName)
          Sets this object's rule node's state property to refer to the specified state node
protected  void updateStringProperty(String value, String prop)
          update a text field.
 void updateSubject(String sub)
           
 void updateTitle(String title)
          Creates a new version of this object's node, updating the title content for the node.
 void updateType(String type)
           
 
Methods inherited from class org.drools.repository.Item
equals, getNode, getRulesRepository, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TITLE_PROPERTY_NAME

public static final String TITLE_PROPERTY_NAME
Property names for this node type.

See Also:
Constant Field Values

DESCRIPTION_PROPERTY_NAME

public static final String DESCRIPTION_PROPERTY_NAME
See Also:
Constant Field Values

LAST_MODIFIED_PROPERTY_NAME

public static final String LAST_MODIFIED_PROPERTY_NAME
See Also:
Constant Field Values

FORMAT_PROPERTY_NAME

public static final String FORMAT_PROPERTY_NAME
See Also:
Constant Field Values

CHECKIN_COMMENT

public static final String CHECKIN_COMMENT
See Also:
Constant Field Values

VERSION_NUMBER_PROPERTY_NAME

public static final String VERSION_NUMBER_PROPERTY_NAME
See Also:
Constant Field Values

CONTENT_PROPERTY_ARCHIVE_FLAG

public static final String CONTENT_PROPERTY_ARCHIVE_FLAG
See Also:
Constant Field Values

LAST_CONTRIBUTOR_PROPERTY_NAME

public static final String LAST_CONTRIBUTOR_PROPERTY_NAME
Dublin core based fields.

See Also:
Constant Field Values

CREATOR_PROPERTY_NAME

public static final String CREATOR_PROPERTY_NAME
See Also:
Constant Field Values

TYPE_PROPERTY_NAME

public static final String TYPE_PROPERTY_NAME
See Also:
Constant Field Values

SOURCE_PROPERTY_NAME

public static final String SOURCE_PROPERTY_NAME
See Also:
Constant Field Values

SUBJECT_PROPERTY_NAME

public static final String SUBJECT_PROPERTY_NAME
See Also:
Constant Field Values

RELATION_PROPERTY_NAME

public static final String RELATION_PROPERTY_NAME
See Also:
Constant Field Values

RIGHTS_PROPERTY_NAME

public static final String RIGHTS_PROPERTY_NAME
See Also:
Constant Field Values

COVERAGE_PROPERTY_NAME

public static final String COVERAGE_PROPERTY_NAME
See Also:
Constant Field Values

PUBLISHER_PROPERTY_NAME

public static final String PUBLISHER_PROPERTY_NAME
See Also:
Constant Field Values

STATE_PROPERTY_NAME

public static final String STATE_PROPERTY_NAME
The name of the state property on the rule node type

See Also:
Constant Field Values

CATEGORY_PROPERTY_NAME

public static final String CATEGORY_PROPERTY_NAME
The name of the tag property on the rule node type

See Also:
Constant Field Values

DEFAULT_CONTENT_FORMAT

public static final String DEFAULT_CONTENT_FORMAT
The possible formats for the format property of the node

See Also:
Constant Field Values
Constructor Detail

VersionableItem

public VersionableItem(RulesRepository rulesRepository,
                       javax.jcr.Node node)
Sets this object's node attribute to the specified node

Parameters:
rulesRepository - the RulesRepository object that this object is being created from
node - the node in the repository that this item corresponds to
Method Detail

getUUID

public String getUUID()
Returns:
A unique identifier for this items content node. This UUID is constant even with new versions, it represents the asset, and ALL its historical versions.

isHistoricalVersion

public boolean isHistoricalVersion()
                            throws javax.jcr.RepositoryException
This will return true if the current entity is actually a historical version (which means is effectively read only).

Throws:
javax.jcr.RepositoryException

getPrecedingVersionNode

protected javax.jcr.Node getPrecedingVersionNode()
                                          throws RulesRepositoryException
Returns:
the predessor node of this node in the version history, or null if no predecessor version exists
Throws:
RulesRepositoryException

getSucceedingVersionNode

protected javax.jcr.Node getSucceedingVersionNode()
                                           throws RulesRepositoryException
Returns:
the successor node of this node in the version history
Throws:
RulesRepositoryException

getPrecedingVersion

public abstract VersionableItem getPrecedingVersion()
                                             throws RulesRepositoryException
Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g.
           RuleItem item;
           ...
           RuleItem predcessor = (RuleItem) item.getPrecedingVersion();
         

Returns:
a VersionableItem object encapsulating the predessor node of this node in the version history, or null if no predecessor version exists
Throws:
RulesRepositoryException

getSucceedingVersion

public abstract VersionableItem getSucceedingVersion()
                                              throws RulesRepositoryException
Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g.
           RuleItem item;
           ...
           RuleItem successor = (RuleItem) item.getSucceedingVersion();
         

Returns:
a VersionableItem object encapsulating the successor node of this node in the version history.
Throws:
RulesRepositoryException

getTitle

public String getTitle()
                throws RulesRepositoryException
Gets the Title of the versionable node. See the Dublin Core documentation for more explanation: http://dublincore.org/documents/dces/

Returns:
the title of the node this object encapsulates
Throws:
RulesRepositoryException

updateTitle

public void updateTitle(String title)
                 throws RulesRepositoryException
Creates a new version of this object's node, updating the title content for the node.
See the Dublin Core documentation for more explanation: http://dublincore.org/documents/dces/

Parameters:
title - the new title for the node
Throws:
RulesRepositoryException

updateType

public void updateType(String type)

updateExternalSource

public void updateExternalSource(String source)

updateSubject

public void updateSubject(String sub)

updateExternalRelation

public void updateExternalRelation(String rel)

updateRights

public void updateRights(String rights)

updateCoverage

public void updateCoverage(String cov)

updatePublisher

public void updatePublisher(String pub)

updateStringProperty

protected void updateStringProperty(String value,
                                    String prop)
update a text field. This is a convenience method that just uses the JCR node to set a property. This will also update the timestamp.


getDescription

public String getDescription()
                      throws RulesRepositoryException
See the Dublin Core documentation for more explanation: http://dublincore.org/documents/dces/

Returns:
the description of this object's node.
Throws:
RulesRepositoryException

getVersionNumber

public long getVersionNumber()
get this version number (default is incrementing integer, but you can provide an implementation of VersionNumberGenerator if needed).


getCheckinComment

public String getCheckinComment()
                         throws RulesRepositoryException
This will return the checkin comment for the latest revision.

Throws:
RulesRepositoryException

getLastModified

public Calendar getLastModified()
                         throws RulesRepositoryException
Returns:
the date the function node (this version) was last modified
Throws:
RulesRepositoryException

updateDescription

public void updateDescription(String newDescriptionContent)
                       throws RulesRepositoryException
Creates a new version of this object's node, updating the description content for the node.
See the Dublin Core documentation for more explanation: http://dublincore.org/documents/dces/

Parameters:
newDescriptionContent - the new description content for the rule
Throws:
RulesRepositoryException

getFormat

public String getFormat()
                 throws RulesRepositoryException
This returns the format of an item. This is analagous to a file extension if the resource was a file (it may contain more information then a pure file extension could, however). See the Dublin Core documentation for more explanation: http://dublincore.org/documents/dces/

Returns:
the format of this object's node
Throws:
RulesRepositoryException

updateFormat

public void updateFormat(String newFormat)
This sets the format (or "file extension" of the resource). In some cases this is critical, and generally should not be changed after the initial version is checked in.

Parameters:
newFormat -

getVersionContentNode

public javax.jcr.Node getVersionContentNode()
                                     throws javax.jcr.RepositoryException,
                                            javax.jcr.PathNotFoundException
When retrieving content, if we are dealing with a version in the history, we need to get the actual content node to retrieve values.

Throws:
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException

getRealContentFromVersion

protected javax.jcr.Node getRealContentFromVersion(javax.jcr.Node node)
                                            throws javax.jcr.RepositoryException,
                                                   javax.jcr.PathNotFoundException
This deals with a node which *may* be a version, if it is, it grabs the frozen copy.

Throws:
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException

getName

public String getName()
Need to get the name from the content node, not the version node if it is in fact a version !

Overrides:
getName in class Item
Returns:
the name of the node that this item encapsultes

checkout

public void checkout()
This will check out the node prior to editing.


checkin

public void checkin(String comment)
This will save the content (if it hasn't been already) and then check it in to create a new version. It will also set the last modified property.


checkIsUpdateable

protected void checkIsUpdateable()
This will check to see if the node is the "head" and so can be updated (you can't update historical nodes ).

Throws:
RulesRepositoryException - if it is not allowed (means a programming error !).

updateState

public void updateState(String stateName)
                 throws RulesRepositoryException
Sets this object's rule node's state property to refer to the specified state node

Parameters:
stateName - the name of the state to set the rule node to
Throws:
RulesRepositoryException

updateState

public void updateState(StateItem stateItem)
                 throws RulesRepositoryException
Sets this object's rule node's state property to refer to the specified StateItem's node

Parameters:
stateItem - the StateItem encapsulating the node to refer to from this object's node's state property
Throws:
RulesRepositoryException

getState

public StateItem getState()
                   throws RulesRepositoryException
Gets StateItem object corresponding to the state property of this object's node

Returns:
a StateItem object corresponding to the state property of this object's node, or null if the state property is not set
Throws:
RulesRepositoryException

getStateDescription

public String getStateDescription()
This will return the current state item as a displayable thing. If there is no state, it will be an empty string.


sameState

public boolean sameState(StateItem other)
Compare this rules state with some other state


getLastContributor

public String getLastContributor()
Returns the last contributors name.


getCreator

public String getCreator()
This is the person who initially created the resource.


getType

public String getType()
This is the Dublin Core field of type (a broad classification of resource type).


getExternalSource

public String getExternalSource()
This is the source of the asset/rule. Ie a human description of where it came from.


getSubject

public String getSubject()
Typically, Subject will be expressed as keywords, key phrases or classification codes that describe a topic of the resource.


getExternalRelation

public String getExternalRelation()
A reference to a EXTERNAL related resource.


getRights

public String getRights()
Optionally contains any copyright/ownership rights for the asset.


getCoverage

public String getCoverage()
Typically, Coverage will include spatial location (a place name or geographic coordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity). Recommended best practice is to select a value from a controlled vocabulary (for example, the Thesaurus of Geographic Names [TGN]) and to use, where appropriate, named places or time periods in preference to numeric identifiers such as sets of coordinates or date ranges.


getPublisher

public String getPublisher()
Examples of Publisher include a person, an organization, or a service. Typically, the name of a Publisher should be used to indicate the entity.


getCreatedDate

public Calendar getCreatedDate()
This returns the date/time on which the asset was "ORIGINALLY CREATED". Kinda handy if you want to know how old something is.


getStringProperty

protected String getStringProperty(String property)

getLongProperty

protected long getLongProperty(String property)

getVersionSnapshotUUID

public String getVersionSnapshotUUID()
This returns the id of the exact version node (as opposed to the "main" node). Note that each asset has only one UUID the whole time, but there are also UUIDs for each item in the history. So while the main UUID version remains constant, the version UUIDs change on each checkin, which is what this method provides.


archiveItem

public VersionableItem archiveItem(boolean data)

isArchived

public boolean isArchived()
Test if the VersionableItem is archived



Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.