|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 |
CATEGORY_RULE_KEYS_PROPERTY_NAME
|
static String |
CATEGORY_RULE_VALUES_PROPERTY_NAME
|
static String |
DEPENDENCIES_PROPERTY_NAME
|
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 |
static String |
WORKSPACE_PROPERTY_NAME
|
| 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). |
AssetItem |
addAssetImportedFromGlobalArea(String sharedAssetName)
This adds a rule which is imported from global area. |
void |
addWorkspace(String workspace)
This adds a workspace |
void |
changeStatus(String newState)
This will change the status of this package, and all the contained assets. |
boolean |
containsAsset(String name)
Returns true if this package item contains an asset of the given name. |
String[] |
convertStringToArray(String tagName)
|
PackageItem |
createSubPackage(String subPackageName)
Creates a nested package. |
static String[] |
decodeDependencyPath(String dependencyPath)
|
static String |
encodeDependencyPath(String dependencyPath,
String dependencyVersion)
|
Iterator<AssetItem> |
getAssets()
Return an iterator for the rules in this package |
Iterator<AssetItem> |
getAssetsWithStatus(StateItem state)
This will return a list of assets for a given state. |
Iterator<AssetItem> |
getAssetsWithStatus(StateItem state,
StateItem ignoreState)
This will return a list of assets for a given state. |
HashMap<String,String> |
getCategoryRules()
|
String |
getCategoryRules(boolean keys)
|
byte[] |
getCompiledPackageBytes()
This is a convenience method for returning the binary data as a byte array. |
String[] |
getDependencies()
To avoid updating dependency attribute for every asset operation like adding/renaming/deleting etc, we calculate dependency path on the fly. |
String |
getExternalURI()
|
PackageHistoryIterator |
getHistory()
|
String |
getName()
Return the name of the package. |
PackageItem |
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. |
PackageItem |
getSucceedingVersion()
Clients of this method can cast the resulting object to the type of object they are calling the method on (e.g. |
String[] |
getWorkspaces()
|
boolean |
isBinaryUpToDate()
Return true if the binary is "up to date". |
boolean |
isSnapshot()
|
AssetItemIterator |
listArchivedAssets()
|
AssetItemIterator |
listAssetsByFormat(List<String> formatInList)
|
AssetItemIterator |
listAssetsByFormat(String... formats)
This will load an iterator for assets of the given format type. |
AssetItemIterator |
listAssetsNotOfFormat(String[] formats)
|
AssetItemIterator |
listAssetsWithVersionsSpecifiedByDependenciesByFormat(String... assetFormats)
|
PackageIterator |
listSubPackages()
Returns a PackageIterator of its children |
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 |
remove()
This will permanently delete this package. |
void |
removeWorkspace(String workspace)
This removes a workspace |
void |
setCatRules(String map)
|
String |
toString()
Nicely formats the information contained by the node that this object encapsulates |
void |
updateBinaryUpToDate(boolean status)
Set this to indicate if the binary is up to date, or not. |
void |
updateCategoryRules(String keys,
String values)
|
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 |
updateDependency(String dependencyPath)
|
void |
updateExternalURI(String uri)
|
void |
updateWorkspace(String[] workspace)
This sets the Workspace |
| 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
public static final String CATEGORY_RULE_KEYS_PROPERTY_NAME
public static final String CATEGORY_RULE_VALUES_PROPERTY_NAME
public static final String WORKSPACE_PROPERTY_NAME
public static final String DEPENDENCIES_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 VersionableItempublic boolean isSnapshot()
public void updateBinaryUpToDate(boolean status)
public boolean isBinaryUpToDate()
public String getSnapshotName()
public String[] getWorkspaces()
throws RulesRepositoryException
RulesRepositoryExceptionpublic void updateWorkspace(String[] workspace)
workspace - public void addWorkspace(String workspace)
workspace - public void removeWorkspace(String workspace)
workspace -
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 AssetItem addAssetImportedFromGlobalArea(String sharedAssetName)
sharedAssetName - The name of the imported assetpublic void remove()
public String[] getDependencies()
public void updateDependency(String dependencyPath)
public static String encodeDependencyPath(String dependencyPath,
String dependencyVersion)
public static String[] decodeDependencyPath(String dependencyPath)
public Iterator<AssetItem> 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 listArchivedAssets()
public AssetItemIterator listAssetsByFormat(List<String> formatInList)
public AssetItemIterator listAssetsWithVersionsSpecifiedByDependenciesByFormat(String... assetFormats)
public AssetItemIterator listAssetsByFormat(String... formats)
public AssetItemIterator listAssetsNotOfFormat(String[] formats)
public AssetItem loadAsset(String name)
public boolean containsAsset(String name)
public String toString()
toString in class Objectpublic PackageHistoryIterator getHistory()
getHistory in class VersionableItem
public PackageItem getPrecedingVersion()
throws RulesRepositoryException
VersionableItem
RuleItem item;
...
RuleItem predcessor = (RuleItem) item.getPrecedingVersion();
getPrecedingVersion in class VersionableItemRulesRepositoryException
public PackageItem getSucceedingVersion()
throws RulesRepositoryException
VersionableItem
RuleItem item;
...
RuleItem successor = (RuleItem) item.getSucceedingVersion();
getSucceedingVersion in class VersionableItemRulesRepositoryException
public Iterator<AssetItem> 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<AssetItem> getAssetsWithStatus(StateItem state)
public String getExternalURI()
public void updateExternalURI(String uri)
public void setCatRules(String map)
public void updateCategoryRules(String keys,
String values)
throws RulesRepositoryException
RulesRepositoryExceptionpublic String[] convertStringToArray(String tagName)
public HashMap<String,String> getCategoryRules()
public String getCategoryRules(boolean keys)
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()
public PackageItem createSubPackage(String subPackageName)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic PackageIterator listSubPackages()
PackageIterator of its children
PackageIterator of its children
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||