Package org.apache.openmeetings.db.entity.calendar

Examples of org.apache.openmeetings.db.entity.calendar.Appointment


   
    Calendar now = Calendar.getInstance();
    Calendar a1End = Calendar.getInstance();
    a1End.setTime(now.getTime());
    a1End.add(Calendar.HOUR_OF_DAY, 1);
    Appointment a1 = getAppointment(now.getTime(), a1End.getTime());
    a1.setTitle("GetAppointment");
   
    a1 = appointmentDao.update(a1, OM_URL, userId);
   
    Appointment a = appointmentDao.get(a1.getId());
    assertNotNull("Failed to get Appointment By id", a);
    assertEquals("Inapropriate MeetingMembers count", 0, a.getMeetingMembers() == null ? 0 : a.getMeetingMembers().size());
  }
View Full Code Here


  public Appointment get(Long id) {
    TypedQuery<Appointment> query = em.createNamedQuery("getAppointmentById", Appointment.class);
    query.setParameter("id", id);

    Appointment appoint = null;
    try {
      appoint = query.getSingleResult();
    } catch (NoResultException ex) {
    }
    return appoint;
View Full Code Here

    String hql = "select a from Appointment a WHERE a.id = :id ";

    TypedQuery<Appointment> query = em.createQuery(hql, Appointment.class);
    query.setParameter("id", appointmentId);

    Appointment appoint = null;
    try {
      appoint = query.getSingleResult();
    } catch (NoResultException ex) {
    }
View Full Code Here

    roomDao.update(r, userId);
    Set<Long> mmIds = a.getId() == null ? new HashSet<Long>()
        : meetingMemberDao.getMeetingMemberIdsByAppointment(a.getId());
    // update meeting members
    //TODO update email need to be sent on meeting members list update
    Appointment a0 = a.getId() == null ? null : get(a.getId());
    boolean sendMail = a0 == null || !a0.getTitle().equals(a.getTitle()) ||
        !(a0.getDescription() != null ? a0.getDescription().equals(a.getDescription()) : true) ||
        !(a0.getLocation() != null ? a0.getLocation().equals(a.getLocation()) : true) ||
        !a0.getStart().equals(a.getStart()) ||
        !a0.getEnd().equals(a.getEnd());
    List<MeetingMember> mmList = a.getMeetingMembers();
    if (mmList != null){
      for (MeetingMember mm : mmList) {
        if (mm.getId() == null || !mmIds.contains(mm.getId())) {
          invitationManager.processInvitation(a, mm, MessageType.Create, baseUrl);
View Full Code Here

          + "AND a.start > :appointmentStarttime ";

      TypedQuery<Appointment> query = em.createQuery(hql, Appointment.class);
      query.setParameter("appointmentStarttime", appointmentStarttime);

      Appointment appoint = null;
      try {
        appoint = query.getSingleResult();
      } catch (NoResultException ex) {
      }
View Full Code Here

 
  public Appointment read(InputNode node) throws Exception {
    long oldId = getlongValue(node);
    long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId;
   
    Appointment a = appointmentDao.getAppointmentByIdBackup(newId);
    return a == null ? new Appointment() : a;
  }
View Full Code Here

      Calendar appointmentstart, Calendar appointmentend,
      Boolean isDaily, Boolean isWeekly, Boolean isMonthly,
      Boolean isYearly, Long categoryId, Long remind, String[] mmClient,
      Long roomType, String baseUrl, Long languageId,
      Boolean isPasswordProtected, String password, long roomId, Long users_id) {
    Appointment a = new Appointment();
    a.setTitle(appointmentName);
    a.setLocation(appointmentLocation);
    a.setDescription(appointmentDescription);
    a.setStart(appointmentstart.getTime());
    a.setEnd(appointmentend.getTime());
    a.setIsDaily(isDaily);
    a.setIsWeekly(isWeekly);
    a.setIsMonthly(isMonthly);
    a.setIsYearly(isYearly);
    a.setCategory(appointmentCategoryDao.get(categoryId));
    a.setRemind(appointmentReminderTypDao.get(remind));
    if (roomId > 0) {
      a.setRoom(roomDao.get(roomId));
    } else {
      a.setRoom(new Room());
      a.getRoom().setComment(appointmentDescription);
      a.getRoom().setName(appointmentName);
      a.getRoom().setRoomtype(roomTypeDao.get(roomType));
    }
    a.setOwner(userDao.get(users_id));
    a.setPasswordProtected(isPasswordProtected);
    a.setPassword(password);
    a.setMeetingMembers(new ArrayList<MeetingMember>());
    for (String singleClient : mmClient) {
      MeetingMember mm = getMeetingMember(users_id, languageId, singleClient);
      mm.setAppointment(a);
      a.getMeetingMembers().add(mm);
    }
    return a;
  }
View Full Code Here

    target.add(feedback);
  }

  @Override
  protected void onSubmit(AjaxRequestTarget target) {
        Appointment a = form.getModelObject();
        final List<MeetingMember> attendees = a.getMeetingMembers() == null ? new ArrayList<MeetingMember>() : a.getMeetingMembers();
        Set<Long> currentIds = new HashSet<Long>();
        for (User u : attendeesModel.getObject()) {
          if (u.getUser_id() != null) {
            currentIds.add(u.getUser_id());
          }
        }
       
        //remove users
        for (Iterator<MeetingMember> i = attendees.iterator(); i.hasNext();) {
          MeetingMember m = i.next();
          if (!currentIds.contains(m.getUser().getUser_id())) {
            i.remove();
          }
        }
        Set<Long> originalIds = new HashSet<Long>();
        for (MeetingMember m : attendees) {
          originalIds.add(m.getUser().getUser_id());
        }
        //add users
        for (User u : attendeesModel.getObject()) {
          if (u.getUser_id() == null || !originalIds.contains(u.getUser_id())) {
            MeetingMember mm = new MeetingMember();
            mm.setUser(u);
            mm.setDeleted(false);
            mm.setInserted(a.getInserted());
            mm.setUpdated(a.getUpdated());
            mm.setAppointment(a);
            attendees.add(mm);
          }
        }
        a.setMeetingMembers(attendees);
        getBean(AppointmentDao.class).update(a, getBaseUrl(), getUserId());
    target.add(feedback);
    calendar.refresh(target);
  }
View Full Code Here

    @Override
    protected void onModelChanged() {
      super.onModelChanged();
     
      Appointment a = getModelObject();
      List<AppointmentReminderTyps> remindTypes = getRemindTypes();
      if (a.getRemind() == null && !remindTypes.isEmpty()) {
        a.setRemind(remindTypes.get(0));
      }
     
      List<RoomType> roomTypes = getRoomTypes();
      if (a.getRoom() == null) {
        Room r = new Room();
        r.setAppointment(true);
        a.setRoom(r);
      }
      if (a.getRoom().getRoomtype() == null && !roomTypes.isEmpty()) {
        a.getRoom().setRoomtype(roomTypes.get(0));
      }
      if (a.getId() == null) {
        java.util.Calendar start = WebSession.getCalendar();
        start.setTime(a.getStart());
        java.util.Calendar end = WebSession.getCalendar();
        end.setTime(a.getEnd());
       
        if (start.equals(end)) {
          end.add(java.util.Calendar.HOUR_OF_DAY, 1);
          a.setEnd(end.getTime());
        }
      }
      attendeesModel.setObject(new ArrayList<User>());
      if (a.getMeetingMembers() != null) {
        for (MeetingMember mm : a.getMeetingMembers()) {
          attendeesModel.getObject().add(mm.getUser());
        }
      }
      pwd.setEnabled(a.isPasswordProtected());
    }
View Full Code Here

      //no need to override onDayClick
     
      @Override
      public void onSelect(AjaxRequestTarget target, CalendarView view, Date start, Date end, boolean allDay) {
        target.appendJavaScript("setDatepickerDate('datepicker','" +  formatDateJava.format(start) + "');");
        Appointment a = getDefault();
        if (CalendarView.month == view && start.equals(end)) {
          java.util.Calendar now = WebSession.getCalendar();
          now.setTime(start);
          java.util.Calendar cal = WebSession.getCalendar();
          cal.set(java.util.Calendar.YEAR, now.get(java.util.Calendar.YEAR));
          cal.set(java.util.Calendar.MONTH, now.get(java.util.Calendar.MONTH));
          cal.set(java.util.Calendar.DATE, now.get(java.util.Calendar.DATE));
          cal.set(java.util.Calendar.SECOND, 0);
          cal.set(java.util.Calendar.MILLISECOND, 0);
          a.setStart(cal.getTime());
          cal.add(java.util.Calendar.HOUR_OF_DAY, 1);
          a.setEnd(cal.getTime());
        } else {
          a.setStart(start);
          a.setEnd(end);
        }
        dialog.setModelObjectWithAjaxTarget(a, target);
       
        dialog.open(target);
      }
     
      @Override
      public void onEventClick(AjaxRequestTarget target, CalendarView view, int eventId) {
        Appointment a = getDao().get((long)eventId);
        dialog.setModelObjectWithAjaxTarget(a, target);
       
        dialog.open(target);
      }
     
      @Override
      public void onEventDrop(AjaxRequestTarget target, int eventId, long delta, boolean allDay) {
        AppointmentDao dao = getDao();
        Appointment a = dao.get((long)eventId);
       
        java.util.Calendar cal = WebSession.getCalendar();
        cal.setTime(a.getStart());
        cal.add(java.util.Calendar.MILLISECOND, (int)delta); //FIXME?
        a.setStart(cal.getTime());
       
        cal.setTime(a.getEnd());
        cal.add(java.util.Calendar.MILLISECOND, (int)delta); //FIXME?
        a.setEnd(cal.getTime());
       
        dao.update(a, getBaseUrl(), getUserId());
        //FIXME add feedback info
      }

      @Override
      public void onEventResize(AjaxRequestTarget target, int eventId, long delta) {
        AppointmentDao dao = getDao();
        Appointment a = dao.get((long)eventId);
        java.util.Calendar cal = WebSession.getCalendar();
        cal.setTime(a.getEnd());
        cal.add(java.util.Calendar.MILLISECOND, (int)delta); //FIXME?
        a.setEnd(cal.getTime());
       
        dao.update(a, getBaseUrl(), getUserId());
        //FIXME add feedback info
      }
    };
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.calendar.Appointment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.