wt.sandbox
Class SandboxHelper

java.lang.Object
  extended bywt.sandbox.SandboxHelper
All Implemented Interfaces:
Externalizable, Serializable

public final class SandboxHelper
extends Object
implements Externalizable

Helper class providing static final implementation of SandboxService.

Also provides some utility methods of its own which do not require database queries or other server-side processing.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
static SandboxService service
          

Supported API: false
 
Constructor Summary
SandboxHelper()
           
 
Method Summary
static boolean isCheckedOutToSandbox(Workable obj)
          Similar to WorkInProgressHelper.isCheckedOut() method with same arguments.
static boolean isCheckedOutToSandbox(Workable obj, WTPrincipal worker)
          Similar to WorkInProgressHelper.isCheckedOut() method with same arguments.
static boolean isCheckedOutToSandbox(WorkInProgressState state)
          Takes the state value of an object and compares this to the CheckedOutToSandbox state defined in WorkInProgressState.
static boolean isSandboxWorkingCopyNoDBHack(Versioned version)
          Returns true if the given object is a one-off version resulting from a checkout to a sandbox.
static boolean isSandboxWorkingCopyNoDBHack(WTReference version, WTContainerRef containerRef, Object oneOffVersionId)
          Returns true if the given object is a one-off version resulting from a checkout to a sandbox.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(SandboxHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
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 SandboxService service


Supported API: false


serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

SandboxHelper

public SandboxHelper()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(SandboxHelper thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

isCheckedOutToSandbox

public static boolean isCheckedOutToSandbox(Workable obj)
                                     throws WTException
Similar to WorkInProgressHelper.isCheckedOut() method with same arguments. Returns true if and only if the given iteration has been checked out to a sandbox.

Supported API: false

Parameters:
obj - Workable object to test
Returns:
boolean
Throws:
WTException

isCheckedOutToSandbox

public static boolean isCheckedOutToSandbox(Workable obj,
                                            WTPrincipal worker)
                                     throws WTException
Similar to WorkInProgressHelper.isCheckedOut() method with same arguments. Returns true if and only if the given iteration has been checked out to a sandbox by the given principal.

Supported API: false

Parameters:
obj - Workable object to test
worker - principal to test
Returns:
boolean
Throws:
WTException

isCheckedOutToSandbox

public static boolean isCheckedOutToSandbox(WorkInProgressState state)
Takes the state value of an object and compares this to the CheckedOutToSandbox state defined in WorkInProgressState. If it matches this state, then it returns true.

Supported API: false

Parameters:
state - WorkInProgressState to test
Returns:
boolean

isSandboxWorkingCopyNoDBHack

public static boolean isSandboxWorkingCopyNoDBHack(Versioned version)
                                            throws WTException
Returns true if the given object is a one-off version resulting from a checkout to a sandbox. This method serves the same purpose as wt.sandbox.SandboxService.isWorkingCopy() but does not do a database query and so is less costly. However, it also makes the assumption that every OneOffVersioned object with a non-null OneOffVersionIdentifier string and residing in a project is the result of a sandbox checkout. This assumption may be invalid in future releases or in customizations so SandboxService.isWorkingCopy() should be used instead of this method except where performance is critical.

Supported API: false

Returns:
boolean
Throws:
WTException

isSandboxWorkingCopyNoDBHack

public static boolean isSandboxWorkingCopyNoDBHack(WTReference version,
                                                   WTContainerRef containerRef,
                                                   Object oneOffVersionId)
                                            throws WTException
Returns true if the given object is a one-off version resulting from a checkout to a sandbox. This method serves the same purpose as wt.sandbox.SandboxService.isWorkingCopy() but does not do a database query and so is less costly. However, it also makes the assumption that every OneOffVersioned object with a non-null OneOffVersionIdentifier string and residing in a project is the result of a sandbox checkout. This assumption may be invalid in future releases or in customizations so SandboxService.isWorkingCopy() should be used instead of this method except where performance is critical.

Supported API: false

Parameters:
containerRef -
oneOffVersionId -
Returns:
boolean
Throws:
WTException