Last update: 2011-06-23

org.proteios.core
Class ProjectPermissions

java.lang.Object
  extended by org.proteios.core.ProjectPermissions

public class ProjectPermissions
extends Object

This class is used to specify permissions to share an item to projects. It is a three-step procedure:

Don't forget to commit the transaction.

Version:
2.0
Author:
Nicklas
See Also:
ProjectKey
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Constructor Summary
ProjectPermissions()
          Create a new empty object.
ProjectPermissions(ProjectKey projectKey)
          Create a new object, and initialise it with the permissions from a ProjectKey.
 
Method Summary
 void addPermissions(Project project, Set<Permission> permissions)
          Grant permissions to a project, keeping those that have already been set.
 Set<Permission> getPermissions(Project project)
          Get the permissions for a project.
 void setPermissions(Project project, Set<Permission> permissions)
          Grant permissions to a project.
 int size()
          Get the number of entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectPermissions

public ProjectPermissions()
Create a new empty object.


ProjectPermissions

public ProjectPermissions(ProjectKey projectKey)
                   throws InvalidDataException
Create a new object, and initialise it with the permissions from a ProjectKey.

Parameters:
projectKey - The project key from which we take the current permissions
Throws:
InvalidDataException - If the project key is null
Method Detail

setPermissions

public void setPermissions(Project project,
                           Set<Permission> permissions)
                    throws PermissionDeniedException,
                           InvalidDataException
Grant permissions to a project. Use an empty Set or null to remove all permissions for the project.

Parameters:
project - The Project
permissions - The permissions to grant
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.USE permission for the project
InvalidDataException - If the project is null
See Also:
Permission

addPermissions

public void addPermissions(Project project,
                           Set<Permission> permissions)
                    throws PermissionDeniedException,
                           InvalidDataException
Grant permissions to a project, keeping those that have already been set.

Parameters:
project - The Project
permissions - The permissions to grant
Throws:
PermissionDeniedException - If the logged in user doesn't have Permission.USE permission for the project
InvalidDataException - If the project is null
See Also:
Permission

getPermissions

public Set<Permission> getPermissions(Project project)
                               throws InvalidDataException
Get the permissions for a project.

Parameters:
project - The Project for which we want to get the permission
Returns:
An Set containing the granted permissions, or an empty set if no permissions have been granted
Throws:
InvalidDataException - If the project is null
See Also:
Permission

size

public int size()
Get the number of entries.


Last update: 2011-06-23