try { ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport(); IPersistentCoordinator persistentCoordinator = sp.getIPersistentCoordinator(); IPersistentPersonRole persistentPersonRole = sp.getIPersistentPersonRole();
for (final Iterator iter = coordinatorsIds.iterator(); iter.hasNext(); ) { ICoordinator coordinator = (ICoordinator) persistentCoordinator.readByOID( Coordinator.class, (Integer) iter.next());
    public Boolean run(Integer executionDegreeId, List coordinatorsIds) throws FenixServiceException {        try {            ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentCoordinator persistentCoordinator = sp.getIPersistentCoordinator();            IPersistentPersonRole persistentPersonRole = sp.getIPersistentPersonRole();            Iterator iter = coordinatorsIds.iterator();            while (iter.hasNext()) {                ICoordinator coordinator = (ICoordinator) persistentCoordinator.readByOID(                        Coordinator.class, (Integer) iter.next(), true);                if (coordinator != null) {                    IPersistentTeacher persistentTeacher = sp.getIPersistentTeacher();                    ITeacher teacher = (ITeacher) persistentTeacher.readByOID(Teacher.class, coordinator                            .getTeacher().getIdInternal());                    if (teacher == null) {                        throw new NonExistingServiceException();                    }                    //verify if the teacher already was coordinator                    //it he was that don't delete role COORDINATOR                    List executionDegreesTeacherList = persistentCoordinator                            .readExecutionDegreesByTeacher(teacher.getIdInternal());                    if (executionDegreesTeacherList == null || executionDegreesTeacherList.size() <= 0) {                        IPerson person = coordinator.getTeacher().getPerson();                        IPersonRole personRole = persistentPersonRole.readByPersonAndRole(person, sp                                .getIPersistentRole().readByRoleType(RoleType.COORDINATOR));                        if (personRole != null) {                            persistentPersonRole.deleteByOID(PersonRole.class, personRole                                    .getIdInternal());                        }                    }                    persistentCoordinator.deleteByOID(Coordinator.class, coordinator.getIdInternal());                }            }            return new Boolean(true);        } catch (ExcepcaoPersistencia e) {            throw new FenixServiceException(e);        }    }