wt.folder
Class FolderHelper

java.lang.Object
  extended bywt.folder.FolderHelper

public final class FolderHelper
extends Object

This class provides access to the Windchill foldering capability. The FolderHelper contains direct static methods which provide access to information which is stored within all Foldered and CabinetResident objects. It also provides access to the remote interface of the FolderService itself.

Supported API: true

Extendable: false

See Also:
FolderService, Foldered, FolderEntry, CabinetBased

Field Summary
private static String CABINET_ID
           
private static String CLASSNAME
           
private static boolean DEBUG
           
private static DebugWriter LOG
           
private static String RESOURCE
           
static FolderService service
          

Supported API: false
static int SIZE_LIMIT
           
 
Constructor Summary
FolderHelper()
           
 
Method Summary
static CabinetBased assignCabinetReference(CabinetBased theEntry, CabinetReference cabinetRef)
          Prepare the object to be stored into the database.
static Foldered assignFolder(Foldered theEntry, Folder folder)
          Deprecated.  
static Foldered assignFolderByReference(Foldered theEntry, ObjectReference folderRef)
          Prepare the object to be stored into the database.
static void assignLocation(CabinetMember new_member, Cabinet location)
          Deprecated. Replaced by assignLocations(WTValuedMap)
static void assignLocation(CabinetMember new_member, String location)
          Deprecated. Replaced by assignLocations(WTValuedMap)
static void assignLocation(Foldered new_member, Folder location)
          Deprecated. Replaced by assignLocations(WTValuedMap)
static void assignLocation(Foldered new_member, String location)
          Deprecated. Replaced by assignLocations(WTValuedMap)
static void assignLocation(FolderEntry new_entry, Folder location)
          Assign the initial location of the foldered object.
static void assignLocation(FolderEntry new_entry, String location)
          Deprecated. Replaced by assignLocations(WTValuedMap)
static void assignLocation(FolderEntry new_entry, String location, WTContainerRef container)
          Deprecated. Replaced by assignLocations(WTValuedMap)
static void assignLocation(WTCollection entries, Folder folder)
          Assigns a collection of FolderEntry objects to a given Folder.
static void assignLocations(WTValuedMap entry_to_folder_map)
          Assigns each FolderEntry key in the input map to the corresponding Folder map value.
(package private) static boolean eq(Object o1, Object o2)
          Return true if the given objects are both null or are equal
static WTValuedMap getCabinetBasedToCabinetMap(WTCollection objects)
          Get the cabinets for the given set of CabinetBased objects.
static WTValuedMap getCabinetBasedToFolderMap(WTCollection objects)
          Get the parent folders for the given collection of CabinetBased objects.
static WTKeyedMap getCabinetBasedToLocationMap(WTCollection objects)
          Get the locations for the given CabinetBased objects.
static WTKeyedMap getCabinetBasedToPathMap(WTCollection objects)
          Get the paths for the given CabinetBased objects.
static CabinetReference getCabinetReference(CabinetBased object)
          Retrieve the reference to the cabinet the object is part of.
static CabinetReference getCabinetReference(FolderEntry entry)
          Deprecated. Replaced by getCabinetReference(CabinetBased)
static Folder getFolder(FolderEntry theEntry)
          gets the Folder that the object resides in

Supported API: false
static String getFolderPath(CabinetBased object)
          calculates the folder path of the specified entry

Supported API: true
(package private) static String getFolderPath(CabinetBased object, String location)
          Get the folder path for the given CabinetBased object and location
static String getFolderPath(FolderEntry entry)
          Deprecated. Replaced by getFolderPath(CabinetBased)
static Object[] getFolderPaths(CabinetBased[] objects)
          Deprecated. Replaced by getCabinetBasedToPathMap(wt.fc.collections.WTCollection)
static String getLocation(CabinetBased object)
          calculates the location of a CabinetBased object where location is defined as the the folder path of the Folder that the object is part of

Supported API: true
static String getLocation(FolderEntry entry)
          Deprecated. Replaced by getLocation(CabinetBased)
static Object[] getLocations(CabinetBased[] objects)
          Deprecated. Replaced by #getCabinetBasedToLocationMap
static ArrayList getLocationsFromMemberships(List memberships)
          Deprecated. Replaced by getCabinetBasedToLocationMap(wt.fc.collections.WTCollection)
static ArrayList getMemberships(List members)
          Deprecated. Replaced by FolderService.getEntryToMembershipMap(wt.fc.collections.WTCollection)
static WTSet getObjsInPersonalCabinets(WTCollection objsToCheck)
          Given an input WTCollection of CabinetBased objects, this routine returns the subset which reside in personal cabinets.
static SearchCondition getSearchCondition(Cabinet cabinet, boolean residesIn)
          Return a SearchCondition object which can be used to locate all Foldered objects that either reside in or don't reside in the specified Cabinet.
static boolean inPersonalCabinet(CabinetBased object)
          Deprecated. Replaced by getObjsInPersonalCabinets(WTCollection)
static boolean inPersonalCabinet(FolderEntry entry)
          Deprecated. Replaced by inPersonalCabinet(CabinetBased)
static boolean isPersonalCabinet(Cabinet cabinet)
          Deprecated. Replaced by Cabinet.isPersonalCabinet()
static boolean sameCabinet(CabinetBased object1, CabinetBased object2)
          Returns true if the two objects are stored in the same Cabinet.
(package private) static boolean setFolder(FolderEntry entry, Folder destination)
          Utility method that assigns the given entrie's in-memory folder reference to point ot the given destination
static void validateName(String name)
          A method to validate that the name of the Foldered object is valid as part of a folder path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

service

public static final FolderService service


Supported API: false


DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

SIZE_LIMIT

public static final int SIZE_LIMIT

CABINET_ID

private static final String CABINET_ID
See Also:
Constant Field Values
Constructor Detail

FolderHelper

public FolderHelper()
Method Detail

assignLocation

public static void assignLocation(FolderEntry new_entry,
                                  Folder location)
                           throws WTException
Assign the initial location of the foldered object. This is required before a Foldered object can be stored in the database. This may not be used after the first store.

Supported API: true

Parameters:
new_entry -
location -
Throws:
WTException
See Also:
assignLocations(wt.fc.collections.WTValuedMap)

assignLocation

public static void assignLocation(FolderEntry new_entry,
                                  String location)
                           throws WTException,
                                  FolderNotFoundException
Deprecated. Replaced by assignLocations(WTValuedMap)

Assign the initial location of the foldered object. This is required before a Foldered object can be stored in the database. This may not be used after the first store. The string location supplied must be a valid folderpath. The operation will make a client-server hit to validate the location.

Supported API: true

Parameters:
new_entry -
location -
Throws:
WTException
FolderNotFoundException

assignLocation

public static void assignLocation(FolderEntry new_entry,
                                  String location,
                                  WTContainerRef container)
                           throws WTException,
                                  FolderNotFoundException
Deprecated. Replaced by assignLocations(WTValuedMap)

Assign the initial location of the foldered object. This is required before a Foldered object can be stored in the database. This may not be used after the first store.

Supported API: false

Parameters:
new_entry -
location -
container -
Throws:
WTException
FolderNotFoundException

getCabinetReference

public static CabinetReference getCabinetReference(CabinetBased object)
                                            throws WTException
Retrieve the reference to the cabinet the object is part of.

Supported API: false

Parameters:
object -
Returns:
CabinetReference
Throws:
WTException
See Also:
getCabinetBasedToCabinetMap(wt.fc.collections.WTCollection)

getFolder

public static Folder getFolder(FolderEntry theEntry)
                        throws WTException
gets the Folder that the object resides in

Supported API: false

Parameters:
theEntry -
Returns:
null if the object has not been assigned to a Folder yet
Throws:
WTException - if a low level error occurs
See Also:
getCabinetBasedToFolderMap(wt.fc.collections.WTCollection)

getFolderPath

public static String getFolderPath(CabinetBased object)
                            throws WTException
calculates the folder path of the specified entry

Supported API: true

Parameters:
object -
Returns:
null if the object has not been assigned to a Folder yet
Throws:
WTException - if a low level error occurs
See Also:
getCabinetBasedToPathMap(wt.fc.collections.WTCollection)

getLocation

public static String getLocation(CabinetBased object)
                          throws WTException
calculates the location of a CabinetBased object where location is defined as the the folder path of the Folder that the object is part of

Supported API: true

Parameters:
object -
Returns:
null if the object has not been assigned to a Folder yet
Throws:
WTException - if a low level error occurs
See Also:
getCabinetBasedToLocationMap(wt.fc.collections.WTCollection)

getSearchCondition

public static SearchCondition getSearchCondition(Cabinet cabinet,
                                                 boolean residesIn)
                                          throws QueryException
Return a SearchCondition object which can be used to locate all Foldered objects that either reside in or don't reside in the specified Cabinet.

Supported API: false

Parameters:
cabinet -
residesIn -
Returns:
SearchCondition
Throws:
QueryException

inPersonalCabinet

public static boolean inPersonalCabinet(CabinetBased object)
                                 throws WTException
Deprecated. Replaced by getObjsInPersonalCabinets(WTCollection)

Returns true if the entry resides in a personal cabinet, returns false if in an shared cabinet. If the entry is a shortcut, the test is done on the cabinet of shortcut's parent folder.

Supported API: false

Parameters:
object -
Returns:
boolean
Throws:
WTException

isPersonalCabinet

public static boolean isPersonalCabinet(Cabinet cabinet)
                                 throws WTException
Deprecated. Replaced by Cabinet.isPersonalCabinet()

Returns true if the specified Cabinet is a personal cabinet.

Supported API: false

Parameters:
cabinet -
Returns:
boolean
Throws:
WTException

sameCabinet

public static boolean sameCabinet(CabinetBased object1,
                                  CabinetBased object2)
                           throws WTException
Returns true if the two objects are stored in the same Cabinet. If the entry is a shortcut, the test is done on the cabinet of shortcut's parent folder.

Supported API: false

Parameters:
object1 -
object2 -
Returns:
boolean
Throws:
WTException

validateName

public static void validateName(String name)
                         throws FolderException
A method to validate that the name of the Foldered object is valid as part of a folder path. It ensures the name does not contain a FolderService.FOLDER_SEPARATOR.

Supported API: false

Parameters:
name -
Throws:
FolderException

assignFolder

public static Foldered assignFolder(Foldered theEntry,
                                    Folder folder)
                             throws WTException
Deprecated.  

Prepare the object to be stored into the database. Must be called for all Foldered objects.

Parameters:
theEntry -
folder -
Returns:
Foldered
Throws:
WTException

getCabinetReference

public static CabinetReference getCabinetReference(FolderEntry entry)
                                            throws WTException
Deprecated. Replaced by getCabinetReference(CabinetBased)



Supported API: false

Parameters:
entry -
Returns:
CabinetReference
Throws:
WTException

getFolderPath

public static String getFolderPath(FolderEntry entry)
                            throws WTException
Deprecated. Replaced by getFolderPath(CabinetBased)



Supported API: false

Parameters:
entry -
Returns:
String
Throws:
WTException

getLocation

public static String getLocation(FolderEntry entry)
                          throws WTException
Deprecated. Replaced by getLocation(CabinetBased)



Supported API: false

Parameters:
entry -
Returns:
String
Throws:
WTException

inPersonalCabinet

public static boolean inPersonalCabinet(FolderEntry entry)
                                 throws WTException
Deprecated. Replaced by inPersonalCabinet(CabinetBased)



Supported API: false

Parameters:
entry -
Returns:
boolean
Throws:
WTException

assignLocation

public static void assignLocation(Foldered new_member,
                                  Folder location)
                           throws WTException
Deprecated. Replaced by assignLocations(WTValuedMap)



Supported API: false

Parameters:
new_member -
location -
Throws:
WTException

assignLocation

public static void assignLocation(Foldered new_member,
                                  String location)
                           throws WTException,
                                  FolderNotFoundException
Deprecated. Replaced by assignLocations(WTValuedMap)



Supported API: false

Parameters:
new_member -
location -
Throws:
WTException
FolderNotFoundException

assignLocation

public static void assignLocation(CabinetMember new_member,
                                  Cabinet location)
                           throws WTException
Deprecated. Replaced by assignLocations(WTValuedMap)



Supported API: false

Parameters:
new_member -
location -
Throws:
WTException

assignLocation

public static void assignLocation(CabinetMember new_member,
                                  String location)
                           throws WTException,
                                  FolderNotFoundException
Deprecated. Replaced by assignLocations(WTValuedMap)



Supported API: false

Parameters:
new_member -
location -
Throws:
WTException
FolderNotFoundException

getLocations

public static Object[] getLocations(CabinetBased[] objects)
                             throws WTException
Deprecated. Replaced by #getCabinetBasedToLocationMap

This function returns the folder locations corresponding to an array of CabinetBased objects. The locations are returned as String's. In cases where the location cannot be determined (typically because the caller has no read permission for the folder or because it hasn't been set), an object of class Exception will be returned in the corresponding position of the array.

Supported API: false

Parameters:
objects -
Returns:
Object[]
Throws:
WTException

getFolderPaths

public static Object[] getFolderPaths(CabinetBased[] objects)
                               throws WTException
Deprecated. Replaced by getCabinetBasedToPathMap(wt.fc.collections.WTCollection)

This function returns the folder paths corresponding to an array of CabinetBased objects. The folder paths are returned as String's. In cases where the location cannot be determined (typically because the caller has no read permission for the folder or because it hasn't been set), an object of class Exception will be returned in the corresponding position of the array.

Supported API: false

Parameters:
objects -
Returns:
Object[]
Throws:
WTException

getMemberships

public static ArrayList getMemberships(List members)
                                throws WTException
Deprecated. Replaced by FolderService.getEntryToMembershipMap(wt.fc.collections.WTCollection)

Retrieves the FolderMembership's for a collection of FolderEntry's. The List may include a mixed collection of CabinetBased elements. the result ArrayList will contain the FolderMembership's corresponding to the CabinetBased elements, except for cases where some problem (i.e. Exception) occurred in attempting to retrieve the FolderMembership. In these cases, the Exception will be returned in the corresponding location of the result ArrayList.

Supported API: false

Parameters:
members -
Returns:
ArrayList
Throws:
WTException

getLocationsFromMemberships

public static ArrayList getLocationsFromMemberships(List memberships)
                                             throws WTException
Deprecated. Replaced by getCabinetBasedToLocationMap(wt.fc.collections.WTCollection)

Retrieves the FolderMembership's for a collection of FolderEntry's. The List may include a mixed collection of CabinetBased elements. the result ArraList will contain the FolderMembership's corresponding to the CabinetBased elements, except for cases where some problem (i.e. Exception) occurred in attempting to retrieve the FolderMembership. In these cases, the Exception will be returned in the corresponding location of the result ArrayList.

Supported API: false

Parameters:
memberships -
Returns:
ArrayList
Throws:
WTException

assignLocation

public static void assignLocation(WTCollection entries,
                                  Folder folder)
                           throws WTException
Assigns a collection of FolderEntry objects to a given Folder.



Supported API: true

Parameters:
entries -
folder - Folder to assign objects to
Throws:
WTException
See Also:
assignLocations(WTValuedMap)

assignLocations

public static void assignLocations(WTValuedMap entry_to_folder_map)
                            throws WTException
Assigns each FolderEntry key in the input map to the corresponding Folder map value. This is required before a Foldered object can be stored in the database. This may not be used after the first store.

Supported API: true

Parameters:
entry_to_folder_map - map from FolderEntry objects to the Folders to which they are to be assigned
Throws:
WTException

getCabinetBasedToFolderMap

public static WTValuedMap getCabinetBasedToFolderMap(WTCollection objects)
                                              throws WTException
Get the parent folders for the given collection of CabinetBased objects. If any of the objects are Cabinets, then they are mapped to null.

If any of the objects are Foldered, then the implementation will first check to see if their FolderingInfos contain a cached reference to their parent folder, and use the cached instance as the return value. So in some cases this API will not require a trip to the server.

Supported API: true

Parameters:
objects - The CabinetBased objects to find folders for
Returns:
A mapping of the objects to their parent folders
Throws:
FolderNotFoundException
WTException

getCabinetBasedToLocationMap

public static WTKeyedMap getCabinetBasedToLocationMap(WTCollection objects)
                                               throws WTException
Get the locations for the given CabinetBased objects. The current user must have read access to all of their ancestor folders.

If any of the objects are Foldered, then the implementation will first check to see if their FolderingInfos contain a cached location, and use the cached location as the return value. So in some cases this API will not require a trip to the server.

Supported API: true

Parameters:
objects - The CabinetBased objects to find locations for
Returns:
A mapping of CabinetBased objects to locations
Throws:
FolderNotFoundException
WTException

getCabinetBasedToPathMap

public static WTKeyedMap getCabinetBasedToPathMap(WTCollection objects)
                                           throws WTException
Get the paths for the given CabinetBased objects. The path includes the folder location of the object along with its own name

If any of the objects are Foldered, then the implementation will first check to see if their FolderingInfos contain a cached reference to their path, and use the cached path as the return value. So in some cases this API will not require a trip to the server.

Supported API: true

Parameters:
objects - The CabinetBased objects to find paths for
Returns:
A mapping of CabinetBased objects to paths
Throws:
FolderNotFoundException
WTException

getCabinetBasedToCabinetMap

public static WTValuedMap getCabinetBasedToCabinetMap(WTCollection objects)
                                               throws WTException
Get the cabinets for the given set of CabinetBased objects. Cabinets are mapped to a reference to themselves.

This implementation will not inflate the resutling CabinetRefernece objects. To ensure the references are inflated, use FolderService.getCabinetBasedToCabinetMap(wt.fc.collections.WTCollection)

Supported API: true

Parameters:
objects -
Returns:
A mapping of the CabinetBased objects to their cabinets
Throws:
WTException

getObjsInPersonalCabinets

public static WTSet getObjsInPersonalCabinets(WTCollection objsToCheck)
                                       throws WTException
Given an input WTCollection of CabinetBased objects, this routine returns the subset which reside in personal cabinets. Note that if non-CabinetBased objects are included in the input collection they are simply automatically excluded from the output collection as they have no associated Cabinet.

This implementation will minimize client-server traffic by checking for inflated cabinet references on the input collection, and using the cached information if available.

This is a multi-object form of inPersonalCabinet(CabinetBased).

Supported API: true

Parameters:
objsToCheck - objects to determine which reside in a personal cabinet
Returns:
WTSet
Throws:
WTException
See Also:
FolderService.getObjsInPersonalCabinets(WTCollection)

assignFolderByReference

public static Foldered assignFolderByReference(Foldered theEntry,
                                               ObjectReference folderRef)
                                        throws WTException
Prepare the object to be stored into the database. Can be called for all Foldered objects.

Supported API: false

Parameters:
theEntry -
folderRef -
Returns:
Foldered
Throws:
WTException

assignCabinetReference

public static CabinetBased assignCabinetReference(CabinetBased theEntry,
                                                  CabinetReference cabinetRef)
                                           throws WTException
Prepare the object to be stored into the database. Can be called for all CabinetBased or Foldered objects.

Supported API: false

Parameters:
theEntry -
cabinetRef -
Returns:
CabinetBased
Throws:
WTException

getFolderPath

static String getFolderPath(CabinetBased object,
                            String location)
Get the folder path for the given CabinetBased object and location

Parameters:
object - The CabinetBased object to get a path for
location - The location of the entry
Returns:
Then entry object's path

setFolder

static boolean setFolder(FolderEntry entry,
                         Folder destination)
                  throws WTException
Utility method that assigns the given entrie's in-memory folder reference to point ot the given destination

Parameters:
entry -
destination -
Returns:
false if the entry is Foldered and hasn't switched cabinets (in which case the persistent state of the entry hasn't changed). otherwise true
Throws:
WTException

eq

static boolean eq(Object o1,
                  Object o2)
Return true if the given objects are both null or are equal

Parameters:
o1 -
o2 -
Returns:
boolean