wt.clients.vc
Class CheckInOutTaskLogic

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

public class CheckInOutTaskLogic
extends Object

Class CheckInOutTaskLogic is a utility class that provides static methods for manipulating Workable objects. The methods in this class encapsulate the server-side processing needed to manipulate Workable objects.

Supported API: true

Extendable: false

See Also:
Workable

Field Summary
private static String MESSAGES_RESOURCE
           
private static String versionID
           
 
Constructor Summary
CheckInOutTaskLogic()
           
 
Method Summary
static Workable checkInObject(Workable workable, Folder checkin_folder, String note)
          Checks in the given Workable object to the vault for the first time.
static Workable checkInObject(Workable workable, String note)
          Checks in the given Workable object.
static Workable checkInObject(Workable workable, String folder_path, String note)
          Checks in the given Workable object to the vault for the first time.
static CheckoutLink checkOutObject(Workable workable, Folder folder, String note)
          Checks out the given Workable object.
static WTPrincipal getCheckedOutBy(Workable workable)
          Returns the WTPrincipal that currently has the given Workable object checked out.
static String getCheckedOutBy(Workable workable, Locale locale)
          Returns the String display name of the WTPrincipal that currently has the given Workable object checked out.
static Folder getCheckoutFolder()
          Returns the default check-out folder for the current user.
static Folder getCheckoutFolder(Workable workable)
          Returns the folder in which the working copy of the given checked out item exists.
static Workable getOriginalCopy(Workable working_copy)
          Returns the original copy of the given Workable object.
static Workable getWorkingCopy(Workable original_copy)
          Returns the working copy of the given Workable object.
static boolean hasChanged(Workable workable)
          Returns a boolean value indicating whether or not the given workable has been modified since it has been checked out.
static boolean isCheckedOut(Workable item)
          Determines if the given Workable object is currently checked out.
static boolean isCheckedOut(Workable item, WTPrincipal user)
          Determines if the given Workable object is currently checked out by the given WTPrincipal.
static boolean isCheckedOutByOther(Workable workable)
          Determines if the given Workable object is currently checked out by a user other than the current user.
static boolean isCheckedOutByUser(Workable workable)
          Determines if the given Workable object is currently checked out by the current user.
static boolean isCheckinAllowed(Workable workable)
          Determines if the given Workable object is available to be checked in by the current user.
static boolean isCheckoutAllowed(Workable workable)
          Checks if the current user is allowed to check out the given Workable object.
static boolean isInVault(Workable workable)
          Determines whether or not the given Workable already exists in the vault.
static boolean isWorkingCopy(Workable workable)
          Determines if the given Workable object is a working copy.
static Workable refresh(Workable workable)
          Returns a refreshed copy of the given workable.
static Workable undoCheckout(Workable original)
          Undoes the checkout of the given Workable 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
Constructor Detail

CheckInOutTaskLogic

public CheckInOutTaskLogic()
Method Detail

isCheckoutAllowed

public static boolean isCheckoutAllowed(Workable workable)
                                 throws LockException,
                                        WTException
Checks if the current user is allowed to check out the given Workable object. If the given object is not a working copy, and the object is not currently checked out, then the user is allowed to check out the object.

Parameters:
workable - the Workable object which is checked to determine if the current user can check it out
Returns:
if true, the current user is allowed to check out the given object.
Throws:
LockException - if an error occurs determining if the given object is currently checked out
WTException - if an error occurs determining if the given object is a working copy
See Also:
Workable

isCheckedOutByUser

public static boolean isCheckedOutByUser(Workable workable)
                                  throws WTException
Determines if the given Workable object is currently checked out by the current user.

Parameters:
workable - the Workable object to determine if the current user has checked out
Returns:
if true, the current user has the given object checked out
Throws:
WTException - if an error occurs determining if the current user has the given object checked out
See Also:
Workable

isCheckedOutByOther

public static boolean isCheckedOutByOther(Workable workable)
                                   throws WTException
Determines if the given Workable object is currently checked out by a user other than the current user. Note that a returned value of false does not imply that the current user has the object checked out, but only that a user other than the current user does not have the object checked out.

Parameters:
workable - the Workable object to determine if a user other than the current user has checked out
Returns:
if true, a user other than the current user has the given object checked out
Throws:
WTException - if an error occurs determining if a user other than the current user has the given object checked out
See Also:
Workable

isCheckedOut

public static boolean isCheckedOut(Workable item)
                            throws WorkInProgressException,
                                   WTException
Determines if the given Workable object is currently checked out.

Parameters:
item - the Workable item to be tested for being in a checked out state
Returns:
if true, the given object is currently checked out
Throws:
WorkInProgressException - if an error occurs determining the checked out status of the given Workable
WTException - if an error occurs determining the checked out status of the given Workable

isCheckedOut

public static boolean isCheckedOut(Workable item,
                                   WTPrincipal user)
                            throws WorkInProgressException,
                                   WTException
Determines if the given Workable object is currently checked out by the given WTPrincipal.

Parameters:
item - the Workable item to be tested for being checked out by the given WTPrincipal
user - the WTPrincipal to be tested for having the given Workable checked out
Returns:
if true, the given WTPrincipal currently has the given Workable checked out
Throws:
WorkInProgressException - if an error occurs determining if the given WTPrincipal has the given Workable checked out
WTException - if an error occurs determining if the given WTPrincipal has the given Workable checked out

getCheckedOutBy

public static WTPrincipal getCheckedOutBy(Workable workable)
                                   throws LockException,
                                          WorkInProgressException,
                                          WTException
Returns the WTPrincipal that currently has the given Workable object checked out. If the given object is not in a checked out state, a null value is returned.

Parameters:
workable - the Workable object for which the WTPrincipal having this object checked out is returned
Returns:
the WTPrincipal which has the given object checked out; if the object is not checked out, null is returned
Throws:
LockException - if an error occurs retrieving the WTPrincipal which has the given object checked out
WorkInProgressException - if an error occurs determining if the given object is checked out
WTException - if an error occurs determining if the given object is checked out

getCheckedOutBy

public static String getCheckedOutBy(Workable workable,
                                     Locale locale)
                              throws LockException,
                                     WorkInProgressException,
                                     WTException
Returns the String display name of the WTPrincipal that currently has the given Workable object checked out. If the given object is not in a checked out state, a null value is returned.

Parameters:
workable - the Workable object for which the name of the WTPrincipal having this object checked out is returned
locale - the Locale in which to display the name
Returns:
the String display name of the WTPrincipal which has the given object checked out; if the object is not checked out, null is returned
Throws:
LockException - if an error occurs retrieving the WTPrincipal which has the given object checked out
WorkInProgressException - if an error occurs determining if the given object is checked out
WTException - if an error occurs determining if the given object is checked out

isWorkingCopy

public static boolean isWorkingCopy(Workable workable)
Determines if the given Workable object is a working copy.

Parameters:
workable - the Workable item that is checked to see if it is a working copy
Returns:
if true, the given object is a working copy

getWorkingCopy

public static Workable getWorkingCopy(Workable original_copy)
                               throws WorkInProgressException,
                                      WTException
Returns the working copy of the given Workable object. If the given object itself is a working copy, then that object is returned. Otherwise, the working copy of the given original is retrieved and returned.

Parameters:
original_copy - the Workable whose working copy is to be returned
Returns:
the working copy of the given object
Throws:
WorkInProgressException - if an error occurs attempting to retrieve the working copy of the given object
WTException - if an error occurs attempting to retrieve the working copy of the given object
See Also:
getOriginalCopy(wt.vc.wip.Workable), Workable

checkOutObject

public static CheckoutLink checkOutObject(Workable workable,
                                          Folder folder,
                                          String note)
                                   throws CheckInOutException,
                                          WTPropertyVetoException,
                                          WorkInProgressException,
                                          WTException
Checks out the given Workable object. The working copy of the checked out object is placed into the given Folder. If the given folder is null, an exception is thrown. The given String note is used as the check-out note.

Parameters:
workable - the Workable object to be checked out
folder - the Folder in which to place the working copy created by the check-out
note - the String note describing the check-out
Returns:
the CheckoutLink created by checking out the given object
Throws:
CheckInOutException - if the given Folder in which to place the working copy is not given
WTPropertyVetoException - if an error occurs checking out the given object
WorkInProgressException - if an error occurs checking out the given object
WTVetoException - if an error occurs checking out the given object
WTException
See Also:
CheckoutLink, Workable

undoCheckout

public static Workable undoCheckout(Workable original)
                             throws WorkInProgressException,
                                    WTPropertyVetoException,
                                    WTException
Undoes the checkout of the given Workable object.

Parameters:
original - the checked out Workable object for which the check-out is undone
Returns:
the Workable object for which the check-out was undone
Throws:
WorkInProgressException - if an error occurs undoing the check-out of the given object
WTPropertyVetoException - if an error occurs undoing the check-out of the given object
WTException - if an error occurs undoing the check-out of the given object

getOriginalCopy

public static Workable getOriginalCopy(Workable working_copy)
                                throws WorkInProgressException,
                                       WTException
Returns the original copy of the given Workable object. If the given object itself is an original object, then that object is returned. Otherwise, the original of the given working copy is retrieved and returned.

Parameters:
working_copy - the Workable whose original is to be returned
Returns:
the original of the given working copy object
Throws:
WorkInProgressException - if an error occurs attempting to retrieve the original of the given object
WTException - if an error occurs attempting to retrieve the original of the given object
See Also:
getWorkingCopy(wt.vc.wip.Workable), Workable

isCheckinAllowed

public static boolean isCheckinAllowed(Workable workable)
                                throws WTException
Determines if the given Workable object is available to be checked in by the current user. If the given object is currently checked out by the current user, or if the current user is a member of the "Administrators" group, then the checkin is allowed, and this method returns true.

Parameters:
workable - the Workable object which is tested for check-in by the current user
Returns:
true if the given object is currently checked out by the current user
Throws:
WTException - if an error occurs determining if the current user has the given object checked out

checkInObject

public static Workable checkInObject(Workable workable,
                                     String note)
                              throws WTPropertyVetoException,
                                     WorkInProgressException,
                                     WTException
Checks in the given Workable object. The given String note is associated as a description for the check-in operation.

Parameters:
workable - the Workable object to be checked in
note - the String note associated with this checkin.
Returns:
the Workable object updated as a result of being checked in
Throws:
WTPropertyVetoException - if an error occurs attempting to check in the given object
WorkInProgressException - if an error occurs attempting to check in the given object
WTException - if an error occurs attempting to check in the given object

checkInObject

public static Workable checkInObject(Workable workable,
                                     Folder checkin_folder,
                                     String note)
                              throws WTPropertyVetoException,
                                     VersionControlException,
                                     WTException
Checks in the given Workable object to the vault for the first time. The given Folder specifies where to check the object in to. The given String note is associated as a description for the initial check-in operation.

Parameters:
workable - the Workable object to be checked in
checkin_folder - the Folder in which to place the checked in object
note - the String note associated with this checkin.
Returns:
the Workable object updated as a result of being checked in
Throws:
WTPropertyVetoException - if an error occurs attempting to check in the given object
WorkInProgressException - if an error occurs attempting to check in the given object
WTException - if an error occurs attempting to check in the given object
VersionControlException

checkInObject

public static Workable checkInObject(Workable workable,
                                     String folder_path,
                                     String note)
                              throws WTPropertyVetoException,
                                     VersionControlException,
                                     WTException
Checks in the given Workable object to the vault for the first time. The given String folder path specifies the path of the folder where the object is to be checked in to. The given String note is associated as a description for the initial check-in operation.

Parameters:
workable - the Workable object to be checked in
folder_path - the String folder path of the folder in which to place the checked in object
note - the String note associated with this checkin.
Returns:
the Workable object updated as a result of being checked in
Throws:
WTPropertyVetoException - if an error occurs attempting to check in the given object
WorkInProgressException - if an error occurs attempting to check in the given object
WTException - if an error occurs attempting to check in the given object
VersionControlException

getCheckoutFolder

public static Folder getCheckoutFolder()
                                throws WTException
Returns the default check-out folder for the current user.

Returns:
the default check-out Folder for the current user
Throws:
WTException - if an error occurs retrieving the check-out folder
See Also:
Folder

getCheckoutFolder

public static Folder getCheckoutFolder(Workable workable)
                                throws CheckInOutException,
                                       WTException
Returns the folder in which the working copy of the given checked out item exists. If the given object is the original copy of a checked out item, this method will find the working copy and return the folder in which that working copy is contained. Otherwise, if the given object is the working copy, this method will return the containing folder of that given object. If the given object is not checked out, an exception will be thrown.

Parameters:
workable - the original copy for which the folder containing the working copy is returned. If the given object is the working copy, its containing folder is returned
Returns:
the Folder in which the working copy of the given object is contained
Throws:
CheckInOutException
WTException

isInVault

public static boolean isInVault(Workable workable)
                         throws WTException
Determines whether or not the given Workable already exists in the vault. If the given Workable already exists in a shared cabinet and is under revision control, true is returned. Otherwise, if the given Workable is not in a shared cabinet and is not under revision control by the Windchill system, false is returned.

Parameters:
workable - the Workable whose existence in the vault is test
Returns:
true if the given Workable exists in the vault (a shared cabinet)
Throws:
WTException
See Also:
Cabinet, Workable

refresh

public static Workable refresh(Workable workable)
                        throws ObjectNoLongerExistsException,
                               WTException
Returns a refreshed copy of the given workable.

Parameters:
workable - the Workable to be refreshed
Returns:
a refreshed copy of the given workable.
Throws:
ObjectNoLongerExistsException
WTException

hasChanged

public static boolean hasChanged(Workable workable)
                          throws WTException
Returns a boolean value indicating whether or not the given workable has been modified since it has been checked out. This method will accept either the working copy or the original copy and will determine whether or not the working copy has been modified and is different from the existing original copy. If the working copy has been modified since the original has been checked out, true is returned. Otherwise, false is returned.

Parameters:
workable - the Workable to be tested for modification
Returns:
true, if the working copy of the given Workable has been modified and is different from the original copy.
Throws:
WTException