result.setMessageType(2);
if (!resultB) { throw new InterceptingLessonException(); } else { result.setMessageType(2); }
    public InfoLessonServiceResult run(InfoLesson infoLesson, InfoShift infoShift)            throws FenixServiceException, ExcepcaoPersistencia {        final ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();        final IExecutionPeriod executionPeriod = (IExecutionPeriod) sp.getIPersistentExecutionPeriod()                .readByOID(                        ExecutionPeriod.class,                        infoLesson.getInfoShift().getInfoDisciplinaExecucao().getInfoExecutionPeriod()                                .getIdInternal());        final IShift shift = (IShift) sp.getITurnoPersistente().readByOID(Shift.class,                infoShift.getIdInternal());        InfoLessonServiceResult result = validTimeInterval(infoLesson);        if (result.getMessageType() == 1) {            throw new InvalidTimeIntervalServiceException();        }        boolean resultB = validNoInterceptingLesson(infoLesson.getInfoRoomOccupation());        if (result.isSUCESS() && resultB) {            try {                InfoShiftServiceResult infoShiftServiceResult = valid(shift, infoLesson);                if (infoShiftServiceResult.isSUCESS()) {                    IRoomOccupation roomOccupation = DomainFactory.makeRoomOccupation();                    roomOccupation.setDayOfWeek(infoLesson.getInfoRoomOccupation().getDayOfWeek());                    roomOccupation.setStartTime(infoLesson.getInfoRoomOccupation().getStartTime());                    roomOccupation.setEndTime(infoLesson.getInfoRoomOccupation().getEndTime());                    roomOccupation.setFrequency(infoLesson.getInfoRoomOccupation().getFrequency());                    roomOccupation.setWeekOfQuinzenalStart(infoLesson.getInfoRoomOccupation()                            .getWeekOfQuinzenalStart());                    final IRoom sala = sp.getISalaPersistente().readByName(infoLesson.getInfoSala().getNome());                    roomOccupation.setRoom(sala);                    final IPeriod period = (IPeriod) sp.getIPersistentPeriod().readByOID(Period.class,                            infoLesson.getInfoRoomOccupation().getInfoPeriod().getIdInternal());                    roomOccupation.setPeriod(period);                    ILesson aula2 = DomainFactory.makeLesson(infoLesson.getDiaSemana(), infoLesson                            .getInicio(), infoLesson.getFim(), infoLesson.getTipo(), sala,                            roomOccupation, shift);                    sp.getIPersistentRoomOccupation().simpleLockWrite(roomOccupation);                    aula2.setExecutionPeriod(executionPeriod);                } else {                    throw new InvalidLoadException(infoShiftServiceResult.toString());                }            } catch (ExistingPersistentException ex) {                throw new ExistingServiceException(ex);            }        } else {            result.setMessageType(2);        }        return result;    }