List sectionsReordered = persistentSection.readBySiteAndSection(site, superiorSection);
List sectionsReordered = null; if(superiorSection != null){ sectionsReordered = persistentSection.readBySiteAndSection(site.getExecutionCourse().getSigla(), site.getExecutionCourse().getExecutionPeriod().getName(), site.getExecutionCourse().getExecutionPeriod().getExecutionYear().getYear(), superiorSection.getIdInternal()); } else{ sectionsReordered = persistentSection.readBySiteAndSection(site.getExecutionCourse().getSigla(), site.getExecutionCourse().getExecutionPeriod().getName(), site.getExecutionCourse().getExecutionPeriod().getExecutionYear().getYear(), null); }
    public Boolean run(Integer infoExecutionCourseCode, Integer sectionCode)            throws FenixServiceException, ExcepcaoPersistencia {                    ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentSite persistentSite = sp.getIPersistentSite();            IPersistentSection persistentSection = sp.getIPersistentSection();                        ISite site = persistentSite.readByExecutionCourse(infoExecutionCourseCode);            ISection sectionToDelete = (ISection) persistentSection.readByOID(Section.class, sectionCode);            if (sectionToDelete == null) {                throw new FenixServiceException("non existing section");            }            IFileSuport fileSuport = FileSuport.getInstance();            long size = 1;            size = fileSuport.getDirectorySize(sectionToDelete.getSlideName());            if (size > 0) {                throw new notAuthorizedServiceDeleteException();            }            ISection superiorSection = sectionToDelete.getSuperiorSection();            Integer sectionToDeleteOrder = sectionToDelete.getSectionOrder();            persistentSection.delete(sectionToDelete);            sp.confirmarTransaccao();            sp.iniciarTransaccao();            List sectionsReordered = persistentSection.readBySiteAndSection(site, superiorSection);            Iterator iterSections = sectionsReordered.iterator();            while (iterSections.hasNext()) {                ISection section = (ISection) iterSections.next();                Integer sectionOrder = section.getSectionOrder();                if (sectionOrder.intValue() > sectionToDeleteOrder.intValue()) {                    persistentSection.simpleLockWrite(section);                    section.setSectionOrder(new Integer(sectionOrder.intValue() - 1));                }            }            return new Boolean(true);    }