Oracle Content Management SDK

oracle.ifs.beans
Class Folder

java.lang.Object
  |
  +--oracle.ifs.beans.LibraryObject
        |
        +--oracle.ifs.beans.TieLibraryObject
              |
              +--oracle.ifs.beans.PublicObject
                    |
                    +--oracle.ifs.beans.TiePublicObject
                          |
                          +--oracle.ifs.beans.Folder
All Implemented Interfaces:
IfsEventHandler, LibraryObjectInterface, PublicObjectInterface, Traceable
Direct Known Subclasses:
TieFolder

public class Folder
extends TiePublicObject

The Folder class represents Folders in the iFS server. A Folder can contain references to any PublicObjects.

To access PublicObjects in a folder use either the Java Beans compliant getItems() methods, or the cursor based openItems(), nextItem(), closeItems() methods.

Once the items have been fetched they will be cached locally. The local cache can be cleared by a call to resetItems.

The following code fragment shows how to access a folder's items:
//get the home folder
Folder f = sess.getHomeFolder();
//sort on 'NAME'
String[] sort_attributes = {"NAME"};
//sort will be ascending
boolean [] sort_orders = {true};
SortSpecificiation sort = new SortSpecification();
sort.addSortQualifier(sort_attributes[0], sort_orders[0]);
f.setSortSpecification(sort);
//get the items
PublicObject items[] = f.getItems();


Field Summary
static java.lang.String CLASS_NAME
          This class name for this class.
static int SYSTEMOPTIONVALUE_FOLDER_DEPTH_DEEPEST
          FolderDepth option for Folder.free(def).
static int SYSTEMOPTIONVALUE_FOLDER_DEPTH_MUST_BE_EMPTY
          FolderDepth option for Folder.free(def).
static int SYSTEMOPTIONVALUE_FOLDER_DEPTH_NONE
          FolderDepth option for Folder.free(def).
 
Fields inherited from class oracle.ifs.beans.PublicObject
ACL_ATTRIBUTE, ADMINISTRATIONGROUP_ATTRIBUTE, CREATEDATE_ATTRIBUTE, CREATOR_ATTRIBUTE, DELETOR_ATTRIBUTE, DESCRIPTION_ATTRIBUTE, EXPIRATIONDATE_ATTRIBUTE, FAMILY_ATTRIBUTE, FLAGS_ATTRIBUTE, LASTMODIFIER_ATTRIBUTE, LASTMODIFYDATE_ATTRIBUTE, LOCKEDFORSESSION_ATTRIBUTE, LOCKOBJECT_ATTRIBUTE, LOCKSTATE_ATTRIBUTE, LOCKSTATE_HARDLOCK, LOCKSTATE_SESSIONLOCK, LOCKSTATE_SOFTLOCK, LOCKSTATE_UNLOCK, LOCKSTATE_USERLOCK, NAME_ATTRIBUTE, OWNER_ATTRIBUTE, POLICYBUNDLE_ATTRIBUTE, PROPERTYBUNDLE_ATTRIBUTE, RESOLVEDPUBLICOBJECT_ATTRIBUTE, SECURINGPUBLICOBJECT_ATTRIBUTE
 
Method Summary
 void addItem(PublicObject item)
          Adds an item to the folder.
 void addItem(PublicObject item, FolderRelationshipDefinition def)
          Adds an item to the folder.
 void addItems(PublicObject[] objs)
          Adds an array of PublicObjects to this Folder.
 boolean checkExistenceOfPublicObjectByPath(java.lang.String path)
          Determines whether an item exists at the specified path relative to this Folder.
 PublicObject findPublicObjectByPath(java.lang.String path)
          Finds an item descending from a Folder, as specified by a file-system style path.
 int getItemCount()
          Gets the number of items in this Folder, including both documents and subfolders.
 PublicObject[] getItems()
          Gets an array containing this Folder's items.
 SortSpecification getSortSpecification()
          Gets the SortSpecification used for getting items from this folder.
 int getSubfolderCount()
          Gets the count of subfolders in this folder.
 void handleEvent(IfsEvent event)
          Handles the specified event.
 boolean hasSubfolders()
          Gets indication as to whether this folder has any subfolders in it.
 void lock(LockObjectDefinition ldef, FolderDefinition fdef)
          Constructs a new lockobject from the definition and sets it as the value of the LockObject attribute on the PO.
 void lock(LockObject lobj, FolderDefinition fdef)
          Sets the value of the LockObject attribute of the folder.
 void moveItems(PublicObject[] objs, Folder addToFolder)
          Moves the specified array of PublicObjects from this Folder to the passed Folder.
 void removeItem(PublicObject item)
          Removes the first reference to an item from this Folder without altering the item.
 void removeItem(PublicObject item, PublicObjectDefinition def)
          Removes the first reference to an item from this Folder without altering the item.
 void removeItems(PublicObject[] objs)
          Removes the passed array of PublicObjects from this Folder.
 void resetItems()
          Clears locally cached items, including any open cursor.
 void setSortSpecification(SortSpecification spec)
          Sets the SortSpecification used for getting items from this folder.
 void unlock(FolderDefinition fdef)
          Releases the lock on the object.
 
Methods inherited from class oracle.ifs.beans.PublicObject
addCategory, addRelationship, checkEffectiveAccess, checkEffectiveAccess, copy, getAcl, getAllFolderPaths, getAllFolderPaths, getAnyFolderPath, getAnyFolderPath, getCategories, getCategories, getCategories, getCategories, getCreateDate, getCreator, getDefaultAccessLevel, getDescription, getEffectiveAccessLevel, getEffectiveAccessLevel, getExpirationDate, getFamily, getFlags, getFolderReferences, getFolderReferencesSortSpecification, getLastModifier, getLastModifyDate, getLeftwardRelationshipObjects, getLeftwardRelationshipObjects, getLeftwardRelationships, getLeftwardRelationships, getLockObject, getLockState, getLockStateLabel, getOwner, getPolicyBundle, getPropertyBundle, getResolvedPublicObject, getRightwardRelationshipObjects, getRightwardRelationshipObjects, getRightwardRelationships, getRightwardRelationships, getSecuringPublicObject, grantAccess, hasNameAttribute, isLocked, isLockedForSession, isLockedForSessionByCurrentSession, isVersionable, isVersioned, lock, lock, lock, putPolicy, putProperty, putProperty, removeAllPolicies, removeAllProperties, removePolicy, removePolicy, removeProperty, removeRelationship, revokeAccess, revokeAllAccess, setAcl, setDescription, setExpirationDate, setFlags, setFolderReferencesSortSpecification, setOwner, setPolicyBundle, setPropertyBundle, setSecuringPublicObject, toLockStateLabel, toLockStateLabel, toLockStateLabel, unlock, updateLock
 
Methods inherited from class oracle.ifs.beans.LibraryObject
equals, free, free, getAttribute, getAttributeByUpperCaseName, getAttributes, getAttributesByUpperCaseNames, getClassId, getClassObject, getDefinition, getId, getLabel, getName, getSession, invokeServerMethod, isInstanceOf, isTraced, lookupInstanceLabel, postEvent, postEvent, renderAsReader, renderAsStream, setAttribute, setAttribute, setAttributes, setAttributes, setName, toString, trace, update
 
Methods inherited from interface oracle.ifs.common.LibraryObjectInterface
getId
 
Methods inherited from interface oracle.ifs.common.Traceable
getTraceLogger, isTraced, trace
 

Field Detail


CLASS_NAME

public static final java.lang.String CLASS_NAME
This class name for this class. Useful for methods that take a class name argument.

SYSTEMOPTIONVALUE_FOLDER_DEPTH_NONE

public static final int SYSTEMOPTIONVALUE_FOLDER_DEPTH_NONE
FolderDepth option for Folder.free(def). Frees only the folder, no referenced objects are freed.
FolderDepth option for Folder.lock(def) and Folder.unlock(def) Locks/UnLocks only the folder and no referenced objects are affected

SYSTEMOPTIONVALUE_FOLDER_DEPTH_DEEPEST

public static final int SYSTEMOPTIONVALUE_FOLDER_DEPTH_DEEPEST
FolderDepth option for Folder.free(def). Frees all objects referenced by this folder. If those objects are folders, the DEEPEST option is passed on to them (causing a deep free cascade).
FolderDepth option for Folder.lock(def) and Folder.unlock(def) The folder as well as all the referenced objects are locked/unlocked

SYSTEMOPTIONVALUE_FOLDER_DEPTH_MUST_BE_EMPTY

public static final int SYSTEMOPTIONVALUE_FOLDER_DEPTH_MUST_BE_EMPTY
FolderDepth option for Folder.free(def). When this option is set, the free is forbidden if the folder is not empty.
Method Detail

resetItems

public void resetItems()
                throws IfsException
Clears locally cached items, including any open cursor. Subsequent calls to getItems will re-fetch items from the server.
Throws:
IfsException - if closing the folder cursor fails.

getSortSpecification

public SortSpecification getSortSpecification()
                                       throws IfsException
Gets the SortSpecification used for getting items from this folder.
Returns:
this Folder's SortSpecification.
Throws:
IfsException - if operation fails.

setSortSpecification

public void setSortSpecification(SortSpecification spec)
                          throws IfsException
Sets the SortSpecification used for getting items from this folder.
Parameters:
spec - this Folder's SortSpecification
Throws:
IfsException - if operation fails.

findPublicObjectByPath

public PublicObject findPublicObjectByPath(java.lang.String path)
                                    throws IfsException
Finds an item descending from a Folder, as specified by a file-system style path. For example, if the user specifies "eboa/playoff.txt" as the path, the server will search for a folder named "eboa" that is related to the target folder via a FolderPathRelationship, and if found, will look for an object named "playoff.txt" related to that folder via a FolderPathRelationship.
Parameters:
path - the folder path to the desired item.
Throws:
IfsException - if the operation fails.

checkExistenceOfPublicObjectByPath

public boolean checkExistenceOfPublicObjectByPath(java.lang.String path)
                                           throws IfsException
Determines whether an item exists at the specified path relative to this Folder. If the path specified contains subfolder references, then this method returns false if any of those subfolder references are not discoverable by the caller.
Parameters:
path - the folder path to the desired item.
Returns:
true if an object exists at the specified path.
Throws:
IfsException - if the operation fails.

getItemCount

public int getItemCount()
                 throws IfsException
Gets the number of items in this Folder, including both documents and subfolders.

If this method is called before any calls to getItems(), the item count will be calculated via a call to the server. If this method is called after a call to getItems(), the item count is calculated from the local cache size.

Returns:
the item count.
Throws:
IfsException - if operation fails.

getSubfolderCount

public int getSubfolderCount()
                      throws IfsException
Gets the count of subfolders in this folder. This can be used by GUIs to determine whether or not to indicate that this folder has any folders underneath it, but it is not as efficient as hasSubfolders()
Returns:
the subfolder item count.
Throws:
IfsException - if operation fails.
See Also:
hasSubfolders()

hasSubfolders

public boolean hasSubfolders()
                      throws IfsException
Gets indication as to whether this folder has any subfolders in it. This is used by GUIs as a quick determination of whether or not to indicate that this folder contains any folders. The GUI might choose to include a plus sign in the folder's icon if there are subfolders.

Returns:
the subfolder item count.
Throws:
IfsException - if operation fails.

getItems

public PublicObject[] getItems()
                        throws IfsException
Gets an array containing this Folder's items. Returns null if no items in this Folder.
Returns:
the Folder's items. Returns null if no items.
Throws:
IfsException - if the operation fails.

addItem

public void addItem(PublicObject item)
             throws IfsException
Adds an item to the folder.
Parameters:
item - the item to be added.
Throws:
IfsException - if the operation fails.

addItem

public void addItem(PublicObject item,
                    FolderRelationshipDefinition def)
             throws IfsException
Adds an item to the folder.
Parameters:
item - the item to be added.
def - the FolderRelationshipDefinition.
Throws:
IfsException - if the operation fails.

removeItem

public void removeItem(PublicObject item)
                throws IfsException
Removes the first reference to an item from this Folder without altering the item.
Parameters:
item - the item to be removed from the folder.
Throws:
IfsException - if the operation fails.

removeItem

public void removeItem(PublicObject item,
                       PublicObjectDefinition def)
                throws IfsException
Removes the first reference to an item from this Folder without altering the item.
Parameters:
item - the item to be removed from the folder.
def - the options to be used in this operation.
Throws:
IfsException - if the operation fails.

addItems

public void addItems(PublicObject[] objs)
              throws IfsException
Adds an array of PublicObjects to this Folder.

Note that if any of the items fail to be added due to security reasons etc. the entire operation is rolled back and none of the changes take effect.

Parameters:
objs - PublicObjects to be added.
Throws:
IfsException - if the operation fails.

removeItems

public void removeItems(PublicObject[] objs)
                 throws IfsException
Removes the passed array of PublicObjects from this Folder.

If any of the items fail to be removed due to security reasons etc. this method will rollback all operations and none of the changes take effect

Parameters:
objs - PublicObjects to be removed.
Throws:
IfsException - if the operation fails.

moveItems

public void moveItems(PublicObject[] objs,
                      Folder addToFolder)
               throws IfsException
Moves the specified array of PublicObjects from this Folder to the passed Folder.

If any of the items fail to be moved due to security reasons etc. this method will throw an exception and roll back

Parameters:
objs - PublicObjects to be moved.
addToFolder - destination Folder
Throws:
IfsException - if the operation fails.

lock

public void lock(LockObject lobj,
                 FolderDefinition fdef)
          throws IfsException
Sets the value of the LockObject attribute of the folder. A user must have setAttribute permission on the object to perform this operation. see the JavaDoc for LockObject for additional permission requirements for the different lock states.
The folder definition is used for deep locking. If the def has the FolderDepth option SYSTEMOPTIONVALUE_FOLDER_DEPTH_DEEPEST set, then all the items under this folder that the user has access to will be locked and will share the same lockobject as the parent folder. The entire operation is performed in a transaction to ensure complete or no success.
Parameters:
LockObject - the existing lockobject to be used
FolderDefinition - the definition that contains the depth option
Throws:
IfsException - if operation fails.

lock

public void lock(LockObjectDefinition ldef,
                 FolderDefinition fdef)
          throws IfsException
Constructs a new lockobject from the definition and sets it as the value of the LockObject attribute on the PO. A user must have SetAttribute permission on the object to perform this operation. See the JavaDoc for LockObject for additional permission requirements for the various lockstates.
The folder definition is used for deep locking. If the def has the FolderDepth option SYSTEMOPTIONVALUE_FOLDER_DEPTH_DEEPEST set then all the items under this folder that the user has access to will be locked and will share the same lockobject as the parent folder. The entire operation is performed in a transaction to ensure complete or no success.
Parameters:
LockObjectDefinition - to be used.This will construct a new lockobject
FolderDefinition - the definition that contains the depth option
Throws:
IfsException - if operation fails.

unlock

public void unlock(FolderDefinition fdef)
            throws IfsException
Releases the lock on the object. A user must have SetAttribute permissions on the object to perform this operation. See the JavaDoc for LockObject for additional permission requirements for other lock states. This will set the LockObject attribute on PO to null
The folder definition is used for deep locking. If the def has the FolderDepth option SYSTEMOPTIONVALUE_FOLDER_DEPTH_DEEPEST set, then all the items under this folder that the user has access to will be unlocked. The entire operation is performed in a transaction to ensure complete or no success.
Parameters:
FolderDefinition - the definition that contains the depth option
Throws:
IfsException - if operation fails.

handleEvent

public void handleEvent(IfsEvent event)
                 throws IfsException
Handles the specified event.
Overrides:
handleEvent in class PublicObject
Parameters:
event - the event
Throws:
IfsException - if the operation fails

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.