com.ptc.windchill.enterprise.templateutil
Class ActionValidator

java.lang.Object
  extended bycom.ptc.windchill.enterprise.templateutil.ActionValidator

public class ActionValidator
extends Object


Field Summary
protected static boolean VERBOSE
           
 
Constructor Summary
ActionValidator()
           
 
Method Summary
private static boolean canRevise(RevisionControlled object)
           
private static boolean hasSuccessor(Iterated iteration)
           
static boolean isCheckInValid(Object object)
          Validates if the current user can checkin an object.
static boolean isCheckOutValid(Object object)
          Validates if the current user can checkout an object.
static boolean isCopyValid(String type_id, Object object)
          Validates if the current user can perform a save as for a type.
static boolean isCreateFromTemplateValid(String type_id, Object object)
          Validates if the current user can create from template for a type.
static boolean isCreateTemplateValid(String type_id, Object object)
          Validates if the current user can create a template.
static boolean isCreateValid(String type_id, Object object)
          Validates if the current user can create a type.
static boolean isDeleteValid(Object object)
          Validates if the current user can delete an object.
private static boolean isNewInWorkspace(Object object)
           
static boolean isRenameValid(Object object)
          Validates if the current user can rename an object.
static boolean isReviseValid(Object object)
          Validates if the current user can revise an object.
static boolean isSaveAsValid(String type_id, Object object)
          Validates if the current user can perform a save as for a type.
static boolean isSetStateValid(Object object)
          Validates if the current user can set the state on an object.
static boolean isUndoCheckOutValid(Object object)
          Validates if the current user can perform and undo checkout.
static boolean isUpdateValid(Object object)
          Validates if the current user can update an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

protected static boolean VERBOSE
Constructor Detail

ActionValidator

public ActionValidator()
Method Detail

isCreateValid

public static boolean isCreateValid(String type_id,
                                    Object object)
Validates if the current user can create a type. Object passed in must be a WTContainer or WTContained, otherwise false is always returned. Based on the Default Domain of the WTContainer (either directy or via the WTContained object) create access is checked for the current user. If that check is successful the logic proceeds to check that the given type or at least one of its decendents is a creatable type for the container.

Supported API: false

Parameters:
type_id - Persistable type identifier of the object to validate.
object - Container or Contained (i.e. Folder) object to validate in.
Returns:
boolean

isSaveAsValid

public static boolean isSaveAsValid(String type_id,
                                    Object object)
Validates if the current user can perform a save as for a type. Object passed in must be a WTContainer or WTContained, otherwise false is always returned. See isCreateValid method for details.

Supported API: false

Parameters:
type_id - Persistable type identifier of the object to validate.
object - Container or Contained (i.e. Folder) object to validate in.
Returns:
boolean

isCopyValid

public static boolean isCopyValid(String type_id,
                                  Object object)
Validates if the current user can perform a save as for a type. Object passed in must be a WTContainer or WTContained, otherwise false is always returned. This method is the same as calling isSaveAsValid.

Supported API: false

Parameters:
type_id - Persistable type identifier of the object to validate.
object - Container or Contained (i.e. Folder) object to validate in.
Returns:
boolean

isCreateFromTemplateValid

public static boolean isCreateFromTemplateValid(String type_id,
                                                Object object)
Validates if the current user can create from template for a type. Object passed in must be a WTContainer or WTContained, otherwise false is always returned. This method performs the same check as isCreateValid. If that check is success then it checks to see if at least one template for the given type is available in the container.

Supported API: false

Parameters:
type_id - Persistable type identifier of the object to validate.
object - Container or Contained (i.e. Folder) object to validate in.
Returns:
boolean

isCreateTemplateValid

public static boolean isCreateTemplateValid(String type_id,
                                            Object object)
Validates if the current user can create a template. Object passed in must be a WTContainer, otherwise false is always returned. If that check is successful the logic proceeds to check that the given template type or at least one of its decendents is a creatable type for the container.

Supported API: false

Parameters:
object - Container to validate in.
Returns:
boolean

isUpdateValid

public static boolean isUpdateValid(Object object)
Validates if the current user can update an object. If the object is Workable, the current user must have the object checked out.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isRenameValid

public static boolean isRenameValid(Object object)
Validates if the current user can rename an object. If the object is checkedout by another user or if the object is not Versioned, false is returned. Current user must have modify access to all versions.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isCheckInValid

public static boolean isCheckInValid(Object object)
Validates if the current user can checkin an object. If the object is not Workable or the original copy is new to a workspace, then false is always returned. If the current user has the object checked out, or if the object is checkedout and the current user is an administrator where the object is container, then true is returned.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isCheckOutValid

public static boolean isCheckOutValid(Object object)
Validates if the current user can checkout an object. If the object is not Workable, false is always returned. In order to return true the user must have access to modify, the object cannot already be checked out, the object must be the latest iteration, the object can't be checkedout to the sandbox, and the object cannot be new to a workspace.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isUndoCheckOutValid

public static boolean isUndoCheckOutValid(Object object)
Validates if the current user can perform and undo checkout. If the object is not Workable, false is always returned. If the current user has the object checked out, or if the object is checkedout and the current user is an administrator where the object is container, then true is returned. Same as isCheckInValid.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isReviseValid

public static boolean isReviseValid(Object object)
Validates if the current user can revise an object. If the object is not RevisionControlled, false is always returned. In order for true to be returned the current user must have revise access on the object, the object cannot be checked out, and the object must be the latest version.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isDeleteValid

public static boolean isDeleteValid(Object object)
Validates if the current user can delete an object. In order for true to be returned the current user must have delete access on the object, the object cannot be checked out, and the object must be the latest version.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

isSetStateValid

public static boolean isSetStateValid(Object object)
Validates if the current user can set the state on an object. In order for true to be returned the current user must have administrative access on the object and the object cannot be checked out.

Supported API: false

Parameters:
object - Object instance to validate.
Returns:
boolean

canRevise

private static boolean canRevise(RevisionControlled object)
                          throws WTException,
                                 WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

hasSuccessor

private static boolean hasSuccessor(Iterated iteration)
                             throws WTException,
                                    WTPropertyVetoException
Throws:
WTException
WTPropertyVetoException

isNewInWorkspace

private static boolean isNewInWorkspace(Object object)
                                 throws WTException
Throws:
WTException