|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteios.core.BasicItem<D>
org.proteios.core.OwnedItem<ProjectData>
org.proteios.core.Project
public class Project
This class is used to represent projects. A project is used to collect items of particular interest in one place. Users and groups can also be granted access to projects, allowing everyone easy access to shared items within the project.
While working with Proteios it is possible to set one project as the active project. This enables some useful functionality in the core:
Shareable item the user creates is automatically shared to
the project.
It is also possible to add an item to other projects, or remove it completely
from all projects. Every member of a project has a special
project permission which gives the highest permission for
accessing items in the project. Normally this permission is
Permission.USE. One person might be assigned administrator of the
project and given higher permissions.
Items may also be given a permission within the project. The normal is to
give full access, but it may also be set to for example
Permission.READ. Then, not even the project administrator will get
more than read permissions to the item. This feature can for example be used
when a project needs to access data from a user that is not a member of the
project.
Role,
Project,
SessionControl.setActiveProject(Project)| Field Summary | |
|---|---|
static Item |
TYPE
The type of item represented by this class. |
| Fields inherited from interface org.proteios.core.Nameable |
|---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
| Method Summary | |
|---|---|
int |
fetchProjectDirectoryId()
Fetches the project directory id. |
static Project |
getById(DbControl dc,
int id)
Get a Project item when you know the ID. |
String |
getDescription()
Get the description for the item. |
ItemQuery<Group> |
getGroups()
Get a query that returns the groups that are members of this project. |
String |
getName()
Get the name of the item. |
Set<Permission> |
getPermissions(Group group)
Get the permissions for a group in this project. |
Set<Permission> |
getPermissions(User user)
Get the permissions for a user in this project. |
Directory |
getProjectDirectory()
|
int |
getProjectType()
|
static ItemQuery<Project> |
getQuery()
Get a query configured to retrieve projects. |
Item |
getType()
Get the type of item represented by the object. |
ItemQuery<User> |
getUsers()
Get a query that returns the users that are members of this project. |
boolean |
isClosed()
|
boolean |
isRemoved()
Check if the removed flag is set for this item. |
boolean |
isUsed()
Always return FALSE. |
void |
setClosed(boolean closed)
|
void |
setDescription(String description)
Set the description for the item. |
void |
setName(String name)
Set the name of the item. |
void |
setPermissions(Group group,
Set<Permission> permissions)
Grant a group permissions to this project. |
void |
setPermissions(User user,
Set<Permission> permissions)
Grant a user permissions to this project. |
void |
setProjectDirectory(Directory projectDirectory)
|
void |
setProjectType(int projectType)
|
void |
setRemoved(boolean removed)
Set the removed flag for this item. |
| Methods inherited from class org.proteios.core.OwnedItem |
|---|
getOwner, setOwner |
| Methods inherited from class org.proteios.core.BasicItem |
|---|
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.proteios.core.Identifiable |
|---|
getId, getVersion |
| Methods inherited from interface org.proteios.core.AccessControlled |
|---|
checkPermission, hasPermission |
| Field Detail |
|---|
public static final Item TYPE
Item.PROJECT,
getType()| Method Detail |
|---|
public static Project getById(DbControl dc,
int id)
throws ItemNotFoundException,
PermissionDeniedException,
BaseException
Project item when you know the ID.
dc - The DbControl which will be used for permission
checking and database access.id - The ID of the item to load
Project item
ItemNotFoundException - If an item with the specified ID is not
found
PermissionDeniedException - If the logged in user doesn't have
Permission.READ permission to the item
BaseException - If there is another errorpublic static ItemQuery<Project> getQuery()
ItemQuery objectpublic Item getType()
IdentifiableItem enumeration.
getType in interface Identifiablepublic int getProjectType()
public void setProjectType(int projectType)
public String getName()
Nameable
getName in interface NameableString with the name of the item
public void setName(String name)
throws PermissionDeniedException,
InvalidDataException
NameableNameable.MAX_NAME_LENGTH constant.
setName in interface Nameablename - The new name for the item
PermissionDeniedException - If the logged in user doesn't
have write permission
InvalidDataException - If the name is null or longer
than specified by the Nameable.MAX_NAME_LENGTH constantpublic String getDescription()
Nameable
getDescription in interface NameableString with a description of the item
public void setDescription(String description)
throws PermissionDeniedException,
InvalidDataException
NameableNameable.MAX_DESCRIPTION_LENGTH constant.
setDescription in interface Nameabledescription - The new description for the item
PermissionDeniedException - If the logged in user doesn't
have write permission
InvalidDataException - If the description longer
than specified by the Nameable.MAX_DESCRIPTION_LENGTH constantpublic boolean isRemoved()
Removable
isRemoved in interface Removable
public void setRemoved(boolean removed)
throws PermissionDeniedException
Removable
setRemoved in interface Removableremoved - TRUE if the item should be flagged as removed,
FALSE otherwise
PermissionDeniedException - If the logged in user doesn't
have Permission.DELETE permission for setting the flag
to TRUE or Permission.WRITE permission for setting the
flag to FALSE
public boolean isUsed()
throws BaseException
isUsed in class BasicItem<ProjectData>BaseException
public void setPermissions(User user,
Set<Permission> permissions)
throws PermissionDeniedException,
InvalidDataException
Set
or null to remove all permissions for the user.
user - The Userpermissions - The permissions to grant, or null to revoke all
permissions
PermissionDeniedException - If the logged in user doesn't have
Permission.WRITE permission for the project
InvalidDataException - If the user is nullPermission
public Set<Permission> getPermissions(User user)
throws InvalidDataException
user - The User for which we want to get the
permission
Set containing the granted permissions, or an
empty set if no permissions have been granted
InvalidDataException - If the user is nullPermission
public ItemQuery<User> getUsers()
throws BaseException
BaseExceptionUser.getQuery()
public void setPermissions(Group group,
Set<Permission> permissions)
throws PermissionDeniedException,
InvalidDataException,
BaseException
Set
or null to remove all permissions for the group. To share to the
Group.EVERYONE group Permission.SHARE_TO_EVERYONE is
required.
group - The Grouppermissions - The permissions to grant, or null to revoke all
permissions
PermissionDeniedException - If the logged in user doesn't have
Permission.WRITE permission for the project
InvalidDataException - If the group is null
BaseException - If there is another errorPermission
public Set<Permission> getPermissions(Group group)
throws InvalidDataException
group - The Group for which we want to get the
permission
EnumSet containing the granted permissions, or
an empty set if no permissions have been granted
InvalidDataException - If the group is nullPermissionpublic ItemQuery<Group> getGroups()
Group.getQuery()public int fetchProjectDirectoryId()
public Directory getProjectDirectory()
public void setProjectDirectory(Directory projectDirectory)
public boolean isClosed()
public void setClosed(boolean closed)
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||