MPXJ: Microsoft Project Exchange

net.sf.mpxj.mspdi
Class DatatypeConverter

java.lang.Object
  extended by net.sf.mpxj.mspdi.DatatypeConverter

public final class DatatypeConverter
extends java.lang.Object

This class contains methods used to perform the datatype conversions required to read and write MSPDI files.


Constructor Summary
DatatypeConverter()
           
 
Method Summary
static AccrueType parseAccrueType(java.lang.String value)
          Parse an accrue type.
static BookingType parseBookingType(java.lang.String value)
          Parse a booking type.
static java.lang.Boolean parseBoolean(java.lang.String value)
          Parse a boolean.
static ConstraintType parseConstraintType(java.lang.Number value)
          Parse a constraint type.
static java.lang.Double parseCurrency(java.lang.Number value)
          Parse currency.
static CurrencySymbolPosition parseCurrencySymbolPosition(java.lang.String value)
          Parse a currency symbol position value.
static java.util.Date parseDate(java.util.Calendar value)
          Parse date.
static java.util.Calendar parseDateTime(java.lang.String value)
          Parse a date time value.
static Day parseDay(java.lang.Number value)
          Parse a day.
static Duration parseDuration(ProjectFile file, TimeUnit defaultUnits, java.lang.String value)
          Parse a duration.
static Duration parseDurationInTenthsOfMinutes(java.lang.Number value)
          Parse duration represented in tenths of minutes.
static Duration parseDurationInTenthsOfMinutes(ProjectHeader header, java.lang.Number value, TimeUnit targetTimeUnit)
          Parse duration represented as tenths of minutes.
static Duration parseDurationInThousanthsOfMinutes(java.lang.Number value)
          Parse duration represented in thousandths of minutes.
static Duration parseDurationInThousanthsOfMinutes(ProjectHeader header, java.lang.Number value, TimeUnit targetTimeUnit)
          Parse duration represented in thousandths of minutes.
static TimeUnit parseDurationTimeUnits(java.math.BigInteger value)
          Parse duration time units.
static EarnedValueMethod parseEarnedValueMethod(java.lang.Number value)
          Parse an earned value method.
static void parseExtendedAttribute(ProjectFile file, FieldContainer mpx, java.lang.String value, FieldType mpxFieldID)
          Parse an extended attribute value.
static java.lang.Boolean parseExtendedAttributeBoolean(java.lang.String value)
          Parse an extended attribute boolean value.
static java.lang.Number parseExtendedAttributeCurrency(java.lang.String value)
          Parse an extended attribute currency value.
static java.util.Date parseExtendedAttributeDate(java.lang.String value)
          Parse an extended attribute date value.
static java.lang.Number parseExtendedAttributeNumber(java.lang.String value)
          Parse and extended attribute numeric value.
static Priority parsePriority(java.math.BigInteger priority)
          Parse priority.
static Rate parseRate(java.math.BigDecimal value)
          Parse rate.
static ResourceType parseResourceType(java.lang.String value)
          Parse a resource type.
static java.lang.Integer parseResourceUID(java.lang.String value)
          Parse a resource UID.
static java.lang.String parseString(java.lang.String value)
          Parse method for a string: returns the string unchanged.
static TaskType parseTaskType(java.lang.String value)
          Parse a task type.
static java.lang.Integer parseTaskUID(java.lang.String value)
          Parse a task UID.
static java.util.Date parseTime(java.util.Calendar value)
          Parse time.
static java.util.Calendar parseTime(java.lang.String value)
          Parse a time value.
static TimeUnit parseTimeUnit(java.lang.Number value)
          Parse time unit.
static java.lang.Number parseUnits(java.lang.Number value)
          Parse units.
static WorkContour parseWorkContour(java.lang.String value)
          Parse a work contour.
static WorkGroup parseWorkGroup(java.lang.String value)
          Parse a work group.
static TimeUnit parseWorkUnits(java.math.BigInteger value)
          Parse work units.
static java.lang.String printAccrueType(AccrueType value)
          Print an accrue type.
static java.lang.String printBookingType(BookingType value)
          Print a booking type.
static java.lang.String printBoolean(java.lang.Boolean value)
          Print a boolean.
static java.math.BigInteger printConstraintType(ConstraintType value)
          Print a constraint type.
static java.math.BigDecimal printCurrency(java.lang.Number value)
          Print currency.
static java.lang.String printCurrencySymbolPosition(CurrencySymbolPosition value)
          Prints a currency symbol position value.
static java.util.Calendar printDate(java.util.Date value)
          Print date.
static java.lang.String printDateTime(java.util.Calendar value)
          Print a date time value.
static java.math.BigInteger printDay(Day day)
          Print a day.
static java.lang.String printDuration(MSPDIWriter writer, Duration duration)
          Print duration.
static java.math.BigDecimal printDurationInDecimalThousandthsOfMinutes(Duration duration)
          Print duration in thousandths of minutes.
static java.math.BigInteger printDurationInIntegerTenthsOfMinutes(Duration duration)
          Print duration in tenths of minutes.
static java.math.BigInteger printDurationInIntegerThousandthsOfMinutes(Duration duration)
          Print duration in thousandths of minutes.
static java.lang.String printDurationMandatory(MSPDIWriter writer, Duration duration)
          Print duration.
static java.math.BigInteger printDurationTimeUnits(Duration duration, boolean estimated)
          Print duration time units.
static java.math.BigInteger printDurationTimeUnits(TimeUnit value, boolean estimated)
          Print duration time units.
static java.math.BigInteger printEarnedValueMethod(EarnedValueMethod value)
          Print an earned value method.
static java.lang.String printExtendedAttribute(MSPDIWriter writer, java.lang.Object value, DataType type)
          Print an extended attribute value.
static java.lang.String printExtendedAttributeBoolean(java.lang.Boolean value)
          Print an extended attribute boolean value.
static java.lang.String printExtendedAttributeCurrency(java.lang.Number value)
          Print an extended attribute currency value.
static java.lang.String printExtendedAttributeDate(java.util.Date value)
          Print an extended attribute date value.
static java.lang.String printExtendedAttributeNumber(java.lang.Number value)
          Print an extended attribute numeric value.
static java.math.BigInteger printPriority(Priority priority)
          Print priority.
static java.math.BigDecimal printRate(Rate rate)
          Print rate.
static java.lang.String printResourceType(ResourceType value)
          Print a resource type.
static java.lang.String printResourceUID(java.lang.Integer value)
          Print a resource UID.
static java.lang.String printString(java.lang.String value)
          Print method for a string: returns the string unchanged.
static java.lang.String printTaskType(TaskType value)
          Print a task type.
static java.lang.String printTaskUID(java.lang.Integer value)
          Print a task UID.
static java.lang.String printTime(java.util.Calendar value)
          Print a time value.
static java.util.Calendar printTime(java.util.Date value)
          Print time.
static java.math.BigInteger printTimeUnit(TimeUnit value)
          Print time unit.
static java.math.BigDecimal printUnits(java.lang.Number value)
          Print units.
static java.lang.String printWorkContour(WorkContour value)
          Print a work contour.
static java.lang.String printWorkGroup(WorkGroup value)
          Print a work group.
static java.math.BigInteger printWorkUnits(TimeUnit value)
          Print work units.
static void setParentFile(ProjectFile file)
          This method is called to set the parent file for the current write operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatatypeConverter

public DatatypeConverter()
Method Detail

printExtendedAttributeCurrency

public static final java.lang.String printExtendedAttributeCurrency(java.lang.Number value)
Print an extended attribute currency value.

Parameters:
value - currency value
Returns:
string representation

parseExtendedAttributeCurrency

public static final java.lang.Number parseExtendedAttributeCurrency(java.lang.String value)
Parse an extended attribute currency value.

Parameters:
value - string representation
Returns:
currency value

printExtendedAttributeNumber

public static final java.lang.String printExtendedAttributeNumber(java.lang.Number value)
Print an extended attribute numeric value.

Parameters:
value - numeric value
Returns:
string representation

parseExtendedAttributeNumber

public static final java.lang.Number parseExtendedAttributeNumber(java.lang.String value)
Parse and extended attribute numeric value.

Parameters:
value - string representation
Returns:
numeric value

printExtendedAttributeBoolean

public static final java.lang.String printExtendedAttributeBoolean(java.lang.Boolean value)
Print an extended attribute boolean value.

Parameters:
value - boolean value
Returns:
string representation

parseExtendedAttributeBoolean

public static final java.lang.Boolean parseExtendedAttributeBoolean(java.lang.String value)
Parse an extended attribute boolean value.

Parameters:
value - string representation
Returns:
boolean value

printExtendedAttributeDate

public static final java.lang.String printExtendedAttributeDate(java.util.Date value)
Print an extended attribute date value.

Parameters:
value - date value
Returns:
string representation

parseExtendedAttributeDate

public static final java.util.Date parseExtendedAttributeDate(java.lang.String value)
Parse an extended attribute date value.

Parameters:
value - string representation
Returns:
date value

printExtendedAttribute

public static final java.lang.String printExtendedAttribute(MSPDIWriter writer,
                                                            java.lang.Object value,
                                                            DataType type)
Print an extended attribute value.

Parameters:
writer - parent MSPDIWriter instance
value - attribute value
type - type of the value being passed
Returns:
string representation

parseExtendedAttribute

public static final void parseExtendedAttribute(ProjectFile file,
                                                FieldContainer mpx,
                                                java.lang.String value,
                                                FieldType mpxFieldID)
Parse an extended attribute value.

Parameters:
file - parent file
mpx - parent entity
value - string value
mpxFieldID - field ID

printCurrencySymbolPosition

public static final java.lang.String printCurrencySymbolPosition(CurrencySymbolPosition value)
Prints a currency symbol position value.

Parameters:
value - CurrencySymbolPosition instance
Returns:
currency symbol position

parseCurrencySymbolPosition

public static final CurrencySymbolPosition parseCurrencySymbolPosition(java.lang.String value)
Parse a currency symbol position value.

Parameters:
value - currency symbol position
Returns:
CurrencySymbolPosition instance

printAccrueType

public static final java.lang.String printAccrueType(AccrueType value)
Print an accrue type.

Parameters:
value - AccrueType instance
Returns:
accrue type value

parseAccrueType

public static final AccrueType parseAccrueType(java.lang.String value)
Parse an accrue type.

Parameters:
value - accrue type value
Returns:
AccrueType instance

printResourceType

public static final java.lang.String printResourceType(ResourceType value)
Print a resource type.

Parameters:
value - ResourceType instance
Returns:
resource type value

parseResourceType

public static final ResourceType parseResourceType(java.lang.String value)
Parse a resource type.

Parameters:
value - resource type value
Returns:
ResourceType instance

printWorkGroup

public static final java.lang.String printWorkGroup(WorkGroup value)
Print a work group.

Parameters:
value - WorkGroup instance
Returns:
work group value

parseWorkGroup

public static final WorkGroup parseWorkGroup(java.lang.String value)
Parse a work group.

Parameters:
value - work group value
Returns:
WorkGroup instance

printWorkContour

public static final java.lang.String printWorkContour(WorkContour value)
Print a work contour.

Parameters:
value - WorkContour instance
Returns:
work contour value

parseWorkContour

public static final WorkContour parseWorkContour(java.lang.String value)
Parse a work contour.

Parameters:
value - work contour value
Returns:
WorkContour instance

printBookingType

public static final java.lang.String printBookingType(BookingType value)
Print a booking type.

Parameters:
value - BookingType instance
Returns:
booking type value

parseBookingType

public static final BookingType parseBookingType(java.lang.String value)
Parse a booking type.

Parameters:
value - booking type value
Returns:
BookingType instance

printTaskType

public static final java.lang.String printTaskType(TaskType value)
Print a task type.

Parameters:
value - TaskType instance
Returns:
task type value

parseTaskType

public static final TaskType parseTaskType(java.lang.String value)
Parse a task type.

Parameters:
value - task type value
Returns:
TaskType instance

printEarnedValueMethod

public static final java.math.BigInteger printEarnedValueMethod(EarnedValueMethod value)
Print an earned value method.

Parameters:
value - EarnedValueMethod instance
Returns:
earned value method value

parseEarnedValueMethod

public static final EarnedValueMethod parseEarnedValueMethod(java.lang.Number value)
Parse an earned value method.

Parameters:
value - earned value method
Returns:
EarnedValueMethod instance

printUnits

public static final java.math.BigDecimal printUnits(java.lang.Number value)
Print units.

Parameters:
value - units value
Returns:
units value

parseUnits

public static final java.lang.Number parseUnits(java.lang.Number value)
Parse units.

Parameters:
value - units value
Returns:
units value

printTimeUnit

public static final java.math.BigInteger printTimeUnit(TimeUnit value)
Print time unit.

Parameters:
value - TimeUnit instance
Returns:
time unit value

parseTimeUnit

public static final TimeUnit parseTimeUnit(java.lang.Number value)
Parse time unit.

Parameters:
value - time unit value
Returns:
TimeUnit instance

printDate

public static final java.util.Calendar printDate(java.util.Date value)
Print date.

Parameters:
value - Date value
Returns:
Calendar value

parseDate

public static final java.util.Date parseDate(java.util.Calendar value)
Parse date.

Parameters:
value - Calendar value
Returns:
Date value

printTime

public static final java.util.Calendar printTime(java.util.Date value)
Print time.

Parameters:
value - time value
Returns:
calendar value

parseTime

public static final java.util.Date parseTime(java.util.Calendar value)
Parse time.

Parameters:
value - Calendar value
Returns:
time value

parseWorkUnits

public static final TimeUnit parseWorkUnits(java.math.BigInteger value)
Parse work units.

Parameters:
value - work units value
Returns:
TimeUnit instance

printWorkUnits

public static final java.math.BigInteger printWorkUnits(TimeUnit value)
Print work units.

Parameters:
value - TimeUnit instance
Returns:
work units value

parseDuration

public static final Duration parseDuration(ProjectFile file,
                                           TimeUnit defaultUnits,
                                           java.lang.String value)
Parse a duration.

Parameters:
file - parent file
defaultUnits - default time units for the resulting duration
value - duration value
Returns:
Duration instance

printDuration

public static final java.lang.String printDuration(MSPDIWriter writer,
                                                   Duration duration)
Print duration. Note that Microsoft's xsd:duration parser implementation does not appear to recognise durations other than those expressed in hours. We use the compatibility flag to determine whether the output is adjusted for the benefit of Microsoft Project.

Parameters:
writer - parent MSPDIWriter instance
duration - Duration value
Returns:
xsd:duration value

printDurationMandatory

public static final java.lang.String printDurationMandatory(MSPDIWriter writer,
                                                            Duration duration)
Print duration. Note that Microsoft's xsd:duration parser implementation does not appear to recognise durations other than those expressed in hours. We use the compatibility flag to determine whether the output is adjusted for the benefit of Microsoft Project.

Parameters:
writer - parent MSPDIWriter instance
duration - Duration value
Returns:
xsd:duration value

printDurationTimeUnits

public static final java.math.BigInteger printDurationTimeUnits(Duration duration,
                                                                boolean estimated)
Print duration time units.

Parameters:
duration - Duration value
estimated - is this an estimated duration
Returns:
time units value

parseCurrency

public static final java.lang.Double parseCurrency(java.lang.Number value)
Parse currency.

Parameters:
value - currency value
Returns:
currency value

printCurrency

public static final java.math.BigDecimal printCurrency(java.lang.Number value)
Print currency.

Parameters:
value - currency value
Returns:
currency value

parseDurationTimeUnits

public static final TimeUnit parseDurationTimeUnits(java.math.BigInteger value)
Parse duration time units. Note that we don't differentiate between confirmed and unconfirmed durations. Unrecognised duration types are default to hours.

Parameters:
value - BigInteger value
Returns:
Duration units

printDurationTimeUnits

public static final java.math.BigInteger printDurationTimeUnits(TimeUnit value,
                                                                boolean estimated)
Print duration time units. Note that we don't differentiate between confirmed and unconfirmed durations. Unrecognised duration types are default to hours.

Parameters:
value - Duration units
estimated - is this an estimated duration
Returns:
BigInteger value

parsePriority

public static final Priority parsePriority(java.math.BigInteger priority)
Parse priority.

Parameters:
priority - priority value
Returns:
Priority instance

printPriority

public static final java.math.BigInteger printPriority(Priority priority)
Print priority.

Parameters:
priority - Priority instance
Returns:
priority value

parseDurationInThousanthsOfMinutes

public static final Duration parseDurationInThousanthsOfMinutes(java.lang.Number value)
Parse duration represented in thousandths of minutes.

Parameters:
value - duration value
Returns:
Duration instance

parseDurationInTenthsOfMinutes

public static final Duration parseDurationInTenthsOfMinutes(java.lang.Number value)
Parse duration represented in tenths of minutes.

Parameters:
value - duration value
Returns:
Duration instance

parseDurationInThousanthsOfMinutes

public static final Duration parseDurationInThousanthsOfMinutes(ProjectHeader header,
                                                                java.lang.Number value,
                                                                TimeUnit targetTimeUnit)
Parse duration represented in thousandths of minutes.

Parameters:
header - project header
value - duration value
targetTimeUnit - required output time units
Returns:
Duration instance

parseDurationInTenthsOfMinutes

public static final Duration parseDurationInTenthsOfMinutes(ProjectHeader header,
                                                            java.lang.Number value,
                                                            TimeUnit targetTimeUnit)
Parse duration represented as tenths of minutes.

Parameters:
header - project header
value - duration value
targetTimeUnit - required output time units
Returns:
Duration instance

printDurationInIntegerThousandthsOfMinutes

public static final java.math.BigInteger printDurationInIntegerThousandthsOfMinutes(Duration duration)
Print duration in thousandths of minutes.

Parameters:
duration - Duration instance
Returns:
duration in thousandths of minutes

printDurationInDecimalThousandthsOfMinutes

public static final java.math.BigDecimal printDurationInDecimalThousandthsOfMinutes(Duration duration)
Print duration in thousandths of minutes.

Parameters:
duration - Duration instance
Returns:
duration in thousandths of minutes

printDurationInIntegerTenthsOfMinutes

public static final java.math.BigInteger printDurationInIntegerTenthsOfMinutes(Duration duration)
Print duration in tenths of minutes.

Parameters:
duration - Duration instance
Returns:
duration in tenths of minutes

printRate

public static final java.math.BigDecimal printRate(Rate rate)
Print rate.

Parameters:
rate - Rate instance
Returns:
rate value

parseRate

public static final Rate parseRate(java.math.BigDecimal value)
Parse rate.

Parameters:
value - rate value
Returns:
Rate instance

printDay

public static final java.math.BigInteger printDay(Day day)
Print a day.

Parameters:
day - Day instance
Returns:
day value

parseDay

public static final Day parseDay(java.lang.Number value)
Parse a day.

Parameters:
value - day value
Returns:
Day instance

parseConstraintType

public static final ConstraintType parseConstraintType(java.lang.Number value)
Parse a constraint type.

Parameters:
value - constraint type value
Returns:
ConstraintType instance

printConstraintType

public static final java.math.BigInteger printConstraintType(ConstraintType value)
Print a constraint type.

Parameters:
value - ConstraintType instance
Returns:
constraint type value

printTaskUID

public static final java.lang.String printTaskUID(java.lang.Integer value)
Print a task UID.

Parameters:
value - task UID
Returns:
task UID string

parseTaskUID

public static final java.lang.Integer parseTaskUID(java.lang.String value)
Parse a task UID.

Parameters:
value - task UID string
Returns:
task UID

printResourceUID

public static final java.lang.String printResourceUID(java.lang.Integer value)
Print a resource UID.

Parameters:
value - resource UID value
Returns:
resource UID string

parseResourceUID

public static final java.lang.Integer parseResourceUID(java.lang.String value)
Parse a resource UID.

Parameters:
value - resource UID string
Returns:
resource UID value

printBoolean

public static final java.lang.String printBoolean(java.lang.Boolean value)
Print a boolean.

Parameters:
value - boolean
Returns:
boolean value

parseBoolean

public static final java.lang.Boolean parseBoolean(java.lang.String value)
Parse a boolean.

Parameters:
value - boolean
Returns:
Boolean value

printTime

public static final java.lang.String printTime(java.util.Calendar value)
Print a time value.

Parameters:
value - time value
Returns:
time value

parseTime

public static final java.util.Calendar parseTime(java.lang.String value)
Parse a time value.

Parameters:
value - time value
Returns:
time value

printDateTime

public static final java.lang.String printDateTime(java.util.Calendar value)
Print a date time value.

Parameters:
value - date time value
Returns:
string representation

parseDateTime

public static final java.util.Calendar parseDateTime(java.lang.String value)
Parse a date time value.

Parameters:
value - string representation
Returns:
date time value

printString

public static final java.lang.String printString(java.lang.String value)
Print method for a string: returns the string unchanged. This is used to enable to string representation of an xsd:datetime to be generated by MPXJ.

Parameters:
value - string value
Returns:
string value

parseString

public static final java.lang.String parseString(java.lang.String value)
Parse method for a string: returns the string unchanged. This is used to enable to string representation of an xsd:datetime to be processed by MPXJ.

Parameters:
value - string value
Returns:
string value

setParentFile

public static final void setParentFile(ProjectFile file)
This method is called to set the parent file for the current write operation. This allows task and resource write events to be captured and passed to any file listeners.

Parameters:
file - parent file instance


Copyright © 2000-2014 Packwood Software. All Rights Reserved.