IDisciplinaExecucao executionCourse = null; ISite site=null;
IDisciplinaExecucao executionCourse = null; teacher = persistentTeacher.readTeacherByNumber(teacherNumber);  executionCourse = Cloner.copyInfoExecutionCourse2ExecutionCourse( infoExecutionCourse); System.out.println("Teacher: " + teacher.getTeacherNumber()); System.out.println("Teacher: " + teacher); if (teacher == null) { System.out.println("O Teacher est a null: ");  throw new InvalidArgumentsServiceException(); } else {  List professorShipsExecutionCoursesList = teacher.getProfessorShipsExecutionCourses();  if (professorShipsExecutionCoursesList .contains(executionCourse)) throw new ExistingServiceException();  professorShipsExecutionCoursesList.add(executionCourse);  teacher.setProfessorShipsExecutionCourses( professorShipsExecutionCoursesList);  persistentTeacher.lockWrite(teacher);  return true; }  } catch (ExcepcaoPersistencia ex) {
    public void run(InfoExecutionCourse infoExecutionCourse,Integer teacherNumber) throws FenixServiceException{		try{			ISuportePersistente sp = SuportePersistenteOJB.getInstance();			IPersistentTeacher persistentTeacher = sp.getIPersistentTeacher();			IPersistentSite persistentSite = sp.getIPersistentSite();			ITeacher teacher = null;            IDisciplinaExecucao executionCourse = null;			ISite site=null;						teacher = persistentTeacher.readTeacherByNumber(teacherNumber);								Cloner.copyInfoExecutionCourse2ExecutionCourse(infoExecutionCourse);			site = persistentSite.readByExecutionCourse(executionCourse);             if(teacher == null )                              throw new InvalidArgumentsServiceException();			List professorShipsExecutionCoursesList=teacher.getProfessorShipsExecutionCourses();			if(professorShipsExecutionCoursesList.contains(executionCourse))							throw new ExistingServiceException();			professorShipsExecutionCoursesList.add(executionCourse);			teacher.setProfessorShipsExecutionCourses(professorShipsExecutionCoursesList);									persistentTeacher.lockWrite(teacher);		}		catch(ExcepcaoPersistencia ex){			throw new ExistingServiceException(ex);		}    }