Shift shift = rootDomainObject.readShiftByOID(shiftOID);
final Set<SchoolClass> availableSchoolClasses = new HashSet<SchoolClass>(); for (final CurricularCourse curricularCourse : executionCourse.getAssociatedCurricularCoursesSet()) { final DegreeCurricularPlan degreeCurricularPlan = curricularCourse.getDegreeCurricularPlan(); for (final ExecutionDegree executionDegree : degreeCurricularPlan.getExecutionDegreesSet()) { if (executionDegree.getExecutionYear() == executionYear) { for (final SchoolClass schoolClass : executionDegree.getSchoolClassesSet()) { if (schoolClass.getExecutionPeriod() == executionPeriod) { if (!shift.getAssociatedClassesSet().contains(schoolClass)) { availableSchoolClasses.add(schoolClass); } } } } } }
    public List run(Integer shiftOID) throws ExcepcaoPersistencia {        List infoClasses = null;        Shift shift = rootDomainObject.readShiftByOID(shiftOID);        List<CurricularCourse> curricularCourses = shift.getDisciplinaExecucao()                .getAssociatedCurricularCourses();        ExecutionCourse executionCourse = shift.getDisciplinaExecucao();        List<SchoolClass> executionPeriodClasses = executionCourse.getExecutionPeriod()                .getSchoolClasses();        List<SchoolClass> shiftClasses = shift.getAssociatedClasses();        infoClasses = new ArrayList();        Iterator iter = executionPeriodClasses.iterator();        while (iter.hasNext()) {            SchoolClass schoolClass = (SchoolClass) iter.next();            if (!shiftClasses.contains(schoolClass) && containsScope(curricularCourses, schoolClass)) {                final InfoClass infoClass = InfoClass.newInfoFromDomain(schoolClass);                final ExecutionDegree executionDegree = schoolClass.getExecutionDegree();                final InfoExecutionDegree infoExecutionDegree = InfoExecutionDegree                        .newInfoFromDomain(executionDegree);                infoClass.setInfoExecutionDegree(infoExecutionDegree);                final DegreeCurricularPlan degreeCurricularPlan = executionDegree                        .getDegreeCurricularPlan();                final InfoDegreeCurricularPlan infoDegreeCurricularPlan = InfoDegreeCurricularPlan                        .newInfoFromDomain(degreeCurricularPlan);                infoExecutionDegree.setInfoDegreeCurricularPlan(infoDegreeCurricularPlan);                final Degree degree = degreeCurricularPlan.getDegree();                final InfoDegree infoDegree = InfoDegree.newInfoFromDomain(degree);                infoDegreeCurricularPlan.setInfoDegree(infoDegree);                infoClasses.add(infoClass);            }        }        return infoClasses;    }