net.sf.mpxj
Class ProjectFile

java.lang.Object
  extended by net.sf.mpxj.ProjectFile

public final class ProjectFile
extends Object

This class represents a project plan.


Constructor Summary
ProjectFile()
           
 
Method Summary
 ProjectCalendar addBaseCalendar()
          This method is used to add a new base calendar to the file.
 void addCustomFieldValueItem(CustomFieldValueItem item)
          Add a custom field value list item.
 ProjectCalendar addDefaultBaseCalendar()
          This is a convenience method used to add a base calendar called "Standard" to the file, and populate it with a default working week and default working hours.
 void addFilter(Filter filter)
          Adds a filter definition to this project file.
 void addGraphicalIndicator(FieldType field, GraphicalIndicator indicator)
          Adds the definition of a graphical indicator for a field type.
 void addGroup(Group group)
          Adds a group definition to this project file.
 void addProjectListener(ProjectListener listener)
          Adds a listener to this project file.
 void addProjectListeners(List<ProjectListener> listeners)
          Adds a collection of listeners to the current project.
 Resource addResource()
          This method is used to add a new resource to the file.
 ProjectCalendar addResourceCalendar()
          This method is provided to create a resource calendar, before it has been attached to a resource.
 void addSubProject(SubProject project)
          This package-private method is used to add sub project details.
 void addTable(Table table)
          Package-private method used to add tables to this MPP file.
 Task addTask()
          This method allows a task to be added to the file programatically.
 void addView(View view)
          Package-private method used to add views to this MPP file.
 void fireAssignmentReadEvent(ResourceAssignment resourceAssignment)
          This method is called to alert project listeners to the fact that a resource assignment has been read from a project file.
 void fireAssignmentWrittenEvent(ResourceAssignment resourceAssignment)
          This method is called to alert project listeners to the fact that a resource assignment has been written to a project file.
 void fireCalendarReadEvent(ProjectCalendar calendar)
          This method is called to alert project listeners to the fact that a calendar has been read from a project file.
 void fireCalendarWrittenEvent(ProjectCalendar calendar)
          This method is called to alert project listeners to the fact that a calendar has been written to a project file.
 void fireRelationReadEvent(Relation relation)
          This method is called to alert project listeners to the fact that a relation has been read from a project file.
 void fireRelationWrittenEvent(Relation relation)
          This method is called to alert project listeners to the fact that a relation has been written to a project file.
 void fireResourceReadEvent(Resource resource)
          This method is called to alert project listeners to the fact that a resource has been read from a project file.
 void fireResourceWrittenEvent(Resource resource)
          This method is called to alert project listeners to the fact that a resource has been written to a project file.
 void fireTaskReadEvent(Task task)
          This method is called to alert project listeners to the fact that a task has been read from a project file.
 void fireTaskWrittenEvent(Task task)
          This method is called to alert project listeners to the fact that a task has been written to a project file.
 ResourceField getAliasResourceField(String alias)
          Retrieves a resource field based on its alias.
 TaskField getAliasTaskField(String alias)
          Retrieves a task field instance based on its alias.
 List<Group> getAllGroups()
          Retrieves a list of all groups.
 List<ResourceAssignment> getAllResourceAssignments()
          This method is used to retrieve a list of all of the resource assignments that are defined in this MPX file.
 List<Filter> getAllResourceFilters()
          Retrieves a list of all resource filters.
 List<Resource> getAllResources()
          This method is used to retrieve a list of all of the resources that are defined in this MPX file.
 List<SubProject> getAllSubProjects()
          Retrieves all the subprojects for this MPX file.
 List<Filter> getAllTaskFilters()
          Retrieves a list of all task filters.
 List<Task> getAllTasks()
          This method is used to retrieve a list of all of the tasks that are defined in this MPX file.
 boolean getAutoAssignmentUniqueID()
          Retrieve the flag that determines whether the assignment unique ID is generated automatically.
 boolean getAutoCalendarUniqueID()
          Retrieve the flag that determines whether the calendar unique ID is generated automatically.
 boolean getAutoFilter()
          Retrieve a flag indicating if auto filter is enabled.
 boolean getAutoOutlineLevel()
          Retrieve the flag that determines whether outline level is generated automatically.
 boolean getAutoOutlineNumber()
          Retrieve the flag that determines whether outline numbers are generated automatically.
 boolean getAutoResourceID()
          Retrieve the flag that determines whether the resource ID is generated automatically.
 boolean getAutoResourceUniqueID()
          Retrieve the flag that determines whether the resource unique ID is generated automatically.
 boolean getAutoTaskID()
          Retrieve the flag that determines whether the task ID is generated automatically.
 boolean getAutoTaskUniqueID()
          Retrieve the flag that determines whether the task unique ID is generated automatically.
 boolean getAutoWBS()
          Retrieve the flag that determines whether WBS is generated automatically.
 ProjectCalendar getBaseCalendar(String calendarName)
          Retrieves the named base calendar.
 ProjectCalendar getBaseCalendarByUniqueID(Integer calendarID)
          Retrieves the base calendar referred to by the supplied unique ID value.
 List<ProjectCalendar> getBaseCalendars()
          This method retrieves the list of base calendars defined in this file.
 ProjectCalendar getBaselineCalendar()
          Retrieve the calendar used internally for timephased baseline calculation.
 ProjectCalendar getCalendar()
          Retrieves the default calendar for this project.
 List<Task> getChildTasks()
          This method is used to retrieve a list of all of the top level tasks that are defined in this MPX file.
 CustomFieldValueItem getCustomFieldValueItem(Integer uniqueID)
          Get the custom field value list item with the given unique ID.
 ProjectCalendar getDefaultResourceCalendar()
          This is a protected convenience method to add a default resource calendar.
 char getDelimiter()
          Accessor method to retrieve the current file delimiter character.
 Duration getDuration(Date startDate, Date endDate)
          This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar.
 Duration getDuration(String calendarName, Date startDate, Date endDate)
          This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar.
 boolean getEncoded()
          Get whether the data in this file is encoded.
 byte getEncryptionCode()
          Get the key with which this data is encrypted (can be decrypted) with.
 FileCreationRecord getFileCreationRecord()
          Retrieves the file creation record.
 Filter getFilterByID(Integer id)
          Retrieve a given filter by ID.
 Filter getFilterByName(String name)
          Retrieve a given filter by name.
 Date getFinishDate()
          Find the latest task finish date.
 GraphicalIndicator getGraphicalIndicator(FieldType field)
          Retrieves the definition of any graphical indicators used for the given field type.
 Group getGroupByName(String name)
          Retrieve a given group by name.
 int getMppFileType()
          This method retrieves a value representing the type of MPP file that has been read.
 String getProjectFilePath()
          Gets the project file path.
 ProjectHeader getProjectHeader()
          This method is used to retrieve the project header record.
 Resource getResourceByID(Integer id)
          This method allows an arbitrary resource to be retrieved based on its ID field.
 Resource getResourceByUniqueID(Integer id)
          This method allows an arbitrary resource to be retrieved based on its UniqueID field.
 List<ProjectCalendar> getResourceCalendars()
          This method retrieves the list of resource calendars defined in this file.
 String getResourceFieldAlias(ResourceField field)
          Retrieves the alias associated with a custom resource field.
 Map<ResourceField,String> getResourceFieldAliasMap()
          Allows callers to gain access to the mapping between resource field numbers and aliases.
 int getResourceID()
          This method is used to retrieve the next ID for a resource.
 SubProject getResourceSubProject()
          Retrieves details of the sub project file used as a resource pool.
 Table getResourceTableByName(String name)
          Utility method to retrieve the definition of a resource table by name.
 int getResourceUniqueID()
          This method is used to retrieve the next unique ID for a resource.
 Date getStartDate()
          Find the earliest task start date.
 List<Table> getTables()
          This method returns a list of the tables defined in this MPP file.
 Task getTaskByID(Integer id)
          This method allows an arbitrary task to be retrieved based on its ID field.
 Task getTaskByUniqueID(Integer id)
          This method allows an arbitrary task to be retrieved based on its UniqueID field.
 String getTaskFieldAlias(TaskField field)
          Retrieves the alias associated with a custom task field.
 Map<TaskField,String> getTaskFieldAliasMap()
          Allows derived classes to gain access to the mapping between MPX task field numbers and aliases.
 List<String> getTaskFieldDescriptionList(TaskField field)
          Retrieves the description value list associated with a custom task field.
 List<Object> getTaskFieldValueList(TaskField field)
          Retrieves the value list associated with a custom task field.
 int getTaskID()
          This method is used to retrieve the next ID for a task.
 Table getTaskTableByName(String name)
          Utility method to retrieve the definition of a task table by name.
 int getTaskUniqueID()
          This method is used to retrieve the next unique ID for a task.
 List<View> getViews()
          This method returns a list of the views defined in this MPP file.
 ViewState getViewState()
          Retrieve the saved view state associated with this file.
 ResourceAssignment newResourceAssignment(Task task)
          This method has been provided to allow the subclasses to instantiate ResourecAssignment instances.
 void removeCalendar(ProjectCalendar calendar)
          Removes a base calendar.
 void removeFilter(String filterName)
          Removes a filter from this project file.
 void removeProjectListener(ProjectListener listener)
          Removes a listener from this project file.
 void removeResource(Resource resource)
          This method is used to remove a resource from the project.
 void removeTask(Task task)
          This method is used to remove a task from the project.
 void renumberResourceIDs()
          This method can be called to ensure that the IDs of all resources in this project are sequential, and start from an appropriate point.
 void renumberTaskIDs()
          This method can be called to ensure that the IDs of all tasks in this project are sequential, and start from an appropriate point.
 void setAutoAssignmentUniqueID(boolean flag)
          Used to set whether the assignment unique ID field is automatically populated.
 void setAutoCalendarUniqueID(boolean flag)
          Used to set whether the calendar unique ID field is automatically populated.
 void setAutoFilter(boolean autoFilter)
          Sets a flag indicating if auto filter is enabled.
 void setAutoOutlineLevel(boolean flag)
          Used to set whether outline level numbers are automatically created.
 void setAutoOutlineNumber(boolean flag)
          Used to set whether outline numbers are automatically created.
 void setAutoResourceID(boolean flag)
          Used to set whether the resource ID field is automatically populated.
 void setAutoResourceUniqueID(boolean flag)
          Used to set whether the resource unique ID field is automatically populated.
 void setAutoTaskID(boolean flag)
          Used to set whether the task ID field is automatically populated.
 void setAutoTaskUniqueID(boolean flag)
          Used to set whether the task unique ID field is automatically populated.
 void setAutoWBS(boolean flag)
          Used to set whether WBS numbers are automatically created.
 void setCalendar(ProjectCalendar calendar)
          Sets the default calendar for this project.
 void setDelimiter(char delimiter)
          Modifier method used to set the delimiter character.
 void setEncoded(boolean encoded)
          Set whether the data in this file is encoded.
 void setEncryptionCode(byte encryptionKey)
          Set the key with which this data is encrypted (can be decrypted) with.
 void setMppFileType(int fileType)
          Used internally to set the file type.
 void setProjectFilePath(String projectFilePath)
          Sets the project file path.
 void setResourceFieldAlias(ResourceField field, String alias)
          Associates an alias with a custom resource field number.
 void setResourceSubProject(SubProject project)
          This package-private method is used to add resource sub project details.
 void setTaskFieldAlias(TaskField field, String alias)
          Associates an alias with a custom task field number.
 void setTaskFieldDescriptionList(TaskField field, List<String> descriptions)
          Associates a descriptions for value list with a custom task field number.
 void setTaskFieldValueList(TaskField field, List<Object> values)
          Associates a value list with a custom task field number.
 void setViewState(ViewState viewState)
          Set the saved view state associated with this file.
 void synchronizeTaskIDToHierarchy()
          Microsoft Project bases the order of tasks displayed on their ID value.
 void updateStructure()
          This method is used to recreate the hierarchical structure of the MPX file from scratch.
 void updateUniqueCounters()
          This method is called to ensure that after a project file has been read, the cached unique ID values used to generate new unique IDs start after the end of the existing set of unique IDs.
 void validateUniqueIDsForMicrosoftProject()
          This method is called to ensure that all unique ID values held by MPXJ are within the range supported by MS Project.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectFile

public ProjectFile()
Method Detail

getDelimiter

public char getDelimiter()
Accessor method to retrieve the current file delimiter character.

Returns:
delimiter character

setDelimiter

public void setDelimiter(char delimiter)
Modifier method used to set the delimiter character.

Parameters:
delimiter - delimiter character

addTask

public Task addTask()
This method allows a task to be added to the file programatically.

Returns:
new task object

removeTask

public void removeTask(Task task)
This method is used to remove a task from the project.

Parameters:
task - task to be removed

renumberTaskIDs

public void renumberTaskIDs()
This method can be called to ensure that the IDs of all tasks in this project are sequential, and start from an appropriate point. If tasks are added to and removed from the list of tasks, then the project is loaded into Microsoft project, if the ID values have gaps in the sequence, there will be blank task rows shown.


renumberResourceIDs

public void renumberResourceIDs()
This method can be called to ensure that the IDs of all resources in this project are sequential, and start from an appropriate point. If resources are added to and removed from the list of resources, then the project is loaded into Microsoft project, if the ID values have gaps in the sequence, there will be blank resource rows shown.


validateUniqueIDsForMicrosoftProject

public void validateUniqueIDsForMicrosoftProject()
This method is called to ensure that all unique ID values held by MPXJ are within the range supported by MS Project. If any of these values fall outside of this range, the unique IDs of the relevant entities are renumbered.


synchronizeTaskIDToHierarchy

public void synchronizeTaskIDToHierarchy()
Microsoft Project bases the order of tasks displayed on their ID value. This method takes the hierarchical structure of tasks represented in MPXJ and renumbers the ID values to ensure that this structure is displayed as expected in Microsoft Project. This is typically used to deal with the case where a hierarchical task structure has been created programatically in MPXJ.


getChildTasks

public List<Task> getChildTasks()
This method is used to retrieve a list of all of the top level tasks that are defined in this MPX file.

Returns:
list of tasks

getAllTasks

public List<Task> getAllTasks()
This method is used to retrieve a list of all of the tasks that are defined in this MPX file.

Returns:
list of all tasks

setAutoWBS

public void setAutoWBS(boolean flag)
Used to set whether WBS numbers are automatically created.

Parameters:
flag - true if automatic WBS required.

setAutoOutlineLevel

public void setAutoOutlineLevel(boolean flag)
Used to set whether outline level numbers are automatically created.

Parameters:
flag - true if automatic outline level required.

setAutoOutlineNumber

public void setAutoOutlineNumber(boolean flag)
Used to set whether outline numbers are automatically created.

Parameters:
flag - true if automatic outline number required.

setAutoTaskUniqueID

public void setAutoTaskUniqueID(boolean flag)
Used to set whether the task unique ID field is automatically populated.

Parameters:
flag - true if automatic unique ID required.

setAutoCalendarUniqueID

public void setAutoCalendarUniqueID(boolean flag)
Used to set whether the calendar unique ID field is automatically populated.

Parameters:
flag - true if automatic unique ID required.

setAutoAssignmentUniqueID

public void setAutoAssignmentUniqueID(boolean flag)
Used to set whether the assignment unique ID field is automatically populated.

Parameters:
flag - true if automatic unique ID required.

setAutoTaskID

public void setAutoTaskID(boolean flag)
Used to set whether the task ID field is automatically populated.

Parameters:
flag - true if automatic ID required.

getAutoWBS

public boolean getAutoWBS()
Retrieve the flag that determines whether WBS is generated automatically.

Returns:
boolean, default is false.

getAutoOutlineLevel

public boolean getAutoOutlineLevel()
Retrieve the flag that determines whether outline level is generated automatically.

Returns:
boolean, default is false.

getAutoOutlineNumber

public boolean getAutoOutlineNumber()
Retrieve the flag that determines whether outline numbers are generated automatically.

Returns:
boolean, default is false.

getAutoTaskUniqueID

public boolean getAutoTaskUniqueID()
Retrieve the flag that determines whether the task unique ID is generated automatically.

Returns:
boolean, default is false.

getAutoCalendarUniqueID

public boolean getAutoCalendarUniqueID()
Retrieve the flag that determines whether the calendar unique ID is generated automatically.

Returns:
boolean, default is false.

getAutoAssignmentUniqueID

public boolean getAutoAssignmentUniqueID()
Retrieve the flag that determines whether the assignment unique ID is generated automatically.

Returns:
boolean, default is true.

getAutoTaskID

public boolean getAutoTaskID()
Retrieve the flag that determines whether the task ID is generated automatically.

Returns:
boolean, default is false.

getTaskUniqueID

public int getTaskUniqueID()
This method is used to retrieve the next unique ID for a task.

Returns:
next unique ID

getTaskID

public int getTaskID()
This method is used to retrieve the next ID for a task.

Returns:
next ID

setAutoResourceUniqueID

public void setAutoResourceUniqueID(boolean flag)
Used to set whether the resource unique ID field is automatically populated.

Parameters:
flag - true if automatic unique ID required.

setAutoResourceID

public void setAutoResourceID(boolean flag)
Used to set whether the resource ID field is automatically populated.

Parameters:
flag - true if automatic ID required.

getAutoResourceUniqueID

public boolean getAutoResourceUniqueID()
Retrieve the flag that determines whether the resource unique ID is generated automatically.

Returns:
boolean, default is false.

getAutoResourceID

public boolean getAutoResourceID()
Retrieve the flag that determines whether the resource ID is generated automatically.

Returns:
boolean, default is false.

getResourceUniqueID

public int getResourceUniqueID()
This method is used to retrieve the next unique ID for a resource.

Returns:
next unique ID

getResourceID

public int getResourceID()
This method is used to retrieve the next ID for a resource.

Returns:
next ID

getFileCreationRecord

public FileCreationRecord getFileCreationRecord()
Retrieves the file creation record.

Returns:
file creation record.

addResourceCalendar

public ProjectCalendar addResourceCalendar()
This method is provided to create a resource calendar, before it has been attached to a resource.

Returns:
new ProjectCalendar instance

addBaseCalendar

public ProjectCalendar addBaseCalendar()
This method is used to add a new base calendar to the file.

Returns:
new base calendar object

removeCalendar

public void removeCalendar(ProjectCalendar calendar)
Removes a base calendar.

Parameters:
calendar - calendar to be removed

addDefaultBaseCalendar

public ProjectCalendar addDefaultBaseCalendar()
This is a convenience method used to add a base calendar called "Standard" to the file, and populate it with a default working week and default working hours.

Returns:
a new default base calendar

getDefaultResourceCalendar

public ProjectCalendar getDefaultResourceCalendar()
This is a protected convenience method to add a default resource calendar. This is used when the calendar data is available before the resource data has been read, a situation which occurs with MPP files.

Returns:
new ProjectCalendar instance

getBaseCalendars

public List<ProjectCalendar> getBaseCalendars()
This method retrieves the list of base calendars defined in this file.

Returns:
list of base calendars

getResourceCalendars

public List<ProjectCalendar> getResourceCalendars()
This method retrieves the list of resource calendars defined in this file.

Returns:
list of resource calendars

getProjectHeader

public ProjectHeader getProjectHeader()
This method is used to retrieve the project header record.

Returns:
project header object

addResource

public Resource addResource()
This method is used to add a new resource to the file.

Returns:
new resource object

removeResource

public void removeResource(Resource resource)
This method is used to remove a resource from the project.

Parameters:
resource - resource to be removed

getAllResources

public List<Resource> getAllResources()
This method is used to retrieve a list of all of the resources that are defined in this MPX file.

Returns:
list of all resources

getAllResourceAssignments

public List<ResourceAssignment> getAllResourceAssignments()
This method is used to retrieve a list of all of the resource assignments that are defined in this MPX file.

Returns:
list of all resources

newResourceAssignment

public ResourceAssignment newResourceAssignment(Task task)
This method has been provided to allow the subclasses to instantiate ResourecAssignment instances.

Parameters:
task - parent task
Returns:
new resource assignment instance

getBaseCalendar

public ProjectCalendar getBaseCalendar(String calendarName)
Retrieves the named base calendar. This method will return null if the named base calendar is not located.

Parameters:
calendarName - name of the required base calendar
Returns:
base calendar object

getBaseCalendarByUniqueID

public ProjectCalendar getBaseCalendarByUniqueID(Integer calendarID)
Retrieves the base calendar referred to by the supplied unique ID value. This method will return null if the required calendar is not located.

Parameters:
calendarID - calendar unique ID
Returns:
ProjectCalendar instance

getDuration

public Duration getDuration(Date startDate,
                            Date endDate)
                     throws MPXJException
This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar. The calendar used is the "Standard" calendar. If this calendar does not exist, and exception will be thrown.

Parameters:
startDate - start of the period
endDate - end of the period
Returns:
new Duration object
Throws:
MPXJException - normally when no Standard calendar is available

getDuration

public Duration getDuration(String calendarName,
                            Date startDate,
                            Date endDate)
                     throws MPXJException
This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar. The name of the calendar to be used is passed as an argument.

Parameters:
calendarName - name of the calendar to use
startDate - start of the period
endDate - end of the period
Returns:
new Duration object
Throws:
MPXJException - normally when no Standard calendar is available

getTaskByID

public Task getTaskByID(Integer id)
This method allows an arbitrary task to be retrieved based on its ID field.

Parameters:
id - task identified
Returns:
the requested task, or null if not found

getTaskByUniqueID

public Task getTaskByUniqueID(Integer id)
This method allows an arbitrary task to be retrieved based on its UniqueID field.

Parameters:
id - task identified
Returns:
the requested task, or null if not found

getResourceByID

public Resource getResourceByID(Integer id)
This method allows an arbitrary resource to be retrieved based on its ID field.

Parameters:
id - resource identified
Returns:
the requested resource, or null if not found

getResourceByUniqueID

public Resource getResourceByUniqueID(Integer id)
This method allows an arbitrary resource to be retrieved based on its UniqueID field.

Parameters:
id - resource identified
Returns:
the requested resource, or null if not found

updateStructure

public void updateStructure()
This method is used to recreate the hierarchical structure of the MPX file from scratch. The method sorts the list of all tasks, then iterates through it creating the parent-child structure defined by the outline level field.


updateUniqueCounters

public void updateUniqueCounters()
This method is called to ensure that after a project file has been read, the cached unique ID values used to generate new unique IDs start after the end of the existing set of unique IDs.


getStartDate

public Date getStartDate()
Find the earliest task start date. We treat this as the start date for the project.

Returns:
start date

getFinishDate

public Date getFinishDate()
Find the latest task finish date. We treat this as the finish date for the project.

Returns:
finish date

fireTaskReadEvent

public void fireTaskReadEvent(Task task)
This method is called to alert project listeners to the fact that a task has been read from a project file.

Parameters:
task - task instance

fireTaskWrittenEvent

public void fireTaskWrittenEvent(Task task)
This method is called to alert project listeners to the fact that a task has been written to a project file.

Parameters:
task - task instance

fireResourceReadEvent

public void fireResourceReadEvent(Resource resource)
This method is called to alert project listeners to the fact that a resource has been read from a project file.

Parameters:
resource - resource instance

fireResourceWrittenEvent

public void fireResourceWrittenEvent(Resource resource)
This method is called to alert project listeners to the fact that a resource has been written to a project file.

Parameters:
resource - resource instance

fireCalendarReadEvent

public void fireCalendarReadEvent(ProjectCalendar calendar)
This method is called to alert project listeners to the fact that a calendar has been read from a project file.

Parameters:
calendar - calendar instance

fireAssignmentReadEvent

public void fireAssignmentReadEvent(ResourceAssignment resourceAssignment)
This method is called to alert project listeners to the fact that a resource assignment has been read from a project file.

Parameters:
resourceAssignment - resourceAssignment instance

fireAssignmentWrittenEvent

public void fireAssignmentWrittenEvent(ResourceAssignment resourceAssignment)
This method is called to alert project listeners to the fact that a resource assignment has been written to a project file.

Parameters:
resourceAssignment - resourceAssignment instance

fireRelationReadEvent

public void fireRelationReadEvent(Relation relation)
This method is called to alert project listeners to the fact that a relation has been read from a project file.

Parameters:
relation - relation instance

fireRelationWrittenEvent

public void fireRelationWrittenEvent(Relation relation)
This method is called to alert project listeners to the fact that a relation has been written to a project file.

Parameters:
relation - relation instance

fireCalendarWrittenEvent

public void fireCalendarWrittenEvent(ProjectCalendar calendar)
This method is called to alert project listeners to the fact that a calendar has been written to a project file.

Parameters:
calendar - calendar instance

addProjectListener

public void addProjectListener(ProjectListener listener)
Adds a listener to this project file.

Parameters:
listener - listener instance

addProjectListeners

public void addProjectListeners(List<ProjectListener> listeners)
Adds a collection of listeners to the current project.

Parameters:
listeners - collection of listeners

removeProjectListener

public void removeProjectListener(ProjectListener listener)
Removes a listener from this project file.

Parameters:
listener - listener instance

setTaskFieldAlias

public void setTaskFieldAlias(TaskField field,
                              String alias)
Associates an alias with a custom task field number.

Parameters:
field - custom field number
alias - alias text

getTaskFieldAlias

public String getTaskFieldAlias(TaskField field)
Retrieves the alias associated with a custom task field. This method will return null if no alias has been defined for this field.

Parameters:
field - task field instance
Returns:
alias text

getAliasTaskField

public TaskField getAliasTaskField(String alias)
Retrieves a task field instance based on its alias. If the alias is not recognised, this method will return null.

Parameters:
alias - alias text
Returns:
task field instance

setTaskFieldValueList

public void setTaskFieldValueList(TaskField field,
                                  List<Object> values)
Associates a value list with a custom task field number.

Parameters:
field - custom field number
values - values for the value list

getTaskFieldValueList

public List<Object> getTaskFieldValueList(TaskField field)
Retrieves the value list associated with a custom task field. This method will return null if no value list has been defined for this field.

Parameters:
field - task field instance
Returns:
alias text

setTaskFieldDescriptionList

public void setTaskFieldDescriptionList(TaskField field,
                                        List<String> descriptions)
Associates a descriptions for value list with a custom task field number.

Parameters:
field - custom field number
descriptions - descriptions for the value list

getTaskFieldDescriptionList

public List<String> getTaskFieldDescriptionList(TaskField field)
Retrieves the description value list associated with a custom task field. This method will return null if no descriptions for the value list has been defined for this field.

Parameters:
field - task field instance
Returns:
alias text

setResourceFieldAlias

public void setResourceFieldAlias(ResourceField field,
                                  String alias)
Associates an alias with a custom resource field number.

Parameters:
field - custom field number
alias - alias text

getResourceFieldAlias

public String getResourceFieldAlias(ResourceField field)
Retrieves the alias associated with a custom resource field. This method will return null if no alias has been defined for this field.

Parameters:
field - field number
Returns:
alias text

getAliasResourceField

public ResourceField getAliasResourceField(String alias)
Retrieves a resource field based on its alias. If the alias is not recognised, this method will return null.

Parameters:
alias - alias text
Returns:
resource field instance

getTaskFieldAliasMap

public Map<TaskField,String> getTaskFieldAliasMap()
Allows derived classes to gain access to the mapping between MPX task field numbers and aliases.

Returns:
task field to alias map

getResourceFieldAliasMap

public Map<ResourceField,String> getResourceFieldAliasMap()
Allows callers to gain access to the mapping between resource field numbers and aliases.

Returns:
resource field to alias map

getMppFileType

public int getMppFileType()
This method retrieves a value representing the type of MPP file that has been read. Currently this method will return the value 8 for an MPP8 file (Project 98), 9 for an MPP9 file (Project 2000 and Project 2002) and 12 for an MPP12 file (Project 12).

Returns:
integer representing the file type

setMppFileType

public void setMppFileType(int fileType)
Used internally to set the file type.

Parameters:
fileType - file type

addView

public void addView(View view)
Package-private method used to add views to this MPP file.

Parameters:
view - view data

getViews

public List<View> getViews()
This method returns a list of the views defined in this MPP file.

Returns:
list of views

addTable

public void addTable(Table table)
Package-private method used to add tables to this MPP file.

Parameters:
table - table data

getTables

public List<Table> getTables()
This method returns a list of the tables defined in this MPP file.

Returns:
list of tables

addFilter

public void addFilter(Filter filter)
Adds a filter definition to this project file.

Parameters:
filter - filter definition

removeFilter

public void removeFilter(String filterName)
Removes a filter from this project file.

Parameters:
filterName - The name of the filter

getAllResourceFilters

public List<Filter> getAllResourceFilters()
Retrieves a list of all resource filters.

Returns:
list of all resource filters

getAllTaskFilters

public List<Filter> getAllTaskFilters()
Retrieves a list of all task filters.

Returns:
list of all task filters

getFilterByName

public Filter getFilterByName(String name)
Retrieve a given filter by name.

Parameters:
name - filter name
Returns:
filter instance

getFilterByID

public Filter getFilterByID(Integer id)
Retrieve a given filter by ID.

Parameters:
id - filter ID
Returns:
filter instance

getAllGroups

public List<Group> getAllGroups()
Retrieves a list of all groups.

Returns:
list of all groups

getGroupByName

public Group getGroupByName(String name)
Retrieve a given group by name.

Parameters:
name - group name
Returns:
Group instance

addGroup

public void addGroup(Group group)
Adds a group definition to this project file.

Parameters:
group - group definition

addGraphicalIndicator

public void addGraphicalIndicator(FieldType field,
                                  GraphicalIndicator indicator)
Adds the definition of a graphical indicator for a field type.

Parameters:
field - field type
indicator - graphical indicator definition

getGraphicalIndicator

public GraphicalIndicator getGraphicalIndicator(FieldType field)
Retrieves the definition of any graphical indicators used for the given field type.

Parameters:
field - field type
Returns:
graphical indicator definition

getTaskTableByName

public Table getTaskTableByName(String name)
Utility method to retrieve the definition of a task table by name. This method will return null if the table name is not recognised.

Parameters:
name - table name
Returns:
table instance

getResourceTableByName

public Table getResourceTableByName(String name)
Utility method to retrieve the definition of a resource table by name. This method will return null if the table name is not recognised.

Parameters:
name - table name
Returns:
table instance

setResourceSubProject

public void setResourceSubProject(SubProject project)
This package-private method is used to add resource sub project details.

Parameters:
project - sub project

getResourceSubProject

public SubProject getResourceSubProject()
Retrieves details of the sub project file used as a resource pool.

Returns:
sub project details

addSubProject

public void addSubProject(SubProject project)
This package-private method is used to add sub project details.

Parameters:
project - sub project

getAllSubProjects

public List<SubProject> getAllSubProjects()
Retrieves all the subprojects for this MPX file.

Returns:
all sub project details

getAutoFilter

public boolean getAutoFilter()
Retrieve a flag indicating if auto filter is enabled.

Returns:
auto filter flag

setAutoFilter

public void setAutoFilter(boolean autoFilter)
Sets a flag indicating if auto filter is enabled.

Parameters:
autoFilter - boolean flag

setViewState

public void setViewState(ViewState viewState)
Set the saved view state associated with this file.

Parameters:
viewState - view state

getViewState

public ViewState getViewState()
Retrieve the saved view state associated with this file.

Returns:
view state

setEncoded

public void setEncoded(boolean encoded)
Set whether the data in this file is encoded.

Parameters:
encoded - True if the data is encoded in the file

getEncoded

public boolean getEncoded()
Get whether the data in this file is encoded.

Returns:
encoded

setEncryptionCode

public void setEncryptionCode(byte encryptionKey)
Set the key with which this data is encrypted (can be decrypted) with.

Parameters:
encryptionKey - Encryption key

getEncryptionCode

public byte getEncryptionCode()
Get the key with which this data is encrypted (can be decrypted) with.

Returns:
m_encryptionKey

setProjectFilePath

public void setProjectFilePath(String projectFilePath)
Sets the project file path.

Parameters:
projectFilePath - project file path

getProjectFilePath

public String getProjectFilePath()
Gets the project file path.

Returns:
project file path

addCustomFieldValueItem

public void addCustomFieldValueItem(CustomFieldValueItem item)
Add a custom field value list item.

Parameters:
item - CustomFieldValueItem instance

getCustomFieldValueItem

public CustomFieldValueItem getCustomFieldValueItem(Integer uniqueID)
Get the custom field value list item with the given unique ID.

Parameters:
uniqueID - unique ID
Returns:
CustomFieldValueItem instance

getCalendar

public ProjectCalendar getCalendar()
Retrieves the default calendar for this project.

Returns:
default projectCalendar instance

setCalendar

public void setCalendar(ProjectCalendar calendar)
Sets the default calendar for this project.

Parameters:
calendar - default calendar instance

getBaselineCalendar

public ProjectCalendar getBaselineCalendar()
Retrieve the calendar used internally for timephased baseline calculation.

Returns:
baseline calendar


Copyright © 2012. All Rights Reserved.