Package org.jbpm.designer.repository
Interface Repository
-
- All Known Implementing Classes:
GuvnorRepository
,VFSRepository
public interface Repository
Repository is responsible for managing its components that are as follows:- Asset - component that can be of any type and is stored in a custom location
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
assetExists(String assetUniqueId)
Examines repository if asset given by theassetUniqueId
existsboolean
copyAsset(String uniqueId, String location)
Copy asset given byuniqueId
into destination given bylocation
boolean
copyDirectory(String sourceDirectory, String location)
Copy directory given byuniqueId
into destination given bylocation
String
createAsset(Asset asset)
Stores given asset in the repository.Directory
createDirectory(String location)
Stores new directory in given location, in case of sub folders existence in the location all sub folders are created as well.boolean
deleteAsset(String assetUniqueId)
Deletes asset from repository identified byassetUniqueId
if existsboolean
deleteAssetFromPath(String path)
Deletes asset from repository given by thepath
if existsboolean
deleteDirectory(String directory, boolean failIfNotEmpty)
Deletes directory from repository including its content NOTE: Directory should be always relative to the repository rootboolean
directoryExists(String directory)
Examines repository if given directory exists in the repository NOTE: Directory should be always relative to the repository rootString
getName()
Returns name used to identify this repository.Collection<Asset>
listAssets(String location)
Retrieves all assets stored in the given location.Collection<Asset>
listAssets(String location, Filter filter)
Retrieves all assets stored in the given location.Collection<Asset>
listAssetsRecursively(String startAt, Filter filter)
Retrieves all directories stored understartAt
location including all sub folders.Collection<Directory>
listDirectories(String startAt)
Retrieves all directories stored understartAt
location.Asset
loadAsset(String assetUniqueId)
Loads an asset given by theassetUniqueId
including actual content of the asset.Asset
loadAssetFromPath(String path)
Loads an asset given by thepath
including actual content of the asset.boolean
moveAsset(String uniqueId, String location, String name)
Moves asset given byuniqueId
into destination given bylocation
and renames it with givenname
boolean
moveDirectory(String sourceDirectory, String location, String name)
Moves directory given byuniqueId
into destination given bylocation
and renames it with givenname
String
updateAsset(Asset asset, String commitMessage, String sessionId)
Updates content of the asset
-
-
-
Method Detail
-
getName
String getName()
Returns name used to identify this repository.
-
listDirectories
Collection<Directory> listDirectories(String startAt)
Retrieves all directories stored understartAt
location. NOTE: Directory should be always relative to the repository root- Parameters:
startAt
- - location where directories should be fetched from- Returns:
- - list of directories
-
listAssetsRecursively
Collection<Asset> listAssetsRecursively(String startAt, Filter filter)
Retrieves all directories stored understartAt
location including all sub folders. NOTE: Directory should be always relative to the repository root- Parameters:
startAt
- - location where directories should be fetched fromfilter
- - filter that allows to narrow the results- Returns:
- - list of assets found
-
createDirectory
Directory createDirectory(String location)
Stores new directory in given location, in case of sub folders existence in the location all sub folders are created as well.- Parameters:
location
- - location in the repository to be created- Returns:
- - returns identifier of the new directory
-
directoryExists
boolean directoryExists(String directory)
Examines repository if given directory exists in the repository NOTE: Directory should be always relative to the repository root- Parameters:
directory
- - directory to check- Returns:
- - true if and only if given directory exists
-
deleteDirectory
boolean deleteDirectory(String directory, boolean failIfNotEmpty)
Deletes directory from repository including its content NOTE: Directory should be always relative to the repository root- Parameters:
directory
- - directory to be deletedfailIfNotEmpty
- - indicates if delete operation should fail in case given directory is not empty
-
copyDirectory
boolean copyDirectory(String sourceDirectory, String location)
Copy directory given byuniqueId
into destination given bylocation
- Parameters:
sourceDirectory
- - source directory path relative to repository rootlocation
- - destination where directory will be copied to- Returns:
- - true when copy operation was successful otherwise false
-
moveDirectory
boolean moveDirectory(String sourceDirectory, String location, String name)
Moves directory given byuniqueId
into destination given bylocation
and renames it with givenname
- Parameters:
sourceDirectory
- - source directory path relative to repository rootlocation
- - final destination where directory should be moved toname
- - name of the directory after move, if null is given name is not changed- Returns:
- - returns true if move operation was successful otherwise false
-
listAssets
Collection<Asset> listAssets(String location)
Retrieves all assets stored in the given location. NOTE: This will not load the actual content of the asset but only its meta data- Parameters:
location
- - location that assets should be collected from- Returns:
- - list of available assets
-
listAssets
Collection<Asset> listAssets(String location, Filter filter)
Retrieves all assets stored in the given location. NOTE: This will not load the actual content of the asset but only its meta data- Parameters:
location
- - location that assets should be collected fromfilter
- - allows to defined filter criteria to fetch only assets of interest- Returns:
- - list of available assets
-
loadAsset
Asset loadAsset(String assetUniqueId) throws org.uberfire.java.nio.file.NoSuchFileException
Loads an asset given by theassetUniqueId
including actual content of the asset.- Parameters:
assetUniqueId
- - unique identifier of the asset to load- Returns:
- return loaded asset including content
- Throws:
org.uberfire.java.nio.file.NoSuchFileException
- - throws in case of asset given by id does not exist
-
loadAssetFromPath
Asset loadAssetFromPath(String path) throws org.uberfire.java.nio.file.NoSuchFileException
Loads an asset given by thepath
including actual content of the asset.- Parameters:
path
- - complete path of the asset to load (relative to the repository root)- Returns:
- return loaded asset including content
- Throws:
org.uberfire.java.nio.file.NoSuchFileException
- - throws in case of asset given by id does not exist
-
createAsset
String createAsset(Asset asset)
Stores given asset in the repository.asset
need to have all meta data and content available for the operation to successfully complete.- Parameters:
asset
- - asset to be stored- Returns:
- returns asset unique identifier that can be used to locate it
-
updateAsset
String updateAsset(Asset asset, String commitMessage, String sessionId) throws org.uberfire.java.nio.file.NoSuchFileException
Updates content of the asset- Parameters:
asset
- - asset to be stored with new content in it, all other data (like name, location) should be same- Returns:
- - returns uniqueId of the asset
- Throws:
org.uberfire.java.nio.file.NoSuchFileException
- - throws in case of asset given by id does not exist
-
deleteAsset
boolean deleteAsset(String assetUniqueId)
Deletes asset from repository identified byassetUniqueId
if exists- Parameters:
assetUniqueId
- - unique identifier of the asset- Returns:
- return true if and only if operation completed successfully otherwise false
-
deleteAssetFromPath
boolean deleteAssetFromPath(String path)
Deletes asset from repository given by thepath
if exists- Parameters:
path
- - complete path of the asset to delete- Returns:
- return true if and only if operation completed successfully otherwise false
-
assetExists
boolean assetExists(String assetUniqueId)
Examines repository if asset given by theassetUniqueId
exists- Parameters:
assetUniqueId
- - unique identifier of the asset- Returns:
- true if and only if asset exists otherwise false
-
copyAsset
boolean copyAsset(String uniqueId, String location)
Copy asset given byuniqueId
into destination given bylocation
- Parameters:
uniqueId
- - source asset unique idlocation
- - destination where asset will be copied to- Returns:
- - true when copy operation was successful otherwise false
-
moveAsset
boolean moveAsset(String uniqueId, String location, String name)
Moves asset given byuniqueId
into destination given bylocation
and renames it with givenname
- Parameters:
uniqueId
- - source asset unique idlocation
- - final destination where asset should be moved toname
- - name of the asset after move, if null is given name is not changed- Returns:
- - returns true if move operation was successful otherwise false
-
-