Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java,v diff -u -r1.38 -r1.39 --- lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java 18 Oct 2007 07:26:05 -0000 1.38 +++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/SequenceActivity.java 14 Nov 2007 05:49:10 -0000 1.39 @@ -244,14 +244,19 @@ } /** - * Validate the sequence activity. All sequence activities must have at least child activity and the default - * activity must be set as this is the first activity in the sequence. One sequence activity exists for each - * branch in a branching activity, so this ensures all branches have a valid child activity. + * Validate the sequence activity. If the sequence is part of an optional activity then there must be children. + * If a sequence is part of branching then it may be empty but if there is any child activities then the + * default activity (the first activity in the sequence) must be set. * @return error message key */ public Vector validateActivity(MessageService messageService) { Vector listOfValidationErrors = new Vector(); - if ( getActivities() == null || getActivities().size() == 0 || getDefaultActivity() == null ) { + if ( getActivities() == null || getActivities().size() == 0 ) { + Activity parent = getParentActivity(); + if ( parent != null && parent.isOptionsActivity()) { + listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.SEQUENCE_ACTIVITY_MUST_HAVE_FIRST_ACTIVITY_ERROR_CODE, messageService.getMessage(ValidationErrorDTO.SEQUENCE_ACTIVITY_MUST_HAVE_FIRST_ACTIVITY), this.getActivityUIID())); + } + } else if ( getDefaultActivity() == null ) { listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.SEQUENCE_ACTIVITY_MUST_HAVE_FIRST_ACTIVITY_ERROR_CODE, messageService.getMessage(ValidationErrorDTO.SEQUENCE_ACTIVITY_MUST_HAVE_FIRST_ACTIVITY), this.getActivityUIID())); } return listOfValidationErrors;