Class TaskHelper

java.lang.Object
com.ptc.windchill.esi.utl.TaskHelper

public final class TaskHelper extends Object
Common utility methods of general usefulness to ESI classes and ESI Info*Engine tasks.

Supported API: true

Extendable: false
  • Method Details

    • getObjectID

      public static final String getObjectID(Persistable object)
      Returns the UFID for a Persistable. If any exception is caught , null is returned.

      Supported API: true
      Parameters:
      object - - The persistable object whose UFID is desired.
      Returns:
      String
    • addMultivaluePersistableParamGroup

      public final void addMultivaluePersistableParamGroup(String paramName, String groupName, com.infoengine.SAK.Tasklet task) throws com.infoengine.util.IEException
      Get the task parameter values and add each one to an element in a group.
      • If any of the arguments are null, or null strings, or all spaces, an exception is thrown.
      • Creates a Group with name passed in the groupName argument. Adds the Group to the task.
      • The Task's @FORM group is accessed to obtain all values for the Att whose name matches the paramName argument. If none match, an exception is thrown.
      • If any of the values are not properly formatted as UFIDs, an exception is thrown.
      • For each value in @FORM group, obtain the Persistable associated with the UFID in the value
      • Add an Element to the group that was added to the task. The element has one Att. The Att name is the same as the task parameter that was accessed. The Att's value is the Persistable obtained.


      Supported API: true
      Parameters:
      paramName - - The name of the task parameter whose values are to be obtained.
      groupName - - the name of the Group to add to the task's VDB.
      task - - The task whose parameters are to be obtained and whose VDB is to be updated.
      Throws:
      com.infoengine.util.IEException
    • getBooleanStringParameter

      public static final boolean getBooleanStringParameter(String paramName, com.infoengine.SAK.Tasklet task) throws com.infoengine.util.IEException
      Obtains a task parameter and returns it as a boolean value. If either argument is null, an exception is thrown. If the task has no such parameter, an exception is thrown. If the task parameter is neither "TRUE" nor "FALSE" (case-insensitive) an exception is thrown.

      Supported API: true
      Parameters:
      paramName - - The parameter to access.
      task - - The task whose parameter is to be examined.
      Returns:
      boolean
      Throws:
      com.infoengine.util.IEException
    • getBooleanStringParameter

      public static final boolean getBooleanStringParameter(String paramName, boolean defaultValue, com.infoengine.SAK.Tasklet task) throws com.infoengine.util.IEException
      Obtains a task parameter and returns it as a boolean value. If either argument is null, an exception is thrown. If the task has no such parameter, the default value is returned. If the task parameter is neither "TRUE" nor "FALSE" (case-insensitive) an exception is thrown.

      Supported API: true
      Parameters:
      paramName - - The parameter to access.
      defaultValue - - The value to return if the task has no parameter matching the value of the paramName argument.
      task - - The task whose parameter is to be examined.
      Returns:
      boolean
      Throws:
      com.infoengine.util.IEException
    • getParameterString

      public static final String getParameterString(String paramName, com.infoengine.SAK.Tasklet tasklet) throws com.infoengine.util.IEException
      Returns the value of a task parameter. If either argument is null, or the task parameter is not specified, an exception is thrown.

      Supported API: true
      Parameters:
      paramName - - The name of the parameter to obtain.
      tasklet - - The Tasklet whose parameter is to be queried.
      Returns:
      String
      Throws:
      com.infoengine.util.IEException
    • waitForMethodServer

      public final void waitForMethodServer()
      Waits until the method server is ready. The method prevents ESI processes from activating until the Windchill Method Server is fully initialized. The method reads ESIProperties to determine the length of time to wait and the number of wait intervals. It locks its thread for the specified interval. If wt.method.WTAdapter.ADAPTER_INITIALIZED is true, the method exits. The method is accessed by the ESI SubscribeQueues task.

      Supported API: true
    • addSuccessMsgGroup

      public final void addSuccessMsgGroup(String groupName, com.infoengine.SAK.Tasklet task) throws com.infoengine.util.IEException
      Adds a group to the task to ensure that receivers are notified of a successful invocation of a service that returns a java void. If either argument is null, an exception is thrown.

      Supported API: true
      Parameters:
      groupName - The name of the group to create.
      task - The Tasklet whose VDB is to be updated.
      Throws:
      com.infoengine.util.IEException
    • getRpcGroupNames

      public final Iterator<String> getRpcGroupNames(String groupName, com.infoengine.SAK.Tasklet task) throws com.infoengine.util.IEException
      Obtains the results of an apply-service webject for an ESI RPC, adds all of the groups in the RPC response to the task passed in the argument, and returns an iterator of a collection of group names in the resultant VDB. Does the following:
      1. Validates arguments to make sure they are not null and that the groupName argument is not a null string.
      2. Extracts the Group whose name is equal to the first argument from the second argument. If no Group is found, throws an exception.
      3. Gets the first element from the group. If the group is empty, throws an exception.
      4. Gets the value of the "result" Att from the element just obtained. If Att is not found or null, throws an exception.
      5. Typecasts the Att value to an IeCollection.
      6. Creates a Collection to hold the names of the groups in the IeCollection
      7. For each group in the IeCollection:
        • Gets the group from the IeCollection
        • Adds the group to the second argument
        • Adds the name of the group to the collection of group names.
      8. Generates an Iterator for the collection of names and returns the Iterator instance.


      Supported API: true
      Parameters:
      groupName - - The name of the group to extract from the task argument. It is presumed to be the name of an Group containing one element with a single Att whose name is "result".
      task -
      Returns:
      Iterator
      Throws:
      com.infoengine.util.IEException
    • getMultivalueParam

      public Collection<Object> getMultivalueParam(String name, com.infoengine.SAK.Tasklet task) throws com.infoengine.util.IEException
      Return a collection of the values of the task parameter identified by the name argument. Obtains the parameters from the task identified by the Info*Engine SAK tasklet object that is identified by the task argument.

      Supported API: true
      Parameters:
      name - - The name of the parameter whose values are to be obtained.
      task - - The tasklet whose parameter is to be obtained.
      Returns:
      Collection
      Throws:
      com.infoengine.util.IEException
    • checkParameter

      public static final void checkParameter(String param, String name) throws MissingParameterException
      Test a string to make sure that it is not null and not empty, and not all spaces.

      Supported API: true
      Parameters:
      param -
      name -
      Throws:
      MissingParameterException
    • checkParameter

      public static final void checkParameter(Object obj, String name) throws MissingParameterException
      Test a method parameter to make sure that it is not null.

      Supported API: true
      Parameters:
      obj -
      name -
      Throws:
      MissingParameterException
    • getObjectID

      public static final String getObjectID(WTReference objRef)
      Returns the UFID for a windchill object reference. If any exception is caught , null is returned.

      Supported API: true
      Parameters:
      objRef - - The persistable object whose UFID is desired.
      Returns:
      - The ufid for the input object reference