public final class ProjectFile extends Object implements TaskContainer
| Constructor and Description |
|---|
ProjectFile() |
| Modifier and Type | Method and Description |
|---|---|
ProjectCalendar |
addCalendar()
This method is used to add a new 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 calendar called
"Standard" to the file, and populate it with a default working week
and default working hours.
|
ProjectCalendar |
addDefaultDerivedCalendar()
This is a protected convenience method to add a default derived
calendar.
|
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.
|
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()
Retrieves a list of all resource assignments in this project.
|
List<Filter> |
getAllResourceFilters()
Retrieves a list of all resource filters.
|
List<Resource> |
getAllResources()
Retrieves a list of all resources in this project.
|
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 project file.
|
String |
getApplicationName()
Retrieves the name of the application used to create this project data.
|
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 |
getBaselineCalendar()
Retrieve the calendar used internally for timephased baseline calculation.
|
ProjectCalendar |
getCalendar()
Retrieves the default calendar for this project.
|
ProjectCalendar |
getCalendarByName(String calendarName)
Retrieves the named calendar.
|
ProjectCalendar |
getCalendarByUniqueID(Integer calendarID)
Retrieves the calendar referred to by the supplied unique ID
value.
|
List<ProjectCalendar> |
getCalendars()
This method retrieves the list of calendars defined in
this file.
|
int |
getCalendarUniqueID()
This method is used to retrieve the next unique ID for a calendar.
|
List<Task> |
getChildTasks()
This method is used to retrieve a list of all of the top level tasks
that are defined in this project file.
|
CustomFieldValueItem |
getCustomFieldValueItem(Integer uniqueID)
Get the custom field value list item with the given unique ID.
|
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.
|
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
task fields 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 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 |
setApplicationName(String name)
Sets the name of the application used to create this projectdata.
|
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
project 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.
|
public char getDelimiter()
public void setDelimiter(char delimiter)
delimiter - delimiter characterpublic Task addTask()
public void removeTask(Task task)
task - task to be removedpublic void renumberTaskIDs()
public void renumberResourceIDs()
public void validateUniqueIDsForMicrosoftProject()
public void synchronizeTaskIDToHierarchy()
public List<Task> getChildTasks()
getChildTasks in interface TaskContainerpublic List<Task> getAllTasks()
public void setAutoWBS(boolean flag)
flag - true if automatic WBS required.public void setAutoOutlineLevel(boolean flag)
flag - true if automatic outline level required.public void setAutoOutlineNumber(boolean flag)
flag - true if automatic outline number required.public void setAutoTaskUniqueID(boolean flag)
flag - true if automatic unique ID required.public void setAutoCalendarUniqueID(boolean flag)
flag - true if automatic unique ID required.public void setAutoAssignmentUniqueID(boolean flag)
flag - true if automatic unique ID required.public void setAutoTaskID(boolean flag)
flag - true if automatic ID required.public boolean getAutoWBS()
public boolean getAutoOutlineLevel()
public boolean getAutoOutlineNumber()
public boolean getAutoTaskUniqueID()
public boolean getAutoCalendarUniqueID()
public boolean getAutoAssignmentUniqueID()
public boolean getAutoTaskID()
public int getTaskUniqueID()
public int getCalendarUniqueID()
public int getTaskID()
public void setAutoResourceUniqueID(boolean flag)
flag - true if automatic unique ID required.public void setAutoResourceID(boolean flag)
flag - true if automatic ID required.public boolean getAutoResourceUniqueID()
public boolean getAutoResourceID()
public int getResourceUniqueID()
public int getResourceID()
public FileCreationRecord getFileCreationRecord()
public ProjectCalendar addCalendar()
public void removeCalendar(ProjectCalendar calendar)
calendar - calendar to be removedpublic ProjectCalendar addDefaultBaseCalendar()
public ProjectCalendar addDefaultDerivedCalendar()
public List<ProjectCalendar> getCalendars()
public ProjectHeader getProjectHeader()
public Resource addResource()
public void removeResource(Resource resource)
resource - resource to be removedpublic List<Resource> getAllResources()
public List<ResourceAssignment> getAllResourceAssignments()
public ResourceAssignment newResourceAssignment(Task task)
task - parent taskpublic ProjectCalendar getCalendarByName(String calendarName)
calendarName - name of the required calendarpublic ProjectCalendar getCalendarByUniqueID(Integer calendarID)
calendarID - calendar unique IDpublic Duration getDuration(Date startDate, Date endDate) throws MPXJException
startDate - start of the periodendDate - end of the periodMPXJException - normally when no Standard calendar is availablepublic Duration getDuration(String calendarName, Date startDate, Date endDate) throws MPXJException
calendarName - name of the calendar to usestartDate - start of the periodendDate - end of the periodMPXJException - normally when no Standard calendar is availablepublic Task getTaskByID(Integer id)
id - task identifiedpublic Task getTaskByUniqueID(Integer id)
id - task identifiedpublic Resource getResourceByID(Integer id)
id - resource identifiedpublic Resource getResourceByUniqueID(Integer id)
id - resource identifiedpublic void updateStructure()
public void updateUniqueCounters()
public Date getStartDate()
public Date getFinishDate()
public void fireTaskReadEvent(Task task)
task - task instancepublic void fireTaskWrittenEvent(Task task)
task - task instancepublic void fireResourceReadEvent(Resource resource)
resource - resource instancepublic void fireResourceWrittenEvent(Resource resource)
resource - resource instancepublic void fireCalendarReadEvent(ProjectCalendar calendar)
calendar - calendar instancepublic void fireAssignmentReadEvent(ResourceAssignment resourceAssignment)
resourceAssignment - resourceAssignment instancepublic void fireAssignmentWrittenEvent(ResourceAssignment resourceAssignment)
resourceAssignment - resourceAssignment instancepublic void fireRelationReadEvent(Relation relation)
relation - relation instancepublic void fireRelationWrittenEvent(Relation relation)
relation - relation instancepublic void fireCalendarWrittenEvent(ProjectCalendar calendar)
calendar - calendar instancepublic void addProjectListener(ProjectListener listener)
listener - listener instancepublic void addProjectListeners(List<ProjectListener> listeners)
listeners - collection of listenerspublic void removeProjectListener(ProjectListener listener)
listener - listener instancepublic void setTaskFieldAlias(TaskField field, String alias)
field - custom field numberalias - alias textpublic String getTaskFieldAlias(TaskField field)
field - task field instancepublic TaskField getAliasTaskField(String alias)
alias - alias textpublic void setTaskFieldValueList(TaskField field, List<Object> values)
field - custom field numbervalues - values for the value listpublic List<Object> getTaskFieldValueList(TaskField field)
field - task field instancepublic void setTaskFieldDescriptionList(TaskField field, List<String> descriptions)
field - custom field numberdescriptions - descriptions for the value listpublic List<String> getTaskFieldDescriptionList(TaskField field)
field - task field instancepublic void setResourceFieldAlias(ResourceField field, String alias)
field - custom field numberalias - alias textpublic String getResourceFieldAlias(ResourceField field)
field - field numberpublic ResourceField getAliasResourceField(String alias)
alias - alias textpublic Map<TaskField,String> getTaskFieldAliasMap()
public Map<ResourceField,String> getResourceFieldAliasMap()
public int getMppFileType()
public void setMppFileType(int fileType)
fileType - file typepublic String getApplicationName()
public void setApplicationName(String name)
name - application namepublic void addView(View view)
view - view datapublic List<View> getViews()
public void addTable(Table table)
table - table datapublic List<Table> getTables()
public void addFilter(Filter filter)
filter - filter definitionpublic void removeFilter(String filterName)
filterName - The name of the filterpublic List<Filter> getAllResourceFilters()
public List<Filter> getAllTaskFilters()
public Filter getFilterByName(String name)
name - filter namepublic Filter getFilterByID(Integer id)
id - filter IDpublic List<Group> getAllGroups()
public Group getGroupByName(String name)
name - group namepublic void addGroup(Group group)
group - group definitionpublic void addGraphicalIndicator(FieldType field, GraphicalIndicator indicator)
field - field typeindicator - graphical indicator definitionpublic GraphicalIndicator getGraphicalIndicator(FieldType field)
field - field typepublic Table getTaskTableByName(String name)
name - table namepublic Table getResourceTableByName(String name)
name - table namepublic void setResourceSubProject(SubProject project)
project - sub projectpublic SubProject getResourceSubProject()
public void addSubProject(SubProject project)
project - sub projectpublic List<SubProject> getAllSubProjects()
public boolean getAutoFilter()
public void setAutoFilter(boolean autoFilter)
autoFilter - boolean flagpublic void setViewState(ViewState viewState)
viewState - view statepublic ViewState getViewState()
public void setEncoded(boolean encoded)
encoded - True if the data is encoded in the filepublic boolean getEncoded()
public void setEncryptionCode(byte encryptionKey)
encryptionKey - Encryption keypublic byte getEncryptionCode()
public void setProjectFilePath(String projectFilePath)
projectFilePath - project file pathpublic String getProjectFilePath()
public void addCustomFieldValueItem(CustomFieldValueItem item)
item - CustomFieldValueItem instancepublic CustomFieldValueItem getCustomFieldValueItem(Integer uniqueID)
uniqueID - unique IDpublic ProjectCalendar getCalendar()
public void setCalendar(ProjectCalendar calendar)
calendar - default calendar instancepublic ProjectCalendar getBaselineCalendar()
Copyright © 2013. All Rights Reserved.