Transformer TRANSFORM_TO_INFOROOM = new Transformer() { public Object transform(Object input) { return Cloner.copyRoom2InfoRoom((IRoom) input); } };  List availableRooms = null;  try { ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport(); IPersistentRoomOccupation persistentRoomOccupation = sp.getIPersistentRoomOccupation(); List roomOccupations = persistentRoomOccupation.readAll();  if (roomOccupationToRemove != null) { roomOccupations.remove(roomOccupationToRemove); } List occupiedInfoRooms = new ArrayList();  for (int iterRO = 0; iterRO < roomOccupations.size(); iterRO++) { IRoomOccupation roomOccupation = (IRoomOccupation) roomOccupations.get(iterRO); boolean occupiedRO = roomOccupation.roomOccupationForDateAndTime(period, startTime, endTime, dayOfWeek, frequency, weekOfStart);  if (occupiedRO) { InfoRoom infoRoom = Cloner.copyRoom2InfoRoom(roomOccupation.getRoom()); occupiedInfoRooms.add(infoRoom); }  }  ISalaPersistente persistentRoom = sp.getISalaPersistente(); List rooms; if (normalCapacity != null) { rooms = persistentRoom.readByNormalCapacity(normalCapacity); } else if (withLabs.booleanValue()) { rooms = persistentRoom.readAll(); } else { rooms = persistentRoom.readForRoomReservation(); }  List allInfoRooms = (List) CollectionUtils.collect(rooms, TRANSFORM_TO_INFOROOM); availableRooms = (List) CollectionUtils.subtract(allInfoRooms, occupiedInfoRooms);  } catch (ExcepcaoPersistencia e) { throw new FenixServiceException(e);
final ISuportePersistente persistentSupport = PersistenceSupportFactory .getDefaultPersistenceSupport(); final ISalaPersistente persistentRoom = persistentSupport.getISalaPersistente(); final List<IRoom> rooms; if (normalCapacity != null) { rooms = persistentRoom.readByNormalCapacity(normalCapacity); } else if (withLabs.booleanValue()) { rooms = persistentRoom.readAll(); } else { rooms = persistentRoom.readForRoomReservation();
    public List run(IPeriod period, Calendar startTime, Calendar endTime, DiaSemana dayOfWeek,            IRoomOccupation roomOccupationToRemove, Integer normalCapacity, Integer frequency,            Integer weekOfStart, Boolean withLabs) throws FenixServiceException {        Transformer TRANSFORM_TO_INFOROOM = new Transformer() {            public Object transform(Object input) {                return Cloner.copyRoom2InfoRoom((IRoom) input);            }        };        List availableRooms = null;        try {            ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            IPersistentRoomOccupation persistentRoomOccupation = sp.getIPersistentRoomOccupation();            List roomOccupations = persistentRoomOccupation.readAll();            if (roomOccupationToRemove != null) {                roomOccupations.remove(roomOccupationToRemove);            }            List occupiedInfoRooms = new ArrayList();            for (int iterRO = 0; iterRO < roomOccupations.size(); iterRO++) {                IRoomOccupation roomOccupation = (IRoomOccupation) roomOccupations.get(iterRO);                boolean occupiedRO = roomOccupation.roomOccupationForDateAndTime(period, startTime,                        endTime, dayOfWeek, frequency, weekOfStart);                if (occupiedRO) {                    InfoRoom infoRoom = Cloner.copyRoom2InfoRoom(roomOccupation.getRoom());                    occupiedInfoRooms.add(infoRoom);                }            }            ISalaPersistente persistentRoom = sp.getISalaPersistente();            List rooms;            if (normalCapacity != null) {                rooms = persistentRoom.readByNormalCapacity(normalCapacity);            } else if (withLabs.booleanValue()) {                rooms = persistentRoom.readAll();            } else {                rooms = persistentRoom.readForRoomReservation();            }            List allInfoRooms = (List) CollectionUtils.collect(rooms, TRANSFORM_TO_INFOROOM);            availableRooms = (List) CollectionUtils.subtract(allInfoRooms, occupiedInfoRooms);        } catch (ExcepcaoPersistencia e) {            throw new FenixServiceException(e);        }        return availableRooms;    }