com.ptc.windchill.esi.evt
Class EventEmitter

java.lang.Object
  extended bycom.ptc.windchill.esi.evt.EventEmitter

public class EventEmitter
extends Object

Creates an ESI event and sends it to JMS via Info*engine.

Supported API: true

Extendable: true


Field Summary
protected static ESIPropertyRequest ADMIN_USER
           
private static String CLASSNAME
           
private  ESIECNFactory ecnFactory
           
private static HashMap esiLocaleMap
           
private static Locale esiTargetLocale
           
private  ESIEvent event
           
protected static ESIPropertyRequest EVENT_AUTO_GENERATE_ECN
           
protected static ESIPropertyRequest EVENT_ECN_FACTORY
           
protected static ESIPropertyRequest EVENT_ECN_VALIDATOR
           
protected static ESIPropertyRequest EVENT_PART_VALIDATOR
           
protected static ESIPropertyRequest EVENT_QUEUE_NAME
           
protected static ESIPropertyRequest EVENT_QUEUE_PASSWORD
           
protected static ESIPropertyRequest EVENT_QUEUE_TASK
           
protected static ESIPropertyRequest EVENT_QUEUE_USER
           
protected static ESIPropertyRequest EVENT_SOAP_RENDERER
           
protected static ESIPropertyRequest EVENT_WTOBJECT_VALIDATOR
           
protected  String jmsQueueName
           
protected  String jmsQueuePassword
           
protected  String jmsQueueTaskName
           
protected  String jmsQueueUser
           
protected static String NULL_STRING
           
private  SoapRequestRenderer renderer
           
private static String RESOURCE
           
private static ArrayList sl
           
private static String sourceLocales
           
private static String targetLocales
           
private  Task task
           
private static ArrayList tl
           
private  ESIValidator validator
           
 
Constructor Summary
EventEmitter()
           
 
Method Summary
protected  void addParam(String name, Object value)
          Adds a task parameter to the event creation task before it's executed.
protected  void addTaskParams()
          Allows subclasses to add additional parameters to the task before it's executed.
private static ArrayList buildLcList(String s, String delimiter)
           
protected  String encodeUser(String userIn)
           
private  void eventValidate(ESIEvent a_Event)
           
 ESIEvent getEvent()
          Gets the object for the association that plays role: event.
protected  Locale getLocale()
          Obtains the locale to use to publish objects.
protected  String getUserName()
          Obtains the user ID of the individual responsible for publishing objects.
private  void initialize()
           
private static void initLocaleMaps()
           
private  boolean inSourceLocaleSet(Locale locale)
           
protected  void invokeTask(Releasable object, String action, WTObject waitingObject, String userName, Locale locale)
          Invoke an Info*Engine task to write the ESI Event into the appropriate JMS queue.Obtains from ESI properties:the name of the taskthe name of the JMS queueJMS queue authentication informationObtains the current user from the Session Manager.Obtains the SOAP message from the SoapRequestRenderer in the renderer attribute.Passes the obtained information to the task as parametersInvokes the task

Supported API: true
private static boolean isSupportedLocale(Locale locale)
           
 void releasePart(WTPart part, String action, WTPart waitingPart)
          Validates arguments and then: creates a new transaction creates a new event passes the event to a new EventRenderer creates the task defined in the property "com.ptc.windchill.esi.eventTask" invokes the task

Supported API: true
 void releasePart(WTPart part, String action, WTPart waitingPart, String userName, Locale locale)
          Validates arguments and then: creates a new transaction creates a new event passes the event to a new EventRenderer creates the task defined in the property "com.ptc.windchill.esi.eventTask" invokes the task

Supported API: true
 void releaseWTChangeOrder2(WTChangeOrder2 ecn, String action, WTObject waitingObject)
          Validates arguments and then: creates a new transaction creates a new event passes the event to a new EventRenderer creates the task defined in the property "com.ptc.windchill.esi.eventTask" invokes the task

Supported API: true
 void releaseWTChangeOrder2(WTChangeOrder2 ecn, String action, WTObject waitingObject, String userName, Locale locale)
          Validates arguments and then: creates a new transaction creates a new event passes the event to a new EventRenderer creates the task defined in the property "com.ptc.windchill.esi.eventTask" invokes the task

Supported API: true
private  void say(String s)
           
 void setEvent(ESIEvent a_Event)
          Sets the object for the association that plays role: event.
protected  void testArgument(Object obj, String name, Class cls)
           
protected  void testStringArgument(String s, String name)
           
protected  void updateTask()
          Provided as a convenience to extenders of the class.
protected  void validate(String className, WTObject object)
          Obtains an instance of ESIValidator and invokes the validate() method on that instance.
protected  void validatePart(WTPart part)
          Makes sure that the argument is in the correct state to be published by ESI.
protected  void validateWTChangeOrder2(WTChangeOrder2 ecn)
          Makes sure that the argument is in the correct state to be published by ESI.
protected  void validateWTObject(WTObject object)
          Convenience for extenders of this class.
 
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

validator

private ESIValidator validator

renderer

private SoapRequestRenderer renderer

event

private ESIEvent event

ecnFactory

private ESIECNFactory ecnFactory

NULL_STRING

protected static final String NULL_STRING
See Also:
Constant Field Values

EVENT_QUEUE_NAME

protected static final ESIPropertyRequest EVENT_QUEUE_NAME

EVENT_QUEUE_USER

protected static final ESIPropertyRequest EVENT_QUEUE_USER

EVENT_QUEUE_PASSWORD

protected static final ESIPropertyRequest EVENT_QUEUE_PASSWORD

EVENT_QUEUE_TASK

protected static final ESIPropertyRequest EVENT_QUEUE_TASK

EVENT_SOAP_RENDERER

protected static final ESIPropertyRequest EVENT_SOAP_RENDERER

EVENT_PART_VALIDATOR

protected static final ESIPropertyRequest EVENT_PART_VALIDATOR

EVENT_ECN_VALIDATOR

protected static final ESIPropertyRequest EVENT_ECN_VALIDATOR

EVENT_WTOBJECT_VALIDATOR

protected static final ESIPropertyRequest EVENT_WTOBJECT_VALIDATOR

ADMIN_USER

protected static final ESIPropertyRequest ADMIN_USER

EVENT_AUTO_GENERATE_ECN

protected static final ESIPropertyRequest EVENT_AUTO_GENERATE_ECN

EVENT_ECN_FACTORY

protected static final ESIPropertyRequest EVENT_ECN_FACTORY

jmsQueueName

protected String jmsQueueName

jmsQueueUser

protected String jmsQueueUser

jmsQueuePassword

protected String jmsQueuePassword

jmsQueueTaskName

protected String jmsQueueTaskName

task

private Task task

sourceLocales

private static String sourceLocales

targetLocales

private static String targetLocales

esiLocaleMap

private static HashMap esiLocaleMap

sl

private static ArrayList sl

tl

private static ArrayList tl

esiTargetLocale

private static Locale esiTargetLocale
Constructor Detail

EventEmitter

public EventEmitter()
Method Detail

getEvent

public ESIEvent getEvent()
Gets the object for the association that plays role: event.

Supported API: false

Returns:
ESIEvent

setEvent

public void setEvent(ESIEvent a_Event)
              throws WTPropertyVetoException
Sets the object for the association that plays role: event.

Supported API: false

Parameters:
a_Event -
Throws:
WTPropertyVetoException

eventValidate

private void eventValidate(ESIEvent a_Event)
                    throws WTPropertyVetoException
Parameters:
a_Event -
Throws:
WTPropertyVetoException

releasePart

public final void releasePart(WTPart part,
                              String action,
                              WTPart waitingPart)
                       throws WTException
Validates arguments and then:
  1. creates a new transaction
  2. creates a new event
  3. passes the event to a new EventRenderer
  4. creates the task defined in the property "com.ptc.windchill.esi.eventTask"
  5. invokes the task


Supported API: true

Parameters:
part -
action -
waitingPart - optional parameter. If not null, the id of the part is passed in the generated event
Throws:
WTException

releasePart

public final void releasePart(WTPart part,
                              String action,
                              WTPart waitingPart,
                              String userName,
                              Locale locale)
                       throws WTException
Validates arguments and then:
  1. creates a new transaction
  2. creates a new event
  3. passes the event to a new EventRenderer
  4. creates the task defined in the property "com.ptc.windchill.esi.eventTask"
  5. invokes the task


Supported API: true

Parameters:
part -
action -
waitingPart - optional parameter. If not null, the id of the part is passed in the generated event
userName - The user ID of the individual responsible for publishing the object.
locale - The locale to use for publishing the object.
Throws:
WTException

releaseWTChangeOrder2

public final void releaseWTChangeOrder2(WTChangeOrder2 ecn,
                                        String action,
                                        WTObject waitingObject)
                                 throws WTException
Validates arguments and then:
  1. creates a new transaction
  2. creates a new event
  3. passes the event to a new EventRenderer
  4. creates the task defined in the property "com.ptc.windchill.esi.eventTask"
  5. invokes the task


Supported API: true

Parameters:
ecn -
action -
waitingObject - optional parameter. If not null, the id of the WTChangeOrder2 is passed in the generated event
Throws:
WTException

releaseWTChangeOrder2

public final void releaseWTChangeOrder2(WTChangeOrder2 ecn,
                                        String action,
                                        WTObject waitingObject,
                                        String userName,
                                        Locale locale)
                                 throws WTException
Validates arguments and then:
  1. creates a new transaction
  2. creates a new event
  3. passes the event to a new EventRenderer
  4. creates the task defined in the property "com.ptc.windchill.esi.eventTask"
  5. invokes the task


Supported API: true

Parameters:
ecn -
action -
waitingObject - optional parameter. If not null, the id of the WTChangeOrder2 is passed in the generated event
userName - The user ID of the individual responsible for publishing the object.
locale - The locale to use for publishing the object.
Throws:
WTException

addTaskParams

protected void addTaskParams()
Allows subclasses to add additional parameters to the task before it's executed.

Supported API: true


addParam

protected void addParam(String name,
                        Object value)
Adds a task parameter to the event creation task before it's executed.

Supported API: true

Parameters:
name -
value -

validatePart

protected void validatePart(WTPart part)
                     throws WTException
Makes sure that the argument is in the correct state to be published by ESI. Obtains the name of the validator to use from ESI properties.

Supported API: false

Parameters:
part -
Throws:
WTException

validateWTChangeOrder2

protected void validateWTChangeOrder2(WTChangeOrder2 ecn)
                               throws WTException
Makes sure that the argument is in the correct state to be published by ESI. Obtains the name of the validator to use from ESI properties.

Supported API: false

Parameters:
ecn -
Throws:
WTException

validateWTObject

protected void validateWTObject(WTObject object)
                         throws WTException
Convenience for extenders of this class. Called by releaseWTObject(). Default behavior is to call ESIWTObjectValidator.

Supported API: true

Parameters:
object -
Throws:
WTException

validate

protected void validate(String className,
                        WTObject object)
                 throws WTException
Obtains an instance of ESIValidator and invokes the validate() method on that instance. The name of the class to instantiate is the first argument.

Supported API: true

Parameters:
className - The name of a class that implements ESIValidator.
object - The object whose state is to be validated.
Throws:
WTException

updateTask

protected void updateTask()
Provided as a convenience to extenders of the class. Called by releasePart(), releaseWTChangeOrder2() and releaseWTObject() immediately prior to invoking Info*Engine. Default implementation is to to do nothing.

Supported API: false


invokeTask

protected void invokeTask(Releasable object,
                          String action,
                          WTObject waitingObject,
                          String userName,
                          Locale locale)
                   throws ESIEventException
Invoke an Info*Engine task to write the ESI Event into the appropriate JMS queue.
  1. Obtains from ESI properties:
    • the name of the task
    • the name of the JMS queue
    • JMS queue authentication information
  2. Obtains the current user from the Session Manager.
  3. Obtains the SOAP message from the SoapRequestRenderer in the renderer attribute.
  4. Passes the obtained information to the task as parameters
  5. Invokes the task


Supported API: true

Parameters:
object - The object that is to be published by ESI.
action - The type of release.
waitingObject - Optional argument that indicates a workflow is waiting for a Windchill event.
userName - The user ID of the individual responsible for publishing the object.
locale - The locale to use for publishing the object.
Throws:
ESIEventException

getUserName

protected String getUserName()
                      throws ESIEventException
Obtains the user ID of the individual responsible for publishing objects.

Supported API: true

Returns:
String
Throws:
ESIEventException

getLocale

protected Locale getLocale()
                    throws ESIEventException
Obtains the locale to use to publish objects.

Supported API: true

Returns:
Locale
Throws:
ESIEventException

testArgument

protected void testArgument(Object obj,
                            String name,
                            Class cls)
                     throws ESIEventException
Throws:
ESIEventException

testStringArgument

protected void testStringArgument(String s,
                                  String name)
                           throws ESIEventException
Throws:
ESIEventException

encodeUser

protected String encodeUser(String userIn)

initialize

private void initialize()

say

private void say(String s)

isSupportedLocale

private static boolean isSupportedLocale(Locale locale)

initLocaleMaps

private static void initLocaleMaps()

buildLcList

private static ArrayList buildLcList(String s,
                                     String delimiter)

inSourceLocaleSet

private boolean inSourceLocaleSet(Locale locale)