for (final Attends attends : attendsList) { if (!(onlyEnrolledCourses.booleanValue() && (attends.getEnrolment() == null))) { if(!onlyAttendsWithTeachers) { infoAttendsList.add(InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers.newInfoFromDomain(attends));  } else if((!attends.getDisciplinaExecucao().getProfessorships().isEmpty()) || (!attends.getDisciplinaExecucao().getNonAffiliatedTeachers().isEmpty())) {  infoAttendsList.add(InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers.newInfoFromDomain(attends)); }
final ExecutionPeriod executionPeriod = rootDomainObject.readExecutionPeriodByOID(executionPeriodId); final Registration someRegistration = rootDomainObject.readRegistrationByOID(studentId); for (final Registration registration : someRegistration.getStudent().getRegistrationsSet()) { for (final Attends attends : registration.getAssociatedAttendsSet()) { final ExecutionCourse executionCourse = attends.getDisciplinaExecucao(); if (executionCourse.getExecutionPeriod() == executionPeriod && (!(onlyEnrolledCourses.booleanValue() && (attends.getEnrolment() == null)))) { if(!onlyAttendsWithTeachers) { infoAttendsList.add(InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers.newInfoFromDomain(attends)); } else if((!attends.getDisciplinaExecucao().getProfessorships().isEmpty()) || (!attends.getDisciplinaExecucao().getNonAffiliatedTeachers().isEmpty())) { infoAttendsList.add(InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers.newInfoFromDomain(attends)); } }
    public List<InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers> run(Integer studentId, Integer executionPeriodId,            Boolean onlyEnrolledCourses, Boolean onlyAttendsWithTeachers) throws ExcepcaoPersistencia {        ExecutionPeriod executionPeriod = rootDomainObject.readExecutionPeriodByOID(executionPeriodId);        Registration registration = rootDomainObject.readRegistrationByOID(studentId);                List<Attends> attendsList = new ArrayList();        if(registration != null){            attendsList = registration.readAttendsByExecutionPeriod(executionPeriod);        }                final List<InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers> infoAttendsList =			new ArrayList<InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers>(attendsList.size());        for (final Attends attends : attendsList) {            if (!(onlyEnrolledCourses.booleanValue() && (attends.getEnrolment() == null))) {				if(!onlyAttendsWithTeachers) {					infoAttendsList.add(InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers.newInfoFromDomain(attends));								} else if((!attends.getDisciplinaExecucao().getProfessorships().isEmpty()) || 						(!attends.getDisciplinaExecucao().getNonAffiliatedTeachers().isEmpty())) {					infoAttendsList.add(InfoAttendsWithProfessorshipTeachersAndNonAffiliatedTeachers.newInfoFromDomain(attends));				}				            }        }        return infoAttendsList;    }