use of teammates.common.util.FieldValidator in project teammates by TEAMMATES.
the class FeedbackResponseAttributes method getInvalidityInfo.
@Override
public List<String> getInvalidityInfo() {
FieldValidator validator = new FieldValidator();
List<String> errors = new ArrayList<>();
addNonEmptyError(validator.getInvalidityInfoForFeedbackSessionName(feedbackSessionName), errors);
addNonEmptyError(validator.getInvalidityInfoForCourseId(courseId), errors);
return errors;
}
use of teammates.common.util.FieldValidator in project teammates by TEAMMATES.
the class FeedbackSessionAttributes method getInvalidityInfo.
@Override
public List<String> getInvalidityInfo() {
FieldValidator validator = new FieldValidator();
List<String> errors = new ArrayList<>();
// Check for null fields.
addNonEmptyError(validator.getValidityInfoForNonNullField(FieldValidator.FEEDBACK_SESSION_NAME_FIELD_NAME, feedbackSessionName), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField(FieldValidator.COURSE_ID_FIELD_NAME, courseId), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("instructions to students", instructions), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("time for the session to become visible", sessionVisibleFromTime), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("session time zone", timeZone), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("creator's email", creatorEmail), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("session creation time", createdTime), errors);
// Early return if any null fields
if (!errors.isEmpty()) {
return errors;
}
addNonEmptyError(validator.getInvalidityInfoForFeedbackSessionName(feedbackSessionName), errors);
addNonEmptyError(validator.getInvalidityInfoForCourseId(courseId), errors);
addNonEmptyError(validator.getInvalidityInfoForEmail(creatorEmail), errors);
addNonEmptyError(validator.getInvalidityInfoForGracePeriod(gracePeriod), errors);
// Skip time frame checks if session type is private.
if (this.isPrivateSession()) {
return errors;
}
addNonEmptyError(validator.getValidityInfoForNonNullField("submission opening time", startTime), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("submission closing time", endTime), errors);
addNonEmptyError(validator.getValidityInfoForNonNullField("time for the responses to become visible", resultsVisibleFromTime), errors);
// Early return if any null fields
if (!errors.isEmpty()) {
return errors;
}
addNonEmptyError(validator.getInvalidityInfoForTimeForSessionStartAndEnd(startTime, endTime), errors);
addNonEmptyError(validator.getInvalidityInfoForTimeForVisibilityStartAndSessionStart(sessionVisibleFromTime, startTime), errors);
Instant actualSessionVisibleFromTime = sessionVisibleFromTime;
if (actualSessionVisibleFromTime.equals(Const.TIME_REPRESENTS_FOLLOW_OPENING)) {
actualSessionVisibleFromTime = startTime;
}
addNonEmptyError(validator.getInvalidityInfoForTimeForVisibilityStartAndResultsPublish(actualSessionVisibleFromTime, resultsVisibleFromTime), errors);
return errors;
}
Aggregations