Package ch.bsgroup.scrumit.domain

Examples of ch.bsgroup.scrumit.domain.UserStory


    Session sess = sessionFactory.getCurrentSession();

    Transaction tx = sess.beginTransaction();

    try {
      UserStory u = (UserStory)sess.createQuery("from UserStory where id = "+userstoryId).list().get(0);
      Set<Sprint> sprints = u.getSprints();
      for (Sprint sprint : sprints) {
        if (sprint.getUserStories().contains(u)) {
          sprint.getUserStories().remove(u);
              sess.saveOrUpdate(sprint);
        }
View Full Code Here


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

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

  @RequestMapping(value="alluserstories/{sprintid}/", method=RequestMethod.GET)
  public @ResponseBody List<SerializableUserStory> getAllUserstoriesOfSprint(@PathVariable int sprintid) {
    Set<UserStory> userstories = this.userStoryService.getAllUserStorysBySprintId(sprintid);
    List<SerializableUserStory> serializedUserstories = new ArrayList<SerializableUserStory>();
    for (Iterator<UserStory> iterator = userstories.iterator(); iterator.hasNext();) {
      UserStory u = iterator.next();
      SerializableUserStory su = new SerializableUserStory(u.getId(), u.getName());
      serializedUserstories.add(su);
    }
    return serializedUserstories;
  }
View Full Code Here

    }
  }

  @RequestMapping(value="userstory/{userstoryid}/", method=RequestMethod.GET)
  public @ResponseBody SerializableUserStory getUserstory(@PathVariable int userstoryid) {
    UserStory u = this.userStoryService.findUserStoryById(userstoryid);
    if (u == null) {
      throw new ResourceNotFoundException(userstoryid);
    }
    return new SerializableUserStory(u.getId(), u.getName(), u.getPriority(), u.getCreationDate(),
        u.getEstimatedSize(), u.getAcceptanceTest());
  }
View Full Code Here

        u.getEstimatedSize(), u.getAcceptanceTest());
  }
 
  @RequestMapping(value="userstory/update/", method=RequestMethod.POST)
  public @ResponseBody Map<String, ? extends Object> updateUserstory(@RequestBody UserStory u, HttpServletResponse response) {
    UserStory us = this.userStoryService.findUserStoryById(u.getId());
    us.setName(u.getName().trim());
    us.setPriority(u.getPriority());
    us.setEstimatedSize(u.getEstimatedSize());
    us.setAcceptanceTest(u.getAcceptanceTest().trim());
    Set<ConstraintViolation<UserStory>> failures = validator.validate(us);
    if (!failures.isEmpty()) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return validationMessagesUserstory(failures);
    } else {
      this.userStoryService.updateUserStory(us);
      return Collections.singletonMap("userstory",
          new SerializableUserStory(
            us.getId(),
            us.getName(),
            us.getPriority(),
            us.getCreationDate(),
            us.getEstimatedSize(),
            us.getAcceptanceTest()
          )
      );
    }
  }
View Full Code Here

    Set<ConstraintViolation<UserStory>> failures = validator.validate(u);
    if (!failures.isEmpty()) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return validationMessagesUserstory(failures);
    } else {
      UserStory newUserStory = this.userStoryService.addUserStory(u);

      Set<UserStory> userstories = this.userStoryService.getAllUserStorysBySprintId(sprintid);
      userstories.add(newUserStory);
      sprint.setUserStories(userstories);
      this.sprintService.updateSprint(sprint);

      return Collections.singletonMap("userstory",
          new SerializableUserStory(
              newUserStory.getId(),
              newUserStory.getName(),
              newUserStory.getPriority(),
              newUserStory.getCreationDate(),
              newUserStory.getEstimatedSize(),
              newUserStory.getAcceptanceTest()
          )
      );
    }
  }
View Full Code Here

  @RequestMapping(value="alluserstories/{sprintid}/", method=RequestMethod.GET)
  public @ResponseBody List<SerializableUserStory> getAllUserstoriesOfSprint(@PathVariable Integer sprintid) {
    Set<UserStory> userstories = this.userStoryService.getAllUserStorysBySprintId(sprintid);
    List<SerializableUserStory> serializedUserstories = new ArrayList<SerializableUserStory>();
    for (Iterator<UserStory> iterator = userstories.iterator(); iterator.hasNext();) {
      UserStory u = iterator.next();
      SerializableUserStory su = new SerializableUserStory(u.getId(), u.getName(), u.getxCoord(), u.getyCoord());
      serializedUserstories.add(su);
    }
    return serializedUserstories;
  }
View Full Code Here

    return serializedTasks;
  }

  @RequestMapping(value="userstory/updatecoord/", method=RequestMethod.POST)
  public @ResponseBody void updateUserstoryCoord(@RequestBody UserStory u) {
    UserStory us = this.userStoryService.findUserStoryById(u.getId());
    us.setxCoord(u.getxCoord());
    us.setyCoord(u.getyCoord());
    this.userStoryService.updateUserStory(us);
  }
View Full Code Here

    this.userStoryService.updateUserStory(us);
  }

  @RequestMapping(value="userstory/updatename/", method=RequestMethod.POST)
  public @ResponseBody void updateUserstoryName(@RequestBody UserStory u) {
    UserStory us = this.userStoryService.findUserStoryById(u.getId());
    us.setName(u.getName());
    this.userStoryService.updateUserStory(us);
  }
View Full Code Here

    this.userStoryService.updateUserStory(us);
  }

  @RequestMapping(value="add/task/{userstoryid}/{sprintid}/", method=RequestMethod.POST)
  public @ResponseBody SerializableTask addTask(@PathVariable Integer userstoryid, @PathVariable int sprintid, @RequestBody Task t) {
    UserStory u = this.userStoryService.findUserStoryById(userstoryid);
    if (u == null) {
      throw new ResourceNotFoundException(userstoryid);
    }
    t.setUserStory(u);
    t.setCreationDate(new Date());
View Full Code Here

TOP

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

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.