/** * Determines whether a subject may receive an additional study event. This is true if: * * <ul> * <li>The study event definition is repeating; or * <li>The subject does not yet have a study event for the given study event definition * </ul> * * @param studyEventDefinition The definition of the study event which is to be added for the * subject. * @param studySubject The subject for which the study event is to be added. * @return <code>true</code> if the subject may receive an additional study event, <code>false * </code> otherwise. */ public static boolean subjectMayReceiveStudyEvent( DataSource ds, StudyEventDefinitionBean studyEventDefinition, StudySubjectBean studySubject) { if (studyEventDefinition.isRepeating()) { // System.out.println("this def is repeating" + studyEventDefinition.getName()); return true; } StudyEventDAO sedao = new StudyEventDAO(ds); ArrayList allEvents = sedao.findAllByDefinitionAndSubject(studyEventDefinition, studySubject); if (allEvents.size() > 0) { // System.out.println("this non-repeating def has event already" + // studyEventDefinition.getName()); return false; } return true; }