|
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<D>
org.proteios.core.SharedItem<DirectoryData>
org.proteios.core.Directory
public class Directory
This is used to represent directory items. Directories can be used to group
File:s into more manageable compartments. Directories can be
organised into an arbitrarily deep tree-like structure. For each directory no
two sub-directories may have the same name, and no two files may have the
same name. However, it is legal for a file to have the same name as a
directory.
| Field Summary | |
|---|---|
static String |
HOME
The id for the Directory item representing the home
directory. |
static String |
ROOT
The id for the Directory item representing the root. |
static String |
TEMPLATE
The id for the Directory item representing the template
directory. |
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 | |
|---|---|
static boolean |
exists(DbControl dc,
Directory directory,
String subdirectoryName)
Checks if a subdirectory with the specified name exists in a directory. |
Date |
getCreated()
|
String |
getDescription()
Get the description for the item. |
ItemQuery<File> |
getFileQuery()
|
String |
getName()
Get the name of the item. |
Directory |
getParent()
Get the parent directory of this directory. |
Path |
getPath()
Get the complete path to this directory. |
Project |
getProjectDirectoryProject()
Returns the project if this directory is assigned to one, else null is returned. |
static ItemQuery<Directory> |
getQuery()
Get a query configured to retrieve directories. |
ItemQuery<Directory> |
getSubDirectories()
Get a query that return subdirectories of this directory. |
String |
getSystemId()
Get the system id for the item. |
Item |
getType()
Get the type of item represented by the object. |
boolean |
isHomeDirectory()
Returns TRUE if this directory is a subdirectory to HOME. |
boolean |
isProjectDirectory()
Returns TRUE if this directory is assigned to a project. |
boolean |
isRemoved()
Check if the removed flag is set for this item. |
boolean |
isRootDirectory()
Returns TRUE if this directories parent equals null and therfore is a root directory. |
boolean |
isSystemItem()
Check if the item is a system item or not. |
boolean |
isUsed()
Check that: no files are in the directory no subdirectories are in the directory no user has this directory as the home directory |
void |
setDescription(String description)
Set the description for the item. |
void |
setName(String name)
Set the name of the item. |
void |
setParent(Directory parent)
Set the parent directory of this directory. |
void |
setRemoved(boolean removed)
Set the removed flag for this item. |
| Methods inherited from class org.proteios.core.SharedItem |
|---|
getItemKey, getProjectKey, isShared, setItemKey, setProjectKey |
| 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 |
| Methods inherited from interface org.proteios.core.Ownable |
|---|
getOwner, setOwner |
| Field Detail |
|---|
public static final Item TYPE
Item.DIRECTORY,
getType()public static final String ROOT
Directory item representing the root.
public static final String HOME
Directory item representing the home
directory. The home directory is the parent directory for the user's home
directories.
public static final String TEMPLATE
Directory item representing the template
directory. The template directory is used to create the directory
structure for new users.
| Method Detail |
|---|
public static boolean exists(DbControl dc,
Directory directory,
String subdirectoryName)
throws BaseException
dc - The DbControl which will be used for permission
checking and database access.directory - The directory to check insubdirectoryName - The name of the subdirectory to look for
BaseException - If there is an errorpublic static ItemQuery<Directory> getQuery()
ItemQuery objectpublic Date getCreated()
public ItemQuery<File> getFileQuery()
ItemQuery of files in this directorypublic 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 Item getType()
IdentifiableItem enumeration.
getType in interface Identifiablepublic 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 FALSEpublic String getSystemId()
SystemItem
getSystemId in interface SystemItempublic boolean isSystemItem()
SystemItem
isSystemItem in interface SystemItem
public boolean isUsed()
throws BaseException
isUsed in class BasicItem<DirectoryData>BaseException - If there is an error.
public Directory getParent()
throws PermissionDeniedException,
BaseException
Directory, or null if this directory
is a root directory
PermissionDeniedException - This exception is thrown if the logged
in user doesn't have READ permission to
the items
BaseException - If there is another error
public void setParent(Directory parent)
throws PermissionDeniedException,
InvalidDataException
parent - The new parent directory. Cant be null.
PermissionDeniedException - If the logged in user doesn't have
Permission.WRITE permission to this directory or
Permission.USE permission to the parent directory
permission for the parent directory
InvalidDataException - If parent is null or is a subdirectory to
this directorypublic boolean isRootDirectory()
public boolean isHomeDirectory()
HOME.
public boolean isProjectDirectory()
public Path getPath()
Path objectpublic ItemQuery<Directory> getSubDirectories()
ItemQuery objectpublic Project getProjectDirectoryProject()
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||