net.sf.mpxj.mpd
Class MPDDatabaseReader

java.lang.Object
  extended by net.sf.mpxj.mpd.MPDDatabaseReader
All Implemented Interfaces:
ProjectReader

public final class MPDDatabaseReader
extends Object
implements ProjectReader

This class provides a generic front end to read project data from a database.


Constructor Summary
MPDDatabaseReader()
           
 
Method Summary
 void addProjectListener(ProjectListener listener)
          Add a listener to receive events as a project is being read.
 Map<Integer,String> listProjects()
          Populates a Map instance representing the IDs and names of projects available in the current database.
 ProjectFile read()
          Read project data from a database.
 ProjectFile read(File file)
          Read a file where a File instance is supplied.
 ProjectFile read(InputStream inputStream)
          Read a file where the contents of the project file are supplied via an input stream.
 ProjectFile read(String accessDatabaseFileName)
          This is a convenience method which reads the first project from the named MPD file using the JDBC-ODBC bridge driver.
 void setConnection(Connection connection)
          Sets the connection.
 void setDataSource(DataSource dataSource)
          Set the data source.
 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(int projectID)
          Set the ID of the project to be read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MPDDatabaseReader

public MPDDatabaseReader()
Method Detail

addProjectListener

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

Specified by:
addProjectListener in interface ProjectReader
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 project data from a database.

Returns:
ProjectFile instance
Throws:
MPXJException

setProjectID

public void setProjectID(int projectID)
Set 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

setDataSource

public void setDataSource(DataSource dataSource)
Set the data source. A DataSource or a Connection can be supplied to this class to allow connection to the database.

Parameters:
dataSource - data source

setConnection

public void setConnection(Connection connection)
Sets the connection. A DataSource or a Connection can be supplied to this class to allow connection to the database.

Parameters:
connection - database connection

read

public ProjectFile read(String accessDatabaseFileName)
                 throws MPXJException
This is a convenience method which reads the first project from the named MPD file using the JDBC-ODBC bridge driver.

Specified by:
read in interface ProjectReader
Parameters:
accessDatabaseFileName - access database file name
Returns:
ProjectFile instance
Throws:
MPXJException

read

public ProjectFile read(File file)
                 throws MPXJException
Read a file where a File instance is supplied.

Specified by:
read in interface ProjectReader
Parameters:
file - File instance
Returns:
ProjectFile instance
Throws:
MPXJException

read

public ProjectFile read(InputStream inputStream)
Read a file where the contents of the project file are supplied via an input stream.

Specified by:
read in interface ProjectReader
Parameters:
inputStream - InputStream instance
Returns:
ProjectFile instance


Copyright © 2012. All Rights Reserved.