wt.clients.vc
Class CheckOutTask

java.lang.Object
  extended bywt.clients.vc.CheckOutTask

public class CheckOutTask
extends Object

Class CheckOutTask is a generic task class which performs the checking out of a Workable object. To perform a check-out of an object, this class only needs to be given a parent Applet, which provides context, a Frame to parent dialogs launched in the check-out task, the Folder in which to place the working copy of the checked out object and the Workable object to be checked out:

       CheckOutTask checkout_task =
                   new CheckInTask( my_applet, my_frame, checkout_folder, checked_out_obj );
       checkout_task.checkout();
  


Supported API: true

Extendable: false

See Also:
Workable

Nested Class Summary
(package private)  class CheckOutTask.CheckOutThread
           
 
Field Summary
private  Folder checkoutFolder
           
private  Workable checkoutItem
           
private  ThreadGroup contextGroup
           
private static boolean DEBUG
          Flag used to provide debugging messages.
private  WTPreferences downloadPreferences
           
private  Applet parentApplet
           
private  Frame parentFrame
           
private static String PREF_KEY_DOWNLOADOPTYPE
           
private static String PREF_KEY_SKIPDOWNLOAD
           
private static String PREF_KEY_WORKSPACEPATH
           
private static String PREF_NODE
           
private static ResourceBundle resources
           
private static String RESOURCES
           
private static boolean SHOW_CONTENTS
           
private  boolean threadCompleted
           
private  Exception threadException
           
private  Object threadLock
           
private  boolean threadSuccessful
           
private static String versionID
           
 
Constructor Summary
CheckOutTask(Applet parent_applet, Frame parent_frame, Folder checkout_folder)
          Construct a CheckOutTask to handle the checkout of a Workable object.
 
Method Summary
 Workable checkout()
          Performs the actual check-out of the item to be checked out.
private  void dispatchRefreshEvent(Object obj, int action)
           
 Folder getCheckoutFolder()
          Returns the Folder in which the working copy of the checked out object is to be placed.
 Workable getCheckoutItem()
          Returns the Workable item checked out by this task.
private  WTContext getContext()
           
private  String getIdentity(Object obj)
           
 Applet getParentApplet()
          Returns the parent Applet which provides context to this task.
 Frame getParentFrame()
          Returns the Frame which is used as the owner of dialogs launched in this task.
private  String getPreferenceValue(String key, String defaultValue)
           
private  void initResources()
           
private  boolean isCheckoutAllowed(Workable checkout_item)
           
private  WTPreferences retrievePreferences(String node)
           
 void setCheckoutFolder(Folder checkout_folder)
          Sets the Folder in which to place the working copy of the checked out object.
 void setCheckoutItem(Workable checkout_item)
          Sets the Workable item to be checked out.
private  void setContext(boolean set)
           
 void setParentApplet(Applet parent_applet)
          Sets the parent Applet which provides context to this task.
 void setParentFrame(Frame parent_frame)
          Sets the Frame to be used as the owner of dialogs launched in this task.
private  void showMessageDialog(String message)
           
 
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

RESOURCES

private static String RESOURCES

resources

private static ResourceBundle resources

DEBUG

private static boolean DEBUG
Flag used to provide debugging messages.


SHOW_CONTENTS

private static boolean SHOW_CONTENTS

PREF_NODE

private static String PREF_NODE

PREF_KEY_SKIPDOWNLOAD

private static String PREF_KEY_SKIPDOWNLOAD

PREF_KEY_DOWNLOADOPTYPE

private static String PREF_KEY_DOWNLOADOPTYPE

PREF_KEY_WORKSPACEPATH

private static String PREF_KEY_WORKSPACEPATH

parentApplet

private Applet parentApplet

parentFrame

private Frame parentFrame

checkoutFolder

private Folder checkoutFolder

checkoutItem

private Workable checkoutItem

contextGroup

private ThreadGroup contextGroup

threadLock

private Object threadLock

threadCompleted

private boolean threadCompleted

threadSuccessful

private boolean threadSuccessful

threadException

private Exception threadException

downloadPreferences

private WTPreferences downloadPreferences
Constructor Detail

CheckOutTask

public CheckOutTask(Applet parent_applet,
                    Frame parent_frame,
                    Folder checkout_folder)
Construct a CheckOutTask to handle the checkout of a Workable object.

Parameters:
parent_applet - The parent Applet from which this task gets its context.
parent_frame - The parent Frame which is used to provide a Frame for launching dialogs. If no frame is provided, the applet is used in launching dialogs.
checkout_folder - The folder into which the working copy of the checked out it is placed. If no checkout folder is provided, the checkout folder returned by CheckInOutTaskLogic.getCheckoutFolder() is used.
See Also:
Workable
Method Detail

setParentApplet

public void setParentApplet(Applet parent_applet)
Sets the parent Applet which provides context to this task. The parent Applet is used to get the appropriate WTContext object for this task.

Parameters:
parent_applet - the Applet to be used for context
See Also:
getParentApplet(), WTContext

getParentApplet

public Applet getParentApplet()
Returns the parent Applet which provides context to this task. The parent Applet is used to get the appropriate WTContext object for this task.

Returns:
the Applet used for providing context
See Also:
setParentApplet(java.applet.Applet), WTContext

setParentFrame

public void setParentFrame(Frame parent_frame)
Sets the Frame to be used as the owner of dialogs launched in this task. Since a Dialog requires a Frame to be constructed, this task must be given a frame to use.

Parameters:
parent_frame - the Frame used for launching dialogs from this task
See Also:
getParentFrame(), Dialog

getParentFrame

public Frame getParentFrame()
Returns the Frame which is used as the owner of dialogs launched in this task. If the parent frame has not been explicitly set (via setParentFrame), this method will try to retrieve a frame by traversing the parent hierarchy of the parent applet, if the parent applet has been given.

Returns:
the parent Frame used for launching dialogs from this task
See Also:
setParentFrame(java.awt.Frame), setParentApplet(java.applet.Applet)

setCheckoutFolder

public void setCheckoutFolder(Folder checkout_folder)
Sets the Folder in which to place the working copy of the checked out object.

Parameters:
checkout_folder - the Folder in which to place the working copy
See Also:
Folder

getCheckoutFolder

public Folder getCheckoutFolder()
Returns the Folder in which the working copy of the checked out object is to be placed.

Returns:
the Folder in which the working copy is to be placed
See Also:
Folder

setCheckoutItem

public void setCheckoutItem(Workable checkout_item)
                     throws CheckedOutByOtherException,
                            AlreadyCheckedOutException,
                            WTException
Sets the Workable item to be checked out. This method does not verify that the given Workable corresponds to an object that is available to be checked out.

Parameters:
checkout_item - the Workable object to be checked out
Throws:
CheckedOutByOtherException
AlreadyCheckedOutException
WTException
See Also:
getCheckoutItem(), Workable

getCheckoutItem

public Workable getCheckoutItem()
Returns the Workable item checked out by this task.

Returns:
the Workable item checked out by this task
See Also:
setCheckoutItem(wt.vc.wip.Workable), Workable

checkout

public Workable checkout()
Performs the actual check-out of the item to be checked out. This method will validate that the given item corresponds to an item that is available to be checked out to the user. If the given item is a FormatContentHolder object, and the object currently has content files associated with it, this method gives the user the opportunity to download those content files. Any files chosen for download are marked as having an intent to change.

Returns:
the Workable object to be checked out
See Also:
FormatContentHolder, Workable

initResources

private void initResources()

isCheckoutAllowed

private boolean isCheckoutAllowed(Workable checkout_item)
                           throws WorkInProgressException,
                                  WTException
Throws:
WorkInProgressException
WTException

getContext

private WTContext getContext()

setContext

private void setContext(boolean set)

showMessageDialog

private void showMessageDialog(String message)

dispatchRefreshEvent

private void dispatchRefreshEvent(Object obj,
                                  int action)

getIdentity

private String getIdentity(Object obj)

getPreferenceValue

private String getPreferenceValue(String key,
                                  String defaultValue)

retrievePreferences

private WTPreferences retrievePreferences(String node)