@Override
 public int hashCode() {
   int result = termID != null ? termID.hashCode() : 0;
   result = 31 * result + (nachtMo != null ? nachtMo.hashCode() : 0);
   result = 31 * result + (morgens != null ? morgens.hashCode() : 0);
   result = 31 * result + (mittags != null ? mittags.hashCode() : 0);
   result = 31 * result + (nachmittags != null ? nachmittags.hashCode() : 0);
   result = 31 * result + (abends != null ? abends.hashCode() : 0);
   result = 31 * result + (nachtAb != null ? nachtAb.hashCode() : 0);
   result = 31 * result + (uhrzeitAnzahl != null ? uhrzeitAnzahl.hashCode() : 0);
   result = 31 * result + (uhrzeit != null ? uhrzeit.hashCode() : 0);
   result = 31 * result + (taeglich != null ? taeglich.hashCode() : 0);
   result = 31 * result + (woechentlich != null ? woechentlich.hashCode() : 0);
   result = 31 * result + (monatlich != null ? monatlich.hashCode() : 0);
   result = 31 * result + (tagNum != null ? tagNum.hashCode() : 0);
   result = 31 * result + (mon != null ? mon.hashCode() : 0);
   result = 31 * result + (die != null ? die.hashCode() : 0);
   result = 31 * result + (mit != null ? mit.hashCode() : 0);
   result = 31 * result + (don != null ? don.hashCode() : 0);
   result = 31 * result + (fre != null ? fre.hashCode() : 0);
   result = 31 * result + (sam != null ? sam.hashCode() : 0);
   result = 31 * result + (son != null ? son.hashCode() : 0);
   result = 31 * result + (erforderlich != null ? erforderlich.hashCode() : 0);
   result = 31 * result + (lDatum != null ? lDatum.hashCode() : 0);
   result = 31 * result + (dauer != null ? dauer.hashCode() : 0);
   result = 31 * result + (bemerkung != null ? bemerkung.hashCode() : 0);
   result = 31 * result + (version != null ? version.hashCode() : 0);
   result = 31 * result + (nursingProcess != null ? nursingProcess.hashCode() : 0);
   result = 31 * result + (intervention != null ? intervention.hashCode() : 0);
   return result;
 }
  public InterventionSchedule(NursingProcess planung, Intervention intervention) {
    this.morgens = 1;
    this.taeglich = 1;
    this.lDatum = new LocalDate().toDate();
    this.dauer = intervention.getDauer();
    this.nursingProcess = planung;
    this.intervention = intervention;

    this.nachtMo = 0;
    this.mittags = 0;
    this.nachmittags = 0;
    this.abends = 0;
    this.nachtAb = 0;
    this.uhrzeitAnzahl = 0;
    this.uhrzeit = null;
    this.woechentlich = 0;
    this.monatlich = 0;
    this.tagNum = 0;
    this.mon = 0;
    this.die = 0;
    this.mit = 0;
    this.don = 0;
    this.fre = 0;
    this.sam = 0;
    this.son = 0;
    this.erforderlich = false;
    this.bemerkung = null;
    this.uuid = UUID.randomUUID().toString();
  }
Example #3
0
 private ArrayList<String> retrieveInterventionsItemized() {
   ArrayList<String> items = new ArrayList<String>();
   interventions = interventionEngine.getInterventions();
   for (Intervention i : interventions) {
     Personne req = i.getRequerant();
     items.add(
         "["
             + req.getPrenom()
             + " "
             + req.getNom()
             + "]"
             + i.getCode()
             + " "
             + i.getDescription()
             + i.getPosition());
   }
   return items;
 }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    InterventionSchedule that = (InterventionSchedule) o;
    if (termID != null ? !termID.equals(that.termID) : that.termID != null) return false;
    if (abends != null ? !abends.equals(that.abends) : that.abends != null) return false;
    if (bemerkung != null ? !bemerkung.equals(that.bemerkung) : that.bemerkung != null)
      return false;
    if (dauer != null ? !dauer.equals(that.dauer) : that.dauer != null) return false;
    if (die != null ? !die.equals(that.die) : that.die != null) return false;
    if (don != null ? !don.equals(that.don) : that.don != null) return false;
    if (erforderlich != null ? !erforderlich.equals(that.erforderlich) : that.erforderlich != null)
      return false;
    if (fre != null ? !fre.equals(that.fre) : that.fre != null) return false;
    if (intervention != null ? !intervention.equals(that.intervention) : that.intervention != null)
      return false;
    if (lDatum != null ? !lDatum.equals(that.lDatum) : that.lDatum != null) return false;
    if (mit != null ? !mit.equals(that.mit) : that.mit != null) return false;
    if (mittags != null ? !mittags.equals(that.mittags) : that.mittags != null) return false;
    if (mon != null ? !mon.equals(that.mon) : that.mon != null) return false;
    if (monatlich != null ? !monatlich.equals(that.monatlich) : that.monatlich != null)
      return false;
    if (morgens != null ? !morgens.equals(that.morgens) : that.morgens != null) return false;
    if (nachmittags != null ? !nachmittags.equals(that.nachmittags) : that.nachmittags != null)
      return false;
    if (nachtAb != null ? !nachtAb.equals(that.nachtAb) : that.nachtAb != null) return false;
    if (nachtMo != null ? !nachtMo.equals(that.nachtMo) : that.nachtMo != null) return false;
    if (nursingProcess != null
        ? !nursingProcess.equals(that.nursingProcess)
        : that.nursingProcess != null) return false;
    if (sam != null ? !sam.equals(that.sam) : that.sam != null) return false;
    if (son != null ? !son.equals(that.son) : that.son != null) return false;
    if (taeglich != null ? !taeglich.equals(that.taeglich) : that.taeglich != null) return false;
    if (tagNum != null ? !tagNum.equals(that.tagNum) : that.tagNum != null) return false;
    if (uhrzeit != null ? !uhrzeit.equals(that.uhrzeit) : that.uhrzeit != null) return false;
    if (uhrzeitAnzahl != null
        ? !uhrzeitAnzahl.equals(that.uhrzeitAnzahl)
        : that.uhrzeitAnzahl != null) return false;
    if (version != null ? !version.equals(that.version) : that.version != null) return false;
    if (woechentlich != null ? !woechentlich.equals(that.woechentlich) : that.woechentlich != null)
      return false;
    if (uuid != null ? !uuid.equals(that.uuid) : that.uuid != null) return false;

    return true;
  }
  @Override
  public int compareTo(InterventionSchedule interventionSchedule) {
    return intervention
        .getBezeichnung()
        .compareTo(interventionSchedule.getIntervention().getBezeichnung());
    //        if (uhrzeit != null && interventionSchedule.getUhrzeit() == null){
    //            return -1;
    //        }
    //        if (uhrzeit == null && interventionSchedule.getUhrzeit() != null){
    //            return 1;
    //        }
    //        if (uhrzeit != null){
    //            return uhrzeit.compareTo(interventionSchedule.getUhrzeit());
    //        }
    //        if (isDaily() && !interventionSchedule.isDaily()){
    //            return 1;
    //        }
    //        if (!isDaily() && interventionSchedule.isDaily()){
    //            return -1;
    //        }
    //        if (isDaily()){
    //            return new Short(getTaeglich()).compareTo(interventionSchedule.getTaeglich());
    //        }
    //        if (isWeekly() && !interventionSchedule.isWeekly()){
    //            return 1;
    //        }
    //        if (!isWeekly() && interventionSchedule.isWeekly()){
    //            return -1;
    //        }
    //        if (isWeekly()){
    //            return new
    // Short(getWoechentlich()).compareTo(interventionSchedule.getWoechentlich());
    //        }
    //

  }
Example #6
0
  public void testCollectionCUD() throws HibernateException, SQLException {
    if (isUsingIdentity()) {
      reportSkip("hand sql expecting non-identity id gen", "Custom SQL");
      return;
    }

    Role role = new Role();

    role.setName("Jim Flanders");

    Intervention iv = new Medication();
    iv.setDescription("JF medical intervention");

    role.getInterventions().add(iv);

    List sx = new ArrayList();
    sx.add("somewhere");
    sx.add("somehow");
    sx.add("whatever");
    role.setBunchOfStrings(sx);

    Session s = openSession();

    s.save(role);
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();

    Role r = (Role) s.get(Role.class, new Long(role.getId()));
    assertNotSame(role, r);

    assertEquals(1, r.getInterventions().size());

    assertEquals(3, r.getBunchOfStrings().size());

    r.getBunchOfStrings().set(1, "replacement");
    s.flush();
    s.connection().commit();
    s.close();

    s = openSession();

    r = (Role) s.get(Role.class, new Long(role.getId()));
    assertNotSame(role, r);

    assertEquals(r.getBunchOfStrings().get(1), "replacement");
    assertEquals(3, r.getBunchOfStrings().size());

    r.getBunchOfStrings().set(1, "replacement");

    r.getBunchOfStrings().remove(1);
    s.flush();

    r.getBunchOfStrings().clear();
    s.flush();

    s.connection().commit();
    s.close();
  }