| java.lang.Object org.drools.repository.Item org.drools.repository.VersionableItem org.drools.repository.PackageItem
PackageItem | public class PackageItem extends VersionableItem (Code) | | 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".
author: btruitt |
Method Summary | |
public AssetItem | addAsset(String assetName, String description) Adds a rule to the current package with no category (not recommended !). | public AssetItem | addAsset(String assetName, String description, String initialCategory, String format) This adds a rule to the current physical package (you can move it later).
With the given category.
This will NOT check the asset in, just create the basic record. | public void | changeStatus(String newState) This will change the status of this package, and all the contained assets. | public boolean | containsAsset(String name) Returns true if this package item contains an asset of the given name. | public Iterator | getAssets() | public Iterator | getAssetsWithStatus(StateItem state, StateItem ignoreState) This will return a list of assets for a given state.
It works through the assets that belong to this package, and
if they are not in the correct state, walks backwards until it finds one
in the correct state. | public Iterator | getAssetsWithStatus(StateItem state) This will return a list of assets for a given state.
It works through the assets that belong to this package, and
if they are not in the correct state, walks backwards until it finds one
in the correct state. | public byte[] | getCompiledPackageBytes() This is a convenience method for returning the binary data as a byte array. | public String | getExternalURI() The external URI which will be used to sync this package to an external resource.Generally this will resolve to a directory in (for example) Subversion - with each assetbeing a file (with the format property as the file extension). | public String | getHeader() | public String | getName() Return the name of the package. | public VersionableItem | getPrecedingVersion() | public String | getSnapshotName() returns the name of the snapshot, if this package is really a snapshot. | public VersionableItem | getSucceedingVersion() | public boolean | isSnapshot() | public AssetItemIterator | listArchivedAssets() | public AssetItemIterator | listAssetsByFormat(String[] formats) This will load an iterator for assets of the given format type. | public AssetItem | loadAsset(String name) Load a specific rule asset by name. | public AssetItemIterator | queryAssets(String fieldPredicates, boolean seekArchived) This will query any assets stored under this package.
For example, you can pass in "drools:format = 'drl'" to get a list of
only a certain type of asset.
Parameters: fieldPredicates - A predicate string (SQL style). | public AssetItemIterator | queryAssets(String fieldPredicates) | public 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. | void | sortHistoryByVersionNumber(List fullHistory) | public String | toString() | public void | updateCheckinComment(String comment) Update the checkin comment. | public PackageItem | updateCompiledPackage(InputStream data) If the asset is a binary asset, then use this to update the content
(do NOT use text). | public void | updateExternalURI(String uri) | public void | updateHeader(String header) |
ASSET_FOLDER_NAME | final public static String ASSET_FOLDER_NAME(Code) | | This is the name of the rules "subfolder" where rules are kept
for this package.
|
EXTERNAL_URI_PROPERTY_NAME | final public static String EXTERNAL_URI_PROPERTY_NAME(Code) | | |
HEADER_PROPERTY_NAME | final public static String HEADER_PROPERTY_NAME(Code) | | |
PACKAGE_FORMAT | final public static String PACKAGE_FORMAT(Code) | | The dublin core format attribute.
|
RULE_PACKAGE_TYPE_NAME | final public static String RULE_PACKAGE_TYPE_NAME(Code) | | The name of the rule package node type
|
PackageItem | public PackageItem(RulesRepository rulesRepository, Node node) throws RulesRepositoryException(Code) | | Constructs an object of type RulePackageItem corresponding the specified node
Parameters: rulesRepository - the rulesRepository that instantiated this object Parameters: node - the node to which this object corresponds throws: RulesRepositoryException - |
PackageItem | PackageItem()(Code) | | |
addAsset | public AssetItem addAsset(String assetName, String description)(Code) | | Adds a rule to the current package with no category (not recommended !).
Without categories, its going to be hard to find rules later on
(unless packages are enough for you).
|
addAsset | public AssetItem addAsset(String assetName, String description, String initialCategory, String format)(Code) | | This adds a rule to the current physical package (you can move it later).
With the given category.
This will NOT check the asset in, just create the basic record.
Parameters: assetName - The name of the asset (the file name minus the extension) Parameters: description - A description of the asset. Parameters: initialCategory - The initial category the asset is placed in (can belong to multiple ones later). Parameters: format - The dublin core format (which also determines what editor is used) - this is effectively the file extension. |
changeStatus | public void changeStatus(String newState)(Code) | | This will change the status of this package, and all the contained assets.
No new versions are created of anything.
Parameters: newState - The status tag to change it to. |
containsAsset | public boolean containsAsset(String name)(Code) | | Returns true if this package item contains an asset of the given name.
|
getAssets | public Iterator getAssets()(Code) | | Return an iterator for the rules in this package
|
getAssetsWithStatus | public Iterator getAssetsWithStatus(StateItem state, StateItem ignoreState)(Code) | | This will return a list of assets for a given state.
It works through the assets that belong to this package, and
if they are not in the correct state, walks backwards until it finds one
in the correct state.
If it walks all the way back up the versions looking for the "latest"
version with the appropriate state, and can't find one,
that asset is not included in the result.
This will exclude any items that have the "ignoreState" set
(so for example, retired items, invalid items etc).
Parameters: state - The state of assets to retrieve. Parameters: ignoreState - The statuses to not include in the results (it will lookat the status of the latest one). |
getAssetsWithStatus | public Iterator getAssetsWithStatus(StateItem state)(Code) | | This will return a list of assets for a given state.
It works through the assets that belong to this package, and
if they are not in the correct state, walks backwards until it finds one
in the correct state.
If it walks all the way back up the versions looking for the "latest"
version with the appropriate state, and can't find one,
that asset is not included in the result.
|
getCompiledPackageBytes | public byte[] getCompiledPackageBytes()(Code) | | This is a convenience method for returning the binary data as a byte array.
|
getExternalURI | public String getExternalURI()(Code) | | The external URI which will be used to sync this package to an external resource.Generally this will resolve to a directory in (for example) Subversion - with each assetbeing a file (with the format property as the file extension). |
getHeader | public String getHeader()(Code) | | The header contents as pertains to a package of rule assets. |
getName | public String getName()(Code) | | Return the name of the package.
|
getSnapshotName | public String getSnapshotName()(Code) | | returns the name of the snapshot, if this package is really a snapshot.
If it is not, it will just return the name of the package, so use wisely !
|
isSnapshot | public boolean isSnapshot()(Code) | | true if this package is actually a snapshot. |
listAssetsByFormat | public AssetItemIterator listAssetsByFormat(String[] formats)(Code) | | This will load an iterator for assets of the given format type.
|
queryAssets | public AssetItemIterator queryAssets(String fieldPredicates, boolean seekArchived)(Code) | | This will query any assets stored under this package.
For example, you can pass in "drools:format = 'drl'" to get a list of
only a certain type of asset.
Parameters: fieldPredicates - A predicate string (SQL style). A list of matches. |
removeAsset | public void removeAsset(String name)(Code) | | Remove an asset by name
After doing this, you will need to check in the package
as removing an item effects the parent package.
|
sortHistoryByVersionNumber | void sortHistoryByVersionNumber(List fullHistory)(Code) | | |
toString | public String toString()(Code) | | Nicely formats the information contained by the node that this object encapsulates
|
updateCheckinComment | public void updateCheckinComment(String comment)(Code) | | Update the checkin comment.
|
updateCompiledPackage | public PackageItem updateCompiledPackage(InputStream data)(Code) | | If the asset is a binary asset, then use this to update the content
(do NOT use text).
|
updateExternalURI | public void updateExternalURI(String uri)(Code) | | |
|
|