|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.drools.repository.Item org.drools.repository.VersionableItem org.drools.repository.PackageItem
public class PackageItem
A PackageItem object aggregates a set of assets (for example, rules). This is advantageous for systems using the JBoss Rules engine where the application might make use of many related rules.
A PackageItem refers to rule nodes within the RulesRepository. It contains the "master copy" of assets (which may be linked into other packages or other types of containers). This is a container "node".
Field Summary | |
---|---|
static String |
ASSET_FOLDER_NAME
This is the name of the rules "subfolder" where rules are kept for this package. |
static String |
EXTERNAL_URI_PROPERTY_NAME
|
static String |
HEADER_PROPERTY_NAME
|
static String |
PACKAGE_FORMAT
The dublin core format attribute. |
static String |
RULE_PACKAGE_TYPE_NAME
The name of the rule package node type |
Fields inherited from class org.drools.repository.Item |
---|
node, rulesRepository |
Constructor Summary | |
---|---|
PackageItem(RulesRepository rulesRepository,
javax.jcr.Node node)
Constructs an object of type RulePackageItem corresponding the specified node |
Method Summary | |
---|---|
AssetItem |
addAsset(String assetName,
String description)
Adds a rule to the current package with no category (not recommended !). |
AssetItem |
addAsset(String assetName,
String description,
String initialCategory,
String format)
This adds a rule to the current physical package (you can move it later). |
void |
changeStatus(String newState)
This will change the status of this package, and all the contained assets. |
Iterator |
getAssets()
Return an iterator for the rules in this package |
Iterator |
getAssetsWithStatus(StateItem state)
This will return a list of assets for a given state. |
Iterator |
getAssetsWithStatus(StateItem state,
StateItem ignoreState)
This will return a list of assets for a given state. |
byte[] |
getCompiledPackageBytes()
This is a convenience method for returning the binary data as a byte array. |
String |
getExternalURI()
|
String |
getHeader()
|
String |
getName()
Return the name of the 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. |
String |
getSnapshotName()
returns the name of the snapshot, if this package is really a snapshot. |
VersionableItem |
getSucceedingVersion()
Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g. |
boolean |
isSnapshot()
|
AssetItemIterator |
listAssetsByFormat(String[] formats)
This will load an iterator for assets of the given format type. |
AssetItem |
loadAsset(String name)
Load a specific rule asset by name. |
AssetItemIterator |
queryAssets(String fieldPredicates)
|
AssetItemIterator |
queryAssets(String fieldPredicates,
boolean seekArchived)
This will query any assets stored under this package. |
void |
removeAsset(String name)
Remove an asset by name After doing this, you will need to check in the package as removing an item effects the parent package. |
String |
toString()
Nicely formats the information contained by the node that this object encapsulates |
void |
updateCheckinComment(String comment)
Update the checkin comment. |
PackageItem |
updateCompiledPackage(InputStream data)
If the asset is a binary asset, then use this to update the content (do NOT use text). |
void |
updateExternalURI(String uri)
|
void |
updateHeader(String header)
|
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 |
---|
public static final String ASSET_FOLDER_NAME
public static final String PACKAGE_FORMAT
public static final String RULE_PACKAGE_TYPE_NAME
public static final String HEADER_PROPERTY_NAME
public static final String EXTERNAL_URI_PROPERTY_NAME
Constructor Detail |
---|
public PackageItem(RulesRepository rulesRepository, javax.jcr.Node node) throws RulesRepositoryException
rulesRepository
- the rulesRepository that instantiated this objectnode
- the node to which this object corresponds
RulesRepositoryException
Method Detail |
---|
public String getName()
getName
in class VersionableItem
public boolean isSnapshot()
public String getSnapshotName()
public AssetItem addAsset(String assetName, String description)
public AssetItem addAsset(String assetName, String description, String initialCategory, String format)
assetName
- The name of the asset (the file name minus the extension)description
- A description of the asset.initialCategory
- The initial category the asset is placed in (can belong to multiple ones later).format
- The dublin core format (which also determines what editor is used) - this is effectively the file extension.public void removeAsset(String name)
public Iterator getAssets()
public AssetItemIterator queryAssets(String fieldPredicates, boolean seekArchived)
"drools:format = 'drl'"
to get a list of
only a certain type of asset.
fieldPredicates
- A predicate string (SQL style).
public AssetItemIterator queryAssets(String fieldPredicates)
public AssetItemIterator listAssetsByFormat(String[] formats)
public AssetItem loadAsset(String name)
public String toString()
public VersionableItem getPrecedingVersion() throws RulesRepositoryException
VersionableItem
RuleItem item; ... RuleItem predcessor = (RuleItem) item.getPrecedingVersion();
getPrecedingVersion
in class VersionableItem
RulesRepositoryException
public VersionableItem getSucceedingVersion() throws RulesRepositoryException
VersionableItem
RuleItem item; ... RuleItem successor = (RuleItem) item.getSucceedingVersion();
getSucceedingVersion
in class VersionableItem
RulesRepositoryException
public Iterator getAssetsWithStatus(StateItem state, StateItem ignoreState)
state
- The state of assets to retrieve.ignoreState
- The statuses to not include in the results (it will look
at the status of the latest one).public Iterator getAssetsWithStatus(StateItem state)
public String getHeader()
public String getExternalURI()
public void updateHeader(String header)
public void updateExternalURI(String uri)
public void updateCheckinComment(String comment)
public void changeStatus(String newState)
newState
- The status tag to change it to.public PackageItem updateCompiledPackage(InputStream data)
public byte[] getCompiledPackageBytes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |