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

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


      log.debug("saveAppointMent users_id:" + users_id);

      Long user_level = userManager.getUserLevelByID(users_id);

      if (AuthLevelUtil.checkUserLevel(user_level)) {
        Appointment a = appointmentLogic.getAppointment(appointmentName, appointmentLocation, appointmentDescription,
            appointmentstart, appointmentend, isDaily, isWeekly, isMonthly, isYearly, categoryId, remind,
            mmClient, roomType, languageId, isPasswordProtected, password, roomId, users_id);
        return appointmentDao.update(a, users_id).getId();
      } else {
        log.error("saveAppointment : wrong user level");
View Full Code Here


      Long users_id = sessiondataDao.checkSession(SID);
      Long user_level = userManager.getUserLevelByID(users_id);
      if (AuthLevelUtil.checkUserLevel(user_level)) {

        Appointment a = appointmentDao.get(appointmentId);
        if (!AuthLevelUtil.checkAdminLevel(user_level) && !a.getOwner().getUser_id().equals(users_id)) {
          throw new AxisFault("The Appointment cannot be updated by the given user");
        }
        if (!a.getStart().equals(appointmentstart) || !a.getEnd().equals(appointmentend)) {
          a.setStart(appointmentstart);
          a.setEnd(appointmentend);
          //FIXME this might change the owner!!!!!
          return appointmentDao.update(a, users_id).getId();
        }         
      }
    } catch (Exception err) {
View Full Code Here

      if (AuthLevelUtil.checkWebServiceLevel(user_level) || AuthLevelUtil.checkAdminLevel(user_level)) {
        // fine
      } else if (AuthLevelUtil.checkUserLevel(user_level)) {
        // check if the appointment belongs to the current user
        Appointment a = appointmentDao.get(appointmentId);
        if (!a.getOwner().getUser_id().equals(users_id)) {
          throw new AxisFault("The Appointment cannot be updated by the given user");
        }
      } else {
        throw new AxisFault("Not allowed to preform that action, Authenticate the SID first");
      }

      Appointment a = appointmentDao.get(appointmentId);
      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));
      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 = appointmentLogic.getMeetingMember(users_id, languageId, singleClient);
        mm.setAppointment(a);
        a.getMeetingMembers().add(mm);
      }
      return appointmentDao.update(a, users_id).getId();
    } catch (Exception err) {
      log.error("[updateAppointment]", err);
      throw new AxisFault(err.getMessage());
View Full Code Here

  public Long deleteAppointment(String SID, Long appointmentId, Long language_id) throws AxisFault {
    try {
      Long users_id = sessiondataDao.checkSession(SID);
      Long user_level = userManager.getUserLevelByID(users_id);

      Appointment a = appointmentDao.get(appointmentId);
      if (AuthLevelUtil.checkWebServiceLevel(user_level) || AuthLevelUtil.checkAdminLevel(user_level)) {
        // fine
      } else if (AuthLevelUtil.checkUserLevel(user_level)) {
        // check if the appointment belongs to the current user
        if (!a.getOwner().getUser_id().equals(users_id)) {
          throw new AxisFault("The Appointment cannot be updated by the given user");
        }
      } else {
        throw new AxisFault("Not allowed to preform that action, Authenticate the SID first");
      }
      appointmentDao.delete(a, users_id); //FIXME check this !!!!
      return a.getId();
    } catch (Exception err) {
      log.error("[deleteAppointment]", err);
      throw new AxisFault(err.getMessage());
    }
  }
View Full Code Here

      Long users_id = sessiondataDao.checkSession(SID);
      Long user_level = userManager.getUserLevelByID(users_id);
      if (AuthLevelUtil.checkUserLevel(user_level)) {

        Appointment appointment = new Appointment();

        Appointment appStored = appointmentDao.getAppointmentByRoomId(
            users_id, room_id);

        appointment.setStart(appStored
            .getStart());
        appointment.setEnd(appStored
            .getEnd());

        return appointment;
      }
View Full Code Here

 
  public Appointment getAppointment(Date start, Date end) {
    assertNotNull("Can't access to appointment dao implimentation", appointmentDao);

    // add new appointment
    Appointment ap = new Appointment();

    ap.setTitle("appointmentName");
    ap.setLocation("appointmentLocation");

    ap.setStart(start);
    ap.setEnd(end);
    ap.setDescription("appointmentDescription");
    ap.setInserted(new Date());
    ap.setDeleted(false);
    ap.setIsDaily(false);
    ap.setIsWeekly(false);
    ap.setIsMonthly(false);
    ap.setIsYearly(false);
    ap.setPasswordProtected(false);

    ap.setOwner(userDao.get(1L));
    ap.setConnectedEvent(false);

    if (ap.getRemind() == null && !remindTypes.isEmpty()) {
      ap.setRemind(remindTypes.get(0));
    }
   
    Room r = new Room();
    if (!roomTypes.isEmpty()) {
      r.setRoomtype(roomTypes.get(0));
    }
    r.setAppointment(true);
    ap.setRoom(r);
    return ap;
  }
View Full Code Here

   
    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, 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 createAppointment(Date start, Date end) {
    assertNotNull("Can't access to appointment dao implimentation", appointmentDao);

    // add new appointment
    Appointment ap = new Appointment();

    ap.setTitle("appointmentName");
    ap.setLocation("appointmentLocation");

    ap.setStart(start);
    ap.setEnd(end);
    ap.setDescription("appointmentDescription");
    ap.setInserted(new Date());
    ap.setDeleted(false);
    ap.setIsDaily(false);
    ap.setIsWeekly(false);
    ap.setIsMonthly(false);
    ap.setIsYearly(false);
    ap.setPasswordProtected(false);

    ap.setOwner(userDao.get(1L));
    ap.setConnectedEvent(false);
    Long id = appointmentDao.addAppointmentObj(ap);
    assertNotNull("Cann't add appointment", id);
    return ap;
  }
View Full Code Here

          "first" + i + ".last" + i + "@webbase-design.de", "Etc/GMT+1");
    }
    Long language_id = 1L;
    Long roomType = 1L;

    Appointment a = appointmentLogic.getAppointment(appointmentName,
        appointmentLocation, appointmentDescription,
        start, end, isDaily, isWeekly,
        isMonthly, isYearly, categoryId, remind, mmClient,
        roomType, language_id, false, "", -1, users_id);
    a = appointmentDao.update(a, users_id);
   
    Thread.sleep(3000);
   
    appointmentLogic.doScheduledMeetingReminder();
   
    Thread.sleep(3000);
   
    assertTrue("Saved appointment should have valid id: " + a.getId(), a.getId() != null && a.getId() > 0);
  }
View Full Code Here

    rangeEnd.setTime(now.getTime());
   
    Calendar a1End = Calendar.getInstance();
    a1End.setTime(now.getTime());
    a1End.add(Calendar.HOUR_OF_DAY, 1);
    Appointment a1 = getAppointment(now.getTime(), a1End.getTime());
    a1.setTitle("AppointmentByRange_a1");

    Appointment a2 = getAppointment(now.getTime(), a1End.getTime());
    a2.setTitle("AppointmentByRange_a2");
    a2.setMeetingMembers(new ArrayList<MeetingMember>());
    MeetingMember mm1 = new MeetingMember();
    mm1.setUser(createUserContact(rnd.nextInt(), userId));
    mm1.setAppointment(a2);
    a2.getMeetingMembers().add(mm1);
   
    Appointment a3 = getAppointment(now.getTime(), a1End.getTime());
    a3.setTitle("AppointmentByRange_a3");
    a3.setMeetingMembers(new ArrayList<MeetingMember>());
    MeetingMember mm2 = new MeetingMember();
    mm2.setUser(createUserContact(rnd.nextInt(), userId));
    mm2.setAppointment(a3);
    a3.getMeetingMembers().add(mm2);
    MeetingMember mm3 = new MeetingMember();
    mm3.setUser(createUserContact(rnd.nextInt(), userId));
    mm3.setAppointment(a3);
    a3.getMeetingMembers().add(mm3);
   
    a1 = appointmentDao.update(a1, userId);
    a2 = appointmentDao.update(a2, userId);
    a3 = appointmentDao.update(a3, userId);
   
    int a1found = 0, a2found = 0, a3found = 0;
    for (Appointment a : appointmentDao.getAppointmentsByRange(userId, rangeStart.getTime(), rangeEnd.getTime())) {
      int mmCount = a.getMeetingMembers() == null ? 0 : a.getMeetingMembers().size();
      if (a.getId().equals(a1.getId())) {
        assertEquals("Inapropriate MeetingMembers count", 0, mmCount);
        a1found++;
      }
      if (a.getId().equals(a2.getId())) {
        assertEquals("Inapropriate MeetingMembers count", 1, mmCount);
        a2found++;
      }
      if (a.getId().equals(a3.getId())) {
        assertEquals("Inapropriate MeetingMembers count", 2, mmCount);
        a3found++;
      }
    }
    assertEquals("Inappropriate count of appointments without members found", 1, a1found);
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.