public List run(Calendar day, Calendar beginning) { List availableRooms = new ArrayList(); List availableInfoRooms = new ArrayList();
public List run(Calendar day, Calendar beginning) throws ExcepcaoPersistencia { ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport(); List exams = sp.getIPersistentExam().readBy(day, beginning); List allRooms = sp.getISalaPersistente().readAll();
    public List run(Calendar day, Calendar beginning) {        List availableRooms = new ArrayList();        List availableInfoRooms = new ArrayList();        try {            ISuportePersistente sp = PersistenceSupportFactory.getDefaultPersistenceSupport();            List exams = sp.getIPersistentExam().readBy(day, beginning);            List allRooms = sp.getISalaPersistente().readAll();            List occupiedRooms = new ArrayList();            for (int i = 0; i < exams.size(); i++) {                List examRooms = ((IExam) exams.get(i)).getAssociatedRooms();                if (examRooms != null && examRooms.size() > 0) {                    for (int r = 0; r < examRooms.size(); r++) {                        occupiedRooms.add(examRooms.get(r));                    }                }            }            availableRooms = (ArrayList) CollectionUtils.subtract(allRooms, occupiedRooms);            for (int i = 0; i < availableRooms.size(); i++) {                IRoom room = (IRoom) availableRooms.get(i);                InfoRoom infoRoom = Cloner.copyRoom2InfoRoom(room);                availableInfoRooms.add(infoRoom);            }        } catch (ExcepcaoPersistencia ex) {            ex.printStackTrace();        }        return availableInfoRooms;    }