net.sf.mpxj.mpd
Class MPD9DatabaseReader

java.lang.Object
  extended by net.sf.mpxj.mpd.MPD9DatabaseReader

public final class MPD9DatabaseReader
extends Object

This class reads project data from an MPD9 format database.


Field Summary
protected  ProjectFile m_project
           
protected  Integer m_projectID
           
 
Constructor Summary
MPD9DatabaseReader()
           
 
Method Summary
 void addProjectListener(ProjectListener listener)
          Add a listener to receive events as a project is being read.
 Double getDefaultOnNull(Double value, Double defaultValue)
          Returns a default value if a null value is found.
 Integer getDefaultOnNull(Integer value, Integer defaultValue)
          Returns a default value if a null value is found.
 Map<Integer,String> listProjects()
          Populates a Map instance representing the IDs and names of projects available in the current database.
protected  void postProcessing()
          Carry out any post-processing required to tidy up the data read from the database.
protected  void processAssignment(net.sf.mpxj.mpd.Row row)
          Process a resource assignment.
protected  void processAssignmentBaseline(net.sf.mpxj.mpd.Row row)
          Read resource assignment baseline values.
protected  void processCalendar(net.sf.mpxj.mpd.Row row)
          Read a calendar.
protected  void processCalendarData(ProjectCalendar calendar, net.sf.mpxj.mpd.Row row)
          Read calendar hours and exception data.
protected  void processDateField(net.sf.mpxj.mpd.Row row)
          Read a single date field extended attribute.
protected  void processDurationField(net.sf.mpxj.mpd.Row row)
          Read a single duration field extended attribute.
protected  void processField(net.sf.mpxj.mpd.Row row, String fieldIDColumn, Integer entityID, Object value)
          Generic method to process an extended attribute field.
protected  void processField(net.sf.mpxj.mpd.Row row, String fieldIDColumn, String entityIDColumn, Object value)
          Generic method to process an extended attribute field.
protected  void processFlagField(net.sf.mpxj.mpd.Row row)
          Read a single flag field extended attribute.
protected  void processLink(net.sf.mpxj.mpd.Row row)
          Process a relationship between two tasks.
protected  void processNumberField(net.sf.mpxj.mpd.Row row)
          Read a single number field extended attribute.
protected  void processOutlineCodeField(Integer entityID, net.sf.mpxj.mpd.Row row)
          Read a single outline code field extended attribute.
protected  void processProjectHeader(net.sf.mpxj.mpd.Row row)
          Reads the project header.
protected  void processProjectListItem(Map<Integer,String> result, net.sf.mpxj.mpd.Row row)
          Retrieve the details of a single project from the database.
protected  void processResource(net.sf.mpxj.mpd.Row row)
          Process a resource.
protected  void processResourceBaseline(net.sf.mpxj.mpd.Row row)
          Read resource baseline values.
protected  void processTask(net.sf.mpxj.mpd.Row row)
          Process a task.
protected  void processTaskBaseline(net.sf.mpxj.mpd.Row row)
          Read task baseline values.
protected  void processTextField(net.sf.mpxj.mpd.Row row)
          Read a single text field extended attribute.
 ProjectFile read()
          Read a project from the current data source.
protected  void reset()
          Called to reset internal state prior to reading a new project.
 void setConnection(Connection connection)
          Sets the connection to be used to read the project data.
 void setDataSource(DataSource dataSource)
          Sets the data source used to read the project data.
 void setPreserveNoteFormatting(boolean preserveNoteFormatting)
          This method sets a flag to indicate whether the RTF formatting associated with notes should be preserved or removed.
 void setProjectID(Integer projectID)
          Sets the ID of the project to be read.
protected  void updateBaseCalendarNames()
          The way calendars are stored in an MPP9 file means that there can be forward references between the base calendar unique ID for a derived calendar, and the base calendar itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_projectID

protected Integer m_projectID

m_project

protected ProjectFile m_project
Constructor Detail

MPD9DatabaseReader

public MPD9DatabaseReader()
Method Detail

addProjectListener

public void addProjectListener(ProjectListener listener)
Add a listener to receive events as a project is being read.

Parameters:
listener - ProjectListener instance

listProjects

public Map<Integer,String> listProjects()
                                 throws MPXJException
Populates a Map instance representing the IDs and names of projects available in the current database.

Returns:
Map instance containing ID and name pairs
Throws:
MPXJException

read

public ProjectFile read()
                 throws MPXJException
Read a project from the current data source.

Returns:
ProjectFile instance
Throws:
MPXJException

setDataSource

public void setDataSource(DataSource dataSource)
Sets the data source used to read the project data.

Parameters:
dataSource - data source

setConnection

public void setConnection(Connection connection)
Sets the connection to be used to read the project data.

Parameters:
connection - database connection

reset

protected void reset()
Called to reset internal state prior to reading a new project.


processProjectListItem

protected void processProjectListItem(Map<Integer,String> result,
                                      net.sf.mpxj.mpd.Row row)
Retrieve the details of a single project from the database.

Parameters:
result - Map instance containing the results
row - result set row read from the database

processProjectHeader

protected void processProjectHeader(net.sf.mpxj.mpd.Row row)
Reads the project header.

Parameters:
row - project header data

processCalendar

protected void processCalendar(net.sf.mpxj.mpd.Row row)
Read a calendar.

Parameters:
row - calendar data

processCalendarData

protected void processCalendarData(ProjectCalendar calendar,
                                   net.sf.mpxj.mpd.Row row)
Read calendar hours and exception data.

Parameters:
calendar - parent calendar
row - calendar hours and exception data

updateBaseCalendarNames

protected void updateBaseCalendarNames()
The way calendars are stored in an MPP9 file means that there can be forward references between the base calendar unique ID for a derived calendar, and the base calendar itself. To get around this, we initially populate the base calendar name attribute with the base calendar unique ID, and now in this method we can convert those ID values into the correct names.


processResource

protected void processResource(net.sf.mpxj.mpd.Row row)
Process a resource.

Parameters:
row - resource data

processResourceBaseline

protected void processResourceBaseline(net.sf.mpxj.mpd.Row row)
Read resource baseline values.

Parameters:
row - result set row

processTextField

protected void processTextField(net.sf.mpxj.mpd.Row row)
Read a single text field extended attribute.

Parameters:
row - field data

processNumberField

protected void processNumberField(net.sf.mpxj.mpd.Row row)
Read a single number field extended attribute.

Parameters:
row - field data

processFlagField

protected void processFlagField(net.sf.mpxj.mpd.Row row)
Read a single flag field extended attribute.

Parameters:
row - field data

processDurationField

protected void processDurationField(net.sf.mpxj.mpd.Row row)
Read a single duration field extended attribute.

Parameters:
row - field data

processDateField

protected void processDateField(net.sf.mpxj.mpd.Row row)
Read a single date field extended attribute.

Parameters:
row - field data

processOutlineCodeField

protected void processOutlineCodeField(Integer entityID,
                                       net.sf.mpxj.mpd.Row row)
Read a single outline code field extended attribute.

Parameters:
entityID - parent entity
row - field data

processField

protected void processField(net.sf.mpxj.mpd.Row row,
                            String fieldIDColumn,
                            String entityIDColumn,
                            Object value)
Generic method to process an extended attribute field.

Parameters:
row - extended attribute data
fieldIDColumn - column containing the field ID
entityIDColumn - column containing the entity ID
value - field value

processField

protected void processField(net.sf.mpxj.mpd.Row row,
                            String fieldIDColumn,
                            Integer entityID,
                            Object value)
Generic method to process an extended attribute field.

Parameters:
row - extended attribute data
fieldIDColumn - column containing the field ID
entityID - parent entity ID
value - field value

processTask

protected void processTask(net.sf.mpxj.mpd.Row row)
Process a task.

Parameters:
row - task data

processTaskBaseline

protected void processTaskBaseline(net.sf.mpxj.mpd.Row row)
Read task baseline values.

Parameters:
row - result set row

processLink

protected void processLink(net.sf.mpxj.mpd.Row row)
Process a relationship between two tasks.

Parameters:
row - relationship data

processAssignment

protected void processAssignment(net.sf.mpxj.mpd.Row row)
Process a resource assignment.

Parameters:
row - resource assignment data

processAssignmentBaseline

protected void processAssignmentBaseline(net.sf.mpxj.mpd.Row row)
Read resource assignment baseline values.

Parameters:
row - result set row

postProcessing

protected void postProcessing()
Carry out any post-processing required to tidy up the data read from the database.


getDefaultOnNull

public Double getDefaultOnNull(Double value,
                               Double defaultValue)
Returns a default value if a null value is found.

Parameters:
value - value under test
defaultValue - default if value is null
Returns:
value

getDefaultOnNull

public Integer getDefaultOnNull(Integer value,
                                Integer defaultValue)
Returns a default value if a null value is found.

Parameters:
value - value under test
defaultValue - default if value is null
Returns:
value

setProjectID

public void setProjectID(Integer projectID)
Sets the ID of the project to be read.

Parameters:
projectID - project ID

setPreserveNoteFormatting

public void setPreserveNoteFormatting(boolean preserveNoteFormatting)
This method sets a flag to indicate whether the RTF formatting associated with notes should be preserved or removed. By default the formatting is removed.

Parameters:
preserveNoteFormatting - boolean flag


Copyright © 2012. All Rights Reserved.