private void writeTask ( Task mpxjTask , List < net . sf . mpxj . planner . schema . Task > taskList ) throws JAXBException { net . sf . mpxj . planner . schema . Task plannerTask = m_factory . createTask ( ) ; taskList . add ( plannerTask ) ; plannerTask . setEnd ( getDateTimeString ( mpxjTask . getFinish ( ) ) ) ; plannerTask . setId ( getIntegerString ( mpxjTask . getUniqueID ( ) ) ) ; plannerTask . setName ( getString ( mpxjTask . getName ( ) ) ) ; plannerTask . setNote ( mpxjTask . getNotes ( ) ) ; plannerTask . setPercentComplete ( getIntegerString ( mpxjTask . getPercentageWorkComplete ( ) ) ) ; plannerTask . setPriority ( mpxjTask . getPriority ( ) == null ? null : getIntegerString ( mpxjTask . getPriority ( ) . getValue ( ) * 10 ) ) ; plannerTask . setScheduling ( getScheduling ( mpxjTask . getType ( ) ) ) ; plannerTask . setStart ( getDateTimeString ( DateHelper . getDayStartDate ( mpxjTask . getStart ( ) ) ) ) ; if ( mpxjTask . getMilestone ( ) ) { plannerTask . setType ( "milestone" ) ; } else { plannerTask . setType ( "normal" ) ; } plannerTask . setWork ( getDurationString ( mpxjTask . getWork ( ) ) ) ; plannerTask . setWorkStart ( getDateTimeString ( mpxjTask . getStart ( ) ) ) ; ConstraintType mpxjConstraintType = mpxjTask . getConstraintType ( ) ; if ( mpxjConstraintType != ConstraintType . AS_SOON_AS_POSSIBLE ) { Constraint plannerConstraint = m_factory . createConstraint ( ) ; plannerTask . setConstraint ( plannerConstraint ) ; if ( mpxjConstraintType == ConstraintType . START_NO_EARLIER_THAN ) { plannerConstraint . setType ( "start-no-earlier-than" ) ; } else { if ( mpxjConstraintType == ConstraintType . MUST_START_ON ) { plannerConstraint . setType ( "must-start-on" ) ; } } plannerConstraint . setTime ( getDateTimeString ( mpxjTask . getConstraintDate ( ) ) ) ; } // // Write predecessors // writePredecessors ( mpxjTask , plannerTask ) ; m_eventManager . fireTaskWrittenEvent ( mpxjTask ) ; // // Write child tasks // List < net . sf . mpxj . planner . schema . Task > childTaskList = plannerTask . getTask ( ) ; for ( Task task : mpxjTask . getChildTasks ( ) ) { writeTask ( task , childTaskList ) ; } }
This method writes data for a single task to a Planner file .