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

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


org.drools.repository
Class AssetItem

java.lang.Object
  extended by org.drools.repository.Item
      extended by org.drools.repository.VersionableItem
          extended by org.drools.repository.CategorisableItem
              extended by org.drools.repository.AssetItem

public class AssetItem
extends CategorisableItem

The RuleItem class is used to abstract away the details of the underlying JCR repository. It is used to pass information about rules stored in the repository.

Author:
btruitt

Field Summary
static String CONTENT_PROPERTY_ATTACHMENT_FILENAME
           
static String CONTENT_PROPERTY_BINARY_NAME
           
static String CONTENT_PROPERTY_NAME
           
static String DATE_EFFECTIVE_PROPERTY_NAME
          The name of the date effective property on the rule node type
static String DATE_EXPIRED_PROPERTY_NAME
          The name of the date expired property on the rule node type
static String PACKAGE_NAME_PROPERTY
           
static String RULE_NODE_TYPE_NAME
          The name of the rule node type
 
Fields inherited from class org.drools.repository.VersionableItem
CATEGORY_PROPERTY_NAME, CHECKIN_COMMENT, CONTENT_PROPERTY_ARCHIVE_FLAG, COVERAGE_PROPERTY_NAME, CREATOR_PROPERTY_NAME, DEFAULT_CONTENT_FORMAT, DESCRIPTION_PROPERTY_NAME, FORMAT_PROPERTY_NAME, LAST_CONTRIBUTOR_PROPERTY_NAME, LAST_MODIFIED_PROPERTY_NAME, PUBLISHER_PROPERTY_NAME, RELATION_PROPERTY_NAME, RIGHTS_PROPERTY_NAME, SOURCE_PROPERTY_NAME, STATE_PROPERTY_NAME, SUBJECT_PROPERTY_NAME, TITLE_PROPERTY_NAME, TYPE_PROPERTY_NAME, VERSION_NUMBER_PROPERTY_NAME
 
Fields inherited from class org.drools.repository.Item
node, rulesRepository
 
Constructor Summary
AssetItem()
           
AssetItem(RulesRepository rulesRepository, javax.jcr.Node node)
          Constructs a RuleItem object, setting its node attribute to the specified node.
 
Method Summary
 byte[] getBinaryContentAsBytes()
          This is a convenience method for returning the binary data as a byte array.
 InputStream getBinaryContentAttachment()
          If this asset contains binary data, this is how you return it.
 String getBinaryContentAttachmentFileName()
          Get the name of the "file" attachment, if one is set.
 String getContent()
          returns the string contents of the rule node.
 Calendar getDateEffective()
           
 Calendar getDateExpired()
           
 AssetHistoryIterator getHistory()
           
 PackageItem getPackage()
          This will get the package an asset item belongs to.
 String getPackageName()
          Get the name of the enclosing package.
 VersionableItem getPrecedingVersion()
          Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g.
 VersionableItem getSucceedingVersion()
          Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g.
 String getUserProperty(String property)
           
 void remove()
          This will remove the item.
 String toString()
          Nicely formats the information contained by the node that this object encapsulates
 AssetItem updateBinaryContentAttachment(InputStream data)
          If the asset is a binary asset, then use this to update the content (do NOT use text).
 void updateBinaryContentAttachmentFileName(String name)
          Optionally set the filename to be associated with the binary content.
 AssetItem updateContent(String newRuleContent)
          This will update the asset's content (checking it out if it is not already).
 void updateDateEffective(Calendar newDateEffective)
          Creates a new version of this object's rule node, updating the effective date for the rule node.
 void updateDateExpired(Calendar newDateExpired)
          Creates a new version of this object's rule node, updating the expired date for the rule node.
 void updateUserProperty(String propertyName, String value)
          This updates a user defined property (not one of the intrinsic ones).
 
Methods inherited from class org.drools.repository.CategorisableItem
addCategory, getCategories, removeCategory, updateCategoryList
 
Methods inherited from class org.drools.repository.VersionableItem
archiveItem, checkin, checkIsUpdateable, checkout, getCheckinComment, getCoverage, getCreatedDate, getCreator, getDescription, getExternalRelation, getExternalSource, getFormat, getLastContributor, getLastModified, getLongProperty, getName, getPrecedingVersionNode, getPublisher, getRealContentFromVersion, getRights, getState, getStateDescription, getStringProperty, getSubject, getSucceedingVersionNode, getTitle, getType, getUUID, getVersionContentNode, getVersionNumber, getVersionSnapshotUUID, isArchived, isHistoricalVersion, sameState, updateCoverage, updateDescription, updateExternalRelation, updateExternalSource, updateFormat, updatePublisher, updateRights, updateState, updateState, updateStringProperty, updateSubject, updateTitle, updateType
 
Methods inherited from class org.drools.repository.Item
equals, getNode, getRulesRepository, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RULE_NODE_TYPE_NAME

public static final String RULE_NODE_TYPE_NAME
The name of the rule node type

See Also:
Constant Field Values

CONTENT_PROPERTY_NAME

public static final String CONTENT_PROPERTY_NAME
See Also:
Constant Field Values

CONTENT_PROPERTY_BINARY_NAME

public static final String CONTENT_PROPERTY_BINARY_NAME
See Also:
Constant Field Values

CONTENT_PROPERTY_ATTACHMENT_FILENAME

public static final String CONTENT_PROPERTY_ATTACHMENT_FILENAME
See Also:
Constant Field Values

DATE_EFFECTIVE_PROPERTY_NAME

public static final String DATE_EFFECTIVE_PROPERTY_NAME
The name of the date effective property on the rule node type

See Also:
Constant Field Values

DATE_EXPIRED_PROPERTY_NAME

public static final String DATE_EXPIRED_PROPERTY_NAME
The name of the date expired property on the rule node type

See Also:
Constant Field Values

PACKAGE_NAME_PROPERTY

public static final String PACKAGE_NAME_PROPERTY
See Also:
Constant Field Values
Constructor Detail

AssetItem

public AssetItem(RulesRepository rulesRepository,
                 javax.jcr.Node node)
          throws RulesRepositoryException
Constructs a RuleItem object, setting its node attribute to the specified node.

Parameters:
rulesRepository - the rulesRepository that instantiated this object
node - the node in the repository that this RuleItem corresponds to
Throws:
RulesRepositoryException

AssetItem

public AssetItem()
Method Detail

getContent

public String getContent()
                  throws RulesRepositoryException
returns the string contents of the rule node. If this is a binary asset, this will return null (use getBinaryContent instead).

Throws:
RulesRepositoryException

getBinaryContentAttachment

public InputStream getBinaryContentAttachment()
If this asset contains binary data, this is how you return it. Otherwise it will return null.


getBinaryContentAttachmentFileName

public String getBinaryContentAttachmentFileName()
Get the name of the "file" attachment, if one is set. Null otherwise


getBinaryContentAsBytes

public byte[] getBinaryContentAsBytes()
This is a convenience method for returning the binary data as a byte array.


getDateEffective

public Calendar getDateEffective()
                          throws RulesRepositoryException
Returns:
the date the rule becomes effective
Throws:
RulesRepositoryException

updateDateEffective

public void updateDateEffective(Calendar newDateEffective)
                         throws RulesRepositoryException
Creates a new version of this object's rule node, updating the effective date for the rule node.

Parameters:
newDateEffective - the new effective date for the rule
Throws:
RulesRepositoryException

getDateExpired

public Calendar getDateExpired()
                        throws RulesRepositoryException
Returns:
the date the rule becomes expired
Throws:
RulesRepositoryException

updateDateExpired

public void updateDateExpired(Calendar newDateExpired)
                       throws RulesRepositoryException
Creates a new version of this object's rule node, updating the expired date for the rule node.

Parameters:
newDateExpired - the new expired date for the rule
Throws:
RulesRepositoryException

updateContent

public AssetItem updateContent(String newRuleContent)
                        throws RulesRepositoryException
This will update the asset's content (checking it out if it is not already). This will not save the session or create a new version of the node (this has to be done seperately, as several properties may change as part of one edit). This is only used if the asset is a textual asset. For binary, use the updateBinaryContent method instead.

Throws:
RulesRepositoryException

updateBinaryContentAttachment

public AssetItem updateBinaryContentAttachment(InputStream data)
If the asset is a binary asset, then use this to update the content (do NOT use text).


updateBinaryContentAttachmentFileName

public void updateBinaryContentAttachmentFileName(String name)
Optionally set the filename to be associated with the binary content.


updateUserProperty

public void updateUserProperty(String propertyName,
                               String value)
This updates a user defined property (not one of the intrinsic ones).


toString

public String toString()
Nicely formats the information contained by the node that this object encapsulates

Overrides:
toString in class Object

getPrecedingVersion

public VersionableItem getPrecedingVersion()
                                    throws RulesRepositoryException
Description copied from class: VersionableItem
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();
         

Specified by:
getPrecedingVersion in class VersionableItem
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 VersionableItem getSucceedingVersion()
                                     throws RulesRepositoryException
Description copied from class: VersionableItem
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();
         

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

getPackageName

public String getPackageName()
Get the name of the enclosing package. As assets are stored in versionable subfolders, this means walking up 2 levels in the hierarchy to get to the enclosing "package" node.


getUserProperty

public String getUserProperty(String property)
Returns:
A property value (for a user defined property).

remove

public void remove()
This will remove the item. The repository will need to be saved for this to take effect. Typically the package that contains this should be versioned before removing this, to make it easy to roll back.


getHistory

public AssetHistoryIterator getHistory()
Returns:
An iterator over the nodes history.

getPackage

public PackageItem getPackage()
This will get the package an asset item belongs to.



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