Package ch.bsgroup.scrumit.domain

Examples of ch.bsgroup.scrumit.domain.Sprint


  @RequestMapping(value="all/{projectid}/", method=RequestMethod.GET)
  public @ResponseBody List<SerializableSprint> getAllSprintsOfProject(@PathVariable int projectid) {
    Set<Sprint> sprints = this.sprintService.getAllSprintsByProjectId(projectid);
    List<SerializableSprint> serializedSprints = new ArrayList<SerializableSprint>();
    for (Iterator<Sprint> iterator = sprints.iterator(); iterator.hasNext();) {
      Sprint s = iterator.next();
      SerializableSprint ss = new SerializableSprint(s.getId(), s.getSlogan(), s.getStartDate(), s.getEndDate());
      serializedSprints.add(ss);
    }
    return serializedSprints;
  }
View Full Code Here


    return serializedUserstories;
  }

  @RequestMapping(value="sprint/{sprintid}/", method=RequestMethod.GET)
  public @ResponseBody SerializableSprint getSprint(@PathVariable int sprintid) {
    Sprint s = this.sprintService.findSprintById(sprintid);
    if (s == null) {
      throw new ResourceNotFoundException(sprintid);
    }
    return new SerializableSprint(s.getId(), s.getSlogan(), s.getStartDate(), s.getEndDate());
  }
View Full Code Here

  }

  @RequestMapping(value="update/", method=RequestMethod.POST)
  public @ResponseBody Map<String, ? extends Object> updateSprint(@RequestBody Sprint s, HttpServletResponse response) {
    Set<ConstraintViolation<Sprint>> failures = validator.validate(s);
    Sprint sprint = this.sprintService.findSprintById(s.getId());
    sprint.setSlogan(s.getSlogan().trim());
    sprint.setStartDate(s.getStartDate());
    sprint.setEndDate(s.getEndDate());
    if (!failures.isEmpty()) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return validationMessagesSprint(failures);
    } else {
      this.sprintService.updateSprint(sprint);
      return Collections.singletonMap("sprint",
        new SerializableSprint(
          sprint.getId(),
          sprint.getSlogan(),
          sprint.getStartDate(),
          sprint.getEndDate()
      ));
    }
  }
View Full Code Here

  /**
   * Delete Sprint
   */
  public void removeSprint(int sprintId){
    Sprint s = findSprintById(sprintId);

    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 {
      Sprint sprint = (Sprint)sess.createQuery("from Sprint where id = "+sprintId).list().get(0);
      tx.commit();
      return sprint;
    }
    catch (IndexOutOfBoundsException ex) {
      return null;
View Full Code Here

    if (!failures.isEmpty()) {
      response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      return validationMessagesSprint(failures);
    } else {
      s.setSlogan(s.getSlogan().trim());
      Sprint sprint = this.sprintService.addSprint(s);
      List<BurnDown> bdList = new ArrayList<BurnDown>();

      Calendar c = Calendar.getInstance();
      c.setTime(sprint.getStartDate());
      Calendar startCalendar = new GregorianCalendar(
        c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE));
      c.setTime(s.getEndDate())
      Calendar endCalendar = new GregorianCalendar(
        c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE));
      boolean writeBurnDown = false;
      BurnDown bd;
      if (startCalendar.compareTo(endCalendar) <= 0) {
        writeBurnDown = true;
      }
      while (startCalendar.compareTo(endCalendar) <= 0) {
        bd = new BurnDown(0, 0, sprint.getId(), startCalendar.getTime());
        bdList.add(bd);
        startCalendar.add(Calendar.DATE, 1);
      }
      if (writeBurnDown) {
        this.burnDownChartService.addBurnDownForSprint(bdList);
      }
      return Collections.singletonMap("sprint",
          new SerializableSprint(
              sprint.getId(),
              sprint.getSlogan(),
              sprint.getStartDate(),
              sprint.getEndDate()
          )
      );
    }
  }
View Full Code Here

    }
  }

  @RequestMapping(value="add/userstory/{sprintid}/", method=RequestMethod.POST)
  public @ResponseBody Map<String, ? extends Object> addUserstory(@PathVariable int sprintid, @RequestBody UserStory u, HttpServletResponse response) {
    Sprint sprint = this.sprintService.findSprintById(sprintid);
    if (sprint == null) {
      throw new ResourceNotFoundException(sprintid);
    }
    u.setName(u.getName().trim());
    u.setAcceptanceTest(u.getAcceptanceTest().trim());
    u.setCreationDate(new Date());
    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(),
View Full Code Here

    Project p = this.projectService.findProjectById(pid);
    if (p == null) {
      throw new ResourceNotFoundException(pid);
    }
    model.addAttribute("projectname", p.getName());
    Sprint s = this.sprintService.findSprintById(sid);
    if (s == null) {
      throw new ResourceNotFoundException(sid);
    }
    model.addAttribute("sprintslogan", s.getSlogan());
    return "board/board";
  }
View Full Code Here

  public void testAddSprint() {
    // fetch all sprints from database
    Set<Sprint> sprints = service.getAllSprints();

    // create new sprint
    Sprint sprint = new Sprint();
    sprint.setSlogan("Pizza and Pasta");
    sprint.setStartDate(new Date());
    sprint.setEndDate(new Date());

    service.addSprint(sprint);

    // fetch now all sprints from database
    Set<Sprint> newSprints = service.getAllSprints();
View Full Code Here

  public void testUpdateSprint() {
    // fetching the first sprint
    Set<Sprint> sprints = service.getAllSprints();
    Iterator<Sprint> iterator = sprints.iterator();
    if (iterator.hasNext()) {
      Sprint sprint = iterator.next();

      // change & save sprint
      sprint.setSlogan("All the good things");
      sprint.setEndDate(new Date());
      service.updateSprint(sprint);

      // search sprint via id
      Sprint newSprint = service.findSprintById(sprint.getId());

      // check the slogan
      assertEquals(newSprint.getSlogan(), sprint.getSlogan());
    }
  }
View Full Code Here

TOP

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

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.