private void setConstraints ( Task task , MapRow row ) { ConstraintType constraintType = null ; Date constraintDate = null ; Date lateDate = row . getDate ( "CONSTRAINT_LATE_DATE" ) ; Date earlyDate = row . getDate ( "CONSTRAINT_EARLY_DATE" ) ; switch ( row . getInteger ( "CONSTRAINT_TYPE" ) . intValue ( ) ) { case 2 : // Cannot Reschedule { constraintType = ConstraintType . MUST_START_ON ; constraintDate = task . getStart ( ) ; break ; } case 12 : //Finish Between { constraintType = ConstraintType . MUST_FINISH_ON ; constraintDate = lateDate ; break ; } case 10 : // Finish On or After { constraintType = ConstraintType . FINISH_NO_EARLIER_THAN ; constraintDate = earlyDate ; break ; } case 11 : // Finish On or Before { constraintType = ConstraintType . FINISH_NO_LATER_THAN ; constraintDate = lateDate ; break ; } case 13 : // Mandatory Start case 5 : // Start On case 9 : // Finish On { constraintType = ConstraintType . MUST_START_ON ; constraintDate = earlyDate ; break ; } case 14 : // Mandatory Finish { constraintType = ConstraintType . MUST_FINISH_ON ; constraintDate = earlyDate ; break ; } case 4 : // Start As Late As Possible { constraintType = ConstraintType . AS_LATE_AS_POSSIBLE ; break ; } case 3 : // Start As Soon As Possible { constraintType = ConstraintType . AS_SOON_AS_POSSIBLE ; break ; } case 8 : // Start Between { constraintType = ConstraintType . AS_SOON_AS_POSSIBLE ; constraintDate = earlyDate ; break ; } case 6 : // Start On or Before { constraintType = ConstraintType . START_NO_LATER_THAN ; constraintDate = earlyDate ; break ; } case 15 : // Work Between { constraintType = ConstraintType . START_NO_EARLIER_THAN ; constraintDate = earlyDate ; break ; } } task . setConstraintType ( constraintType ) ; task . setConstraintDate ( constraintDate ) ; }
Map Synchro constraints to MPXJ constraints .