/** * DOCUMENT ME! */ public void startBeds() { PersistableManager pm = PersistableManager.getInstance(); try { Class bedClass = Class.forName("net.sourceforge.floggy.persistence.model.Bed"); beds = pm.find(bedClass, null, new BedComparator()); Bed bed = new Bed(); for (int i = 0; i < beds.size(); i++) { beds.get(i, bed); this.cgBeds.append(String.valueOf(bed.getNumber()), null); } } catch (Exception e) { HospitalMIDlet.showException(e); } }
/** * DOCUMENT ME! */ public void startDoctors() { PersistableManager pm = PersistableManager.getInstance(); try { Class doctorClass = Class.forName("net.sourceforge.floggy.persistence.model.Doctor"); doctors = pm.find(doctorClass, null, new Comparator() { public int compare(Persistable arg0, Persistable arg1) { Doctor p1 = (Doctor) arg0; Doctor p2 = (Doctor) arg1; return p1.getName().compareTo(p2.getName()); } }); Doctor doctor = new Doctor(); for (int i = 0; i < doctors.size(); i++) { doctors.get(i, doctor); this.cgDoctors.append(doctor.getName(), null); } } catch (Exception e) { HospitalMIDlet.showException(e); } }
/** * DOCUMENT ME! */ public void startPatients() { PersistableManager pm = PersistableManager.getInstance(); try { Class patientClass = Class.forName("net.sourceforge.floggy.persistence.model.Patient"); patients = pm.find(patientClass, null, new Comparator() { public int compare(Persistable arg0, Persistable arg1) { Patient p1 = (Patient) arg0; Patient p2 = (Patient) arg1; return p1.getName().compareTo(p2.getName()); } }); Patient patient = new Patient(); for (int i = 0; i < patients.size(); i++) { patients.get(i, patient); this.cgPatients.append(patient.getName(), null); } } catch (Exception e) { HospitalMIDlet.showException(e); } }
/** * DOCUMENT ME! */ public void startFormations() { PersistableManager pm = PersistableManager.getInstance(); try { Class formationClass = Class.forName("net.sourceforge.floggy.persistence.model.Formation"); formations = pm.find(formationClass, null, new Comparator() { public int compare(Persistable arg0, Persistable arg1) { Formation f1 = (Formation) arg0; Formation f2 = (Formation) arg1; return f1.getFormation().compareTo(f2.getFormation()); } }); for (int i = 0; i < formations.size(); i++) { Formation formation = (Formation) formations.get(i); int index = this.cgFormation.append(formation.getFormation(), null); if ((doctor.getFormations() != null) && (this.doctor.getFormations().contains(formation))) { this.cgFormation.setSelectedIndex(index, true); } } } catch (Exception e) { HospitalMIDlet.showException(e); } }