public Vector<TodoDetail> getEntriesFromExternal(
      String spaceId, String componentId, String externalId) {
    SilverTrace.info(
        "calendar",
        "TodoBackboneAcess.getEntriesFromExternal(String spaceId, String componentId, String externalId)",
        "root.MSG_GEN_ENTER_METHOD",
        "spaceId=" + spaceId + ", componentId=" + componentId + ", externalId=" + externalId);
    try {
      Collection<ToDoHeader> headers =
          getCalendarBm().getExternalTodos(spaceId, componentId, externalId);
      Vector<TodoDetail> result = new Vector<TodoDetail>();
      for (ToDoHeader header : headers) {
        TodoDetail detail = todoHeaderToDetail(header);

        Collection<Attendee> list = getCalendarBm().getToDoAttendees(detail.getId());
        detail.setAttendees(new Vector<Attendee>(list));
        result.add(detail);
      }
      return result;
    } catch (Exception e) {
      SilverTrace.error(
          "calendar",
          "TodoBackboneAcess.getEntriesFromExternal(String spaceId, String componentId, String externalId)",
          "calendar.MSG_CANT_GET",
          "return null",
          e);
      return null;
    }
  }
  public String addEntry(
      TodoDetail todo, boolean notifyAttendees, String txtTitle, String txtMessage) {
    SilverTrace.info("calendar", "TodoBackboneAcess.addEntry()", "root.MSG_GEN_ENTER_METHOD");
    NotificationSender notifSender = new NotificationSender(todo.getComponentId());
    try {
      ToDoHeader header = todoDetailToHeader(todo);
      SilverTrace.info(
          "calendar", "TodoBackboneAcess.addEntry()", "root.MSG_GEN_ENTER_METHOD", "apres header");
      String id = getCalendarBm().addToDo(header);
      SilverTrace.info(
          "calendar", "TodoBackboneAcess.addEntry()", "root.MSG_GEN_ENTER_METHOD", "id=" + id);

      if (todo.getAttendees() != null) {
        Collection<UserRecipient> selectedUsers = new ArrayList<UserRecipient>();
        for (Attendee attendee : todo.getAttendees()) {
          getCalendarBm().addToDoAttendee(id, attendee);
          if (notifyAttendees && (!todo.getDelegatorId().equals(attendee.getUserId()))) {
            selectedUsers.add(new UserRecipient(attendee.getUserId()));
          }
        }
        if (!selectedUsers.isEmpty()) {
          NotificationMetaData notifMetaData =
              new NotificationMetaData(NotificationParameters.NORMAL, txtTitle, txtMessage);
          notifMetaData.setSender(todo.getDelegatorId());
          notifMetaData.setUserRecipients(selectedUsers);
          notifSender.notifyUser(notifMetaData);
        }
      }
      return id;
    } catch (Exception e) {
      SilverTrace.error(
          "calendar",
          "TodoBackboneAcess.addEntry()",
          "calendar.MSG_ADD_ENTRY_FAILED",
          "value return id= null",
          e);
      return null;
    }
  }
 public void updateEntry(TodoDetail todo) {
   SilverTrace.info(
       "calendar", "TodoBackboneAcess.updateEntry(TodoDetail todo)", "root.MSG_GEN_ENTER_METHOD");
   try {
     ToDoHeader header = todoDetailToHeader(todo);
     getCalendarBm().updateToDo(header);
     if (todo.getAttendees() != null) {
       String[] userIds = new String[todo.getAttendees().size()];
       int posit = 0;
       for (Attendee attendee : todo.getAttendees()) {
         userIds[posit++] = attendee.getUserId();
       }
       getCalendarBm().setToDoAttendees(header.getId(), userIds);
     }
   } catch (Exception e) {
     SilverTrace.error(
         "calendar",
         "TodoBackboneAcess.addEntry(TodoDetail todo)",
         "calendar.MSG_UPDATE_ENTRY_FAILED",
         "id=" + todo.getId(),
         e);
   }
 }
  public TodoDetail getEntry(String id) {
    SilverTrace.info(
        "calendar",
        "TodoBackboneAcess.getEntry(String id)",
        "root.MSG_GEN_ENTER_METHOD",
        "id=" + id);
    try {
      ToDoHeader header = getCalendarBm().getToDoHeader(id);
      TodoDetail detail = todoHeaderToDetail(header);

      Collection<Attendee> list = getCalendarBm().getToDoAttendees(id);
      Vector<Attendee> vector = new Vector<Attendee>(list);
      detail.setAttendees(vector);
      return detail;
    } catch (Exception e) {
      SilverTrace.error(
          "calendar",
          "TodoBackboneAcess.getEntry(TodoDetail todo)",
          "calendar.MSG_CANT_GET",
          "return null",
          e);
      return null;
    }
  }
 private static ToDoHeader todoDetailToHeader(final TodoDetail detail) {
   ToDoHeader head = new ToDoHeader();
   head.setName(detail.getName());
   head.setId(detail.getId());
   head.setDescription(detail.getDescription());
   head.setDelegatorId(detail.getDelegatorId());
   head.setStartDate(detail.getStartDate());
   head.setEndDate(detail.getEndDate());
   head.setDuration((int) detail.getDuration());
   head.setPercentCompleted(detail.getPercentCompleted());
   head.setComponentId(detail.getComponentId());
   head.setSpaceId(detail.getSpaceId());
   head.setExternalId(detail.getExternalId());
   return head;
 }
 private static TodoDetail todoHeaderToDetail(final ToDoHeader header) {
   TodoDetail detail = new TodoDetail();
   detail.setName(header.getName());
   detail.setId(header.getId());
   detail.setDescription(header.getDescription());
   detail.setDelegatorId(header.getDelegatorId());
   // detail.setPriority(header.getPriority());
   detail.setStartDate(header.getStartDate());
   detail.setEndDate(header.getEndDate());
   detail.setDuration(header.getDuration());
   detail.setPercentCompleted(header.getPercentCompleted());
   detail.setComponentId(header.getComponentId());
   detail.setSpaceId(header.getSpaceId());
   detail.setExternalId(header.getExternalId());
   return detail;
 }