org.drools.guvnor.server
Class RepositoryAssetService

java.lang.Object
  extended by org.drools.guvnor.server.RepositoryAssetService
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, AssetService

@Name(value="org.drools.guvnor.client.rpc.AssetService")
@AutoCreate
public class RepositoryAssetService
extends Object
implements AssetService


Constructor Summary
RepositoryAssetService()
           
 
Method Summary
 List<DiscussionRecord> addToDiscussionForAsset(String assetId, String comment)
          Append a discussion item for the current user.
 void archiveAsset(String uuid)
           
 void archiveAssets(String[] uuids, boolean value)
          Archive assets based on uuid
 String buildAssetSource(RuleAsset asset)
          This will return the effective source for an asset (in DRL).
 void changeAssetPackage(String uuid, String newPackage, String comment)
          This moves an asset to the given target package.
 void changePackageState(String uuid, String newState)
          This will change the state of package.
 void changeState(String uuid, String newState)
          Role-based Authorization check: This method can be accessed if user has following permissions: 1.
 String checkinVersion(RuleAsset asset)
          This checks in a new version of an asset.
 void clearAllDiscussionsForAsset(String assetId)
          Only for admins, they can nuke it from orbit to clear it out
 String copyAsset(String assetUUID, String newPackage, String newName)
          Copies an asset into a new destination package.
 void create()
           
 PageResponse<AssetPageRow> findAssetPage(AssetPageRequest request)
          Supports filtering and pagination.
 long getAssetCount(AssetPageRequest request)
          This will return the number of Assets matching the given criteria
 String getAssetLockerUserName(String uuid)
          Returns the lockers user name
 RulesRepository getRulesRepository()
           
 TableDataResult listAssets(String packageUuid, String[] formats, int skip, int numRows, String tableConfig)
          Deprecated. in favour of findAssetPage(AssetPageRequest)
 TableDataResult listAssetsWithPackageName(String packageName, String[] formats, int skip, int numRows, String tableConfig)
          Deprecated. in favour of findAssetPage(AssetPageRequest)
 TableDataResult loadArchivedAssets(int skip, int numRows)
          Deprecated. 
 PageResponse<AdminArchivedPageRow> loadArchivedAssets(PageRequest request)
          This will load all archived assets, in a summary format suitable for display in a table.
 TableDataResult loadAssetHistory(String packageUUID, String assetName)
          Deprecated. in favour of loadArchivedAssets(PageRequest)
 List<DiscussionRecord> loadDiscussionForAsset(String assetId)
          Return a list of discussion items for a given asset...
 TableDataResult loadItemHistory(String uuid)
          This will load the history of the given asset or package, in a summary format suitable for display in a table.
 RuleAsset loadRuleAsset(String uuid)
          This actually does the hard work of loading up an asset based on its format.
 RuleAsset[] loadRuleAssets(String[] uuids)
           
 void lockAsset(String uuid)
          Locks the asset, if a lock already exists this over writes it.
 void promoteAssetToGlobalArea(String uuid)
          Prompt an asset into Global area.
 TableDataResult queryFullText(String text, boolean seekArchived, int skip, int numRows)
          Deprecated. in favour of ServiceImplementation.queryFullText(QueryPageRequest)
 PageResponse<QueryPageRow> quickFindAsset(QueryPageRequest request)
          This will quickly return a list of assets
 TableDataResult quickFindAsset(String searchText, boolean searchArchived, int skip, int numRows)
          Deprecated. in favour of quickFindAsset(QueryPageRequest)
 void removeAsset(String uuid)
          Remove an asset based on uuid
 void removeAssets(String[] uuids)
          Remove assets based on uuid
 String renameAsset(String uuid, String newName)
          Rename an asset.
 void restoreVersion(String versionUUID, String assetUUID, String comment)
          This will restore the specified version in the repository, saving, and creating a new version (with all the restored content).
 void setRulesRepository(RulesRepository repository)
           
 void unArchiveAsset(String uuid)
           
 void unLockAsset(String uuid)
          Unlocks the asset.
 BuilderResult validateAsset(RuleAsset asset)
          This will build the asset and return any build results (errors).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryAssetService

public RepositoryAssetService()
Method Detail

create

@Create
public void create()

setRulesRepository

public void setRulesRepository(RulesRepository repository)

getRulesRepository

public RulesRepository getRulesRepository()

loadRuleAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public RuleAsset loadRuleAsset(String uuid)
                        throws com.google.gwt.user.client.rpc.SerializationException
This actually does the hard work of loading up an asset based on its format.

Role-based Authorization check: This method can be accessed if user has following permissions: 1. The user has a ANALYST_READ role or higher (i.e., ANALYST) and this role has permission to access the category which the asset belongs to. Or. 2. The user has a package.readonly role or higher (i.e., package.admin, package.developer) and this role has permission to access the package which the asset belongs to.

Specified by:
loadRuleAsset in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

loadRuleAssets

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public RuleAsset[] loadRuleAssets(String[] uuids)
                           throws com.google.gwt.user.client.rpc.SerializationException
Specified by:
loadRuleAssets in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

checkinVersion

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public String checkinVersion(RuleAsset asset)
                      throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This checks in a new version of an asset.

Specified by:
checkinVersion in interface AssetService
Returns:
the UUID of the asset you are checking in, null if there was some problem (and an exception was not thrown).
Throws:
com.google.gwt.user.client.rpc.SerializationException

restoreVersion

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void restoreVersion(String versionUUID,
                                              String assetUUID,
                                              String comment)
Description copied from interface: AssetService
This will restore the specified version in the repository, saving, and creating a new version (with all the restored content).

Specified by:
restoreVersion in interface AssetService

loadItemHistory

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public TableDataResult loadItemHistory(String uuid)
                                throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This will load the history of the given asset or package, in a summary format suitable for display in a table.

Specified by:
loadItemHistory in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

loadAssetHistory

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public TableDataResult loadAssetHistory(String packageUUID,
                                                           String assetName)
                                 throws com.google.gwt.user.client.rpc.SerializationException
Deprecated. in favour of loadArchivedAssets(PageRequest)

Description copied from interface: AssetService
This will load the history of the given asset, in a summary format suitable for display in a table.

Specified by:
loadAssetHistory in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

loadArchivedAssets

@WebRemote
@Restrict(value="#{identity.loggedIn}")
@Deprecated
public TableDataResult loadArchivedAssets(int skip,
                                                                        int numRows)
                                   throws com.google.gwt.user.client.rpc.SerializationException
Deprecated. 

Description copied from interface: AssetService
This will load all archived assets, in a summary format suitable for display in a table.

Specified by:
loadArchivedAssets in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

loadArchivedAssets

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public PageResponse<AdminArchivedPageRow> loadArchivedAssets(PageRequest request)
                                                      throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This will load all archived assets, in a summary format suitable for display in a table.

Specified by:
loadArchivedAssets in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

listAssetsWithPackageName

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public TableDataResult listAssetsWithPackageName(String packageName,
                                                                    String[] formats,
                                                                    int skip,
                                                                    int numRows,
                                                                    String tableConfig)
                                          throws com.google.gwt.user.client.rpc.SerializationException
Deprecated. in favour of findAssetPage(AssetPageRequest)

Description copied from interface: AssetService
Given a format, this will return assets that match. It can also be used for "pagination" by passing in start and finish row numbers.

Specified by:
listAssetsWithPackageName in interface AssetService
Parameters:
packageName - The name of package to search inside.
numRows - The number of rows to return. -1 means all.
Throws:
com.google.gwt.user.client.rpc.SerializationException

listAssets

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public TableDataResult listAssets(String packageUuid,
                                                     String[] formats,
                                                     int skip,
                                                     int numRows,
                                                     String tableConfig)
                           throws com.google.gwt.user.client.rpc.SerializationException
Deprecated. in favour of findAssetPage(AssetPageRequest)

Description copied from interface: AssetService
Given a format, this will return assets that match. It can also be used for "pagination" by passing in start and finish row numbers.

Specified by:
listAssets in interface AssetService
Parameters:
packageUuid - The package uuid to search inside.
numRows - The number of rows to return. -1 means all.
Throws:
com.google.gwt.user.client.rpc.SerializationException

copyAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public String copyAsset(String assetUUID,
                                           String newPackage,
                                           String newName)
Description copied from interface: AssetService
Copies an asset into a new destination package.

Specified by:
copyAsset in interface AssetService
Parameters:
assetUUID - The source assetID.
newPackage - The destination package (may be the same as the current source package, but in that case the asset has to have a different name).
newName - The new name of the asset.

changeAssetPackage

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void changeAssetPackage(String uuid,
                                                  String newPackage,
                                                  String comment)
Description copied from interface: AssetService
This moves an asset to the given target package.

Specified by:
changeAssetPackage in interface AssetService

promoteAssetToGlobalArea

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void promoteAssetToGlobalArea(String uuid)
Description copied from interface: AssetService
Prompt an asset into Global area.

Specified by:
promoteAssetToGlobalArea in interface AssetService
Parameters:
uuid - The source assetID.

buildAssetSource

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public String buildAssetSource(RuleAsset asset)
                        throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This will return the effective source for an asset (in DRL). Used as an aid for debugging.

Specified by:
buildAssetSource in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

renameAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public String renameAsset(String uuid,
                                             String newName)
Description copied from interface: AssetService
Rename an asset.

Specified by:
renameAsset in interface AssetService

archiveAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void archiveAsset(String uuid)
Specified by:
archiveAsset in interface AssetService

validateAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public BuilderResult validateAsset(RuleAsset asset)
                            throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This will build the asset and return any build results (errors). This is only to report on the results - it will generally not store any state or apply any changed.

Specified by:
validateAsset in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

unArchiveAsset

public void unArchiveAsset(String uuid)
Specified by:
unArchiveAsset in interface AssetService

archiveAssets

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void archiveAssets(String[] uuids,
                                             boolean value)
Description copied from interface: AssetService
Archive assets based on uuid

Specified by:
archiveAssets in interface AssetService

removeAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void removeAsset(String uuid)
Description copied from interface: AssetService
Remove an asset based on uuid

Specified by:
removeAsset in interface AssetService

removeAssets

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void removeAssets(String[] uuids)
Description copied from interface: AssetService
Remove assets based on uuid

Specified by:
removeAssets in interface AssetService

findAssetPage

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public PageResponse<AssetPageRow> findAssetPage(AssetPageRequest request)
                                         throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
Supports filtering and pagination.

Specified by:
findAssetPage in interface AssetService
Parameters:
request - never null, contains filter and pagination values
Returns:
never null, contains the List of AssetPageRow
Throws:
com.google.gwt.user.client.rpc.SerializationException

quickFindAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public PageResponse<QueryPageRow> quickFindAsset(QueryPageRequest request)
                                          throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This will quickly return a list of assets

Specified by:
quickFindAsset in interface AssetService
Parameters:
request - The parameters for the search
Throws:
com.google.gwt.user.client.rpc.SerializationException

quickFindAsset

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public TableDataResult quickFindAsset(String searchText,
                                                         boolean searchArchived,
                                                         int skip,
                                                         int numRows)
                               throws com.google.gwt.user.client.rpc.SerializationException
Deprecated. in favour of quickFindAsset(QueryPageRequest)

Description copied from interface: AssetService
This will quickly return a list of assets

Specified by:
quickFindAsset in interface AssetService
Throws:
com.google.gwt.user.client.rpc.SerializationException

lockAsset

@Restrict(value="#{identity.loggedIn}")
public void lockAsset(String uuid)
Description copied from interface: AssetService
Locks the asset, if a lock already exists this over writes it.

Specified by:
lockAsset in interface AssetService

unLockAsset

@Restrict(value="#{identity.loggedIn}")
public void unLockAsset(String uuid)
Description copied from interface: AssetService
Unlocks the asset.

Specified by:
unLockAsset in interface AssetService

queryFullText

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public TableDataResult queryFullText(String text,
                                                        boolean seekArchived,
                                                        int skip,
                                                        int numRows)
                              throws com.google.gwt.user.client.rpc.SerializationException
Deprecated. in favour of ServiceImplementation.queryFullText(QueryPageRequest)

Description copied from interface: AssetService
Runs a full text search using JCR.

Specified by:
queryFullText in interface AssetService
Returns:
Throws:
com.google.gwt.user.client.rpc.SerializationException

addToDiscussionForAsset

@Restrict(value="#{identity.loggedIn}")
public List<DiscussionRecord> addToDiscussionForAsset(String assetId,
                                                               String comment)
Description copied from interface: AssetService
Append a discussion item for the current user.

Specified by:
addToDiscussionForAsset in interface AssetService

clearAllDiscussionsForAsset

@Restrict(value="#{identity.loggedIn}")
public void clearAllDiscussionsForAsset(String assetId)
Description copied from interface: AssetService
Only for admins, they can nuke it from orbit to clear it out

Specified by:
clearAllDiscussionsForAsset in interface AssetService

loadDiscussionForAsset

@Restrict(value="#{identity.loggedIn}")
public List<DiscussionRecord> loadDiscussionForAsset(String assetId)
Description copied from interface: AssetService
Return a list of discussion items for a given asset...

Specified by:
loadDiscussionForAsset in interface AssetService

changeState

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void changeState(String uuid,
                                           String newState)
Role-based Authorization check: This method can be accessed if user has following permissions: 1. The user has a Analyst role and this role has permission to access the category which the asset belongs to. Or. 2. The user has a package.developer role or higher (i.e., package.admin) and this role has permission to access the package which the asset belongs to.

Specified by:
changeState in interface AssetService
Parameters:
uuid - The UUID of the asset we are tweaking.
newState - The new state to set. It must be valid in the repo.

changePackageState

@WebRemote
@Restrict(value="#{identity.loggedIn}")
public void changePackageState(String uuid,
                                                  String newState)
Description copied from interface: AssetService
This will change the state of package.

Specified by:
changePackageState in interface AssetService
Parameters:
uuid - The UUID of the asset we are tweaking.

getAssetLockerUserName

@Restrict(value="#{identity.loggedIn}")
public String getAssetLockerUserName(String uuid)
Description copied from interface: AssetService
Returns the lockers user name

Specified by:
getAssetLockerUserName in interface AssetService
Returns:
Lockers user name or null if there is no lock.

getAssetCount

@Restrict(value="#{identity.loggedIn}")
public long getAssetCount(AssetPageRequest request)
                   throws com.google.gwt.user.client.rpc.SerializationException
Description copied from interface: AssetService
This will return the number of Assets matching the given criteria

Specified by:
getAssetCount in interface AssetService
Returns:
Throws:
com.google.gwt.user.client.rpc.SerializationException


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.