com.aspose.tasks

Interfaces

Classes

Exceptions

com.aspose.tasks

Class Project



  • public class Project
    extends Object

    Represents a project.

    • Constructor Detail

      • Project

        public Project()

        Initializes a new instance of the Project class.

      • Project

        public Project(String template,
                       String protectionPassword)

        Initializes a new instance of the Project class from a password protected template (existent mpp or mpt file).

        Parameters:
        template - Path to template to create project from.
        protectionPassword - Protection password.

        Reading password protected files currently supported for MSP 2003 file format only.

      • Project

        public Project(String template)

        Initializes a new instance of the Project class from a template (existent mpp or mpt file).

        Parameters:
        template - Path to template to create project from.
      • Project

        public Project(String projectTemplate,
                       ParseErrorCallback parseErrorHandler)

        Initializes a new instance of the Project class from a projectTemplate (existent mpp or mpt file).

        Parameters:
        projectTemplate - Path to projectTemplate to create project from.
        parseErrorHandler - the specified callback method to handle xml parse errors.
      • Project

        public Project(InputStream stream)

        Initializes a new instance of the Project class from a template(existent mpp or mpt file).

        Parameters:
        stream - Stream to load a template from.
      • Project

        public Project(InputStream stream,
                       PrimaveraXmlReadingOptions options)

        Initializes a new instance of the Project class from the specified stream with the specified instance of the PrimaveraXmlReadingOptions class.

        Parameters:
        stream - Stream to load a template from.
        options - the specified instance of the PrimaveraXmlReadingOptions class.
      • Project

        public Project(String projectTemplate,
                       PrimaveraXmlReadingOptions options)

        Initializes a new instance of the Project class from a projectTemplate with the specified instance of the PrimaveraXmlReadingOptions class.

        Parameters:
        projectTemplate - Path to projectTemplate to create project from
        options - the specified instance of the PrimaveraXmlReadingOptions class.
      • Project

        public Project(String projectTemplate,
                       ParseErrorCallback parseErrorHandler,
                       PrimaveraXmlReadingOptions options)

        Initializes a new instance of the Project class from a projectTemplate (existent mpp or mpt file) with the specified instance of the PrimaveraXmlReadingOptions class.

        Parameters:
        projectTemplate - Path to projectTemplate to create project from
        parseErrorHandler - the specified callback method to handle xml parse errors
        options - the specified instance of the PrimaveraXmlReadingOptions class.
      • Project

        public Project(DbSettings settings)

        Inititalizes a new instance of the Project to read data from a database which is specified by the instance of the DbSettings class.

        Parameters:
        settings - the specified instance of the DbSettings class.
      • Project

        public Project(InputStream stream,
                       ParseErrorCallback parseErrorHandler)

        Initializes a new instance of the Project class from a template(existent mpp or mpt file).

        Parameters:
        stream - Stream to load a template from.
        parseErrorHandler - the specified callback method to handle xml parse errors.
      • Project

        public Project(InputStream stream,
                       String protectionPassword)

        Initializes a new instance of the Project class from a template(existent mpp or mpt file).

        Parameters:
        stream - Stream to load a template from.
        protectionPassword - Protection password.

        Reading password protected files currently supported for MSP 2003 file format only.

      • Project

        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.

        Parameters:
        projectTemplate - Path to template to create project from
        options - the specified instance of the LoadOptions class.
      • Project

        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.

        Parameters:
        stream - Stream of the Project System.IO.Streamclass
        options - the specified instance of the LoadOptionsclass
    • Method Detail

      • getDisplayOptions

        public ProjectDisplayOptions getDisplayOptions()

        Returns an instance of the ProjectDisplayOptions class.

        Returns:
        an instance of the ProjectDisplayOptions class.
      • getCalculationMode

        public int getCalculationMode()

        Specifies calculation mode of a project. Can be one of the values of CalculationMode enumeration.

        Returns:
        the calculation mode for this project.
      • setCalculationMode

        public void setCalculationMode(int value)

        Specifies calculation mode of a project. Can be one of the values of CalculationMode enumeration.

        Parameters:
        value - one of the values of CalculationMode enumeration which specifies calculation mode of a project.
      • getRootTask

        public Task getRootTask()

        Returns the root of the tree of tasks. Read-only instance of the Task class.

        Returns:
        returns the root task of this project (project summary task).
      • getTaskLinks

        public TaskLinkCollection getTaskLinks()

        Returns TaskLinkCollection object. Read only TaskLinkCollection.

        Returns:
        returns a collection of task links used in this project.
      • getCalendars

        public CalendarCollection getCalendars()

        Returns CalendarCollection object of this Project instance. Read only CalendarCollection.

        Returns:
        returns a collection of calendars used in this project.
      • getVbaProject

        public VbaProject getVbaProject()

        Represents an instance of VbaProject class.

        Returns:
        returns the VbaProject objects.
      • getResources

        public ResourceCollection getResources()

        Returns ResourceCollection object. Read-only ResourceCollection object.

        Returns:
        returns a collection of resources used in this project.
      • getOutlineCodes

        public OutlineCodeDefinitionCollection getOutlineCodes()

        Returns OutlineCodeDefinitionCollection object. The collection of outline code definitions associated with a project. Read only OutlineCodeDefinitionCollection instance.

        Returns:
        returns a collection of OutlineCodeDefinition instances used in this project.
      • getResourceAssignments

        public ResourceAssignmentCollection getResourceAssignments()

        Returns the instance of ResourceAssignmentCollection class.

        Returns:
        returns a collection of ResourceAssignment objects used in this project.
      • getDefaultWeekWorkingDays

        public WeekDayCollection getDefaultWeekWorkingDays()

        Returns the instance of WeekDayCollection class which represents a collection of project default week working days and working times. The data contains only in mpp files (not in xml).

        Returns:
        returns the instanceWeekDayCollection class which contains a list of WeekDay objects.
      • getCustomProperties

        public Map<String,Object> getCustomProperties()

        Returns project custom properties map. Read/write Map<String,Object>.

        Returns:
        returns a map of custom properties used in this project.
      • getExtendedAttributes

        public ExtendedAttributeDefinitionCollection getExtendedAttributes()

        Returns ExtendedAttributeDefinitionCollection object. The collection of extended attribute (custom fields) definitions associated with a project. Read only ExtendedAttributeDefinitionCollection instance.

        Returns:
        returns a collection of ExtendedAttributeDefinition objects used in this project.
      • getCriticalPath

        public TaskCollection getCriticalPath()

        Returns TaskCollection which contains a list of Critical tasks which comprise Critical Path of this project.

        Returns:
        TaskCollection which represents a list of all critical tasks.

        this is an O(n) operation, where n is the number of tasks in the project.

      • getTaskFilters

        public FilterCollection getTaskFilters()

        Represents all the task-based filter definitions. TaskFilters is a collection of Filter objects.

        Returns:
        FilterCollection object containing all the task-based filter definitions.
      • getResourceFilters

        public FilterCollection getResourceFilters()

        Represents all the resource-based filter definitions. ResourceFilters is a collection of Filter objects.

        Returns:
        FilterCollection object containing all the resource-based filter definitions.
      • getDefaultView

        public View getDefaultView()

        Gets default view of the project.

        Returns:
        default view of the project.
      • getViews

        public ViewCollection getViews()

        Contains a list of View objects.

        Returns:
        ViewCollection object containing all the views of this project.
      • getTables

        public TableCollection getTables()

        Contains a list of Table objects.

        Returns:
        TableCollection object containing all the tables of this project.
      • getTaskGroups

        public GroupCollection getTaskGroups()

        Represents all the task-based group definitions. TaskGroups is a collection of Group objects.

        Returns:
        GroupCollection object containing all the task-based group definitions of this project.
      • getResourceGroups

        public GroupCollection getResourceGroups()

        Represents all of the resource-based group definitions. ResourceGroups is a collection of Group objects.

        Returns:
        returns GroupCollection object containing all the resource-based group definitions of this project.
      • getWBSCodeDefinition

        public WBSCodeDefinition getWBSCodeDefinition()

        Gets WBS Code Definition for the project.

        Returns:
        WBS Code Definition for the project.
      • setWBSCodeDefinition

        public void setWBSCodeDefinition(WBSCodeDefinition value)
        Sets WBS Code Definition for the project.
        Parameters:
        value - WBS Code Definition for the project.
      • getOleObjects

        public OleObjectCollection getOleObjects()

        Returns a collection containing the instances of the OleObject class which are linked or embedded to this project file. Available for mpp file format only.

        Returns:
        returns a collection containing the instances of the OleObject class which are linked or embedded to this project file.
      • selectAllChildTasks

        public List<Task> selectAllChildTasks()

        Recursively collects all child tasks of this task.

        Returns:
        java.util.List<Task> which consists of all child tasks of this task.
      • getProjectFileInfo

        public static ProjectFileInfo getProjectFileInfo(String filename)

        Read project file info from the file.

        Parameters:
        filename - The project filename.
        Returns:
        The project file info Aspose.Tasks.ProjectFileInfo.
      • getProjectFileInfo

        public static ProjectFileInfo getProjectFileInfo(InputStream stream)
        /**

        Gets project file info from the stream.

        Parameters:
        stream - The data stream.
        Returns:
        returns the instance of Aspose.Tasks.ProjectFileInfo class.
      • getPredecessors

        public TaskLinkCollection getPredecessors(Task task)

        Returns a collection of task links which are predecessors of the specified task.

        Parameters:
        task - the specified Task object.
        Returns:
        List of predecessors TaskLink of the specified task.
      • get

        public <T> T get(Key<T,Integer> key)

        Returns the value to which the property is mapped in this container.

        Parameters:
        key - the specified property key. Prj for getting the property key.
        Returns:
        the value to which the property is mapped in this container.
      • set

        public <T> void set(Key<T,Integer> key,
                            T val)

        Maps the specified property to the specified value in this container.

        Type Parameters:
        T - the type of the mapped value.
        Parameters:
        key - the specified property key. Prj for getting the property key.
        val - the value.
      • calcResourceStartFinish

        public void calcResourceStartFinish()

        Recalculates Start and Finish of resources.

      • calcResourceFields

        public void calcResourceFields()

        Recalculates Id, Start and Finish of resources.

      • removeInvalidResourceAssignments

        public void removeInvalidResourceAssignments()

        Eliminates invalid resource assignments from the project resource assignments list. MS Project creates an empty resource assignment for each task. Call the method to remove them.

      • getBaselineSaveTime

        public Date getBaselineSaveTime(int baselineNumber)

        Returns the baseline save time. Returns DateTime.MinValue if the baseline was not saved.

        Parameters:
        baselineNumber - The baseline's number Aspose.Tasks.BaselineType.
        Returns:
        The baseline's last save date and time.
      • recalculate

        public void recalculate()

        Reschedules all project tasks ids, outline levels, start/finish dates, sets early/late dates, calculates slacks, work and cost fields.

      • save

        public void save(String filename,
                         MPPSaveOptions options)

        Saves the document to mpp file format using the specified save options.

        Parameters:
        filename - The file name.
        options - MPPSaveOptions save options.
      • save

        public void save(String filename,
                         SaveOptions options)

        Saves the document to a file using the specified save options.

        Parameters:
        filename - The file name.
        options - SaveOptions save options.
      • save

        public void save(String filename,
                         int format)

        Saves the project data to the file.

        Parameters:
        filename - The file name.
        format - SaveFileFormat save file format.
      • save

        public void save(OutputStream stream,
                         SaveOptions options)
                  throws IOException

        Saves the project to a stream using the specified save options.

        Parameters:
        stream - The stream.
        options - SaveOptions save options.
        Throws:
        IOException
      • save

        public void save(OutputStream stream,
                         int format)
                  throws IOException

        Saves the project data to the output stream.

        Parameters:
        stream - The output stream to save project data to.
        format - the specified save file format.SaveFileFormat
        Throws:
        IOException
      • saveReport

        public void saveReport(OutputStream stream)
                        throws IOException

        Saves the project overview report to the stream.

        Parameters:
        stream - The stream to save project report to.
        Throws:
        IOException
      • saveReport

        public void saveReport(String fileName)

        Saves the project overview report to pdf file.

        Parameters:
        fileName - The file name.
      • saveReport

        public void saveReport(OutputStream stream,
                               int reportType)
                        throws IOException

        Saves the project report of the specified type to the specified stream.

        Parameters:
        stream - the specified stream to save project report to.
        reportType - the specified report type.ReportType
        Throws:
        IOException
      • saveReport

        public void saveReport(String fileName,
                               int reportType)

        Saves the project report of the specified type in pdf format to the specified file path.

        Parameters:
        fileName - the specified file name.
        reportType - the specified report type.ReportType
      • saveAsTemplate

        public void saveAsTemplate(String fileName,
                                   SaveTemplateOptions options)

        Saves the project as a template.

        Parameters:
        fileName - The file name.
        options - the specified save options SaveTemplateOptions.
      • saveAsTemplate

        public void saveAsTemplate(String fileName)

        Saves the project as a template to the specified file path.

        Parameters:
        fileName - the specified file name.
      • saveAsTemplate

        public void saveAsTemplate(OutputStream stream)

        Saves the project as a template to a specified stream.

        Parameters:
        stream - the specified stream to save the project to.
      • getPageCount

        public int getPageCount()

        Returns page count for the project to be rendered using default Timescale(Days).

        Returns:
        Page count to be rendered.
      • getPageCount_Timescale

        public int getPageCount_Timescale(int scale)

        Returns page count for the project to be rendered using given Timescale.

        Parameters:
        scale - Timescale to get page count for.
        Returns:
        Page count to be rendered.
      • getPageCount_PresentationFormat

        public int getPageCount_PresentationFormat(int format)

        Returns page count for the project to be rendered using default Timescale(Days) and given PresentationFormat

        Parameters:
        format - PresentationFormat to get page count for.
        Returns:
        Page count to be rendered.
      • getPageCount

        public int getPageCount(int format,
                                int scale)

        Returns page count for the project to be rendered using given Timescale and PresentationFormat.

        Parameters:
        format - PresentationFormat to get page count for.
        scale - Timescale to get page count for.
        Returns:
        Page count to be rendered.
      • copyTo

        public void copyTo(Project another)

        Copies project's main data and properties to another project.

        Parameters:
        another - Another project to copy data to.
      • setBaseline

        public void setBaseline(int baselineType)

        Saves baseline fields to the specified baseline for the entire project.

        Parameters:
        baselineType - BaselineType to save baseline data to.
      • setBaseline

        public void setBaseline(int baselineType,
                                Iterable<Task> tasks)

        Saves baseline fields to the specified baseline for the selected tasks.

        Parameters:
        baselineType - BaselineType to save baseline data to.
        tasks - List of tasks to save baseline data for.
      • updateProjectWorkAsComplete

        public void updateProjectWorkAsComplete(Date completeThrough,
                                                boolean setZeroOrHundredPercentCompleteOnly)

        Updates all work as complete through a specified date for the entire project.

        Parameters:
        completeThrough - DateTime 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.
      • updateProjectWorkAsComplete

        public void updateProjectWorkAsComplete(Date completeThrough,
                                                boolean setZeroOrHundredPercentCompleteOnly,
                                                List<Task> tasks)

        Updates all work as complete through a specified date for the specified list of tasks.

        Parameters:
        completeThrough - DateTime 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.
      • rescheduleUncompletedWorkToStartAfter

        public void rescheduleUncompletedWorkToStartAfter(Date after)

        Reschedules uncompleted project work to start after a specified date.

        Parameters:
        after - DateTime to reschedule uncompleted work after.

        Ensure that Project.CanSplitsInProgressTasks flag is set to true before using this method.

      • rescheduleUncompletedWorkToStartAfter

        public void rescheduleUncompletedWorkToStartAfter(Date after,
                                                          List<Task> tasks)

        Reschedules uncompleted work for a specified list of tasks to start after a specified date.

        Parameters:
        after - DateTime to reschedule uncompleted work after.
        tasks - List<Task> of tasks to reschedule uncompleted work for.

        Ensure that Project.CanSplitsInProgressTasks flag is set to true before using this method.

      • getDuration

        public Duration getDuration(double val)

        Gets Duration object with the specified double value and default duration format.

        Parameters:
        val - specified value.
        Returns:
        Duration object.
      • getDuration

        public Duration getDuration(double val,
                                    int timeUnit)

        Gets Duration object with the specified TimeSpan value and specified TimeUnitType value.

        Parameters:
        val - specified double value.
        timeUnit - specified TimeUnitType value.
        Returns:
        Duration object.
      • getWork

        public Duration getWork(double val)

        Gets Duration object with the specified double value and default work format.

        Parameters:
        val - specified double value.
        Returns:
        Duration object.