Package ch.bsgroup.scrumit.domain

Examples of ch.bsgroup.scrumit.domain.Task


  /**
   * Delete Task
   */
  public void removeTask(int taskId){
    Task t = findTaskById(taskId);

    SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
    Session sess = sessionFactory.getCurrentSession();

    Transaction tx = sess.beginTransaction();
View Full Code Here


    SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
    Session sess = sessionFactory.getCurrentSession();

    Transaction tx = sess.beginTransaction();
    try {
      Task task = (Task)sess.createQuery("from Task where id = "+taskId).list().get(0);
      tx.commit();
      return task;
    }
    catch (IndexOutOfBoundsException ex) {
      return null;
View Full Code Here

  @RequestMapping(value="userstory/remove/{userstoryid}/", method=RequestMethod.GET)
  public @ResponseBody void removeUserstoryById(@PathVariable int userstoryid) {
    Set<Task> tasks = this.taskService.getAllTasksByUserstoryId(userstoryid);
    int taskDurationOfUserstory = 0;
    for (Iterator<Task> iterator = tasks.iterator(); iterator.hasNext();) {
      Task t = iterator.next();
      taskDurationOfUserstory += t.getDuration();
    }
    if (taskDurationOfUserstory > 0) {
      // Update BurnDownChart
     
    }
View Full Code Here

  @RequestMapping(value="alltasks/{userstoryid}/", method=RequestMethod.GET)
  public @ResponseBody List<SerializableTask> getAllTasksOfUserstory(@PathVariable Integer userstoryid) {
    Set<Task> tasks = this.taskService.getAllTasksByUserstoryId(userstoryid);
    List<SerializableTask> serializedTasks = new ArrayList<SerializableTask>();
    for (Iterator<Task> iterator = tasks.iterator(); iterator.hasNext();) {
      Task t = iterator.next();
      SerializableTask st = new SerializableTask(t.getId(), t.getDescription(), t.getxCoord(),
          t.getyCoord(), t.getStatus(), t.getDuration(), t.getCreationDate());
      serializedTasks.add(st);
    }
    return serializedTasks;
  }
View Full Code Here

    if (u == null) {
      throw new ResourceNotFoundException(userstoryid);
    }
    t.setUserStory(u);
    t.setCreationDate(new Date());
    Task task = this.taskService.addTask(t);
    this.burnDownChartService.updateBurnDown(task.getDuration(), 0, sprintid);
    return new SerializableTask(task.getId(), task.getDescription(), task.getxCoord(), task.getyCoord(),
        task.getStatus(), task.getDuration(), task.getCreationDate());
  }
View Full Code Here

        task.getStatus(), task.getDuration(), task.getCreationDate());
  }

  @RequestMapping(value="task/updatecoord/{sprintid}/", method=RequestMethod.POST)
  public @ResponseBody void updateTaskCoord(@PathVariable int sprintid, @RequestBody Task t) {
    Task task = this.taskService.findTaskById(t.getId());
    if (task == null) {
      throw new ResourceNotFoundException(t.getId());
    }
    task.setxCoord(t.getxCoord());
    task.setyCoord(t.getyCoord());
    if (task.getStatus() != t.getStatus()) {
      // status change
      if (t.getStatus() == 2 && task.getStatus() < 2) {
        // 0,1 -> 2
        this.burnDownChartService.updateBurnDown(-task.getDuration(), task.getDuration(), sprintid);
      }
      if (task.getStatus() == 2 && t.getStatus() < 2) {
        // 2 -> 0,1
        this.burnDownChartService.updateBurnDown(task.getDuration(), -task.getDuration(), sprintid);
      }
      task.setStatus(t.getStatus());
    }
    this.taskService.updateTask(task);
  }
View Full Code Here

    this.taskService.updateTask(task);
  }

  @RequestMapping(value="task/updatedescription/", method=RequestMethod.POST)
  public @ResponseBody void updateTaskDescription(@RequestBody Task t) {
    Task task = this.taskService.findTaskById(t.getId());
    task.setDescription(t.getDescription());
    this.taskService.updateTask(task);
  }
View Full Code Here

  public void testAddTask() {
    // fetch all tasks from database
    Set<Task> tasks = service.getAllTasks();

    // create new task
    Task task = new Task();
    task.setDescription("work");
    task.setDuration(8);
    task.setCreationDate(new Date());
    task.setxCoord(600);
    task.setyCoord(500);
    task.setStatus(2);
    service.addTask(task);

    // fetch now all tasks from database
    Set<Task> newTasks = service.getAllTasks();
View Full Code Here

  public void testUpdateTask() {
    // fetching the first task
    Set<Task> tasks = service.getAllTasks();
    Iterator<Task> iterator = tasks.iterator();
    if (iterator.hasNext()) {
      Task task = iterator.next();

      // change & save task
      task.setDescription("work to do...");
      task.setyCoord(550);
      service.updateTask(task);

      // search task via id
      Task newTask = service.findTaskById(task.getId());

      // check the description
      assertEquals(newTask.getDescription(), task.getDescription());     
    }
  }
View Full Code Here

  public void testFindTaskById() {
    // fetching the first task
    Set<Task> tasks = service.getAllTasks();
    Iterator<Task> iterator = tasks.iterator();
    if (iterator.hasNext()) {
      Task task = iterator.next();

      // search the equivalent task via id
      Task newTask = service.findTaskById(task.getId());

      // check the duration
      assertEquals(task.getDuration(), newTask.getDuration());
    }
  }
View Full Code Here

TOP

Related Classes of ch.bsgroup.scrumit.domain.Task

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.