wt.folder
Class PassThruFolderCache

java.lang.Object
  extended bywt.folder.PassThruFolderCache
All Implemented Interfaces:
FolderCache

final class PassThruFolderCache
extends Object
implements FolderCache

An implementation of FolderCache that always goes to the database

Supported API: false

Extendable: false


Nested Class Summary
(package private) static class PassThruFolderCache.Singleton
           
 
Nested classes inherited from class wt.folder.FolderCache
FolderCache.NamesToFoldersKey
 
Field Summary
private static String CLASSNAME
           
private static boolean DEBUG
           
private static DebugWriter LOG
           
private static String OWNER_ID
           
private static String RESOURCE
           
 
Constructor Summary
private PassThruFolderCache()
           
 
Method Summary
private static void addCabinetToResultBuffer(FolderCache.NamesToFoldersKey key, Map containers_to_indices, List result_buffer, Cabinet cabinet)
          Utility method that adds the Cabinet with the given key to result_buffer, removing it from to_query
 WTList getCabinetsByName(WTList ordered_containers, List ordered_cabinet_names, boolean read_only)
          Get the cabinets in the given parent containers with the given names.
(package private)  List getCabinetsByName(WTList ordered_containers, List ordered_cabinet_names, boolean read_only, boolean throw_fnfe)
          Utility version of getCabinetsByName that can either throw FolderNotFoundExceptions or leave those slots null
 WTValuedMap getChildToParentMap(WTCollection children, boolean read_only)
          Get the parents of the given child folders
 WTKeyedMap getContainerToCabinetMap(WTCollection containers, boolean shared_only, boolean read_only)
          Get all of the cabinets that are in the given containers
(package private) static PassThruFolderCache getInstance()
           
 WTKeyedMap getParentToSubFoldersMap(WTCollection parents, boolean read_only)
          Get all the subfolders of the given parent folders
 WTList getSubFoldersByName(WTList ordered_parents, List ordered_child_names, boolean read_only)
          Get the children of the given parents with the given names.
 WTValuedMap getUserToCabinetMap(WTCollection users, boolean read_only)
          Get the personal cabinets for the given
 
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

DEBUG

private static final boolean DEBUG

LOG

private static final DebugWriter LOG

OWNER_ID

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

PassThruFolderCache

private PassThruFolderCache()
Method Detail

getInstance

static PassThruFolderCache getInstance()

getChildToParentMap

public WTValuedMap getChildToParentMap(WTCollection children,
                                       boolean read_only)
                                throws WTException
Get the parents of the given child folders

Specified by:
getChildToParentMap in interface FolderCache
Parameters:
children - A collection of child folders. The implementation will not inflate the children
read_only - Not applicable
Returns:
The mapping of child folders to parent folders
Throws:
WTException

getSubFoldersByName

public WTList getSubFoldersByName(WTList ordered_parents,
                                  List ordered_child_names,
                                  boolean read_only)
                           throws WTException
Get the children of the given parents with the given names. This API needs to be list-based as neither the parent oids nor the child names need to be unique, and therefore neither can be used as a map key.

Specified by:
getSubFoldersByName in interface FolderCache
Parameters:
ordered_parents - A list of the parent folders to query in. This may either have as many elements as names, or have a single element used with each name
ordered_child_names - A list of child names to find subfolders for within the corresponding parent folder
read_only - Not applicable
Returns:
A WTList of the matching subfolders, in the same order as the input parameters.
Throws:
FolderNotFoundException - If any of the subfolders couldn't be found
WTException

getCabinetsByName

public WTList getCabinetsByName(WTList ordered_containers,
                                List ordered_cabinet_names,
                                boolean read_only)
                         throws WTException
Get the cabinets in the given parent containers with the given names. This API needs to be list-based as neither the container oids nor the cabinet names need to be unique, and therefore neither can be used as a map key.

Specified by:
getCabinetsByName in interface FolderCache
Parameters:
ordered_containers - A list of the containers to query in. This may either have as many elements as names, or have a single element used with each name.
ordered_cabinet_names - A list of cabinet names to find cabinets for within the corresponding container
read_only - Not applicable
Returns:
A WTList of the matching cabinet, in the same order as the input parameters.
Throws:
FolderNotFoundException - If any of the cabinets couldn't be found
WTException

getCabinetsByName

List getCabinetsByName(WTList ordered_containers,
                       List ordered_cabinet_names,
                       boolean read_only,
                       boolean throw_fnfe)
                 throws WTException
Utility version of getCabinetsByName that can either throw FolderNotFoundExceptions or leave those slots null

Parameters:
ordered_containers -
ordered_cabinet_names -
read_only -
Returns:
A List of Cabinets. May contain null values if throw_fnfe is false and there are cabinets that can't be found
Throws:
WTException

addCabinetToResultBuffer

private static void addCabinetToResultBuffer(FolderCache.NamesToFoldersKey key,
                                             Map containers_to_indices,
                                             List result_buffer,
                                             Cabinet cabinet)
                                      throws WTException
Utility method that adds the Cabinet with the given key to result_buffer, removing it from to_query

Parameters:
key - The key for the cabinet
containers_to_indices - Mapping of NamesToFoldersKey objects to either a single Integer result index or a List of result indices
result_buffer - The list to add the cabinet to
cabinet - The cabinet
Throws:
WTException

getUserToCabinetMap

public WTValuedMap getUserToCabinetMap(WTCollection users,
                                       boolean read_only)
                                throws WTException
Get the personal cabinets for the given

Specified by:
getUserToCabinetMap in interface FolderCache
Parameters:
users - The users to find personal cabinets for
read_only - Not applicable
Returns:
A mapping of users to personal cabinets or to null if the user does not have a personal cabinet.
Throws:
WTException

getContainerToCabinetMap

public WTKeyedMap getContainerToCabinetMap(WTCollection containers,
                                           boolean shared_only,
                                           boolean read_only)
                                    throws WTException
Get all of the cabinets that are in the given containers

Specified by:
getContainerToCabinetMap in interface FolderCache
Parameters:
containers - The containers to search in
shared_only - Whether or not to only return shared cabinets
read_only - Not applicable
Returns:
A mapping of the input containers to WTSets of all their cabinets
Throws:
WTException

getParentToSubFoldersMap

public WTKeyedMap getParentToSubFoldersMap(WTCollection parents,
                                           boolean read_only)
                                    throws WTException
Get all the subfolders of the given parent folders

Specified by:
getParentToSubFoldersMap in interface FolderCache
Parameters:
parents - The parent folders to find children for
read_only - Not applicable
Returns:
A mapping of parent folders to WTSets of their child folders
Throws:
WTException