public class Project extends Object
Represents a project.
Constructor and Description |
---|
Project()
Initializes a new instance of the
Project class. |
Project(DbSettings settings)
Initializes a new instance of the
Project class to read data from a database which is specified by the
instance of the DbSettings class. |
Project(InputStream stream)
Initializes a new instance of the
Project class from a template(existent mpp or mpt file). |
Project(InputStream stream,
LoadOptions options)
Initializes a new instance of the
Project class from the Stream
with the specified instance of the LoadOptions class. |
Project(InputStream stream,
ParseErrorCallback parseErrorHandler)
Initializes a new instance of the
Project class from a template(existent mpp or mpt file). |
Project(InputStream stream,
ParseErrorCallback parseErrorHandler,
PrimaveraXmlReadingOptions options)
Initializes a new instance of the
Project class from the Stream
with the specified instance of the PrimaveraXmlReadingOptions class. |
Project(InputStream stream,
PrimaveraXmlReadingOptions options)
Initializes a new instance of the
Project class from the Stream
with the specified instance of the PrimaveraXmlReadingOptions class. |
Project(InputStream stream,
String protectionPassword)
Initializes a new instance of the
Project class from a template(existent mpp or mpt file). |
Project(String projectTemplate)
Initializes a new instance of the
Project class from a template (existent mpp or mpt file). |
Project(String projectTemplate,
LoadOptions options)
Initializes a new instance of the
Project class from a template (existent mpp or mpt file)
with the specified instance of the LoadOptions class. |
Project(String projectTemplate,
ParseErrorCallback parseErrorHandler)
Initializes a new instance of the
Project class from a template (existent mpp or mpt file). |
Project(String projectTemplate,
ParseErrorCallback parseErrorHandler,
PrimaveraXmlReadingOptions options)
Initializes a new instance of the
Project class from a template (existent mpp or mpt file)
with the specified instance of the PrimaveraXmlReadingOptions class. |
Project(String projectTemplate,
PrimaveraXmlReadingOptions options)
Initializes a new instance of the
Project class from a template (existent mpp or mpt file)
with the specified instance of the PrimaveraXmlReadingOptions class. |
Project(String projectTemplate,
String protectionPassword)
Initializes a new instance of the
Project class from a password protected template (existent mpp or mpt
file). |
Modifier and Type | Method and Description |
---|---|
void |
calcResourceFields()
Deprecated.
This method is obsolete and will be removed in future releases. Use the RecalculateResourceFields
method instead.
|
void |
calcResourceStartFinish()
Deprecated.
This method is obsolete and will be removed in future releases. Use the
RecalculateResourceStartFinish method instead.
|
void |
copyTo(Project another)
Copies project's main data and properties to another project.
|
<T> T |
get(Key<T,Integer> key)
Returns the value to which the property is mapped in this container.
|
Date |
getBaselineSaveTime(int baselineNumber)
Returns the baseline save time.
|
int |
getCalculationMode()
Gets calculation mode of a project.
|
CalendarCollection |
getCalendars()
Gets
CalendarCollection object of this Project instance. |
TaskCollection |
getCriticalPath()
Gets TaskCollection which contains a list of Critical tasks which comprise Critical Path of this project.
|
Map<String,Object> |
getCustomProperties()
Gets project's custom properties hashtable.
|
View |
getDefaultView()
Gets default view of the project.
|
WeekDayCollection |
getDefaultWeekWorkingDays()
Gets the instance of
WeekDayCollection class which represents a collection of project default week
working days and working times. |
ProjectDisplayOptions |
getDisplayOptions()
Gets an instance of the
ProjectDisplayOptions class. |
Duration |
getDuration(double val)
Gets
Duration object with the specified double value and default duration format. |
Duration |
getDuration(double val,
int timeUnit)
|
ExtendedAttributeDefinitionCollection |
getExtendedAttributes()
Gets ExtendedAttributeDefinitionCollection object.
|
OleObjectCollection |
getOleObjects()
Gets a collection containing the instances of the
OleObject class which are linked or embedded to this
project file. |
OutlineCodeDefinitionCollection |
getOutlineCodes()
Gets OutlineCodeDefinitionCollection object.
|
int |
getPageCount_PageSize(int pageSize,
int scale)
|
int |
getPageCount_PageSize(int pageSize,
int scale,
Date startDate,
Date endDate)
Returns page count for the project to be rendered using given
Timescale , PresentationFormat and
date range. |
int |
getPageCount_PresentationFormat(int format)
Returns page count for the project to be rendered using default
Timescale (Days) and given PresentationFormat |
int |
getPageCount_Timescale(int scale)
Returns page count for the project to be rendered using given
Timescale . |
int |
getPageCount()
Returns page count for the project to be rendered using default
Timescale (Days). |
int |
getPageCount(int format,
int scale)
Returns page count for the project to be rendered using given
Timescale and PresentationFormat . |
TaskLinkCollection |
getPredecessors(Task task)
Returns a collection of task links which are predecessors of the specified task.
|
static ProjectFileInfo |
getProjectFileInfo(InputStream stream)
Gets project file info from the stream.
|
static ProjectFileInfo |
getProjectFileInfo(String filename)
Read project file info from the file.
|
ResourceAssignmentCollection |
getResourceAssignments()
Gets ResourceAssignmentCollection object.
|
FilterCollection |
getResourceFilters()
Gets all the resource-based filter definitions.
|
GroupCollection |
getResourceGroups()
Gets all of the resource-based group definitions.
|
ResourceCollection |
getResources()
Gets ResourceCollection object.
|
Task |
getRootTask()
Gets the root of the tree of tasks.
|
TableCollection |
getTables()
Gets a list of
Table objects. |
FilterCollection |
getTaskFilters()
Gets all the task-based filter definitions.
|
GroupCollection |
getTaskGroups()
Gets all the task-based group definitions.
|
TaskLinkCollection |
getTaskLinks()
Gets
TaskLinkCollection object. |
VbaProject |
getVbaProject()
Gets an instance of VbaProject class.
|
ViewCollection |
getViews()
Gets a list of
View objects. |
WBSCodeDefinition |
getWBSCodeDefinition()
Gets WBS Code Definition for the project.
|
Duration |
getWork(double val)
Gets
Duration object with the specified double value and default work format. |
void |
recalculate()
Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks,
work and cost fields.
|
void |
recalculate(boolean validate)
Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks,
work and cost fields with optional validation.
|
void |
recalculateResourceFields()
Recalculates Id, Start and Finish of resources.
|
void |
recalculateResourceStartFinish()
Recalculates Start and Finish of resources.
|
void |
removeInvalidResourceAssignments()
Eliminates invalid resource assignments from the project resource assignments list.
|
void |
renumberWBSCode()
Renumber WBS code of all tasks.
|
void |
renumberWBSCode(List<Integer> taskIds)
Renumber WBS code of passed tasks.
|
void |
rescheduleUncompletedWorkToStartAfter(Date after)
Reschedules uncompleted project work to start after a specified date.
|
void |
rescheduleUncompletedWorkToStartAfter(Date after,
List<Task> tasks)
Reschedules uncompleted work for a specified list of tasks to start after a specified date.
|
void |
save(OutputStream stream,
int format)
Saves the project data to the stream.
|
void |
save(OutputStream stream,
MPPSaveOptions options)
Saves the project to a stream using the specified save options.
|
void |
save(OutputStream stream,
SaveOptions options)
Saves the project to a stream using the specified save options.
|
void |
save(String filename,
int format)
Saves the project data to the file.
|
void |
save(String filename,
MPPSaveOptions options)
Saves the document to mpp file format using the specified save options.
|
void |
save(String filename,
SaveOptions options)
Saves the document to a file using the specified save options.
|
void |
saveAsTemplate(OutputStream stream)
Saves the project as a template to a specified stream.
|
void |
saveAsTemplate(OutputStream stream,
SaveTemplateOptions options)
Saves the project as a template to a specified stream.
|
void |
saveAsTemplate(String fileName)
Saves the project as a template to the specified file path.
|
void |
saveAsTemplate(String fileName,
SaveTemplateOptions options)
Saves the project as a template.
|
void |
saveReport(OutputStream stream)
Saves the project overview report to the stream.
|
void |
saveReport(OutputStream stream,
int reportType)
Saves the project report of the specified type to the specified stream.
|
void |
saveReport(String fileName)
Saves the project overview report to pdf file.
|
void |
saveReport(String fileName,
int reportType)
Saves the project report of the specified type in pdf format to the specified file path.
|
List<Task> |
selectAllChildTasks()
Recursively collects all child tasks of the root task.
|
void |
set(Key<Date,Integer> key,
Date val)
Maps the specified property to the specified value in this container.
|
<T> void |
set(Key<T,Integer> key,
T val)
Maps the specified property to the specified value in this container.
|
void |
setBaseline(int baselineType)
Saves baseline fields to the specified baseline for the entire project.
|
void |
setBaseline(int baselineType,
Iterable<Task> tasks)
Saves baseline fields to the specified baseline for the selected tasks.
|
void |
setCalculationMode(int value)
Sets calculation mode of a project.
|
void |
setCustomProperties(Map<String,Object> value)
Sets project's custom properties map.
|
void |
setWBSCodeDefinition(WBSCodeDefinition value)
Sets WBS Code Definition for the project.
|
void |
updateProjectWorkAsComplete(Date completeThrough,
boolean setZeroOrHundredPercentCompleteOnly)
Updates all work as complete through a specified date for the entire project.
|
void |
updateProjectWorkAsComplete(Date completeThrough,
boolean setZeroOrHundredPercentCompleteOnly,
List<Task> tasks)
Updates all work as complete through a specified date for the specified list of tasks.
|
public Project()
Initializes a new instance of the Project
class.
public Project(String projectTemplate, String protectionPassword)
Initializes a new instance of the Project
class from a password protected template (existent mpp or mpt
file).
projectTemplate
- Path to template to create project from.protectionPassword
- Protection password.
public Project(String projectTemplate)
Initializes a new instance of the Project
class from a template (existent mpp or mpt file).
projectTemplate
- Path to template to create project from.public Project(InputStream stream, PrimaveraXmlReadingOptions options)
Initializes a new instance of the Project
class from the Stream
with the specified instance of the PrimaveraXmlReadingOptions
class.
stream
- Stream of the Project InputStream
classoptions
- the specified instance of the PrimaveraXmlReadingOptions
classpublic Project(InputStream stream, ParseErrorCallback parseErrorHandler, PrimaveraXmlReadingOptions options)
Initializes a new instance of the Project
class from the Stream
with the specified instance of the PrimaveraXmlReadingOptions
class.
stream
- Stream of the Project InputStream
classparseErrorHandler
- the specified callback method to handle xml parse errorsoptions
- the specified instance of the PrimaveraXmlReadingOptions
classpublic Project(String projectTemplate, ParseErrorCallback parseErrorHandler)
Initializes a new instance of the Project
class from a template (existent mpp or mpt file).
projectTemplate
- Path to template to create project from.parseErrorHandler
- the specified callback method to handle xml parse errors.public Project(InputStream stream)
Initializes a new instance of the Project
class from a template(existent mpp or mpt file).
stream
- InputStream
to load a template from.public Project(String projectTemplate, PrimaveraXmlReadingOptions options)
Initializes a new instance of the Project
class from a template (existent mpp or mpt file)
with the specified instance of the PrimaveraXmlReadingOptions
class.
projectTemplate
- Path to template to create project fromoptions
- the specified instance of the PrimaveraXmlReadingOptions
class.public Project(String projectTemplate, ParseErrorCallback parseErrorHandler, PrimaveraXmlReadingOptions options)
Initializes a new instance of the Project
class from a template (existent mpp or mpt file)
with the specified instance of the PrimaveraXmlReadingOptions
class.
projectTemplate
- Path to template to create project fromparseErrorHandler
- the specified callback method to handle xml parse errorsoptions
- the specified instance of the PrimaveraXmlReadingOptions
class.public Project(DbSettings settings)
Initializes a new instance of the Project
class to read data from a database which is specified by the
instance of the DbSettings
class.
settings
- the specified instance of the DbSettings
class.public Project(InputStream stream, ParseErrorCallback parseErrorHandler)
Initializes a new instance of the Project
class from a template(existent mpp or mpt file).
stream
- InputStream
to load a template from.parseErrorHandler
- the specified callback method to handle xml parse errors.public Project(InputStream stream, String protectionPassword)
Initializes a new instance of the Project
class from a template(existent mpp or mpt file).
stream
- InputStream
to load a template from.protectionPassword
- Protection password.
public Project(String projectTemplate, LoadOptions options)
Initializes a new instance of the Project
class from a template (existent mpp or mpt file)
with the specified instance of the LoadOptions
class.
projectTemplate
- Path to template to create project fromoptions
- the specified instance of the LoadOptions
class.public Project(InputStream stream, LoadOptions options)
Initializes a new instance of the Project
class from the Stream
with the specified instance of the LoadOptions
class.
stream
- Stream of the Project InputStream
classoptions
- the specified instance of the LoadOptions
class@Deprecated public final void calcResourceFields()
Recalculates Id, Start and Finish of resources.
@Deprecated public final void calcResourceStartFinish()
Recalculates Start and Finish of resources.
public final void copyTo(Project another)
Copies project's main data and properties to another project.
another
- Another project to copy data to.public final <T> T get(Key<T,Integer> key)
Returns the value to which the property is mapped in this container.
key
- the specified property key. Prj
for getting the property key.
T
: the type of the mapped value.
public final Date getBaselineSaveTime(int baselineNumber)
Returns the baseline save time. Returns DateTime.MinValue if the baseline was not saved.
baselineNumber
- The baseline's number BaselineType
.public final int getCalculationMode()
Gets calculation mode of a project.
Can be one of the values of CalculationMode
(getCalculationMode()
/setCalculationMode(int)
)
enumeration.
public final void setCalculationMode(int value)
Sets calculation mode of a project.
Can be one of the values of CalculationMode
(getCalculationMode()
/setCalculationMode(int)
)
enumeration.
value
- calculation mode of a project.public final CalendarCollection getCalendars()
Gets CalendarCollection
object of this Project instance.
CalendarCollection
object of this Project instance.public final TaskCollection getCriticalPath()
Gets TaskCollection which contains a list of Critical tasks which comprise Critical Path of this project.
TaskCollection
which represents a list of all critical tasks.
public final Map<String,Object> getCustomProperties()
Gets project's custom properties hashtable.
Read/write Map
.
public final void setCustomProperties(Map<String,Object> value)
Sets project's custom properties map.
Read/write Map<String,Object>
.
value
- custom properties hashmap of the project.public final View getDefaultView()
Gets default view of the project.
public final WeekDayCollection getDefaultWeekWorkingDays()
Gets the instance of WeekDayCollection
class which represents a collection of project default week
working days and working times.
WeekDayCollection
class which contains a list of WeekDay
objects.
public final ProjectDisplayOptions getDisplayOptions()
Gets an instance of the ProjectDisplayOptions
class.
ProjectDisplayOptions
class.public final Duration getDuration(double val)
Gets Duration
object with the specified double
value and default duration format.
val
- specified value.public final Duration getDuration(double val, int timeUnit)
Gets Duration
object with the specified double
value and specified TimeUnitType
value.
val
- specified double value.timeUnit
- specified TimeUnitType value.public final ExtendedAttributeDefinitionCollection getExtendedAttributes()
Gets ExtendedAttributeDefinitionCollection object.
The collection of extended attribute (custom fields) definitions associated with a project.
Read only ExtendedAttributeDefinitionCollection
instance.
public final OleObjectCollection getOleObjects()
Gets a collection containing the instances of the OleObject
class which are linked or embedded to this
project file.
OleObject
class which are linked or embedded to this
project file.public final OutlineCodeDefinitionCollection getOutlineCodes()
Gets OutlineCodeDefinitionCollection object. The collection of outline code definitions associated with a project.
public final int getPageCount()
Returns page count for the project to be rendered using default Timescale
(Days).
public final int getPageCount_PresentationFormat(int format)
Returns page count for the project to be rendered using default Timescale
(Days) and given PresentationFormat
format
- PresentationFormat
to get page count for.public final int getPageCount_PageSize(int pageSize, int scale, Date startDate, Date endDate)
Returns page count for the project to be rendered using given Timescale
, PresentationFormat
and
date range.
public final int getPageCount_PageSize(int pageSize, int scale)
public final int getPageCount_Timescale(int scale)
Returns page count for the project to be rendered using given Timescale
.
scale
- Timescale
to get page count for.public final int getPageCount(int format, int scale)
Returns page count for the project to be rendered using given Timescale
and PresentationFormat
.
format
- PresentationFormat
to get page count for.scale
- Timescale
to get page count for.public final TaskLinkCollection getPredecessors(Task task)
Returns a collection of task links which are predecessors of the specified task.
task
- The task to get predecessors for.TaskLink
.public static ProjectFileInfo getProjectFileInfo(String filename)
Read project file info from the file.
filename
- The project filename.ProjectFileInfo
.public static ProjectFileInfo getProjectFileInfo(InputStream stream)
Gets project file info from the stream.
stream
- The data stream.ProjectFileInfo
.public final ResourceAssignmentCollection getResourceAssignments()
Gets ResourceAssignmentCollection object.
public final FilterCollection getResourceFilters()
Gets all the resource-based filter definitions.
ResourceFilters is a collection of Filter
objects.
public final GroupCollection getResourceGroups()
Gets all of the resource-based group definitions.
ResourceGroups is a collection of Group
objects.
public final ResourceCollection getResources()
Gets ResourceCollection object.
public final Task getRootTask()
Gets the root of the tree of tasks.
public final TableCollection getTables()
Gets a list of Table
objects.
Table
objects.public final FilterCollection getTaskFilters()
Gets all the task-based filter definitions.
TaskFilters is a collection of Filter
objects.
public final GroupCollection getTaskGroups()
Gets all the task-based group definitions.
TaskGroups is a collection of Group
objects.
public final TaskLinkCollection getTaskLinks()
Gets TaskLinkCollection
object.
TaskLinkCollection
object.public final VbaProject getVbaProject()
Gets an instance of VbaProject class.
public final ViewCollection getViews()
Gets a list of View
objects.
View
objects.public final WBSCodeDefinition getWBSCodeDefinition()
Gets WBS Code Definition for the project.
public final void setWBSCodeDefinition(WBSCodeDefinition value)
Sets WBS Code Definition for the project.
value
- WBS Code Definition for the project.public final Duration getWork(double val)
Gets Duration
object with the specified double
value and default work format.
val
- specified double value.public final void recalculate()
Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks, work and cost fields.
public final void recalculate(boolean validate)
Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks, work and cost fields with optional validation.
validate
- If true the validation of recalculation will be performed.
What data is validated:
At the moment only basic validation of task and task link date ranges is implemented.
Task's date ranges (e.g. ActualStart - ActualFinish, EarlyStart - EarlyFinish, etc.) as well as Task
Links dates
will be checked against the date criteria that start date is less or equal than finish date.
If any of conditions described above is failed then RecalculationValidationException
will be
thrown.public final void recalculateResourceFields()
Recalculates Id, Start and Finish of resources.
public final void recalculateResourceStartFinish()
Recalculates Start and Finish of resources.
public final void removeInvalidResourceAssignments()
Eliminates invalid resource assignments from the project resource assignments list.
public final void renumberWBSCode()
Renumber WBS code of all tasks.
public final void renumberWBSCode(List<Integer> taskIds)
Renumber WBS code of passed tasks.
taskIds
- Task identifiers to renumber WBS codes.public final void rescheduleUncompletedWorkToStartAfter(Date after)
Reschedules uncompleted project work to start after a specified date.
after
- Date
to reschedule uncompleted work after.
public final void rescheduleUncompletedWorkToStartAfter(Date after, List<Task> tasks)
Reschedules uncompleted work for a specified list of tasks to start after a specified date.
after
- Date
to reschedule uncompleted work after.tasks
- List<Task> of tasks to reschedule uncompleted work for.
public final void save(String filename, MPPSaveOptions options) throws IOException
Saves the document to mpp file format using the specified save options.
filename
- The file name.options
- MPPSaveOptions
save options.IOException
public final void save(String filename, SaveOptions options) throws IOException
Saves the document to a file using the specified save options.
filename
- The file name.options
- SaveOptions
save options.IOException
public final void save(String filename, int format) throws IOException
Saves the project data to the file.
filename
- The file name.format
- SaveFileFormat
save file format.IOException
public final void save(OutputStream stream, SaveOptions options) throws IOException
Saves the project to a stream using the specified save options.
stream
- The stream.options
- SaveOptions
save options.IOException
public void save(OutputStream stream, MPPSaveOptions options) throws IOException
Saves the project to a stream using the specified save options.
stream
- The stream.options
- MPPSaveOptions
save options.IOException
public void save(OutputStream stream, int format) throws IOException
Saves the project data to the stream.
stream
- The stream.format
- the specified save file format.SaveFileFormat
IOException
public void saveAsTemplate(String fileName, SaveTemplateOptions options) throws IOException
Saves the project as a template.
fileName
- The file name.options
- the specified save options SaveTemplateOptions
.IOException
public final void saveAsTemplate(String fileName) throws IOException
Saves the project as a template to the specified file path.
fileName
- the specified file name.IOException
public final void saveAsTemplate(OutputStream stream) throws IOException
Saves the project as a template to a specified stream.
stream
- the specified stream to save the project to.IOException
public final void saveAsTemplate(OutputStream stream, SaveTemplateOptions options) throws IOException
Saves the project as a template to a specified stream.
stream
- Stream to save the project template to.options
- the specified save options SaveTemplateOptions
.IOException
public final void saveReport(OutputStream stream) throws IOException
Saves the project overview report to the stream.
stream
- The stream to save project report to.IOException
public final void saveReport(String fileName)
Saves the project overview report to pdf file.
fileName
- The file name.public void saveReport(OutputStream stream, int reportType) throws IOException
Saves the project report of the specified type to the specified stream.
stream
- the specified stream to save project report to.reportType
- the specified report type.ReportType
IOException
public final void saveReport(String fileName, int reportType)
Saves the project report of the specified type in pdf format to the specified file path.
fileName
- the specified file name.reportType
- the specified report type.ReportType
public final List<Task> selectAllChildTasks()
Recursively collects all child tasks of the root task.
public final <T> void set(Key<T,Integer> key, T val)
Maps the specified property to the specified value in this container.
key
- the specified property key. Prj
for getting the property key.val
- the value.
T
: the type of the mapped value.
public final void set(Key<Date,Integer> key, Date val)
Maps the specified property to the specified value in this container.
key
- the specified property key. Prj
for getting the property key.val
- the value.public final void setBaseline(int baselineType)
Saves baseline fields to the specified baseline for the entire project.
baselineType
- BaselineType
to save baseline data to.public final void setBaseline(int baselineType, Iterable<Task> tasks)
Saves baseline fields to the specified baseline for the selected tasks.
baselineType
- BaselineType
to save baseline data to.tasks
- List of tasks to save baseline data for.public final void updateProjectWorkAsComplete(Date completeThrough, boolean setZeroOrHundredPercentCompleteOnly)
Updates all work as complete through a specified date for the entire project.
completeThrough
- Date
to update work as completed through.setZeroOrHundredPercentCompleteOnly
- If set to true updates only those tasks as 100% complete whose
finish
date is before specified complete-through date.
Otherwise, calculates a percentage complete value based on scheduled start and complete-through dates.public final void updateProjectWorkAsComplete(Date completeThrough, boolean setZeroOrHundredPercentCompleteOnly, List<Task> tasks)
Updates all work as complete through a specified date for the specified list of tasks.
completeThrough
- Date
to update work as completed through.setZeroOrHundredPercentCompleteOnly
- If set to true updates only those tasks as 100% complete whose
finish
date is before specified complete-through date.
Otherwise, calculates a percentage complete value based on scheduled start and complete-through dates.tasks
- List<Task> of tasks to update work for.Copyright (c) 2008-2019 Aspose Pty Ltd. All Rights Reserved.