wt.projmgmt.ix
Class ProjMgmtIxUtils

java.lang.Object
  extended bywt.projmgmt.ix.ProjMgmtIxUtils

public class ProjMgmtIxUtils
extends Object


Field Summary
(package private) static String CR
           
(package private) static String CRLF
           
(package private) static String CRLF_REPLACEMENT
           
private static int[] DEF_FROM_INDEXES
           
private static Object[] EMPTY_ARRAY
           
private static Class ENUM_TYPE_CLASS
           
(package private) static String LF
           
private static Class OBJ_REF_CLASS
           
private static String RESOURCE
           
private static boolean VERBOSE
           
private static Class WT_OBJECT_CLASS
           
 
Constructor Summary
ProjMgmtIxUtils()
           
 
Method Summary
static void checkTag(IxbElement elem, String expected_tag)
           
static void checkTags(IxbElement elem, String[] possibletags)
           
static TimeToElapse computeDuration(IxbElement elem, Importer imp)
           
static boolean createFromTemplate(Importer imp)
          Determines if object is being created from template.
static void exportCost(IxbElement elem, String tag, Currency currency, Exporter exporter)
           
static void exportDuration(WfExecutionObject exec_obj, IxbElement elem, Exporter exporter)
           
static void exportExecObjAttributes(ExecutionObject exec_obj, IxbElement exec_elem, Exporter exporter)
          
static void exportOwner(Ownable own_obj, IxbElement elem, Exporter exporter)
          
static File exportProjectDeliverables(WTContainerRef contRef, File outFile, Deliverable[] delivs, IxbDocument ruleFile)
           
static void exportProjectNodeAttributes(ProjectNode node, IxbElement elem, Exporter exporter, int node_id)
          
static void exportProjectVariables(WfExecutionObject exec_obj, IxbElement elem, Exporter exporter)
          
static void exportRate(IxbElement elem, String tag, CurrencyRate currency_rate, Exporter exporter)
          
static void exportSubscriptions(ExecutionObject obj, IxbElement elem, Exporter exp)
          
static void exportTimeToElapse(IxbElement elem, String tag, TimeToElapse time, Exporter exporter)
           
static void exportWork(IxbElement elem, String tag, Work work, Exporter exporter)
           
static ProjectPlan findProjectPlan(IxbElement elem, Importer imp)
          Finds the project plan referenced by the element passed as argument.
private static IxbElement findProjectPlanTag(IxbElement elem)
          This method finds the project plan tag for an IxbElemnt.
static Currency getCost(IxbElement elem, String tag, Importer imp)
          Extracts the cost from the element that corresponds to the tag passed as argument.
static Deliverable getDeliverable(ProjectPlan plan, String deli_name)
           
static Enumeration getDeliverables(ProjectPlan plan)
           
private static String getIdStr(Object obj)
           
static String getMemberEmail(IxbElement elem, String princName)
          Looks up the member email (userEmail) from the RoleMemberMap given a username
static int getNextNodeId(ProjectNode node, Integer nodeId, Importer imp)
           
static Object getObjectFromApplication(IxbElement locId, Importer imp)
          This utility method uses the contents of the element to get the data stashed in the import application.
static Object getObjectFromOID(String oidStr)
           
private static ProjectState getObjectState(ExecutionObject exec_obj)
          Returns the corresponding auto execution state for a execution object, possibly exported from a manual mode.
static Object getObjFromObjectIDElement(IxbElement objId, Importer imp)
          ObjectIds may come in two flavors.
static Object getObjFromObjRefElem(IxbElement objRef, Importer imp)
          ObjectReferences can come in three flavors localId, ufid, and custom.
private static ObjectIdentifier getOid(Object obj)
           
private static WfContainerTemplate getParentTemplate(WfTemplateObject template)
           
static QueryResult getPlans(Project2 project)
          Returns project plans associated with project.
static Project2 getProject(String project_name)
           
static ProjectCategory getProjectCategory(IxbElement elem)
          This method returns the ProjectCategory object.
private static Map getProjectEventTypes(IxbElement elem)
          Returns a Map with PRojectEventType and their values This is map is used by the caller to set the subsriptions.
static ProjectHealthStatus getProjectHealthStatus(IxbElement elem)
          This method returns a ProjectHealthStatus object.
static ProjectPhase getProjectPhase(IxbElement elem)
           
static ProjectPlan getProjectPlan(Importer imp)
          Returns the project plan associated with the container.
static ProjectPlan getProjectPlan(IxbElement elem, Importer imp)
           
static ProjectPlan getProjectPlan(Project2 project)
          Returns project plan associated with project or 'null' if none exists.
static ProjectRiskValue getProjectRiskValue(IxbElement elem)
           
private static ProjectState getProjectState(IxbElement elem)
           
static CurrencyRate getRate(IxbElement elem, String tag, Importer imp)
          
static ObjectReference getReference(String ref_str, Importer imp)
           
static TimeToElapse getTimeToElapse(IxbElement elem, String tag, Importer imp)
          Extracts the elapsed time from the element that corresponds to the tag passed as argument.
static Work getWork(IxbElement elem, String tag, Importer imp)
          Extracts the work from the element that corresponds to the tag passed as argument.
static boolean hasTag(IxbElement elem, String expected_tag)
           
static Project2 importBaseProjectInfo(Project2 proj, IxbElement elem, Importer imp)
           
static ExecutionObject importDuration(ExecutionObject exec_obj, IxbElement elem, Importer imp)
           
private static ExecutionObject importDynamicAttributes(ExecutionObject exec_obj, IxbElement elem, Importer imp)
          Dynamic attributes are those that may change as a result of the execution of the plan.
static boolean importDynAttrs(Importer imp)
          Determines if dynamic attributes should be imported.
static ExecutionObject importExecObjectAttributes(ExecutionObject exec_obj, IxbElement elem, Importer imp)
           TODO: This is a very old version of the DTD.
private static ExecutionObject importManagerSubscriptions(ExecutionObject target, IxbElement elem)
          This method deals with the //import of ManagerSubscriptions for a Milestone or a Deliverable tag.
private static void importNodeId(ProjectNode node, IxbElement elem, Importer imp)
           
private static ExecutionObject importOwnerSubscriptions(ExecutionObject target, IxbElement elem)
           
private static ExecutionObject importPlanLevelManagerSubscriptions(ExecutionObject target, IxbElement elem)
           
private static ExecutionObject importPlanLevelOwnerSubscriptions(ExecutionObject target, IxbElement elem)
           
static ProjectNode importProjectNodeAttributes(ProjectNode node, IxbElement elem, Importer imp)
          
static ExecutionObject importProjectPlanLevelSubscriptions(ExecutionObject target, IxbElement elem, Importer imp)
           
static WfExecutionObject importProjectVariables(WfExecutionObject exec_obj, IxbElement elem, Importer imp)
          
static ExecutionObject importSubscriptions(ExecutionObject target, IxbElement elem, Importer imp)
          This method expects an IxbElement corresponding to a <subsriberPolicy> tag.
static boolean planImport(Importer imp)
          Determines whether an execution object is being imported in the context of a plan or independenlty.
private static boolean processBooleanStr(String str)
           
static String replaceString(String sOrigStr, String replaceWhat, String replaceWith)
           
private static void setArchiveMode(Exporter exp)
           
static ExecutionObject setDuration(ExecutionObject exec_obj, TimeToElapse duration)
           
static ExecutionObject setOwner(ExecutionObject exec_obj, IxbElement elem, Importer imp)
          
private static ExecutionObject setProjectState(ExecutionObject exec_obj, ProjectState plan_state, ProjectState exec_state)
          Sets the project state based on the plan state and the object's state.
static void setVariableValue(ProcessData context, String var_name, Class var_cls, String val_str, Importer imp)
           
static String showObjs(Collection objs)
           
static Timestamp stringToTimeStamp(String str, Importer imp)
          Utility function that convers a string to a timestamp returns null on any type of failure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRLF_REPLACEMENT

static final String CRLF_REPLACEMENT
See Also:
Constant Field Values

LF

static final String LF
See Also:
Constant Field Values

CR

static final String CR
See Also:
Constant Field Values

CRLF

static final String CRLF
See Also:
Constant Field Values

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

ENUM_TYPE_CLASS

private static final Class ENUM_TYPE_CLASS

OBJ_REF_CLASS

private static final Class OBJ_REF_CLASS

WT_OBJECT_CLASS

private static final Class WT_OBJECT_CLASS

DEF_FROM_INDEXES

private static final int[] DEF_FROM_INDEXES

EMPTY_ARRAY

private static final Object[] EMPTY_ARRAY

VERBOSE

private static final boolean VERBOSE
Constructor Detail

ProjMgmtIxUtils

public ProjMgmtIxUtils()
Method Detail

importProjectNodeAttributes

public static ProjectNode importProjectNodeAttributes(ProjectNode node,
                                                      IxbElement elem,
                                                      Importer imp)
                                               throws WTException
 
 

Throws:
WTException

importNodeId

private static void importNodeId(ProjectNode node,
                                 IxbElement elem,
                                 Importer imp)
                          throws WTException
Throws:
WTException

getNextNodeId

public static int getNextNodeId(ProjectNode node,
                                Integer nodeId,
                                Importer imp)
                         throws WTException
Throws:
WTException

exportProjectNodeAttributes

public static void exportProjectNodeAttributes(ProjectNode node,
                                               IxbElement elem,
                                               Exporter exporter,
                                               int node_id)
                                        throws WTException
 
 
 

Throws:
WTException

exportOwner

public static void exportOwner(Ownable own_obj,
                               IxbElement elem,
                               Exporter exporter)
                        throws WTException
 
 

Throws:
WTException

exportExecObjAttributes

public static void exportExecObjAttributes(ExecutionObject exec_obj,
                                           IxbElement exec_elem,
                                           Exporter exporter)
                                    throws WTException
 
 

Throws:
WTException

exportDuration

public static void exportDuration(WfExecutionObject exec_obj,
                                  IxbElement elem,
                                  Exporter exporter)
                           throws WTException
Throws:
WTException

exportTimeToElapse

public static void exportTimeToElapse(IxbElement elem,
                                      String tag,
                                      TimeToElapse time,
                                      Exporter exporter)
                               throws WTException
Throws:
WTException

exportWork

public static void exportWork(IxbElement elem,
                              String tag,
                              Work work,
                              Exporter exporter)
                       throws WTException
Throws:
WTException

exportCost

public static void exportCost(IxbElement elem,
                              String tag,
                              Currency currency,
                              Exporter exporter)
                       throws WTException
Throws:
WTException

exportRate

public static void exportRate(IxbElement elem,
                              String tag,
                              CurrencyRate currency_rate,
                              Exporter exporter)
                       throws WTException
 
 

Throws:
WTException

exportSubscriptions

public static void exportSubscriptions(ExecutionObject obj,
                                       IxbElement elem,
                                       Exporter exp)
                                throws WTException

Throws:
WTException

exportProjectDeliverables

public static File exportProjectDeliverables(WTContainerRef contRef,
                                             File outFile,
                                             Deliverable[] delivs,
                                             IxbDocument ruleFile)
                                      throws WTException
Throws:
WTException

setArchiveMode

private static void setArchiveMode(Exporter exp)
                            throws WTException
Throws:
WTException

exportProjectVariables

public static void exportProjectVariables(WfExecutionObject exec_obj,
                                          IxbElement elem,
                                          Exporter exporter)
                                   throws WTException
 
 
 
 
 
 

Throws:
WTException

checkTag

public static void checkTag(IxbElement elem,
                            String expected_tag)
                     throws WTException
Throws:
WTException

checkTags

public static void checkTags(IxbElement elem,
                             String[] possibletags)
                      throws WTException
Throws:
WTException

hasTag

public static boolean hasTag(IxbElement elem,
                             String expected_tag)
                      throws WTException
Throws:
WTException

getProjectPlan

public static ProjectPlan getProjectPlan(IxbElement elem,
                                         Importer imp)
                                  throws WTException
Throws:
WTException

importSubscriptions

public static ExecutionObject importSubscriptions(ExecutionObject target,
                                                  IxbElement elem,
                                                  Importer imp)
                                           throws WTException
This method expects an IxbElement corresponding to a <subsriberPolicy> tag. It reads the XML and determines whether or not susbcription policies needs to be set on the object, and then it sets them.

Throws:
WTException

importOwnerSubscriptions

private static ExecutionObject importOwnerSubscriptions(ExecutionObject target,
                                                        IxbElement elem)
                                                 throws WTException
Throws:
WTException

importProjectPlanLevelSubscriptions

public static ExecutionObject importProjectPlanLevelSubscriptions(ExecutionObject target,
                                                                  IxbElement elem,
                                                                  Importer imp)
                                                           throws WTException
Throws:
WTException

importPlanLevelManagerSubscriptions

private static ExecutionObject importPlanLevelManagerSubscriptions(ExecutionObject target,
                                                                   IxbElement elem)
                                                            throws WTException
Throws:
WTException

importPlanLevelOwnerSubscriptions

private static ExecutionObject importPlanLevelOwnerSubscriptions(ExecutionObject target,
                                                                 IxbElement elem)
                                                          throws WTException
Throws:
WTException

importManagerSubscriptions

private static ExecutionObject importManagerSubscriptions(ExecutionObject target,
                                                          IxbElement elem)
                                                   throws WTException
This method deals with the //import of ManagerSubscriptions for a Milestone or a Deliverable tag.

Throws:
WTException

findProjectPlanTag

private static IxbElement findProjectPlanTag(IxbElement elem)
                                      throws WTException
This method finds the project plan tag for an IxbElemnt. It returns null if it fails to find it.

Throws:
WTException

getProjectEventTypes

private static Map getProjectEventTypes(IxbElement elem)
                                 throws WTException
Returns a Map with PRojectEventType and their values This is map is used by the caller to set the subsriptions.

Throws:
WTException

importDynamicAttributes

private static ExecutionObject importDynamicAttributes(ExecutionObject exec_obj,
                                                       IxbElement elem,
                                                       Importer imp)
                                                throws WTException
Dynamic attributes are those that may change as a result of the execution of the plan.
      healthStatus?, 
      riskValue?, 
      projectState?, 
      projectPhase?, 
      executionDescription?, 
      riskDescription?, 
      startDate?, 
      finishDate?, 
      performedWork?, 
      currentWorkCost?, 
 
When execution objects are being import individually, as opposed to importing the whole plan, it is possible that they should not be imprted. For this reason they are collected in a separate method.

Throws:
WTException

importExecObjectAttributes

public static ExecutionObject importExecObjectAttributes(ExecutionObject exec_obj,
                                                         IxbElement elem,
                                                         Importer imp)
                                                  throws WTException
 TODO: This is a very old version of the DTD. We need to either update the DTD, 
 or change this method so we are not checking a whole bunch of null ProjMgmtConstants.
 
 

Throws:
WTException

createFromTemplate

public static boolean createFromTemplate(Importer imp)
                                  throws WTException
Determines if object is being created from template.

Throws:
WTException

getProjectPlan

public static ProjectPlan getProjectPlan(Importer imp)
                                  throws WTException
Returns the project plan associated with the container.

Throws:
WTException

planImport

public static boolean planImport(Importer imp)
                          throws WTException
Determines whether an execution object is being imported in the context of a plan or independenlty.

Throws:
WTException

importDynAttrs

public static boolean importDynAttrs(Importer imp)
                              throws WTException
Determines if dynamic attributes should be imported. If the plan is being imported (as opposed to importing individual plan objects, then return 'true'). Otherwise, return 'true' if the plan is in manual mode or if plan has started.

Throws:
WTException

importBaseProjectInfo

public static Project2 importBaseProjectInfo(Project2 proj,
                                             IxbElement elem,
                                             Importer imp)
                                      throws WTException
Throws:
WTException

computeDuration

public static TimeToElapse computeDuration(IxbElement elem,
                                           Importer imp)
                                    throws WTException
Throws:
WTException

importDuration

public static ExecutionObject importDuration(ExecutionObject exec_obj,
                                             IxbElement elem,
                                             Importer imp)
                                      throws WTException
Throws:
WTException

getTimeToElapse

public static TimeToElapse getTimeToElapse(IxbElement elem,
                                           String tag,
                                           Importer imp)
                                    throws WTException
Extracts the elapsed time from the element that corresponds to the tag passed as argument. Elapsed time is typically represented as a string and an attribute giving the unit of time in which the elapsed time is represented, as shown below.
 
 
 

Throws:
WTException

getWork

public static Work getWork(IxbElement elem,
                           String tag,
                           Importer imp)
                    throws WTException
Extracts the work from the element that corresponds to the tag passed as argument. Work is typically represented as a string and an attribute giving the unit of time in which the work is represented, as shown below.
 
 
 

Throws:
WTException

getCost

public static Currency getCost(IxbElement elem,
                               String tag,
                               Importer imp)
                        throws WTException
Extracts the cost from the element that corresponds to the tag passed as argument. Cost (Currency) is typically represented as a string and an attribute giving the locale in which the currency is represented, as shown below.
 
 
 

Throws:
WTException

getRate

public static CurrencyRate getRate(IxbElement elem,
                                   String tag,
                                   Importer imp)
                            throws WTException
 
 

Throws:
WTException

importProjectVariables

public static WfExecutionObject importProjectVariables(WfExecutionObject exec_obj,
                                                       IxbElement elem,
                                                       Importer imp)
                                                throws WTException
 
 
 
 

Throws:
WTException

setVariableValue

public static void setVariableValue(ProcessData context,
                                    String var_name,
                                    Class var_cls,
                                    String val_str,
                                    Importer imp)
                             throws WTException
Throws:
WTException

getReference

public static ObjectReference getReference(String ref_str,
                                           Importer imp)
                                    throws WTException
Throws:
WTException

stringToTimeStamp

public static Timestamp stringToTimeStamp(String str,
                                          Importer imp)
                                   throws WTException
Utility function that convers a string to a timestamp returns null on any type of failure.

Throws:
WTException

getProjectState

private static ProjectState getProjectState(IxbElement elem)
                                     throws WTException
Returns:
ProjectState object
Throws:
WTException

getObjectState

private static ProjectState getObjectState(ExecutionObject exec_obj)
                                    throws WTException
Returns the corresponding auto execution state for a execution object, possibly exported from a manual mode.

Throws:
WTException

setProjectState

private static ExecutionObject setProjectState(ExecutionObject exec_obj,
                                               ProjectState plan_state,
                                               ProjectState exec_state)
                                        throws WTException
Sets the project state based on the plan state and the object's state. The new state is given by the following table (the rows correspond to plan's states and the columns to object's states. ------------------------------------------------------------------ DEFINED RUNNING SUSPENDED COMPLETED ------------------------------------------------------------------ DEFINED DEFINED DEFINED* DEFINED* DEFINED* RUNNING RUNNING* RUNNING SUSPENDED RUNNING* SUSPENDED SUSPENDED* SUSPENDED SUSPENDED COMPLETED ------------------------------------------------------------------ An asterisk (*) denotes that the start, end time or both of the execution object has to be updated.

Throws:
WTException

getObjFromObjectIDElement

public static Object getObjFromObjectIDElement(IxbElement objId,
                                               Importer imp)
                                        throws WTException
ObjectIds may come in two flavors. One with a local identifier such as PROJECT_1, and the other would be an explicit object identifer as one would get from the export of a non-federatable object. This looks like wt.part.WTPart:3432. This function unifies the logic of checking which type of object to get.

Throws:
WTException - if the tag is not an ObjectID tag.

getObjFromObjRefElem

public static Object getObjFromObjRefElem(IxbElement objRef,
                                          Importer imp)
                                   throws WTException
ObjectReferences can come in three flavors localId, ufid, and custom. This method only assumes localId since custom is for a very specific scenario, and ufid is handled elsewhere.

Throws:
WTException

getObjectFromApplication

public static Object getObjectFromApplication(IxbElement locId,
                                              Importer imp)
                                       throws WTException
This utility method uses the contents of the element to get the data stashed in the import application. It returns null if the object has not been put there, or returns the object if it is found there. An exception is thrown if the tag is not , or the importer does not support the functionality.

Throws:
WTException

getObjectFromOID

public static Object getObjectFromOID(String oidStr)
                               throws WTException
Throws:
WTException

getProjectRiskValue

public static ProjectRiskValue getProjectRiskValue(IxbElement elem)
                                            throws WTException
Returns:
ProjectRiskValue constant is returned corresponding to the value of the value attribute. If the input element is null the model default is returned.
Throws:
WTException - is thrown if the input IxbElement does not correspond to a tag.

getProjectPhase

public static ProjectPhase getProjectPhase(IxbElement elem)
                                    throws WTException
Returns:
ProjectPhase.KICKOFF if the elem is null, or the attribute is not defined, otherwise the phase specified by the XML element.
Throws:
WTException - is thrown if the input IxbElement does not correspond to a tag.

getProjectHealthStatus

public static ProjectHealthStatus getProjectHealthStatus(IxbElement elem)
                                                  throws WTException
This method returns a ProjectHealthStatus object. An exception is thrown if it does not recieve an IxbElement corresponding to a tag. This is used for both execution objects and template objects.

Throws:
WTException

getProjectCategory

public static ProjectCategory getProjectCategory(IxbElement elem)
                                          throws WTException
This method returns the ProjectCategory object. An exception is thrown if it does not receive a tag. This is used for both execution objects and template objects.

Throws:
WTException

findProjectPlan

public static ProjectPlan findProjectPlan(IxbElement elem,
                                          Importer imp)
                                   throws WTException
Finds the project plan referenced by the element passed as argument.

Throws:
WTException

getProjectPlan

public static ProjectPlan getProjectPlan(Project2 project)
                                  throws WTException
Returns project plan associated with project or 'null' if none exists.

Throws:
WTException

getPlans

public static QueryResult getPlans(Project2 project)
                            throws WTException
Returns project plans associated with project.

Throws:
WTException

getProject

public static Project2 getProject(String project_name)
                           throws WTException
Throws:
WTException

getDeliverable

public static Deliverable getDeliverable(ProjectPlan plan,
                                         String deli_name)
                                  throws WTException
Throws:
WTException

getDeliverables

public static Enumeration getDeliverables(ProjectPlan plan)
                                   throws WTException
Throws:
WTException

setOwner

public static ExecutionObject setOwner(ExecutionObject exec_obj,
                                       IxbElement elem,
                                       Importer imp)
                                throws WTException
 
 
 

Throws:
WTException

getMemberEmail

public static String getMemberEmail(IxbElement elem,
                                    String princName)
                             throws WTException
Looks up the member email (userEmail) from the RoleMemberMap given a username

Throws:
WTException

getParentTemplate

private static WfContainerTemplate getParentTemplate(WfTemplateObject template)
                                              throws WTException
Throws:
WTException

processBooleanStr

private static boolean processBooleanStr(String str)

setDuration

public static ExecutionObject setDuration(ExecutionObject exec_obj,
                                          TimeToElapse duration)
                                   throws WTException
Throws:
WTException

getIdStr

private static String getIdStr(Object obj)
                        throws WTException
Throws:
WTException

showObjs

public static String showObjs(Collection objs)
                       throws WTException
Throws:
WTException

getOid

private static ObjectIdentifier getOid(Object obj)
                                throws WTException
Throws:
WTException

replaceString

public static String replaceString(String sOrigStr,
                                   String replaceWhat,
                                   String replaceWith)