wt.ownership
Class OwnershipHelper

java.lang.Object
  extended bywt.ownership.OwnershipHelper
All Implemented Interfaces:
Externalizable, Serializable

public class OwnershipHelper
extends Object
implements Externalizable

The OwnershipHelper provides access to the API of the Windchill Ownership capability. It provides direct static methods which allow access to information present in Ownable objects. It also provides access to the remote methods of the OwnershipService by the containment of a static service object.

Supported API: false

Extendable: false

See Also:
OwnershipService, Ownable, 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 OwnershipService service
          

Supported API: false
private static boolean VERBOSE
           
 
Constructor Summary
OwnershipHelper()
           
 
Method Summary
static void copyOwnership(Ownable source, Ownable target)
          Copy the ownership information from one Ownable object to another.
static WTPrincipal getOwner(Ownable obj)
          Retrieve the Owner of the supplied object.
static WTPrincipalReference getOwnerReference(Ownable obj)
          Retrieve the Owner Reference of the supplied object.
static WTPrincipal getReadOnlyOwner(Ownable obj)
           
static SearchCondition getSearchCondition(Class targetClass, boolean owned)
          Create a SearchCondition that will return Ownable objects that are either owned or not owned by a WTPrincipal.
static SearchCondition getSearchCondition(Class targetClass, WTPrincipal owner, boolean owned)
          Create a SearchCondition that will return Ownable objects that are owned (or not owned) by the supplied WTPrincipal.
static boolean isOwned(Ownable obj)
          Determines if the supplied object is owned by any WTPrincipal.
static boolean isOwnedBy(Ownable obj, WTPrincipal principal)
          Determines if the supplied object is owned by a specific WTPrincipal.
 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(OwnershipHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
static boolean sameOwnership(Ownable ownable1, Ownable ownable2)
          Determine if two objects have the same owner.
static void setOwner(Ownable obj, WTPrincipal principal)
          Sets the Owner of the supplied object.
 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 OwnershipService 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

VERBOSE

private static final boolean VERBOSE
Constructor Detail

OwnershipHelper

public OwnershipHelper()
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(OwnershipHelper 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

isOwned

public static boolean isOwned(Ownable obj)
                       throws WTException
Determines if the supplied object is owned by any WTPrincipal. This local operation interogates the Ownership information of the Ownable object and returns a boolean response.

Supported API: false

Parameters:
obj - The object to determine ownership of
Returns:
boolean
Throws:
WTException

isOwnedBy

public static boolean isOwnedBy(Ownable obj,
                                WTPrincipal principal)
                         throws WTException
Determines if the supplied object is owned by a specific WTPrincipal. This local operation interogates the Ownership information of the Ownable object and returns a boolean response.

Supported API: false

Parameters:
obj - The object to determine ownership of
principal - The user or group to test for ownership
Returns:
boolean
Throws:
WTException

getOwner

public static WTPrincipal getOwner(Ownable obj)
                            throws WTException
Retrieve the Owner of the supplied object. May return null if the object current has no owner. This method will run to the server to receive the WTPrincipal object if it's not already been fetched.

Supported API: false

Parameters:
obj - The object to determine ownership of.
Returns:
WTPrincipal
Throws:
WTException

getSearchCondition

public static SearchCondition getSearchCondition(Class targetClass,
                                                 boolean owned)
                                          throws QueryException
Create a SearchCondition that will return Ownable objects that are either owned or not owned by a WTPrincipal. You must supply the target class for the search condition.

Supported API: false

Parameters:
targetClass -
owned -
Returns:
SearchCondition
Throws:
QueryException
See Also:
QuerySpec

getSearchCondition

public static SearchCondition getSearchCondition(Class targetClass,
                                                 WTPrincipal owner,
                                                 boolean owned)
                                          throws QueryException
Create a SearchCondition that will return Ownable objects that are owned (or not owned) by the supplied WTPrincipal. You must supply the target class for the SearchCondition.

Supported API: false

Parameters:
targetClass -
owner -
owned -
Returns:
SearchCondition
Throws:
QueryException
See Also:
QuerySpec

copyOwnership

public static void copyOwnership(Ownable source,
                                 Ownable target)
                          throws WTException
Copy the ownership information from one Ownable object to another. This is a local change only and may only be performed on objects that have not yet been persisted.

Supported API: false

Parameters:
source -
target -
Throws:
WTException

sameOwnership

public static boolean sameOwnership(Ownable ownable1,
                                    Ownable ownable2)
Determine if two objects have the same owner. This is true if the Ownership is the same principal or if the Ownership is such that there is currently no Ownership.

Supported API: false

Parameters:
ownable1 -
ownable2 -
Returns:
boolean

setOwner

public static void setOwner(Ownable obj,
                            WTPrincipal principal)
                     throws WTException,
                            OwnershipException
Sets the Owner of the supplied object. This operation is only valid on an object that has not yet been persisted. For operations involving already persisted operations, use the operations of the OwnershipService which are available via the service member variable. If the principal is null, then releaseOwnership will be called for the specified obj.

Supported API: false

Parameters:
obj -
principal -
Throws:
WTException
OwnershipException
See Also:
OwnershipService

getOwnerReference

public static WTPrincipalReference getOwnerReference(Ownable obj)
                                              throws WTException
Retrieve the Owner Reference of the supplied object. May return null if the object current has no owner. This method will run to the server to receive the WTPrincipalReference object if it's not already been fetched.

Supported API: false

Parameters:
obj -
Returns:
WTPrincipalReference
Throws:
WTException

getReadOnlyOwner

public static WTPrincipal getReadOnlyOwner(Ownable obj)
                                    throws WTException
Throws:
WTException