Novell exteNd
Director 5.2 API

com.sssw.cm.api
Interface EbiDirectory

All Superinterfaces:
Cloneable, Comparable, EbiCmElement, EbiDirectoryEntry, EbiElement, EbiFrameworkElement, EbiSecurableElement, Serializable
All Known Subinterfaces:
EbiDocCategory, EbiDocFolder

public interface EbiDirectory
extends EbiDirectoryEntry

Objects implementing this interface represent Directories (collections of items which are leaf nodes or other Directories).


Field Summary
static int DIR_TYPE_APP_FIRST
          The first value in the set of application-specific Directory types.
static int DIR_TYPE_DEFAULT
          The default Directory type
static int DIR_TYPE_ROOT
          The "root" directory type, meaning the Directory has no parent(s).
static int DIR_TYPE_SYS1
          The first system-reserved Directory type bit.
static int DIR_TYPE_SYS2
          The second system-reserved Directory type bit.
static int DIR_TYPE_SYS3
          The third system-reserved Directory type bit.
static int DIR_TYPE_SYS4
          The fourth system-reserved Directory type bit.
static int DIR_TYPE_SYS5
          The fifth system-reserved Directory type bit.
static int DIR_TYPE_SYSTEM
          The "system" Directory type.
static int OP_ADD_SUBDIR
          The op-code for the "add subdirectory" operation.
 
Fields inherited from interface com.sssw.cm.api.EbiDirectoryEntry
OP_ADD_LEAF_NODE
 
Fields inherited from interface com.sssw.cm.api.EbiCmElement
OP_COPY, OP_MOVE, OP_REMOVE, OP_UPDATE
 
Method Summary
 Collection getChildren(EbiContext context, boolean getSubdirectories, boolean getDocuments, boolean recurseSubdirectories)
          Lists all the child Elements of this Directory.
 Collection getChildren(EbiContext context, boolean checkAccess, boolean getSubdirectories, boolean getDocuments, boolean recurseSubdirectories)
          Lists all the child Elements of this Directory, optionally filtering out any inaccessible items.
 int getCount(EbiContext context, boolean countSubdirs, boolean countDocs, boolean countAccessibleOnly)
          Calculates the number of entries in the directory.
 String getDescription()
          Gets the description of this Directory.
 int getDirectoryType()
          Gets the type of the Directory
 EbiDocument getDocument(EbiContext context, String relativePath)
          Given a relative path to a Document, retrieves it.
 EbiDirectoryEntry getEntry(EbiContext context, String relativePath, String elementType)
          Given a relative path to a Directory Entry, retrieves it.
 String getParentID()
          Gets the ID of the parent directory for this directory
 boolean isRoot()
          Determines if this Directory is the root one (i.e.
 boolean isSystemDirectory()
          Determines if the Directory is a system one.
 boolean isTopLevel()
          Determines if the Directory is a top-level one, i.e.
 int publishAll(EbiContext context, boolean recursive, int versionID)
          Publishes all the Documents contained in this Directory.
 void removeChildren(EbiContext context, boolean removeSubdirectories, boolean removeDocuments)
          Removes all the child Elements of this Directory.
 boolean removeDocument(EbiContext context, String relativePath)
          Given a relative path to a Document, removes it.
 boolean removeEntry(EbiContext context, String relativePath, String elementType)
          Given a relative path to a Directory Entry, removes it.
 void setDescription(String description)
          Sets the description of this Directory.
 void setDirectoryType(int dirType)
          Sets the Directory type.
 void setParentID(String parentID)
          Assigns a new parent to the directory.
 int unpublishAll(EbiContext context, boolean recursive)
          Unpublishes all the Documents contained in this Directory.
 
Methods implemented from interface com.sssw.cm.api.EbiDirectoryEntry
exists, getContentManager, getID, getKey, getName, getParentDirectory, getRepositoryID, getURL, getURLDontThrow, hasChildren, hasNameChanged, isChildOf, isDescendantOf, isDescendantOf, isDirectory, isInDefaultRepository, isInSystemRepository, remove, removeChildren, setID, setID, setLastModified, setName, setRepositoryID, update
 
Methods implemented from interface com.sssw.fw.api.EbiSecurableElement
getAcl, getObjectID, isUserAuthorized, removeAcl, setAcl
 
Methods implemented from interface com.sssw.cm.api.EbiCmElement
fromXML, toXML, validateOperation
 
Methods implemented from interface java.lang.Comparable
compareTo
 
Methods implemented from interface com.sssw.fw.api.EbiFrameworkElement
getElementUUID, getLastModified, getLastModifiedBy, isEqualTo, isReadOnly, resetReadOnly, setLastModified, setLastModifiedBy, setReadOnly
 

Field Detail

DIR_TYPE_DEFAULT

public static final int DIR_TYPE_DEFAULT
The default Directory type
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_SYSTEM

public static final int DIR_TYPE_SYSTEM
The "system" Directory type. The following rules apply to the system Directories:

See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_ROOT

public static final int DIR_TYPE_ROOT
The "root" directory type, meaning the Directory has no parent(s). See also the comments on DIR_TYPE_SYSTEM.
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_SYS1

public static final int DIR_TYPE_SYS1
The first system-reserved Directory type bit. This type is reserved for use by the Content Management System. Application developers are encouraged to use the DIR_TYPE_APP_* directory types defined on this interface.
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_SYS2

public static final int DIR_TYPE_SYS2
The second system-reserved Directory type bit. This type is reserved for use by the Content Management System. Application developers are encouraged to use the DIR_TYPE_APP_* Directory types defined on this interface.
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_SYS3

public static final int DIR_TYPE_SYS3
The third system-reserved Directory type bit. This type is reserved for use by the Content Management System. Application developers are encouraged to use the DIR_TYPE_APP_* Directory types defined on this interface.
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_SYS4

public static final int DIR_TYPE_SYS4
The fourth system-reserved Directory type bit. This type is reserved for use by the Content Management System. Application developers are encouraged to use the DIR_TYPE_APP_* Directory types defined on this interface.
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_SYS5

public static final int DIR_TYPE_SYS5
The fifth system-reserved Directory type bit. This type is reserved for use by the Content Management System. Application developers are encouraged to use the DIR_TYPE_APP_* Directory types defined on this interface.
See Also:
EbiDirectory.getDirectoryType()

DIR_TYPE_APP_FIRST

public static final int DIR_TYPE_APP_FIRST
The first value in the set of application-specific Directory types. The API users are allowed to create Directories (Folders and Categories) of type other than DIR_TYPE_DEFAULT, which are specific to their applications.

The Directory types are bitwise masks uniquely identifying each individual Directory type. A specific Directory may therefore combine several masks into a more complex Directory type:

      // Use DIR_TYPE_APP_FIRST as the seed value and derive
      // other application-specific types
      public static final int MYAPP_DIR_TYPE1 = EbiDirectory.DIR_TYPE_APP_FIRST;
      public static final int MYAPP_DIR_TYPE2 = MYAPP_DIR_TYPE1 * 2;
      public static final int MYAPP_DIR_TYPE3 = MYAPP_DIR_TYPE2 * 2;

      // Create a folder whose type is a combination of two
      // application-specific types.
      int type = MYAPP_DIR_TYPE1 | MYAPP_DIR_TYPE2;
      EbiDocFolder myFld = contentMgr.addFolder(
         ctx,                 // context
         parentFolder,        // parent folder
         "myFolder",          // folder name
         type,                // folder type
         "my test folder",    // description
         null);               // ACL

      // ... do something ...

      // Find the folder we are interested in
      myFld = contentMgr.getFolder(ctx, parentFolder, "myFolder");

      // Get the folder type
      type = myFld.getDirectoryType();

      // Now, test the individual directory type bits
      if ((type & MYAPP_DIR_TYPE1) > 0)
         System.out.println("myFolder is of type 'MYAPP_DIR_TYPE1'");
      if ((type & MYAPP_DIR_TYPE2) > 0)
         System.out.println("myFolder is of type 'MYAPP_DIR_TYPE2'");
 

OP_ADD_SUBDIR

public static final int OP_ADD_SUBDIR
The op-code for the "add subdirectory" operation. E.g. for a Folder, this would imply adding a Subfolder.
Method Detail

isRoot

public boolean isRoot()
Determines if this Directory is the root one (i.e. the one that has no parent). The root Directory is the origin of the hierarchy of Directories.
Returns:
true if this is the root Directory, false otherwise

isSystemDirectory

public boolean isSystemDirectory()
Determines if the Directory is a system one.

isTopLevel

public boolean isTopLevel()
                   throws EboUnrecoverableSystemException
Determines if the Directory is a top-level one, i.e. one whose parent Directory is the root.

getDirectoryType

public int getDirectoryType()
Gets the type of the Directory
Returns:
the Directory type

getDescription

public String getDescription()
Gets the description of this Directory.
Returns:
the description; null if not set

setDescription

public void setDescription(String description)
Sets the description of this Directory.
Parameters:
description - the description for the Directory; an 'update' method needs to be called for this change to take effect
See Also:
EbiContentMgmtDelegate.updateCategory(EbiContext, EbiDocCategory), EbiContentMgmtDelegate.updateFolder(EbiContext, EbiDocFolder)

getParentID

public String getParentID()
Gets the ID of the parent directory for this directory
Returns:
the ID of the parent; null if this is the root directory

setParentID

public void setParentID(String parentID)
Assigns a new parent to the directory. This is an equivalent of a "move" operation. The new parent ID must be an ID of a valid directory. An 'update' method needs to be called for this change to take effect
Parameters:
parentID - the parent ID
See Also:
EbiContentMgmtDelegate.updateCategory(EbiContext, EbiDocCategory), EbiContentMgmtDelegate.updateFolder(EbiContext, EbiDocFolder)

setDirectoryType

public void setDirectoryType(int dirType)
Sets the Directory type.
Parameters:
dirType - the Directory type

getDocument

public EbiDocument getDocument(EbiContext context,
                               String relativePath)
                        throws EboUnrecoverableSystemException,
                               EboSecurityException,
                               EboItemExistenceException
Given a relative path to a Document, retrieves it.
Parameters:
context - context
relativePath - a path to a Document (relative to this Directory)
Returns:
the Document or null if not found
See Also:
EbiDocument

getEntry

public EbiDirectoryEntry getEntry(EbiContext context,
                                  String relativePath,
                                  String elementType)
                           throws EboUnrecoverableSystemException,
                                  EboSecurityException,
                                  EboItemExistenceException
Given a relative path to a Directory Entry, retrieves it.
Parameters:
context - context
relativePath - a path to a Directory Entry (relative to this Directory)
elementType - the type of Element to look up
Returns:
the Directory Entry or null if not found

removeDocument

public boolean removeDocument(EbiContext context,
                              String relativePath)
                       throws EboUnrecoverableSystemException,
                              EboSecurityException,
                              EboItemExistenceException
Given a relative path to a Document, removes it.
Parameters:
context - context
relativePath - a path to a Document (relative to this Directory)
Returns:
true if the Document was successfully removed, false if it was not found

removeEntry

public boolean removeEntry(EbiContext context,
                           String relativePath,
                           String elementType)
                    throws EboUnrecoverableSystemException,
                           EboSecurityException,
                           EboItemExistenceException
Given a relative path to a Directory Entry, removes it.
Parameters:
context - context
relativePath - a path to a Directory Entry (relative to this Directory)
elementType - the type of Element to remove
Returns:
true if the Directory Entry was successfully removed, false if it was not found

removeChildren

public void removeChildren(EbiContext context,
                           boolean removeSubdirectories,
                           boolean removeDocuments)
                    throws EboUnrecoverableSystemException,
                           EboSecurityException,
                           EboItemExistenceException
Removes all the child Elements of this Directory.
Parameters:
context - context
removeSubdirectories - remove any Subdirectories
removeDocuments - remove any Documents

getChildren

public Collection getChildren(EbiContext context,
                              boolean getSubdirectories,
                              boolean getDocuments,
                              boolean recurseSubdirectories)
                       throws EboUnrecoverableSystemException,
                              EboSecurityException
Lists all the child Elements of this Directory.
Specified by:
getChildren in interface EbiDirectoryEntry
Parameters:
context - context
getSubdirectories - if true, include any subdirectories in the listing, otherwise exclude them
getDocuments - if true, include any child Documents in the listing, otherwise exclude them
recurseSubdirectories - if true, any Subdirectories are recursed; if false, no recursion is done
Returns:
a Collection of child Directory Entries

getChildren

public Collection getChildren(EbiContext context,
                              boolean checkAccess,
                              boolean getSubdirectories,
                              boolean getDocuments,
                              boolean recurseSubdirectories)
                       throws EboUnrecoverableSystemException,
                              EboSecurityException
Lists all the child Elements of this Directory, optionally filtering out any inaccessible items.
Parameters:
context - context
checkAccess - if true, only return elements to which the user whose context is passed in, has READ access
getSubdirectories - if true, include any subdirectories in the listing, otherwise exclude them
getDocuments - if true, include any child Documents in the listing, otherwise exclude them
recurseSubdirectories - if true, any Subdirectories are recursed; if false, no recursion is done
Returns:
a Collection of child Directory Entries

publishAll

public int publishAll(EbiContext context,
                      boolean recursive,
                      int versionID)
               throws EboUnrecoverableSystemException,
                      EboSecurityException,
                      EboItemExistenceException
Publishes all the Documents contained in this Directory.
Parameters:
context - context
recursive - if true, recurse the Directory and publish Documents contained in it and any of the subdirectories
versionID - the version ID of Documents to publish; if a particular Document does not have a version with this ID, its content is not published; if version ID is -1, then the latest versions of content are published for all the Documents
Returns:
the number of published Documents

unpublishAll

public int unpublishAll(EbiContext context,
                        boolean recursive)
                 throws EboUnrecoverableSystemException,
                        EboSecurityException,
                        EboItemExistenceException
Unpublishes all the Documents contained in this Directory.
Parameters:
context - context
recursive - if true, recurse the Directory and unpublish Documents contained in it and any of its subdirectories
Returns:
the number of unpublished Documents

getCount

public int getCount(EbiContext context,
                    boolean countSubdirs,
                    boolean countDocs,
                    boolean countAccessibleOnly)
             throws EboUnrecoverableSystemException
Calculates the number of entries in the directory.
Parameters:
context - context
countSubdirs - if true, all subdirectories are counted
countDocs - if true, all docs are counted
countAccessibleOnly - if true, only the items accessible to the user whose context is passed in, are counted (in the out-of-the-box implementation, this security filtering is based on whether the user has the READ access to the items counted)
Returns:
the number of items counted
Throws:
EboUnrecoverableSystemException - on an unrecoverable system exception

Novell exteNd
Director 5.2 API