|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.projmgmt.msproject.Utils
Nested Class Summary | |
static class |
Utils.SortByID
A Comparator that orders
ProjectNode s according to their
IDs. |
static class |
Utils.SortByOID
A Comparator that orders
Persistable s according to their object identifiers. |
Constructor Summary | |
Utils()
|
Method Summary | |
private static void |
addToSet(WfContainer c,
Set set,
boolean getResources)
A helper method used by getProjectResources(wt.workflow.engine.WfContainer) and
getResourceAssignments(wt.workflow.engine.WfContainer) . |
static Timestamp |
alignTime(Timestamp stamp,
boolean nextDay)
Return the Timestamp that represents midnight in the
current user's preferred TimeZone on the same day as
the specified timestamp or on the day following the specified timestamp
depending on the value of nextDay . |
static Timestamp |
alignTime(Timestamp stamp,
boolean nextDay,
boolean allowNonWorking)
Return the Timestamp that represents midnight in the
current user's preferred TimeZone on the same day as
the specified timestamp or on the day following the specified timestamp
depending on the value of nextDay . |
static Timestamp |
alignTime(Timestamp stamp,
TimeZone tzone,
boolean nextDay)
Return the Timestamp that represents midnight in the
specified TimeZone on the same day as the specified
timestamp or on the day following the specified timestamp depending on
the value of nextDay . |
static Timestamp |
alignTime(Timestamp stamp,
TimeZone tzone,
boolean nextDay,
boolean allowNonWorking)
Return the Timestamp that represents midnight in the
specified TimeZone on the same day as the specified
timestamp or on the day following the specified timestamp depending on
the value of nextDay . |
static Timestamp |
alignTime(Timestamp stamp,
WTUser aUser,
boolean nextDay)
Return the Timestamp that represents midnight in the
specified user's preferred TimeZone on the same day as
the specified timestamp or on the day following the specified timestamp
depending on the value of nextDay . |
static String |
decodeNewlines(String str)
Used for import (for status and risk descriptions, Replace the encoded newlines with real newlines. |
static String |
encodeNewlines(String str)
Filters out any newlines in str and replaces with Constants.NEWLINE_EXP_ENCODING, original function for status and risk descriptions |
private static Enumeration |
findUser(String attr_name,
String attr_value)
Finds all users in all services that have the given value for the specified attribute. |
static Timestamp |
getActualFinish(ExecutionObject exObj)
Get the actual finish of the ExecutionObject
that should be exported to Microsoft Project. |
static Timestamp |
getActualStart(ExecutionObject exObj,
TimeToElapse duration)
A helper method used by getActualStart(wt.projmgmt.execution.ExecutionObject, wt.workflow.definer.TimeToElapse) and getActualFinish(wt.projmgmt.execution.ExecutionObject)
to get the planned start date of the
ExecutionObject . |
static Timestamp |
getActualStart(ResourceAssignmentLink link)
Get the actual start of the ResourceAssignmentLink . |
static Timestamp |
getDeadline(ExecutionObject exObj)
Get the deadline of the ExecutionObject
that should be exported to Microsoft Project. |
static ExecutionObject |
getExecutionObject(ResourceAssignmentLink link)
Get the ExecutionObject that is
associated with the specified ResourceAssignmentLink . |
static String |
getFilenameBase(ExecutionObject exObj,
Locale locale,
String defVal)
Get a valid base for a filename based on the name of the specified ExecutionObject . |
static String |
getFilenameBase(String base,
Locale locale,
String defVal)
Get a valid base for a filename based on the specified base name. |
static String |
getFilenameBase(WfContainer c,
Locale locale,
String defVal)
Get a valid base for a filename based on the name of the specified WfContainer . |
static long |
getId(Persistable p)
Get the object identifier of the specified Persistable . |
private static Timestamp |
getLatestWorkingDay(ExecutionObject exObj,
Timestamp finish,
Timestamp start,
TimeToElapse duration)
Return the latest working date that is "less than or equal to" the specified finish date and that is also "greater than or equal to" the
specified start date. |
static int |
getMaxUnits(ProjectResource resource)
Get the maximum number of units of the resource that can be used by this project plan. |
static long |
getMillis(Timestamp stamp)
Return the number of milliseconds in the specified Timestamp . |
static String |
getOffset(TimeZone tzone)
Returns a string representing the offset of the specified TimeZone from GMT . |
static int |
getOutlineLevel(ExecutionObject obj)
Get the OutlineLevel of the specified
ExecutionObject . |
static WfContainer |
getParent(ProjectNode child)
Get the parent of the specified
ProjectNode . |
static WTUser |
getPendingUser(String email)
Get a pending user for the specified email address. |
static String |
getPendingUserEmail(String fullName)
Return a string that is used as the email for a pending user with a known full name but an unknown email. |
static Persistable |
getPersistable(long id,
Class clss)
Get the Persistable with the specified long
ID that is an instance of the specified Class . |
static PersonResource |
getPersonResource(ProjectPlan plan,
String name)
Get a PersonResource with the specified
name . |
static PersonResource |
getPersonResource(ProjectPlan plan,
WTUser user)
Get a PersonResource that corresponds
to the specified WTUser . |
static Timestamp |
getPlannedFinish(ExecutionObject exObj)
Get the estimated finish of the ExecutionObject
that should be exported to Microsoft Project. |
static Timestamp |
getPlannedStart(ExecutionObject exObj)
Get the planned start of the ExecutionObject
that should be exported to Microsoft Project. |
private static Timestamp |
getPlannedStart(ExecutionObject exObj,
TimeToElapse duration)
A helper method used by getPlannedStart(wt.projmgmt.execution.ExecutionObject) and getPlannedFinish(wt.projmgmt.execution.ExecutionObject)
to get the planned start date of the
ExecutionObject . |
static Timestamp |
getPlannedStart(ResourceAssignmentLink link)
Get the planned start of the ResourceAssignmentLink . |
static Timestamp |
getPlannedStart(WfExecutionObject exObj)
Get the planned start of the WfExecutionObject
that should be exported to Microsoft Project. |
static ProjectCategory |
getProjectCategory(String name)
Get the ProjectCategory with the
specified name . |
static ProjectHealthStatus |
getProjectHealthStatus(String name)
Get the ProjectHealthStatus with the
specified name . |
static Enumeration |
getProjectNodes(WfContainer c)
Return the all children of the specified WfContainer
sorted in the "canonical order". |
static ProjectPlan |
getProjectPlan(Persistable p)
Get the ProjectPlan for the specified
Persistable . |
static Enumeration |
getProjectResources(WfContainer c)
Return all the wt.projmgmt.resources.ProjectResource s that are
used by activities in the specified WfContainer . |
static ProjectRiskValue |
getProjectRiskValue(String name)
Get the ProjectRiskValue with the
specified name . |
static ProjectState |
getProjectState(String name)
Get the ProjectState with the
specified name . |
static Enumeration |
getResourceAssignments(WfContainer c)
Return all the ResourceAssignmentLink s that
are used by activities in the specified WfContainer . |
static int |
getResourceUnits(Class resClass,
String strUnits)
Get the number of units of the resource indicated by the specified String . |
static String |
getShortName(Class c)
Get the name of the specified class without the package name prepended. |
private static Timestamp |
getStart(ExecutionObject exObj)
This method calls the correct mthod based on the exObj 's
underlying type in order to get the planned start . |
private static ProjectNode |
getStartAtEndSource(ExecutionObject exObj,
Timestamp timeToStart,
TimeToElapse duration)
Return the source of the exObj 's start date if it starts
at the end of the day. |
static String |
getSubstringAfterLastPeriod(String s)
Get the substraing from the specified string that comes after the last period. |
static String |
getTitle(ExecutionObject exObj)
Get the title to use for the Microsoft Project Plan . |
static WTUser |
getUser(String fullName,
String email)
Get a WTUser based on the specified fullName
and email . |
static WTUser |
getUserByEmail(String email)
Get a WTUser whose
WTUser.EMAIL
is equal to the specified email . |
private static WTUser |
getUserByEmail(String fullName,
String email)
|
static WTUser |
getUserByFullName(String fullName)
Get a WTUser whose
WTUser.FULL_NAME
is equal to the specified fullName . |
static ProjectWorkItem |
getWorkItem(ExecutionObject exObj,
ProjectResource resource)
Get the ProjectWorkItem that is
associated with the specified ProjectResource
and ExecutionObject . |
private static String |
getXSDDateTime(Date date,
TimeZone tzone,
boolean withOffset)
Private helper method that is used by: toXSDDateTime(Timestamp, TimeZone)
toXSDDateTime(Date, TimeZone)
|
static boolean |
isAllowStateChange(ExecutionObject exObj)
Returns true if this wt.projmmgt.execution.ExecutionObject
is in allow state change mode. |
static boolean |
isStartAtEndOfDay(ExecutionObject exObj)
Returns true if exObj starts at
the end of the day. |
static boolean |
parseXSDBoolean(String boo)
Returns a boolean representing the value
contained in the specified XSD boolean type. |
static Timestamp |
parseXSDDateTime(String dateTime,
TimeZone defaultTimeZone)
Returns a Timestamp that is constructed based
on the specified xsd:dateTime string. |
static TimeToElapse |
parseXSDDuration(String duration)
Returns a TimeToElapse representing
the amount of time in the specified xsd:duration . |
static Long |
parseXSDInteger(String integer)
Returns a Long representing the value
contained in the specified XSD integer type. |
static Double |
parseXSDNumber(String number)
Returns a Double representing the value
contained in the specified XSD numeric type. |
static void |
printMap(Map map)
Write out the key=>value pairs in the specified Map object. |
static String |
replaceString(String sOrigStr,
String replaceWhat,
String replaceWith)
String replace function. |
private static void |
reportXSDParseError(String xsdStr,
String type,
int pos)
Report an error that occured while parsing an XSD data type. |
static Work |
toWork(TimeToElapse duration)
Convert the specified TimeToElapse to
a Work object that represents the
equivalent amount of work. |
static TimeToElapse |
toWorkingDays(TimeToElapse workingHours)
Convert the specified working hours to the number
of working days . |
static TimeToElapse |
toWorkingHours(TimeToElapse workingDays)
Convert the specified working days to the number
of working hours . |
static String |
toXSDDateTime(Date date)
Returns a string that can be used as the value of an XML element whose type is xsd:dateTime . |
static String |
toXSDDateTime(Date date,
TimeZone tzone)
Returns a string that can be used as the value of an XML element whose type is xsd:dateTime . |
static String |
toXSDDateTime(Date date,
TimeZone tzone,
boolean withOffset)
Returns a string that can be used as the value of an XML element whose type is xsd:dateTime . |
static String |
toXSDDateTime(Timestamp stamp)
Returns a string that can be used as the value of an XML element whose type is xsd:dateTime . |
static String |
toXSDDateTime(Timestamp stamp,
TimeZone tzone)
Returns a string that can be used as the value of an XML element whose type is xsd:dateTime . |
static String |
toXSDDateTime(Timestamp stamp,
TimeZone tzone,
boolean withOffset)
Returns a string that can be used as the value of an XML element whose type is xsd:dateTime . |
static String |
toXSDDuration(long ms)
Returns a string that can be used as the value of an XML element whose type is xsd:duration . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final boolean EXPORT_DAYS_IN_XSD_DURATIONS
private static final boolean EXPORT_LONG_XSD_DURATIONS
private static final boolean EXPORT_MILLIS_IN_XSD_DATETIMES
private static final String RESOURCE
public static final String NODES_CONTEXT_KEY
public static final String PREDS_CONTEXT_KEY
private static final boolean SERVER
private static final String XSD_ZERO_DURATION
private static final String XSD_ZERO_OFFSET
private static final String XSD_DATETIME_PATTERN
private static final String XSD_GMT_DATETIME_PATTERN
private static final String GMT_NAME
private static final TimeZone GMT
private static final DateFormat XSD_GMT_DATETIME_FORMAT
private static final String XSD_DURATION_PREFIX
private static final String XSD_DATE_TIME_SEPARATOR
private static final char XSD_DATE_SEPARATOR
private static final char XSD_TIME_SEPARATOR
private static final char XSD_DAY_DESIGNATOR
private static final char XSD_HOUR_DESIGNATOR
private static final char XSD_MIN_DESIGNATOR
private static final char XSD_SEC_DESIGNATOR
private static final char XSD_UTC_DESIGNATOR
private static final String XSD_NEG
private static final String XSD_POS
private static final String XSD_DATE_TIME_NAME
private static final String XSD_DURATION_NAME
private static final String XSD_DOUBLE_NAME
private static final String XSD_INTEGER_NAME
private static final Utils.SortByOID SORT_BY_OID
private static final Utils.SortByID SORT_BY_ID
private static final char INVALID_EMAIL_CHAR_REPLACEMENT
private static final String PENDING_USER_EMAIL_SUFFIX
Constructor Detail |
public Utils()
Method Detail |
public static Persistable getPersistable(long id, Class clss) throws WTException
Persistable
with the specified long
ID
that is an instance of the specified Class
.
If such an object does not exist, null
is returned.
If id
is zero, then null
is returned (see
ObjectIdentifier.UNASSIGNED_ID
).
If clss
is null, then the object is searched for
among the WfExecutionObject
objects.
id
- the ID of the persistableclss
- the class of the persistable
WTException
public static long getId(Persistable p)
Persistable
.
This returns the long
ID value and not the
ObjectIdentifier
object.
p
- the persistable to get the ID of
public static ProjectPlan getProjectPlan(Persistable p) throws WTException
ProjectPlan
for the specified
Persistable
. Throw an exception if the Persistable
cannot have a ProjectPlan
. Return null
if
the Persistable
does not have a ProjectPlan
p
- the persistable
WTException
public static WTUser getUser(String fullName, String email) throws WTException
WTUser
based on the specified fullName
and email
. If both fullName
and
email
are null
then null
is
returned. The user to returned is determined using the following
precedence rules:
email
fullName
email
@
to the fullName
If multiple users are considered equal based on the precedence rules then the first user found in the database is returned.
fullName
- the full name of the user or nullemail
- the email address of the user or null
WTException
public static String getPendingUserEmail(String fullName)
From RFC2822
, the legal characters for an email
address are the following:
!"#$%&'*+-/0123456789=?ABCDEFGHIJKLMNOPQRSTUVWXYZ^_
`abcdefghijklmnopqrstuvwxyz{|}~
Since the email address is used to create a pending user, it
also needs to be a valid name for a Windchill
user. The name of a user is used as the name of that user's
personal cabinet. A cabinet names cannot contain a forward slash.
Therefoe, this email cannot contain a forward slash.
fullName
- the full name of the pending userpublic static WTUser getUserByFullName(String fullName) throws WTException
WTUser
whose
WTUser.FULL_NAME
is equal to the specified fullName
. If no such
user exists return null
. If the specified
fullName
is null
then null
is returned.
If multiple users with the same full name are found, only the first user is returned.
fullName
- the full name of the user or null
WTException
public static WTUser getPendingUser(String email) throws WTException
null
if the email address is null
.
If multiple users are returned, then just return the first user int he list.
email
- the email address of the pending user
WTException
OrganizationServicesManager.createPendingUser
public static WTUser getUserByEmail(String email) throws WTException
WTUser
whose
WTUser.EMAIL
is equal to the specified email
. If no such
user exists return null
. If the specified
email
is null
then null
is returned.
If multiple users with the same email are found, only the first user is returned.
email
- the email address of the user or null
WTException
private static WTUser getUserByEmail(String fullName, String email) throws WTException
WTException
private static Enumeration findUser(String attr_name, String attr_value) throws WTException
This is a replacement for the following method which is now deprecated: {@link wt.org.OrganizationServicesManager#findUser(String, String)
attr_name
- an attribute name defined in the
class, e.g. WTUser.FULL_NAME, WTUser.EMAILattr_value
- an attribute value to be matched
WTException
public static PersonResource getPersonResource(ProjectPlan plan, String name) throws WTException
PersonResource
with the specified
name
. If no such resource exists return null
.
If multiple resources with the same name are found,
only the first resource is returned. If name
is
null
then null
is returned.
plan
- the project plan to look inname
- the name of the resource to find
WTException
public static PersonResource getPersonResource(ProjectPlan plan, WTUser user) throws WTException
PersonResource
that corresponds
to the specified WTUser
. If no such
resource exists return null
.
If multiple resources that correspond to the same user are found, only the first resource is returned.
plan
- the project plan to look inuser
- the user whose corresponding resource should be returned
WTException
public static ProjectCategory getProjectCategory(String name)
ProjectCategory
with the
specified name
. If name
does not map
to a category, return the default category. If name
is null
then null
is returned.
public static ProjectRiskValue getProjectRiskValue(String name)
ProjectRiskValue
with the
specified name
. If name
does not map
to a risk value, return the default risk value. If name
is null
then null
is returned.
public static ProjectHealthStatus getProjectHealthStatus(String name)
ProjectHealthStatus
with the
specified name
. If name
does not map
to a health status, return the default health status. If
name
is null
then UNAVAILABLE
is returned.
public static ProjectState getProjectState(String name)
ProjectState
with the
specified name
. If name
does not map
to a project state, return the default project state. If
name
is null
then null
is returned.
public static int getOutlineLevel(ExecutionObject obj)
OutlineLevel
of the specified
ExecutionObject
. This returns
wt.projmgmt.msproject.Constants.TASK0_OUTLINE_LEVEL
if
obj
is not an instance of
wt.projmmgt.execution.ProjectNode
.
public static WfContainer getParent(ProjectNode child)
parent
of the specified
ProjectNode
.
public static Enumeration getProjectNodes(WfContainer c) throws WTException
WfContainer
sorted in the "canonical order". The list includes all children that have
the specified container as an ancestor.
WTException
public static Enumeration getProjectResources(WfContainer c) throws WTException
wt.projmgmt.resources.ProjectResource
s that are
used by activities in the specified WfContainer
.
c
- a ProjectPlan or SummaryActivity
WTException
public static Enumeration getResourceAssignments(WfContainer c) throws WTException
ResourceAssignmentLink
s that
are used by activities in the specified WfContainer
.
c
- a ProjectPlan or SummaryActivity
WTException
private static void addToSet(WfContainer c, Set set, boolean getResources) throws WTException
getProjectResources(wt.workflow.engine.WfContainer)
and
getResourceAssignments(wt.workflow.engine.WfContainer)
. This method iterates through the
container's children. If the child is a ProjectActivity
then its resource assignment links or assigned resources (depending
on the value of the getResources
flag) are added to the
set. If the child is a SummaryActivity
then this method is called recursively on that summary activity. Otherwise,
nothing is done with the child.
c
- a ProjectPlan or SummaryActivitygetResources
- true if resources should be added otherwise assignment links are added
WTException
public static int getMaxUnits(ProjectResource resource)
For TimeResource
s this returns
the maxPercentUtilization
. For
MaterialResource
s this returns
the maxUnits
. For any other resource types this
method returns -1
.
public static int getResourceUnits(Class resClass, String strUnits)
String
. The units returned are "normalized" based
on the type of resource being assigned.
If no units are specified in strUnits
then this method
returns 0
.
public static ExecutionObject getExecutionObject(ResourceAssignmentLink link) throws WTException
ExecutionObject
that is
associated with the specified ResourceAssignmentLink
.
If no such object exists, return null
.
NOTE: If the assignment's ResourceHolder
is a
ProjectActivity
and the activity has a
ProjectWorkItem
then the work item is
returned.
link
- the resource assignment
WTException
public static ProjectWorkItem getWorkItem(ExecutionObject exObj, ProjectResource resource) throws WTException
ProjectWorkItem
that is
associated with the specified ProjectResource
and ExecutionObject
. If no such work item
exists, return null
. If multiple work items exist, then only
one work item is returned.
exObj
- the execution objectresource
- the resource
WTException
public static boolean isAllowStateChange(ExecutionObject exObj) throws WTException
wt.projmmgt.execution.ExecutionObject
is in allow state change
mode.
exObj
- the execution object
WTException
public static final TimeToElapse toWorkingHours(TimeToElapse workingDays)
working days
to the number
of working hours
. The working hours
amount only includes the actual amount of time worked on each
day. So if there are 8 working hours per day then 5 working
days equals 40 working hours.
workingDays
- the working dayspublic static final TimeToElapse toWorkingDays(TimeToElapse workingHours)
working hours
to the number
of working days
. The working hours
amount only includes the actual amount of time worked on each
day. So if there are 8 working hours per day then 5 working
days equals 40 working hours.
workingHours
- the working hourspublic static final Work toWork(TimeToElapse duration)
TimeToElapse
to
a Work
object that represents the
equivalent amount of work.
duration
- the duration to convert to workpublic static final long getMillis(Timestamp stamp)
Timestamp
.
public static final String toXSDDateTime(Timestamp stamp)
xsd:dateTime
. The date is represented
in GMT. The xsd:dateTime
includes the time zone offset
(Z
).
public static final String toXSDDateTime(Date date)
xsd:dateTime
. The date is represented
in GMT. The xsd:dateTime
includes the time zone offset
(Z
).
public static final String toXSDDateTime(Timestamp stamp, TimeZone tzone)
xsd:dateTime
. The date is represented
in the specified TimeZone
. The xsd:dateTime
includes the time zone offset.
public static final String toXSDDateTime(Date date, TimeZone tzone)
xsd:dateTime
. The date is represented
in the specified TimeZone
. The xsd:dateTime
includes the time zone offset.
public static final String toXSDDateTime(Timestamp stamp, TimeZone tzone, boolean withOffset)
xsd:dateTime
. The date is represented
in the specified TimeZone
. The value of
withOffset
determines whether or not the xsd:dateTime
includes the time zone offset. If withOffset
is
true
then the xsd:dateTime
includes the
time zone offset.
public static final String toXSDDateTime(Date date, TimeZone tzone, boolean withOffset)
xsd:dateTime
. The date is represented
in the specified TimeZone
. The value of
withOffset
determines whether or not the xsd:dateTime
includes the time zone offset. If withOffset
is
true
then the xsd:dateTime
includes the
time zone offset.
private static final String getXSDDateTime(Date date, TimeZone tzone, boolean withOffset)
public static final String getOffset(TimeZone tzone)
TimeZone
from GMT
. This is
a string like -06:00
.
public static final Timestamp parseXSDDateTime(String dateTime, TimeZone defaultTimeZone)
Timestamp
that is constructed based
on the specified xsd:dateTime
string. If the
time zone is not specified in the xsd:dateTime
string
then the specified defaultTimeZone
is used. If
the defaultTimeZone
is null
then
GMT
is used as the defaultTimeZone
.
If an error occurs during parsing, null
is returned.
dateTime
- a date and time in xsd:dateTime formatdefaultTimeZone
- the time zone to use when it is not specified
in the dateTime string
private static final void reportXSDParseError(String xsdStr, String type, int pos)
XSD
data type.
public static final String toXSDDuration(long ms)
xsd:duration
.
public static final TimeToElapse parseXSDDuration(String duration)
TimeToElapse
representing
the amount of time in the specified xsd:duration
.
Returns null
if the specified duration
is not a valid xsd:duration
.
This method currently only handles durations that contain days, hours, minutes, seconds and partial seconds.
public static final Double parseXSDNumber(String number)
Double
representing the value
contained in the specified XSD
numeric type.
The specified argument can be an instance of xsd:decimal
(?????), xsd:float
, xsd:double
or
any types derived from these primitive types
.
Returns null
if the specified value is null
or not a valid XSD
numeric value.
public static final Long parseXSDInteger(String integer)
Long
representing the value
contained in the specified XSD
integer type.
The specified argument can be an instance of xsd:integer
or any types derived from this type. Returns null
if the
specified value is null
or not a valid XSD
integer value.
public static final boolean parseXSDBoolean(String boo)
boolean
representing the value
contained in the specified XSD
boolean type.
The specified argument can be an instance of xsd:boolean
or any types derived from this type. Returns false
if the
specified value is null
or not a valid
xsd:boolean
value.
public static final Timestamp getPlannedStart(ExecutionObject exObj)
ExecutionObject
that should be exported to Microsoft Project.
exObj
- the execution objectpublic static final Timestamp getPlannedStart(WfExecutionObject exObj)
WfExecutionObject
that should be exported to Microsoft Project.
exObj
- the execution objectprivate static final Timestamp getPlannedStart(ExecutionObject exObj, TimeToElapse duration)
getPlannedStart(wt.projmgmt.execution.ExecutionObject)
and getPlannedFinish(wt.projmgmt.execution.ExecutionObject)
to get the planned start date of the
ExecutionObject
.
public static final boolean isStartAtEndOfDay(ExecutionObject exObj)
true
if exObj
starts at
the end of the day. See getStartAtEndSource(wt.projmgmt.execution.ExecutionObject, java.sql.Timestamp, wt.workflow.definer.TimeToElapse)
for
a definition of when an object starts at the end of the day.
getStartAtEndSource(wt.projmgmt.execution.ExecutionObject, java.sql.Timestamp, wt.workflow.definer.TimeToElapse)
private static final ProjectNode getStartAtEndSource(ExecutionObject exObj, Timestamp timeToStart, TimeToElapse duration)
exObj
's start date if it starts
at the end of the day. This returns the node's ultimate predecessor
that determines its end-of-day start time. If the node does not start
at the end of the day then this method returns null
.
This is a private helper method used by #isStartAtEndOfDay(WfExecutionObject)
and #getPlannedStart(WfExecutionObject,TimeToElapse
.
If duration is null
then it will be computed inside
this method.
A node starts at the end of the day when the following are true:
public static final Timestamp getPlannedFinish(ExecutionObject exObj)
ExecutionObject
that should be exported to Microsoft Project.
exObj
- the execution objectpublic static final Timestamp getActualStart(ExecutionObject exObj, TimeToElapse duration)
getActualStart(wt.projmgmt.execution.ExecutionObject, wt.workflow.definer.TimeToElapse)
and getActualFinish(wt.projmgmt.execution.ExecutionObject)
to get the planned start date of the
ExecutionObject
.
public static Timestamp getActualStart(ResourceAssignmentLink link) throws WTException
ResourceAssignmentLink
.
WTException
public static Timestamp getPlannedStart(ResourceAssignmentLink link) throws WTException
ResourceAssignmentLink
.
WTException
public static final Timestamp getActualFinish(ExecutionObject exObj)
ExecutionObject
that should be exported to Microsoft Project.
exObj
- the execution objectprivate static final Timestamp getLatestWorkingDay(ExecutionObject exObj, Timestamp finish, Timestamp start, TimeToElapse duration)
finish
date and that is also "greater than or equal to" the
specified start
date. Therefore, if finish
is
a working day then it is returned. If no date satisfies these constraints
then finish
is returned.
If start
is null
then it is computed inside
this method if it is required.
NOTE: this is a private helper method used by getPlannedFinish(wt.projmgmt.execution.ExecutionObject)
and getPlannedStart(wt.projmgmt.execution.ExecutionObject)
.
exObj
- the execution object whose latest working day should be
returnedfinish
- the object's finish date that has already been adjusted
for working hoursstart
- the object's start date that has already been adjusted
for working hours or nullduration
- the object's working duration (no the elapsed duration)private static final Timestamp getStart(ExecutionObject exObj)
exObj
's
underlying type in order to get the planned start
.
public static final Timestamp getDeadline(ExecutionObject exObj)
ExecutionObject
that should be exported to Microsoft Project.
exObj
- the execution objectpublic static Timestamp alignTime(Timestamp stamp, boolean nextDay, boolean allowNonWorking) throws WTException
Timestamp
that represents midnight in the
current user's preferred TimeZone
on the same day as
the specified timestamp or on the day following the specified timestamp
depending on the value of nextDay
.
If nextDay
is true
then midnight on
the next day is returned. Otherwise, midnight on the same day
is returned.
stamp
- the original timestampallowNonWorking
- whether to allow a non working day or not
WTException
public static Timestamp alignTime(Timestamp stamp, WTUser aUser, boolean nextDay) throws WTException
Timestamp
that represents midnight in the
specified user's preferred TimeZone
on the same day as
the specified timestamp or on the day following the specified timestamp
depending on the value of nextDay
.
If nextDay
is true
then midnight on
the next day is returned. Otherwise, midnight on the same day
is returned.
stamp
- the original timestampaUser
- the user who timezone to align to
WTException
public static Timestamp alignTime(Timestamp stamp, TimeZone tzone, boolean nextDay, boolean allowNonWorking)
Timestamp
that represents midnight in the
specified TimeZone
on the same day as the specified
timestamp or on the day following the specified timestamp depending on
the value of nextDay
.
If nextDay
is true
then midnight on
the next day is returned. Otherwise, midnight on the same day
is returned.
stamp
- the original timestamptzone
- the timezoneallowNonWorking
- whether to allow a non working day or notpublic static Timestamp alignTime(Timestamp stamp, TimeZone tzone, boolean nextDay)
Timestamp
that represents midnight in the
specified TimeZone
on the same day as the specified
timestamp or on the day following the specified timestamp depending on
the value of nextDay
.
If nextDay
is true
then midnight on
the next day is returned. Otherwise, midnight on the same day
is returned.
stamp
- the original timestamptzone
- the timezonepublic static Timestamp alignTime(Timestamp stamp, boolean nextDay) throws WTException
Timestamp
that represents midnight in the
current user's preferred TimeZone
on the same day as
the specified timestamp or on the day following the specified timestamp
depending on the value of nextDay
.
If nextDay
is true
then midnight on
the next day is returned. Otherwise, midnight on the same day
is returned.
stamp
- the original timestamp
WTException
public static String getTitle(ExecutionObject exObj) throws WTException
Microsoft Project Plan
.
If the execution object is a ProjectPlan
and belongs to a Project2
then the name of
the project is used as the title rather than the name of the plan.
WTException
public static String getFilenameBase(WfContainer c, Locale locale, String defVal) throws WTException
WfContainer
.
If a valid filename cannot be constructed from the name
of the container, then defVal
is returned.
If the container is not an instance of
ExecutionObject
then
defVal
is returned.
This method filters out characters that cannot appear in valid Windows filenames.
WTException
public static String getFilenameBase(ExecutionObject exObj, Locale locale, String defVal) throws WTException
ExecutionObject
.
If a valid filename cannot be constructed from the name
of the object, then defVal
is returned.
This method filters out characters that cannot appear in valid Windows filenames.
WTException
public static String getFilenameBase(String base, Locale locale, String defVal)
defVal
is returned.
This method filters out characters that cannot appear in valid Windows filenames.
public static void printMap(Map map)
Map
object.
public static String getShortName(Class c)
Class
were passed as the argument, this
method would return the string "Class"
.
public static String getSubstringAfterLastPeriod(String s)
"Hello, my name is Joe. What's your name?"
then the
return value will be: " What's your name?"
.
public static String encodeNewlines(String str)
public static String decodeNewlines(String str)
public static String replaceString(String sOrigStr, String replaceWhat, String replaceWith)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |