diff --git a/app/controllers/MigrationApp.java b/app/controllers/MigrationApp.java index 67bfc53f8..e65dfbafb 100644 --- a/app/controllers/MigrationApp.java +++ b/app/controllers/MigrationApp.java @@ -210,7 +210,7 @@ public static Result exportIssues(String owner, String projectName){ return ok(exportData); } - private static ObjectNode composeMilestoneJson(Milestone m) { + public static ObjectNode composeMilestoneJson(Milestone m) { ObjectNode node = Json.newObject(); node.put("id", m.id); node.put("title", m.title); @@ -381,6 +381,7 @@ public static List composePlainCommentsJson(AbstractPosting posting, List comments = new ArrayList<>(); for (Comment comment : posting.getComments()) { ObjectNode commentNode = Json.newObject(); + commentNode.put("id", comment.id); commentNode.put("type", comment.asResource().getType().toString()); commentNode.put("authorId", comment.authorLoginId); commentNode.put("authorName", comment.authorName); diff --git a/app/controllers/api/ProjectApi.java b/app/controllers/api/ProjectApi.java index 17400506a..6f621bf85 100644 --- a/app/controllers/api/ProjectApi.java +++ b/app/controllers/api/ProjectApi.java @@ -8,6 +8,8 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; +import controllers.MigrationApp; +import controllers.annotation.AnonymousCheck; import controllers.annotation.IsAllowed; import models.*; import models.enumeration.Operation; @@ -41,6 +43,8 @@ public static Result exports(String owner, String projectName) { json.put("milestoneCount", project.milestones.size()); json.put("issues", composePosts(project, Issue.finder)); json.put("posts", composePosts(project, Posting.finder)); + json.put("milestones", toJson(project.milestones.stream() + .map(MigrationApp::composeMilestoneJson).collect(Collectors.toList()))); return ok(json); } @@ -54,6 +58,7 @@ private static JsonNode composePosts(Project project, Model.Finder private static ObjectNode getResult(AbstractPosting posting) { ObjectNode json = Json.newObject(); + json.put("id", posting.getNumber()); json.put("title", posting.title); json.put("type", posting.asResource().getType().toString()); json.put("author", posting.authorLoginId); @@ -63,6 +68,8 @@ private static ObjectNode getResult(AbstractPosting posting) { if(posting.asResource().getType() == ResourceType.ISSUE_POST){ Optional.ofNullable(((Issue)posting).assignee).ifPresent(assignee -> json.put("assignee", assignee.user.loginId)); + Optional.ofNullable(((Issue)posting).milestone).ifPresent(milestone -> json.put("milestone", milestone.title)); + Optional.ofNullable(((Issue)posting).milestone).ifPresent(milestone -> json.put("milestoneId", milestone.id)); } List attachments = Attachment.findByContainer(posting.asResource()); if(attachments.size() > 0) {