wt.projmgmt.monitor
Class ProjectNotification

java.lang.Object
  extended bywt.projmgmt.monitor.ProjectNotification
All Implemented Interfaces:
Externalizable, Serializable

public class ProjectNotification
extends Object
implements Externalizable

Auxiliary class that encapsulates project management notification functionality.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private static String DEADLINE_CHANGE_TEMPLATE_NAME
           
private static String DEADLINE_TEMPLATE_NAME
           
private static String EXECUTION_STATE
           
static long EXTERNALIZATION_VERSION_UID
           
private static String MANAGER_KEY
           
static String MSG_SEPARATOR
           
private static String OBJECT_DELETION_TEMPLATE_NAME
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String OWNER_CHANGE_TEMPLATE_NAME
           
private static String OWNER_KEY
           
private static String RESOURCE
           
private static String SENDER_EMAIL
           
(package private) static long serialVersionUID
           
private static String STATE_CHANGE_TEMPLATE_NAME
           
private static String STATUS_CHANGE_TEMPLATE_NAME
           
private static boolean USE_TEMPLATE
           
private static boolean VERBOSE
           
 
Constructor Summary
ProjectNotification()
           
 
Method Summary
static ExecutionObject createDefaultSubscriptions(ExecutionObject exec_obj)
          Creates subscriptions to perform notification of events as specified in the execution object's configuration.
static Notification createNotification(ObjectSubscription subscription, DistributionList recipients)
          Creates notification given the template, the object subscription and the recipients.
static void createSubscription(ExecutionObject exec_obj, ProjectEventType event, Vector subscribers, String msg, String attr_name, String attr_value, String key)
          Creates subscription to an execution object and event on behalf of the subscribers passed as argument.
static void createSubscriptions(ProjectPlan plan)
          Generates subscriptions for all execution objects contained in the plan passed as argument.
private static void encodeObjInfo(ObjectSubscription subscription, ExecutionObject exec_obj)
          Encodes object information in subscription message's body.
private static Vector filterSubscribers(ExecutionObject exec_obj, String event_key, Vector subscribers, String msg, String attr_name, String attr_value)
           
private static String getEventTypeString(String event_key)
           
private static String getExecObjName(ExecutionObject exec_obj)
          Returns name of the execution object preceded by its type.
private static String getIdString(Object obj)
           
private static Vector getManagers(ExecutionObject exec_obj)
           
static String getName(ObjectSubscription subscription)
           
private static ObjectIdentifier getOid(Object obj)
           
static ProjectPlan getProjectPlan(ObjectSubscription subscription)
           
private static String getStateChangeKey(ProjectState new_state)
          Returns key represent the transition corresponding to the state change.
private static String getSubject(ProjectEventType event_type, ExecutionObject exec_obj, ObjectSubscription subscription)
          Generates notification subject.
private static String getTemplateName(ProjectEventType event_type)
          Returns template name.
private static Vector getVector(Object obj)
           
private static boolean isTheSame(ObjectSubscription subscription, String msg, String attr_name, String attr_value)
           
 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(ProjectNotification thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
static void transferOwnerSubscriptions(ExecutionObject exec_obj, WTPrincipal user1, WTPrincipal user2)
          Transfers owner subscriptions on the object passed as argument from one uesr to another.
static void unsubscribe(ExecutionObject exec_obj, ProjectEventType event, Vector subscribers, String msg, String attr_name, String attr_value, String key)
          Unsubscribes to events - for use with Owner / PM subscriptions.
 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

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

MSG_SEPARATOR

public static final String MSG_SEPARATOR
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE

USE_TEMPLATE

private static final boolean USE_TEMPLATE

SENDER_EMAIL

private static final String SENDER_EMAIL

EXECUTION_STATE

private static final String EXECUTION_STATE
See Also:
Constant Field Values

DEADLINE_TEMPLATE_NAME

private static final String DEADLINE_TEMPLATE_NAME
See Also:
Constant Field Values

DEADLINE_CHANGE_TEMPLATE_NAME

private static final String DEADLINE_CHANGE_TEMPLATE_NAME
See Also:
Constant Field Values

STATE_CHANGE_TEMPLATE_NAME

private static final String STATE_CHANGE_TEMPLATE_NAME
See Also:
Constant Field Values

STATUS_CHANGE_TEMPLATE_NAME

private static final String STATUS_CHANGE_TEMPLATE_NAME
See Also:
Constant Field Values

OBJECT_DELETION_TEMPLATE_NAME

private static final String OBJECT_DELETION_TEMPLATE_NAME
See Also:
Constant Field Values

OWNER_CHANGE_TEMPLATE_NAME

private static final String OWNER_CHANGE_TEMPLATE_NAME
See Also:
Constant Field Values

MANAGER_KEY

private static final String MANAGER_KEY
See Also:
Constant Field Values

OWNER_KEY

private static final String OWNER_KEY
See Also:
Constant Field Values
Constructor Detail

ProjectNotification

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

createNotification

public static Notification createNotification(ObjectSubscription subscription,
                                              DistributionList recipients)
                                       throws WTException
Creates notification given the template, the object subscription and the recipients. Basically forwards the call to the appropriate createNotification method based on the event type. This method is called by the subscription notification mechanism of the notify package.

Supported API: false

Parameters:
subscription -
recipients -
Returns:
Notification
Throws:
WTException
See Also:
StandardNotificationManager, ObjectSubscription

createDefaultSubscriptions

public static ExecutionObject createDefaultSubscriptions(ExecutionObject exec_obj)
                                                  throws WTException
Creates subscriptions to perform notification of events as specified in the execution object's configuration.

Supported API: false

Parameters:
exec_obj -
Returns:
ExecutionObject
Throws:
WTException
See Also:
ExecutionConfiguration, ObjectSubscription

createSubscriptions

public static void createSubscriptions(ProjectPlan plan)
                                throws WTException
Generates subscriptions for all execution objects contained in the plan passed as argument. Called when the project (Project2) is activated to create subscriptions when state changes are not allowed (manual mode).

Supported API: false

Parameters:
plan -
Throws:
WTException

createSubscription

public static void createSubscription(ExecutionObject exec_obj,
                                      ProjectEventType event,
                                      Vector subscribers,
                                      String msg,
                                      String attr_name,
                                      String attr_value,
                                      String key)
                               throws WTException
Creates subscription to an execution object and event on behalf of the subscribers passed as argument.

Supported API: false

Parameters:
exec_obj -
event -
subscribers -
msg -
attr_name -
attr_value -
key -
Throws:
WTException
See Also:
ObjectSubscription

transferOwnerSubscriptions

public static void transferOwnerSubscriptions(ExecutionObject exec_obj,
                                              WTPrincipal user1,
                                              WTPrincipal user2)
                                       throws WTException
Transfers owner subscriptions on the object passed as argument from one uesr to another.

Supported API: false

Parameters:
exec_obj -
user1 -
user2 -
Throws:
WTException
See Also:
ObjectSubscription

unsubscribe

public static void unsubscribe(ExecutionObject exec_obj,
                               ProjectEventType event,
                               Vector subscribers,
                               String msg,
                               String attr_name,
                               String attr_value,
                               String key)
                        throws WTException
Unsubscribes to events - for use with Owner / PM subscriptions.

Supported API: false

Parameters:
exec_obj -
event -
subscribers -
msg -
attr_name -
attr_value -
key -
Throws:
WTException

encodeObjInfo

private static void encodeObjInfo(ObjectSubscription subscription,
                                  ExecutionObject exec_obj)
                           throws WTException,
                                  WTPropertyVetoException
Encodes object information in subscription message's body. This is required in case the object is no longer available at the time the message is sent (e. g. object deletion).

Throws:
WTException
WTPropertyVetoException

getName

public static String getName(ObjectSubscription subscription)

getProjectPlan

public static ProjectPlan getProjectPlan(ObjectSubscription subscription)
                                  throws WTException
Throws:
WTException

getStateChangeKey

private static String getStateChangeKey(ProjectState new_state)
Returns key represent the transition corresponding to the state change.


getExecObjName

private static String getExecObjName(ExecutionObject exec_obj)
Returns name of the execution object preceded by its type.


getEventTypeString

private static String getEventTypeString(String event_key)

getSubject

private static String getSubject(ProjectEventType event_type,
                                 ExecutionObject exec_obj,
                                 ObjectSubscription subscription)
                          throws WTException
Generates notification subject.

Throws:
WTException

getTemplateName

private static String getTemplateName(ProjectEventType event_type)
Returns template name.


filterSubscribers

private static Vector filterSubscribers(ExecutionObject exec_obj,
                                        String event_key,
                                        Vector subscribers,
                                        String msg,
                                        String attr_name,
                                        String attr_value)
                                 throws WTException
Throws:
WTException

getManagers

private static Vector getManagers(ExecutionObject exec_obj)
                           throws WTException
Throws:
WTException

isTheSame

private static boolean isTheSame(ObjectSubscription subscription,
                                 String msg,
                                 String attr_name,
                                 String attr_value)

getIdString

private static String getIdString(Object obj)

getOid

private static ObjectIdentifier getOid(Object obj)

getVector

private static Vector getVector(Object obj)