persistentSuport.confirmarTransaccao(); persistentSuport.iniciarTransaccao(); List itemsList = null; itemsList = persistentItem.readAllItemsBySection(deletedItem.getSection().getIdInternal(), deletedItem.getSection().getSite().getExecutionCourse().getSigla(), deletedItem.getSection().getSite().getExecutionCourse().getExecutionPeriod().getExecutionYear().getYear(), deletedItem.getSection().getSite().getExecutionCourse().getExecutionPeriod().getName()); Iterator iterItems = itemsList.iterator(); while (iterItems.hasNext()) { IItem item = (IItem) iterItems.next(); Integer itemOrder = item.getItemOrder(); if (itemOrder.intValue() > orderOfDeletedItem.intValue()) { persistentItem.simpleLockWrite(item); item.setItemOrder(new Integer(itemOrder.intValue() - 1));
for (final IItem associatedItem : associatedItems) { final int associatedItemOrder = 0; if (associatedItemOrder > orderOfDeletedItem) { persistentItem.simpleLockWrite(associatedItem); associatedItem.setItemOrder(new Integer(associatedItemOrder - 1));
    public Boolean run(Integer infoExecutionCourseCode, Integer itemCode) throws FenixServiceException {        try {            ISuportePersistente persistentSuport = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentItem persistentItem = persistentSuport.getIPersistentItem();            IItem deletedItem = (IItem) persistentItem.readByOID(Item.class, itemCode);            if (deletedItem == null) {                return new Boolean(true);            }            IFileSuport fileSuport = FileSuport.getInstance();            long size = 1;            size = fileSuport.getDirectorySize(deletedItem.getSlideName());            if (size > 0) {                throw new notAuthorizedServiceDeleteException();            }            Integer orderOfDeletedItem = deletedItem.getItemOrder();                        if((deletedItem.getSection() != null) && (deletedItem.getSection().getAssociatedItems() != null))                deletedItem.getSection().getAssociatedItems().remove(deletedItem);                        deletedItem.setSection(null);                       persistentItem.deleteByOID(Item.class, deletedItem.getIdInternal());            persistentSuport.confirmarTransaccao();            persistentSuport.iniciarTransaccao();            List itemsList = null;            itemsList = persistentItem.readAllItemsBySection(deletedItem.getSection().getIdInternal(),                    deletedItem.getSection().getSite().getExecutionCourse().getSigla(),                    deletedItem.getSection().getSite().getExecutionCourse().getExecutionPeriod().getExecutionYear().getYear(),                    deletedItem.getSection().getSite().getExecutionCourse().getExecutionPeriod().getName());            Iterator iterItems = itemsList.iterator();            while (iterItems.hasNext()) {                IItem item = (IItem) iterItems.next();                Integer itemOrder = item.getItemOrder();                if (itemOrder.intValue() > orderOfDeletedItem.intValue()) {                    persistentItem.simpleLockWrite(item);                    item.setItemOrder(new Integer(itemOrder.intValue() - 1));                }            }            return new Boolean(true);        } catch (ExcepcaoPersistencia e) {            throw new FenixServiceException(e);        }    }