org.sakaiproject.service.legacy.alias
Interface AliasService

All Superinterfaces:
EntityProducer
All Known Implementing Classes:
BaseAliasService

public interface AliasService
extends EntityProducer

AliasService provides aliases for CHEF resources. Aliases are not case sensitive.

Version:
$Revision: 2371 $
Author:
University of Michigan, CHEF Software Development Team

Nested Class Summary
 
Nested classes inherited from class org.sakaiproject.service.legacy.entity.EntityProducer
EntityProducer.ChangeType
 
Field Summary
static String REFERENCE_ROOT
          This string starts the references to resources in this service.
static String SECURE_ADD_ALIAS
          Name for the event of adding an alias.
static String SECURE_REMOVE_ALIAS
          Name for the event of removing an alias.
static String SECURE_UPDATE_ALIAS
          Name for the event of updating an alias.
static String SERVICE_NAME
          This string can be used to find the service in the service manager.
 
Method Summary
 AliasEdit add(String id)
          Add a new alias.
 String aliasReference(String id)
          Access the internal reference which can be used to access the resource from within the system.
 boolean allowAdd()
          Check to see if the current user can add an alias.
 boolean allowEdit(String id)
          Check to see if the current user can edit this alias.
 boolean allowRemoveAlias(String alias)
          Check to see if the current user can remove this alias.
 boolean allowRemoveTargetAliases(String target)
          Check to see if the current user can remove these aliasese for this target resource reference.
 boolean allowSetAlias(String alias, String target)
          Check if the current user has permission to set this alias.
 void cancel(AliasEdit edit)
          Cancel the changes made to a AliasEdit object, and release the lock.
 void commit(AliasEdit edit)
          Commit the changes made to a AliasEdit object, and release the lock.
 int countAliases()
          Count all the aliases.
 int countSearchAliases(String criteria)
          Count all the aliases that match this criteria in id or target.
 AliasEdit edit(String id)
          Get a locked alias object for editing.
 List getAliases(int first, int last)
          Find all the aliases within the record range given (sorted by id).
 List getAliases(String target)
          Find all the aliases defined for this target.
 List getAliases(String target, int first, int last)
          Find all the aliases defined for this target, within the record range given (sorted by id).
 String getTarget(String alias)
          Find the target resource reference string associated with this alias.
 void remove(AliasEdit edit)
          Remove this alias information - it must be a user with a lock from edit().
 void removeAlias(String alias)
          Remove an alias.
 void removeTargetAliases(String target)
          Remove all aliases for this target resource reference, if any.
 List searchAliases(String criteria, int first, int last)
          Search all the aliases that match this criteria in id or target, returning a subset of records within the record range given (sorted by id).
 void setAlias(String alias, String target)
          Allocate an alias for a resource
 
Methods inherited from interface org.sakaiproject.service.legacy.entity.EntityProducer
archive, getEntity, getEntityAuthzGroups, getEntityDescription, getEntityResourceProperties, getEntityUrl, getHttpAccess, getLabel, importEntities, merge, parseEntityReference, syncWithSiteChange, willArchiveMerge, willImport
 

Field Detail

SERVICE_NAME

public static final String SERVICE_NAME
This string can be used to find the service in the service manager.


REFERENCE_ROOT

public static final String REFERENCE_ROOT
This string starts the references to resources in this service.

See Also:
Constant Field Values

SECURE_ADD_ALIAS

public static final String SECURE_ADD_ALIAS
Name for the event of adding an alias.

See Also:
Constant Field Values

SECURE_UPDATE_ALIAS

public static final String SECURE_UPDATE_ALIAS
Name for the event of updating an alias.

See Also:
Constant Field Values

SECURE_REMOVE_ALIAS

public static final String SECURE_REMOVE_ALIAS
Name for the event of removing an alias.

See Also:
Constant Field Values
Method Detail

allowSetAlias

public boolean allowSetAlias(String alias,
                             String target)
Check if the current user has permission to set this alias.

Parameters:
alias - The alias.
target - The resource reference string alias target.
Returns:
true if the current user has permission to set this alias, false if not.

setAlias

public void setAlias(String alias,
                     String target)
              throws IdUsedException,
                     IdInvalidException,
                     PermissionException
Allocate an alias for a resource

Parameters:
alias - The alias.
target - The resource reference string alias target.
Throws:
IdUsedException - if the alias is already used.
IdInvalidException - if the alias id is invalid.
PermissionException - if the current user does not have permission to set this alias.

allowRemoveAlias

public boolean allowRemoveAlias(String alias)
Check to see if the current user can remove this alias.

Parameters:
alias - The alias.
Returns:
true if the current user can remove this alias, false if not.

removeAlias

public void removeAlias(String alias)
                 throws IdUnusedException,
                        PermissionException,
                        InUseException
Remove an alias.

Parameters:
alias - The alias.
Throws:
IdUnusedException - if not found.
PermissionException - if the current user does not have permission to remove this alias.
InUseException - if the Alias object is locked by someone else.

allowRemoveTargetAliases

public boolean allowRemoveTargetAliases(String target)
Check to see if the current user can remove these aliasese for this target resource reference.

Parameters:
target - The target resource reference string.
Returns:
true if the current user can remove these aliasese for this target resource reference, false if not.

removeTargetAliases

public void removeTargetAliases(String target)
                         throws PermissionException
Remove all aliases for this target resource reference, if any.

Parameters:
target - The target resource reference string.
Throws:
PermissionException - if the current user does not have permission to remove these aliases.

getTarget

public String getTarget(String alias)
                 throws IdUnusedException
Find the target resource reference string associated with this alias.

Parameters:
alias - The alias.
Returns:
The target resource reference string associated with this alias.
Throws:
IdUnusedException - if the alias is not defined.

getAliases

public List getAliases(String target)
Find all the aliases defined for this target.

Parameters:
target - The target resource reference string.
Returns:
A list (Alias) of all the aliases defined for this target.

getAliases

public List getAliases(String target,
                       int first,
                       int last)
Find all the aliases defined for this target, within the record range given (sorted by id).

Parameters:
target - The target resource reference string.
first - The first record position to return.
last - The last record position to return.
Returns:
A list (Alias) of all the aliases defined for this target, within the record range given (sorted by id).

getAliases

public List getAliases(int first,
                       int last)
Find all the aliases within the record range given (sorted by id).

Parameters:
first - The first record position to return.
last - The last record position to return.
Returns:
A list (Alias) of all the aliases within the record range given (sorted by id).

countAliases

public int countAliases()
Count all the aliases.

Returns:
The count of all aliases.

searchAliases

public List searchAliases(String criteria,
                          int first,
                          int last)
Search all the aliases that match this criteria in id or target, returning a subset of records within the record range given (sorted by id).

Parameters:
criteria - The search criteria.
first - The first record position to return.
last - The last record position to return.
Returns:
A list (Alias) of all the aliases matching the criteria, within the record range given (sorted by id).

countSearchAliases

public int countSearchAliases(String criteria)
Count all the aliases that match this criteria in id or target.

Returns:
The count of all aliases matching the criteria.

aliasReference

public String aliasReference(String id)
Access the internal reference which can be used to access the resource from within the system.

Parameters:
id - The alias id string.
Returns:
The the internal reference which can be used to access the resource from within the system.

allowAdd

public boolean allowAdd()
Check to see if the current user can add an alias.

Returns:
true if the current user can add an alias, false if not.

add

public AliasEdit add(String id)
              throws IdInvalidException,
                     IdUsedException,
                     PermissionException
Add a new alias. Must commit() to make official, or cancel() when done!

Parameters:
id - The alias id.
Returns:
A locked AliasEdit object (reserving the id).
Throws:
IdInvalidException - if the alias id is invalid.
IdUsedException - if the alias id is already used.
PermissionException - if the current user does not have permission to add an alias.

allowEdit

public boolean allowEdit(String id)
Check to see if the current user can edit this alias.

Parameters:
id - The alias id string.
Returns:
true if the current user can edit this alias, false if not.

edit

public AliasEdit edit(String id)
               throws IdUnusedException,
                      PermissionException,
                      InUseException
Get a locked alias object for editing. Must commit() to make official, or cancel() (or remove()) when done!

Parameters:
id - The alias id string.
Returns:
An AliasEdit object for editing.
Throws:
IdUnusedException - if not found.
PermissionException - if the current user does not have permission to mess with this alias.
InUseException - if the Alias object is locked by someone else.

commit

public void commit(AliasEdit edit)
Commit the changes made to a AliasEdit object, and release the lock. The AliasEdit is disabled, and not to be used after this call.


cancel

public void cancel(AliasEdit edit)
Cancel the changes made to a AliasEdit object, and release the lock. The AliasEdit is disabled, and not to be used after this call.


remove

public void remove(AliasEdit edit)
            throws PermissionException
Remove this alias information - it must be a user with a lock from edit(). The AliasEdit is disabled, and not to be used after this call.

Parameters:
edit - The locked AliasEdit object to remove.
Throws:
PermissionException - if the current user does not have permission to remove this alias.