|
||||||||||
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.ModuleItem
public class ModuleItem
A ModuleItem 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 assets.
A ModuleItem refers to module nodes within the RulesRepository. It contains the "master copy" of assets (which may be linked into other module or other types of containers). This is a container "node".
Field Summary | |
---|---|
static String |
ASSET_FOLDER_NAME
This is the name of the asset "subfolder" where assets 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 |
MODULE_FORMAT
The dublin core format attribute. |
static String |
MODULE_TYPE_NAME
The name of the module node type |
static String |
WORKSPACE_PROPERTY_NAME
|
Fields inherited from class org.drools.repository.Item |
---|
node, rulesRepository |
Constructor Summary | |
---|---|
ModuleItem(RulesRepository rulesRepository,
javax.jcr.Node node)
Constructs an object of type ModuleItem corresponding the specified node |
Method Summary | |
---|---|
AssetItem |
addAsset(String assetName,
String description)
Adds an asset to the current module with no category (not recommended !). |
AssetItem |
addAsset(String assetName,
String description,
String initialCategory,
String format)
This adds an asset to the current physical module (you can move it later). |
AssetItem |
addAssetImportedFromGlobalArea(String sharedAssetName)
This adds an asset 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 module, and all the contained assets. |
boolean |
containsAsset(String name)
Returns true if this module contains an asset of the given name. |
String[] |
convertStringToArray(String tagName)
|
ModuleItem |
createSubModule(String subModuleName)
Creates a nested package. |
static String[] |
decodeDependencyPath(String dependencyPath)
|
static String |
encodeDependencyPath(String dependencyPath,
String dependencyVersion)
|
static void |
ensureMixinType(AssetItem assetItem,
String mixin)
|
Iterator<AssetItem> |
getAssets()
Return an iterator for the rules in this module |
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[] |
getCompiledBinaryBytes()
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()
|
ModuleHistoryIterator |
getHistory()
|
String |
getName()
Return the name of the module. |
ModuleItem |
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 module is really a snapshot. |
ModuleItem |
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)
|
ModuleIterator |
listSubModules()
Returns a ModuleIterator of its children |
AssetItem |
loadAsset(String name)
Load a specific asset by name. |
AssetItem |
loadAsset(String name,
long versionNumber)
Load a specific asset by name. |
AssetItemIterator |
queryAssets(String fieldPredicates)
|
AssetItemIterator |
queryAssets(String fieldPredicates,
boolean seekArchived)
This will query any assets stored under this module. |
void |
remove()
This will permanently delete this module. |
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. |
ModuleItem |
updateCompiledBinary(InputStream data)
|
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 MODULE_FORMAT
public static final String MODULE_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 ModuleItem(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 void updateBinaryUpToDate(boolean status)
public boolean isBinaryUpToDate()
public String getSnapshotName()
public String[] getWorkspaces() throws RulesRepositoryException
RulesRepositoryException
public 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 static void ensureMixinType(AssetItem assetItem, String mixin) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public 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 AssetItem loadAsset(String name, long versionNumber)
public boolean containsAsset(String name)
public String toString()
toString
in class Object
public ModuleHistoryIterator getHistory()
getHistory
in class VersionableItem
public ModuleItem getPrecedingVersion() throws RulesRepositoryException
VersionableItem
RuleItem item; ... RuleItem predcessor = (RuleItem) item.getPrecedingVersion();
getPrecedingVersion
in class VersionableItem
RulesRepositoryException
public ModuleItem getSucceedingVersion() throws RulesRepositoryException
VersionableItem
RuleItem item; ... RuleItem successor = (RuleItem) item.getSucceedingVersion();
getSucceedingVersion
in class VersionableItem
RulesRepositoryException
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
RulesRepositoryException
public 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 ModuleItem updateCompiledBinary(InputStream data)
public byte[] getCompiledBinaryBytes()
public ModuleItem createSubModule(String subModuleName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public ModuleIterator listSubModules()
ModuleIterator
of its children
ModuleIterator
of its children
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |