コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see java.lang.Object#hashCode()
  */
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((appt == null) ? 0 : appt.getKey());
   result = prime * result + ((getInstanceTime() == null) ? 0 : getInstanceTime().hashCode());
   return result;
 }
コード例 #2
0
 /** if the reminder instance is a todo, then mark it as done/complete */
 @Override
 public void do_todo(boolean delete) {
   if (appt != null)
     try {
       AppointmentModel.getReference().do_todo(appt.getKey(), delete);
     } catch (Exception e) {
       Errmsg.getErrorHandler().errmsg(e);
     }
 }
コード例 #3
0
  /*
   * (non-Javadoc)
   *
   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    ApptReminderInstance other = (ApptReminderInstance) obj;
    if (appt == null) {
      if (other.appt != null) return false;
    } else if (appt.getKey() != other.appt.getKey()) {
      return false;
    }

    if (getInstanceTime() == null) {
      if (other.getInstanceTime() != null) return false;
    } else if (!getInstanceTime().equals(other.getInstanceTime())) return false;
    return true;
  }
コード例 #4
0
  /**
   * reload the model entity from the db and check if it has changed.
   *
   * @return true if the entity has changed in a way that affects reminders
   */
  @Override
  public boolean reloadAndCheckForChanges() {
    try {
      Appointment origAppt = appt;
      appt = AppointmentModel.getReference().getAppt(appt.getKey());
      if (appt == null) {
        return true;
      }

      if (!appt.getDate().equals(origAppt.getDate())) {
        // date changed - delete. new instance will be added on
        // periodic update
        return true;
      }

      // delete it if the text changed - will be added back in
      // periodic check for
      // popups
      if (!appt.getText().equals(origAppt.getText())) {
        return true;
      }

      if (isTodo()) {
        // skip if inst time changed for untimed todos
        Date nt = appt.getNextTodo();
        if (nt == null) nt = appt.getDate();

        if (!getInstanceTime().equals(nt)) {
          return true;
        }
      }
    } catch (Exception e) {

      // appt cannot be read, must have been deleted
      // this is an expected case when appointments are deleted
      appt = null;
      return true;
    }

    return false;
  }