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; }
/** * Method declaration * * @param name * @param description * @param priority * @param classification * @param startDay * @param startHour * @param endDay * @param endHour * @param percent * @return * @throws TodoException * @see */ public String addToDo( String name, String description, String priority, String classification, Date startDay, String startHour, Date endDay, String endHour, String percent) throws TodoException { String result = null; SilverTrace.info("todo", "ToDoSessionController.addToDo()", "root.MSG_GEN_ENTER_METHOD"); ToDoHeader todo = new ToDoHeader(name, getUserId()); todo.setDescription(description); try { todo.getPriority().setValue(new Integer(priority).intValue()); } catch (Exception e) { SilverTrace.warn( "todo", "ToDoSessionController.addToDo()", "todo.MSG_CANT_SET_TODO_PRIORITY"); } try { todo.setPercentCompleted(new Integer(percent).intValue()); } catch (Exception e) { SilverTrace.warn( "todo", "ToDoSessionController.addToDo()", "todo.MSG_CANT_SET_TODO_PERCENTCOMPLETED"); } try { todo.getClassification().setString(classification); todo.setStartDate(startDay); todo.setStartHour(startHour); todo.setEndDate(endDay); todo.setEndHour(endHour); result = calendarBm.addToDo(todo); } catch (Exception e) { throw new TodoException( "ToDoSessionController.addToDo()", SilverpeasException.ERROR, "todo.MSG_CANT_ADD_TODO", e); } SilverTrace.info("todo", "ToDoSessionController.addToDo()", "root.MSG_GEN_EXIT_METHOD"); return result; }
/** * Method declaration * * @param id * @param name * @param description * @param priority * @param classification * @param startDay * @param startHour * @param endDay * @param endHour * @param percent * @throws TodoException * @see */ public void updateToDo( String id, String name, String description, String priority, String classification, Date startDay, String startHour, Date endDay, String endHour, String percent) throws TodoException { SilverTrace.info("todo", "ToDoSessionController.updateToDo()", "root.MSG_GEN_ENTER_METHOD"); ToDoHeader todo = getToDoHeader(id); todo.setName(name); todo.setDescription(description); try { todo.getPriority().setValue(new Integer(priority).intValue()); } catch (Exception e) { SilverTrace.warn( "todo", "ToDoSessionController.updateToDo()", "todo.MSG_CANT_SET_TODO_PRIORITY"); } try { todo.setPercentCompleted(new Integer(percent).intValue()); } catch (Exception e) { SilverTrace.warn( "todo", "ToDoSessionController.updateToDo()", "todo.MSG_CANT_SET_TODO_PERCENTCOMPLETED"); } try { todo.getClassification().setString(classification); todo.setStartDate(startDay); todo.setStartHour(startHour); todo.setEndDate(endDay); todo.setEndHour(endHour); calendarBm.updateToDo(todo); SilverTrace.info("todo", "ToDoSessionController.updateToDo()", "root.MSG_GEN_EXIT_METHOD"); } catch (Exception e) { throw new TodoException( "ToDoSessionController.updateToDo()", SilverpeasException.ERROR, "todo.MSG_CANT_UPDATE_TODO_DETAIL", e); } }