code: private void populateConstraints(Row row, Task task)
     {
        Date endDateMax = row.getTimestamp("ZGIVENENDDATEMAX_");
        Date endDateMin = row.getTimestamp("ZGIVENENDDATEMIN_");
        Date startDateMax = row.getTimestamp("ZGIVENSTARTDATEMAX_");
        Date startDateMin = row.getTimestamp("ZGIVENSTARTDATEMIN_");
  
        ConstraintType constraintType = null;
        Date constraintDate = null;
  
        if (endDateMax != null)
        {
           constraintType = ConstraintType.FINISH_NO_LATER_THAN;
           constraintDate = endDateMax;
        }
  
        if (endDateMin != null)
        {
           constraintType = ConstraintType.FINISH_NO_EARLIER_THAN;
           constraintDate = endDateMin;
        }
  
        if (endDateMin != null && endDateMin == endDateMax)
        {
           constraintType = ConstraintType.MUST_FINISH_ON;
           constraintDate = endDateMin;
        }
  
        if (startDateMax != null)
        {
           constraintType = ConstraintType.START_NO_LATER_THAN;
           constraintDate = startDateMax;
        }
  
        if (startDateMin != null)
        {
           constraintType = ConstraintType.START_NO_EARLIER_THAN;
           constraintDate = startDateMin;
        }
  
        if (startDateMin != null && startDateMin == endDateMax)
        {
           constraintType = ConstraintType.MUST_START_ON;
           constraintDate = endDateMin;
        }
  
        task.setConstraintType(constraintType);
        task.setConstraintDate(constraintDate);
     }
docs: Populate the constraint type and constraint date.
  Note that Merlin allows both start and end constraints simultaneously.
  As we can't have both, we'll prefer the start constraint.
  
  @param row task data from database
  @param task Task instance