/** path: AjaxShowStoryfromSprint.do class: AjaxShowStoryFromSprintAction */
  public StringBuilder getStoriesInSprintResponseText(ArrayList<StoryObject> stories) {
    StringBuilder sb = new StringBuilder();
    TranslateSpecialChar tsc = new TranslateSpecialChar();
    sb.append("<ExistingStories>");

    for (StoryObject story : stories) {
      long sprintId = story.getSprintId();
      sb.append("<Story>");
      sb.append("<Id>" + story.getId() + "</Id>");
      sb.append("<Link></Link>");
      sb.append("<Name>" + tsc.TranslateXMLChar(story.getName()) + "</Name>");
      sb.append("<Value>" + story.getValue() + "</Value>");
      sb.append("<Importance>" + story.getImportance() + "</Importance>");
      sb.append("<Estimate>" + story.getEstimate() + "</Estimate>");
      sb.append("<Status>" + story.getStatusString() + "</Status>");
      sb.append("<Notes>" + tsc.TranslateXMLChar(story.getNotes()) + "</Notes>");
      sb.append("<HowToDemo>" + tsc.TranslateXMLChar(story.getHowToDemo()) + "</HowToDemo>");
      sb.append("<Release></Release>");
      sb.append("<Sprint>" + sprintId + "</Sprint>");
      sb.append("<Tag>" + tsc.TranslateXMLChar(Translation.Join(story.getTags(), ",")) + "</Tag>");
      sb.append("</Story>");
    }
    sb.append("</ExistingStories>");

    return sb;
  }
  @Override
  public StringBuilder getResponse(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    // get session info
    ProjectObject project = (ProjectObject) SessionManager.getProjectObject(request);

    SprintPlanHelper sprintPlanHelper = new SprintPlanHelper(project);
    TranslateSpecialChar translateSpecialChar = new TranslateSpecialChar();

    // get parameter info
    String sprintId = request.getParameter("Id");
    String sprintGoal = translateSpecialChar.TranslateXMLChar(request.getParameter("Goal"));
    String startDate = request.getParameter("StartDate");
    String interval = request.getParameter("Interval");
    String teamSize = request.getParameter("Members");
    String hoursCanCommit = request.getParameter("AvaliableDays");
    String focusFactor = request.getParameter("FocusFactor");
    String dailyInfo = translateSpecialChar.TranslateXMLChar(request.getParameter("DailyScrum"));
    String demoDate = request.getParameter("DemoDate");
    String demoPlace = translateSpecialChar.TranslateXMLChar(request.getParameter("DemoPlace"));
    String dueDate = request.getParameter("DueDate");

    // set sprint info
    SprintInfo sprintInfo = new SprintInfo();
    sprintInfo.id = Long.parseLong(sprintId);
    sprintInfo.sprintGoal = sprintGoal;
    sprintInfo.startDate = startDate;
    sprintInfo.interval = Integer.parseInt(interval);
    sprintInfo.teamSize = Integer.parseInt(teamSize);
    sprintInfo.hoursCanCommit = Integer.parseInt(hoursCanCommit);
    sprintInfo.focusFactor = Integer.parseInt(focusFactor);
    sprintInfo.dailyInfo = dailyInfo;
    sprintInfo.demoDate = demoDate;
    sprintInfo.demoPlace = demoPlace;
    sprintInfo.dueDate = dueDate;

    sprintPlanHelper.updateSprint(sprintInfo.id, sprintInfo);

    return new StringBuilder("true");
  }
  private String genXML(String sprintID) {
    TranslateSpecialChar tsc = new TranslateSpecialChar();
    StringBuilder sb = new StringBuilder();
    sb.append(
        "<Retrospectives><Sprint><Id>"
            + sprintID
            + "</Id><Name>Sprint #"
            + sprintID
            + "</Name></Sprint>");

    // good
    List<IScrumIssue> goodRes = mCR.getGoodRetrospectiveList();
    for (int i = 0; i < goodRes.size(); i++) {
      IScrumIssue goodR = goodRes.get(i);
      if (goodR.getSprintID().compareTo(sprintID) == 0) {
        sb.append("<Retrospective>");
        sb.append("<Id>" + goodR.getIssueID() + "</Id>");
        sb.append("<Link>" + tsc.TranslateXMLChar(goodR.getIssueLink()) + "</Link>");
        sb.append("<SprintID>" + goodR.getSprintID() + "</SprintID>");
        sb.append("<Name>" + tsc.TranslateXMLChar(goodR.getName()) + "</Name>");
        sb.append("<Type>" + goodR.getCategory() + "</Type>");
        sb.append(
            "<Description>" + tsc.TranslateXMLChar(goodR.getDescription()) + "</Description>");
        sb.append("<Status>" + goodR.getStatus() + "</Status>");
        sb.append("</Retrospective>");
      }
    }

    // improve
    List<IScrumIssue> improveRes = mCR.getImproveRetrospectiveList();
    for (int i = 0; i < improveRes.size(); i++) {
      IScrumIssue improveR = improveRes.get(i);
      if (improveR.getSprintID().compareTo(sprintID) == 0) {
        sb.append("<Retrospective>");
        sb.append("<Id>" + improveR.getIssueID() + "</Id>");
        sb.append("<Link>" + tsc.TranslateXMLChar(improveR.getIssueLink()) + "</Link>");
        sb.append("<SprintID>" + improveR.getSprintID() + "</SprintID>");
        sb.append("<Name>" + tsc.TranslateXMLChar(improveR.getName()) + "</Name>");
        sb.append("<Type>" + improveR.getCategory() + "</Type>");
        sb.append(
            "<Description>" + tsc.TranslateXMLChar(improveR.getDescription()) + "</Description>");
        sb.append("<Status>" + improveR.getStatus() + "</Status>");
        sb.append("</Retrospective>");
      }
    }

    sb.append("</Retrospectives>");
    return sb.toString();
  }