Exemplo n.º 1
0
  private void populateTrainingSessions() {
    if (null == sessions) {
      sessions = new HashSet<TrainingSession>();
    }

    Set<Event> events = getSubscribedEvents();
    for (Event ev : events) {
      TrainingSession ts1 =
          new TrainingSession(
              ev.getId(),
              this,
              new java.util.Date(1227817411),
              "a workout desc",
              true,
              "something for now",
              "something");
      TrainingSession ts2 =
          new TrainingSession(
              ev.getId(),
              this,
              new java.util.Date(1229459011),
              "a workout desc",
              true,
              "something for now",
              "something");

      UserRegistry.getCurrentInstance().userEJB.addTrainingSession(ts1);
      UserRegistry.getCurrentInstance().userEJB.addTrainingSession(ts2);

      sessions.add(ts1);
      sessions.add(ts2);
    }

    UserRegistry.getCurrentInstance().updateUser(this);
  }
Exemplo n.º 2
0
 public List<Event> getEvents(java.util.Calendar c, User u) {
   List<Event> l = new ArrayList<Event>();
   for (Event e : this.events) {
     if (e.happensAtDate(c) && (u.equals(this.owner) | e.visible)) {
       l.add(e);
     }
   }
   return l;
 }
Exemplo n.º 3
0
  public void setEvent(Event event) {

    this.event = event;

    if (event != null) {

      event.setCallListCompany(this);
    }
  }
Exemplo n.º 4
0
  @Override
  public int hashCode() {
    int result = lastDateUpdate != null ? lastDateUpdate.hashCode() : 0;
    result = 31 * result + (callList != null ? callList.hashCode() : 0);
    result = 31 * result + (status != null ? status.hashCode() : 0);
    result = 31 * result + (user != null ? user.hashCode() : 0);
    result = 31 * result + (company != null ? company.hashCode() : 0);
    result = 31 * result + (event != null ? event.hashCode() : 0);

    return result;
  }
Exemplo n.º 5
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof CallListCompany)) return false;

    CallListCompany that = (CallListCompany) o;

    if (callList != null ? !callList.equals(that.callList) : that.callList != null) return false;
    if (company != null ? !company.equals(that.company) : that.company != null) return false;
    if (event != null ? !event.equals(that.event) : that.event != null) return false;
    if (lastDateUpdate != null
        ? !lastDateUpdate.equals(that.lastDateUpdate)
        : that.lastDateUpdate != null) return false;
    if (status != null ? !status.equals(that.status) : that.status != null) return false;
    if (user != null ? !user.equals(that.user) : that.user != null) return false;

    return true;
  }
Exemplo n.º 6
0
 /**
  * Get all authored events
  *
  * @return a list of events that User has authored
  */
 public List<Event> authoredEvents() {
   return Event.find("SELECT r FROM Event r where r.author = ?", this).fetch();
 }