Java Code Examples for net.sf.mpxj.Task#setPriority()
The following examples show how to use
net.sf.mpxj.Task#setPriority() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MerlinReader.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Read data for an individual task. * * @param row task data from database * @param task Task instance */ private void populateTask(Row row, Task task) { task.setUniqueID(row.getInteger("Z_PK")); task.setName(row.getString("ZTITLE")); task.setPriority(Priority.getInstance(row.getInt("ZPRIORITY"))); task.setMilestone(row.getBoolean("ZISMILESTONE")); task.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_")); task.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_")); task.setNotes(row.getString("ZOBJECTDESCRIPTION")); task.setDuration(row.getDuration("ZGIVENDURATION_")); task.setOvertimeWork(row.getWork("ZGIVENWORKOVERTIME_")); task.setWork(row.getWork("ZGIVENWORK_")); task.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_")); task.setActualOvertimeWork(row.getWork("ZGIVENACTUALWORKOVERTIME_")); task.setActualWork(row.getWork("ZGIVENACTUALWORK_")); task.setRemainingWork(row.getWork("ZGIVENACTUALWORK_")); task.setGUID(row.getUUID("ZUNIQUEID")); Integer calendarID = row.getInteger("ZGIVENCALENDAR"); if (calendarID != null) { ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID); if (calendar != null) { task.setCalendar(calendar); } } populateConstraints(row, task); // Percent complete is calculated bottom up from assignments and actual work vs. planned work m_eventManager.fireTaskReadEvent(task); }
Example 2
Source File: ConceptDrawProjectReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Read a project from a ConceptDraw PROJECT file. * * @param project ConceptDraw PROJECT project */ private void readProject(Project project) { Task mpxjTask = m_projectFile.addTask(); //project.getAuthor() mpxjTask.setBaselineCost(project.getBaselineCost()); mpxjTask.setBaselineFinish(project.getBaselineFinishDate()); mpxjTask.setBaselineStart(project.getBaselineStartDate()); //project.getBudget(); //project.getCompany() mpxjTask.setFinish(project.getFinishDate()); //project.getGoal() //project.getHyperlinks() //project.getMarkerID() mpxjTask.setName(project.getName()); mpxjTask.setNotes(project.getNote()); mpxjTask.setPriority(project.getPriority()); // project.getSite() mpxjTask.setStart(project.getStartDate()); // project.getStyleProject() // project.getTask() // project.getTimeScale() // project.getViewProperties() String projectIdentifier = project.getID().toString(); mpxjTask.setGUID(UUID.nameUUIDFromBytes(projectIdentifier.getBytes())); // // Sort the tasks into the correct order // List<Document.Projects.Project.Task> tasks = new ArrayList<>(project.getTask()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(tasks, new Comparator<Document.Projects.Project.Task>() { @Override public int compare(Document.Projects.Project.Task o1, Document.Projects.Project.Task o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); Map<String, Task> map = new HashMap<>(); map.put("", mpxjTask); for (Document.Projects.Project.Task task : tasks) { readTask(projectIdentifier, map, task); } }
Example 3
Source File: ConceptDrawProjectReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Read a task from a ConceptDraw PROJECT file. * * @param projectIdentifier parent project identifier * @param map outline number to task map * @param task ConceptDraw PROJECT task */ private void readTask(String projectIdentifier, Map<String, Task> map, Document.Projects.Project.Task task) { Task parentTask = map.get(getParentOutlineNumber(task.getOutlineNumber())); Task mpxjTask = parentTask.addTask(); TimeUnit units = task.getBaseDurationTimeUnit(); mpxjTask.setCost(task.getActualCost()); mpxjTask.setDuration(getDuration(units, task.getActualDuration())); mpxjTask.setFinish(task.getActualFinishDate()); mpxjTask.setStart(task.getActualStartDate()); mpxjTask.setBaselineDuration(getDuration(units, task.getBaseDuration())); mpxjTask.setBaselineFinish(task.getBaseFinishDate()); mpxjTask.setBaselineCost(task.getBaselineCost()); // task.getBaselineFinishDate() // task.getBaselineFinishTemplateOffset() // task.getBaselineStartDate() // task.getBaselineStartTemplateOffset() mpxjTask.setBaselineStart(task.getBaseStartDate()); // task.getCallouts() mpxjTask.setPercentageComplete(task.getComplete()); mpxjTask.setDeadline(task.getDeadlineDate()); // task.getDeadlineTemplateOffset() // task.getHyperlinks() // task.getMarkerID() mpxjTask.setName(task.getName()); mpxjTask.setNotes(task.getNote()); mpxjTask.setPriority(task.getPriority()); // task.getRecalcBase1() // task.getRecalcBase2() mpxjTask.setType(task.getSchedulingType()); // task.getStyleProject() // task.getTemplateOffset() // task.getValidatedByProject() if (task.isIsMilestone()) { mpxjTask.setMilestone(true); mpxjTask.setDuration(Duration.getInstance(0, TimeUnit.HOURS)); mpxjTask.setBaselineDuration(Duration.getInstance(0, TimeUnit.HOURS)); } String taskIdentifier = projectIdentifier + "." + task.getID(); m_taskIdMap.put(task.getID(), mpxjTask); mpxjTask.setGUID(UUID.nameUUIDFromBytes(taskIdentifier.getBytes())); map.put(task.getOutlineNumber(), mpxjTask); for (Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment : task.getResourceAssignments().getResourceAssignment()) { readResourceAssignment(mpxjTask, assignment); } }
Example 4
Source File: GanttProjectReader.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Recursively read a task, and any sub tasks. * * @param mpxjParent Parent for the MPXJ tasks * @param gpTask GanttProject task */ private void readTask(ChildTaskContainer mpxjParent, net.sf.mpxj.ganttproject.schema.Task gpTask) { Task mpxjTask = mpxjParent.addTask(); mpxjTask.setUniqueID(Integer.valueOf(NumberHelper.getInt(gpTask.getId()) + 1)); mpxjTask.setName(gpTask.getName()); mpxjTask.setPercentageComplete(gpTask.getComplete()); mpxjTask.setPriority(getPriority(gpTask.getPriority())); mpxjTask.setHyperlink(gpTask.getWebLink()); Duration duration = Duration.getInstance(NumberHelper.getDouble(gpTask.getDuration()), TimeUnit.DAYS); mpxjTask.setDuration(duration); if (duration.getDuration() == 0) { mpxjTask.setMilestone(true); } else { mpxjTask.setStart(gpTask.getStart()); mpxjTask.setFinish(m_mpxjCalendar.getDate(gpTask.getStart(), mpxjTask.getDuration(), false)); } mpxjTask.setConstraintDate(gpTask.getThirdDate()); if (mpxjTask.getConstraintDate() != null) { // TODO: you don't appear to be able to change this setting in GanttProject // task.getThirdDateConstraint() mpxjTask.setConstraintType(ConstraintType.START_NO_EARLIER_THAN); } readTaskCustomFields(gpTask, mpxjTask); m_eventManager.fireTaskReadEvent(mpxjTask); // TODO: read custom values // // Process child tasks // for (net.sf.mpxj.ganttproject.schema.Task childTask : gpTask.getTask()) { readTask(mpxjTask, childTask); } }