wt.clients.folder
Class FolderTaskLogic

java.lang.Object
  extended bywt.clients.folder.FolderTaskLogic
Direct Known Subclasses:
CreateFolderTaskLogic, UpdateFolderTaskLogic

public class FolderTaskLogic
extends Object

Class FolderTaskLogic contains static methods to retrieve and manipulate Folder and Foldered objects.

Supported API: false

See Also:
Folder,

Supported API: true

Field Summary
private static String FOLDER_ROOT
           
private static String FOLDER_SEPARATOR
           
private static String MESSAGES_RESOURCE
           
private static String versionID
           
 
Constructor Summary
FolderTaskLogic()
           
 
Method Summary
static Foldered changeFolders(Foldered foldered, Folder new_folder)
          Deprecated. Use changeFolders( FolderEntry, Folder) instead

Supported API: false
static FolderEntry changeFolders(FolderEntry foldered, Folder new_folder)
          Changes the folder of the given FolderEntry object to the given folder.
static SortedEnumeration getAllCabinets()
          Returns a Sorted Enumeration of All Cabinets the current user has access to read.
static SortedEnumeration getAllCabinets(Locale locale)
          Returns a Sorted Enumeration of All Cabinets the current user has access to read.
static SortedEnumeration getCabinetsByPermission(String permission)
          Retrieves all cabinets for which the current user has the given permission.
static SortedEnumeration getCabinetsByPermission(String permission, Locale locale)
          Retrieves all cabinets for which the current user has the given permission.
static Cabinet getContainingCabinet(CabinetBased cabinet_based)
          Returns the Cabinet that contains the given CabinetBased object.
static String getCreatorName(Folder folder)
          Returns the String name of the creator of the given SubFolder.
static Folder getFolder(String folder_path)
          Returns the Folder specified by the given String folder path.
static Folder getFolder(String folder_path, WTContainerRef containerRef)
          Returns the Folder specified by the given String folder path.
static SortedEnumeration getFolderContents(Folder folder)
          Returns the contents of the given folder.
static SortedEnumeration getFolderContents(Folder folder, CollationKeyFactory key)
          Returns the contents of the given folder.
static SortedEnumeration getFolderContents(Folder folder, Locale locale)
          Returns the contents of the given folder.
static String getFolderSeparator()
          Returns the String which is used as the separator in building the folder path of a folder.
static String getObjectId(CabinetBased object)
          Returns a string represenation of the object id of the given CabinetBased object.
static Folder getParentFolder(FolderEntry foldered)
          Returns the Folder which is the parent that contains the given Foldered object.
static Cabinet getPersonalCabinet(WTPrincipal user)
          Returns the personal cabinet corresponding to the given WTPrincipal.
static String getRootPath()
          Returns a String representation of the root of all cabinets - the top-level in the Cabinet-folder hierarchy.
static SortedEnumeration getSubFolders(Folder folder)
          Returns all subfolders of the given folder.
static SortedEnumeration getSubFolders(Folder folder, CollationKeyFactory key)
          Returns the subfolders of the given folder.
static SortedEnumeration getSubFolders(Folder folder, Locale locale)
          Returns all subfolders of the given folder.
static SortedEnumeration getSubFoldersByPermission(String permission, Folder folder)
          Returns the subfolders of the given folder for which the user has the given permission.
static SortedEnumeration getSubFoldersByPermission(String permission, Folder folder, Locale locale)
          Returns the subfolders of the given folder for which the user has the given permission.
static boolean inPersonalCabinet(CabinetBased cabinet_based)
          Returns a boolean value indicating whether or not the given CabinetBased object resides in a personal cabinet.
static boolean inPersonalCabinet(Folder folder)
          Returns a boolean value indicating whether or not the given folder is in the current user's personal cabinet.
static boolean inPersonalCabinet(String folder_path)
          Returns a boolean value indicating whether or not the folder corresponding to the given String folder path is in the current user's personal cabinet.
static boolean inPersonalCabinet(String folder_path, WTContainerRef containerRef)
          Returns a boolean value indicating whether or not the folder corresponding to the given String folder path is in the current user's personal cabinet.
static boolean isEqual(CabinetBased object_a, CabinetBased object_b)
          Tests the equality of the two given CabinetBased objects.
static boolean isPersonalCabinet(Cabinet cabinet)
          Returns a boolean value indicating whether or not the given cabinet is a personal cabinet.
static void setFolder(Foldered foldered_obj, Folder folder)
          Assigns the given Folder as the parent folder containing the given Foldered object.
static void setFolder(Foldered foldered_obj, String folder)
          Assigns the folder corresponding to the given folder path as the parent folder containing the given Foldered object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values

MESSAGES_RESOURCE

private static String MESSAGES_RESOURCE

FOLDER_ROOT

private static String FOLDER_ROOT

FOLDER_SEPARATOR

private static String FOLDER_SEPARATOR
Constructor Detail

FolderTaskLogic

public FolderTaskLogic()
Method Detail

getRootPath

public static String getRootPath()
Returns a String representation of the root of all cabinets - the top-level in the Cabinet-folder hierarchy.

Returns:
the String root of all cabinets

Supported API: true

getFolderSeparator

public static String getFolderSeparator()
Returns the String which is used as the separator in building the folder path of a folder. For example, if the folder path of a folder is "/Windchill/Designs/Components", the folder separator string is "/".

Returns:
the String folder path separator

Supported API: true

getFolder

public static Folder getFolder(String folder_path)
                        throws FolderException,
                               WTException
Returns the Folder specified by the given String folder path.

Returns:
the Folder represented by the given path
Throws:
FolderException - if the given path does not correspond to an actual folder
WTException - if an error occurs trying to retrieve the folder

Supported API: true

getFolder

public static Folder getFolder(String folder_path,
                               WTContainerRef containerRef)
                        throws FolderException,
                               WTException
Returns the Folder specified by the given String folder path.

Returns:
the Folder represented by the given path
Throws:
FolderException - if the given path does not correspond to an actual folder
WTException - if an error occurs trying to retrieve the folder

Supported API: true

getParentFolder

public static Folder getParentFolder(FolderEntry foldered)
                              throws WTException
Returns the Folder which is the parent that contains the given Foldered object.

Parameters:
foldered - the Foldered object whose parent is to be returned
Returns:
the parent Folder of the given FolderEntry object
Throws:
WTException - if an error occurs retrieving the parent folder of the given FolderEntry

Supported API: true

getAllCabinets

public static SortedEnumeration getAllCabinets()
                                        throws QueryException,
                                               WTException
Returns a Sorted Enumeration of All Cabinets the current user has access to read. The returned enumeration is sorted according to the default sorting order, which is the identity of a cabinet.

Returns:
a SortedEnumeration of all cabinets for which the current user has read permissions.
Throws:
QueryException - if an error occurs querying the database for cabinets
WTException - if an error occurs retrieving the cabinets.
See Also:


Supported API: true

getAllCabinets

public static SortedEnumeration getAllCabinets(Locale locale)
                                        throws QueryException,
                                               WTException
Returns a Sorted Enumeration of All Cabinets the current user has access to read. The returned enumeration is sorted according to the default sorting order based on the given locale, which is the identity of a cabinet.

Parameters:
locale - the Locale in which to sort the cabinets
Returns:
a SortedEnumeration of all cabinets for which the current user has read permissions.
Throws:
QueryException - if an error occurs querying the database for cabinets
WTException - if an error occurs retrieving the cabinets.
See Also:


Supported API: true

getCabinetsByPermission

public static SortedEnumeration getCabinetsByPermission(String permission)
                                                 throws QueryException,
                                                        WTException
Retrieves all cabinets for which the current user has the given permission. The cabinets are returned in a SortedEnumeration which is sorted according to the identity of the cabinet.

Returns:
a SortedEnumeration containing the cabinets for which the current user has the given permission
Throws:
QueryException - if an error occurs querying the database for cabinets
WTException - if an error occurs retrieving the cabinets
See Also:


Supported API: true

getCabinetsByPermission

public static SortedEnumeration getCabinetsByPermission(String permission,
                                                        Locale locale)
                                                 throws QueryException,
                                                        WTException
Retrieves all cabinets for which the current user has the given permission. The cabinets are returned in a SortedEnumeration which is sorted according to the identity of the cabinet based on the given Locale.

Parameters:
locale - the Locale in which sorting should be done
Returns:
a SortedEnumeration containing the cabinets for which the current user has the given permission
Throws:
QueryException - if an error occurs querying the database for cabinets
WTException - if an error occurs retrieving the cabinets
See Also:


Supported API: true

getCreatorName

public static String getCreatorName(Folder folder)
                             throws WTException
Returns the String name of the creator of the given SubFolder.

Parameters:
folder - the Folder for which the name of the creator is returned
Returns:
the String name of the creator of the given folder
Throws:
WTException - if an error occurs retrieving the creator of the folder.

Supported API: true

setFolder

public static void setFolder(Foldered foldered_obj,
                             Folder folder)
                      throws WTException
Assigns the given Folder as the parent folder containing the given Foldered object. This method should not be used to change the folder of a foldered object, but should be used to set the folder of a foldered object for the first time.

Parameters:
foldered_obj - the Foldered object whose parent folder is assigned
folder - the Folder assigned as the parent folder of the given foldered object
Throws:
WTException - if an error occurs assigning the folder of the given foldered object.
See Also:


Supported API: true

setFolder

public static void setFolder(Foldered foldered_obj,
                             String folder)
                      throws WTException
Assigns the folder corresponding to the given folder path as the parent folder containing the given Foldered object. This method should not be used to change the folder of a foldered object, but should be used to set the folder of a foldered object for the first time.

Parameters:
foldered_obj - the Foldered object whose parent folder is assigned
folder - the String folder path corresponding to the folder to be assigned as the parent folder of the given foldered object
Throws:
WTException - if an error occurs assigning the folder of the given foldered object
See Also:


Supported API: true

changeFolders

public static Foldered changeFolders(Foldered foldered,
                                     Folder new_folder)
                              throws WTException
Deprecated. Use changeFolders( FolderEntry, Folder) instead

Supported API: false

Changes the folder of the given foldered object to the given folder. This method is used to change the folder of a foldered object after the parent folder has already been initially assigned.

Parameters:
foldered - the FolderEntry object whose parent folder is reassigned
new_folder - the Folder to be assigned as the new parent containing the given foldered object.
Returns:
the updated foldered object
Throws:
WTException - if an error occurs changing the folder of the given foldered object.
See Also:
setFolder(wt.folder.Foldered, wt.folder.Folder)

changeFolders

public static FolderEntry changeFolders(FolderEntry foldered,
                                        Folder new_folder)
                                 throws WTException
Changes the folder of the given FolderEntry object to the given folder. This method is used to change the folder of a FolderEntry object after the parent folder has already been initially assigned.

Parameters:
foldered - the FolderEntry object whose parent folder is reassigned
new_folder - the Folder to be assigned as the new parent containing the given FolderEntry object.
Returns:
the updated FolderEntry object
Throws:
WTException - if an error occurs changing the folder of the given FolderEntry object.

Supported API: true

getSubFolders

public static SortedEnumeration getSubFolders(Folder folder)
                                       throws WTException
Returns all subfolders of the given folder. The subfolders are returned in a SortedEnumeration which is sorted according to the identity of the subfolders.

Parameters:
folder - the Folder whose subfolders are returned
Returns:
a SortedEnumeration of the subfolders of the given folder
Throws:
WTException - if an error occurs retrieving the subfolders.

Supported API: true

getSubFolders

public static SortedEnumeration getSubFolders(Folder folder,
                                              Locale locale)
                                       throws WTException
Returns all subfolders of the given folder. The subfolders are returned in a SortedEnumeration which is sorted according to the identity of the subfolders based on the given locale.

Parameters:
folder - the Folder whose subfolders are returned
locale - the Locale used for sorting the folders
Returns:
a SortedEnumeration of the subfolders of the given folder
Throws:
WTException - if an error occurs retrieving the subfolders.

Supported API: true

getSubFolders

public static SortedEnumeration getSubFolders(Folder folder,
                                              CollationKeyFactory key)
                                       throws WTException
Returns the subfolders of the given folder. The subfolders are returned in a SortedEnumeration which is sorted according to the given CollationKeyFactory.

Parameters:
folder - the Folder whose subfolders are returned
key - the CollationKeyFactory specifying how the subfolders are sorted
Returns:
a SortedEnumeration of the subfolders of the given folder
Throws:
WTException - if an error occurs retrieving the subfolders.

Supported API: true

getFolderContents

public static SortedEnumeration getFolderContents(Folder folder)
                                           throws WTException
Returns the contents of the given folder. The contents are returned in a SortedEnumeration which is sorted based on the FolderCollationKeyFactory.

Parameters:
folder - the folder whose contents are returned
Returns:
the SortedEnumeration of the contents of the given folder
Throws:
WTException - if an error occurs retrieving the folder contents
See Also:


Supported API: true

getFolderContents

public static SortedEnumeration getFolderContents(Folder folder,
                                                  Locale locale)
                                           throws WTException
Returns the contents of the given folder. The contents are returned in a SortedEnumeration which is sorted based on the FolderCollationKeyFactory using the given Locale.

Parameters:
folder - the folder whose contents are returned
locale - the Locale used for sorting the folders
Returns:
the SortedEnumeration of the contents of the given folder
Throws:
WTException - if an error occurs retrieving the folder contents
See Also:


Supported API: true

getFolderContents

public static SortedEnumeration getFolderContents(Folder folder,
                                                  CollationKeyFactory key)
                                           throws WTException
Returns the contents of the given folder. The contents are returned in a SortedEnumeration which is sorted based on the given CollationKeyFactory.

Parameters:
folder - the folder whose contents are returned
key - the CollationKeyFactory specifying the sorting order of the returned SortedEnumeration
Returns:
the SortedEnumeration containing the contents of the given folder
Throws:
WTException - if an error occurs retrieving the folder contents
See Also:
CollationKeyFactory,

Supported API: true

getSubFoldersByPermission

public static SortedEnumeration getSubFoldersByPermission(String permission,
                                                          Folder folder)
                                                   throws WTException
Returns the subfolders of the given folder for which the user has the given permission. The subfolders are returned in a SortedEnumeration which is sorted based on the identity of the folders.

Parameters:
permission - a String permission; only those subfolders for which the current user has the given permission are returned
folder - the Folder whose subfolders are returned
Returns:
a SortedEnumeration of the subfolders of the given folder for which the current user has the given permission
Throws:
WTException - if an error occurs retrieving the subfolders.

Supported API: true

getSubFoldersByPermission

public static SortedEnumeration getSubFoldersByPermission(String permission,
                                                          Folder folder,
                                                          Locale locale)
                                                   throws WTException
Returns the subfolders of the given folder for which the user has the given permission. The subfolders are returned in a SortedEnumeration which is sorted based on the identity of the folders according to the given Locale.

Parameters:
permission - a String permission; only those subfolders for which the current user has the given permission are returned
folder - the Folder whose subfolders are returned
locale - the Locale in which to sort the folders
Returns:
a SortedEnumeration of the subfolders of the given folder for which the current user has the given permission
Throws:
WTException - if an error occurs retrieving the subfolders.

Supported API: true

getObjectId

public static String getObjectId(CabinetBased object)
Returns a string represenation of the object id of the given CabinetBased object. The object id is useful as a key to the object.

Parameters:
object - the CabinetBased object whose object id is returned
Returns:
a String representation of the object id of the given object.

Supported API: true

isEqual

public static boolean isEqual(CabinetBased object_a,
                              CabinetBased object_b)
                       throws WTException
Tests the equality of the two given CabinetBased objects. The two objects are considered to be equal if they represent the same business object. If the two objects are persistent, equality is tested based on the WTReference of the two objects. Otherwise, equality is tested based on the equals ("==") operator.

Parameters:
object_a - one of the objects to be compared for equality
object_b - one of the objects to be compared for equality
Returns:
true if the two given objects refer to the same business object
Throws:
WTException - if an error occurs retrieving the WTReferences of the given objects
See Also:


Supported API: true

getPersonalCabinet

public static Cabinet getPersonalCabinet(WTPrincipal user)
                                  throws FolderNotFoundException,
                                         WTException
Returns the personal cabinet corresponding to the given WTPrincipal.

Parameters:
user - the WTPrincipal whose personal cabinet is returned
Returns:
the personal cabinet of the given WTPrincipal
Throws:
FolderNotFoundException - if the Cabinet of the given WTPrincipal does not exist
WTException - if an error occurs retrieving the personal Cabinet

Supported API: true

getContainingCabinet

public static Cabinet getContainingCabinet(CabinetBased cabinet_based)
                                    throws WTException
Returns the Cabinet that contains the given CabinetBased object.

Parameters:
cabinet_based - the CabinetBased object whose containing cabinet is returned.
Returns:
the cabinet which contains the given CabinetBased object
Throws:
WTException -

Supported API: true

isPersonalCabinet

public static boolean isPersonalCabinet(Cabinet cabinet)
Returns a boolean value indicating whether or not the given cabinet is a personal cabinet.

Supported API: true


inPersonalCabinet

public static boolean inPersonalCabinet(Folder folder)
                                 throws WTException
Returns a boolean value indicating whether or not the given folder is in the current user's personal cabinet.

Parameters:
folder - the folder to be test
Returns:
true if the given folder is in the current user's personal cabinet
Throws:
WTException - if an error occurs testing the given folder

Supported API: true

inPersonalCabinet

public static boolean inPersonalCabinet(String folder_path)
                                 throws FolderNotFoundException,
                                        WTException
Returns a boolean value indicating whether or not the folder corresponding to the given String folder path is in the current user's personal cabinet.

Parameters:
folder_path - the String folder path corresponding to the folder to be tested
Returns:
true if the given folder path corresponds to a folder in the user's personal cabinet
Throws:
WTException - if an error occurs testing the given folder path

Supported API: true
FolderNotFoundException

inPersonalCabinet

public static boolean inPersonalCabinet(String folder_path,
                                        WTContainerRef containerRef)
                                 throws FolderNotFoundException,
                                        WTException
Returns a boolean value indicating whether or not the folder corresponding to the given String folder path is in the current user's personal cabinet.

Parameters:
folder_path - the String folder path corresponding to the folder to be tested
Returns:
true if the given folder path corresponds to a folder in the user's personal cabinet
Throws:
WTException - if an error occurs testing the given folder path

Supported API: true
FolderNotFoundException

inPersonalCabinet

public static boolean inPersonalCabinet(CabinetBased cabinet_based)
                                 throws WTException
Returns a boolean value indicating whether or not the given CabinetBased object resides in a personal cabinet.

Parameters:
cabinet_based - the object to be tested for residing in a personal cabinet
Returns:
true if the given cabinet_based object resides in a personal cabinet
Throws:
WTException - if an error occurs testing the given cabinet_based

Supported API: true