コード例 #1
0
  private List<StoryType> getStoryList(JsonArray jsonStories) {
    List<StoryType> storyList = new ArrayList<StoryType>();

    for (JsonElement e : jsonStories) {
      if (e == null) continue;
      JsonObject jsonStory = e.getAsJsonObject();
      StoryType story = objFactory.createStoryType();
      String storyName = jsonStory.get("Name").getAsString();
      if (!jsonStory.get("Owner").isJsonNull()) {
        story.setOwner(
            getValueOrDefault(jsonStory.get("Owner").getAsJsonObject().get("_refObjectName"), ""));
      }
      story.setFullName(storyName);
      story.setShortName((storyName.length() > 30) ? storyName.substring(0, 30) : storyName);
      story.setIdentifier(jsonStory.get("FormattedID").getAsString());
      story.setEstimate(getValueOrDefault(jsonStory.get("PlanEstimate"), new Double(0.0)));
      story.setDescription(fixDescription(getValueOrDefault(jsonStory.get("Description"), "")));
      addLink(story, jsonStory.get("_ref").getAsString(), RALLY_OBJECT_URL_REL);
      storyList.add(story);

      logger.info(String.format("%s - %s", jsonStory.get("FormattedID").getAsString(), storyName));
    }

    return storyList;
  }