Нашли решение, пожалуйста, найдите ниже
List<Project> extProjects = new ArrayList<Project>();
if (projectIds != null && !projectIds.isEmpty()) {
Long projectId = Long.parseLong(projectIds);
Project project = ComponentAccessor.getProjectManager().getProjectObj(projectId);
if (project != null) {
extProjects.add(project);
}
} else {
extProjects.addAll(ComponentAccessor.getProjectManager().getProjects());
}
JsonArray projJsonArray = new JsonArray();
if (extProjects != null && !extProjects.isEmpty()) {
for (int i = 0; i < extProjects.size(); i++) {
Project project = extProjects.get(i);
List<IssueType> issueTypes = new ArrayList<IssueType>();
issueTypes.addAll(project.getIssueTypes());
JsonObject projectJson = new JsonObject();
projectJson.addProperty("id", project.getId());
projectJson.addProperty("key", project.getKey());
projectJson.addProperty("name", project.getName());
JsonArray issueTypesJsonArray = new JsonArray();
for (IssueType issueType : issueTypes) {
JsonObject issueTypeJson = new JsonObject();
issueTypeJson.addProperty("id", issueType.getId());
issueTypeJson.addProperty("description", issueType.getDescription());
issueTypeJson.addProperty("name", issueType.getName());
issueTypeJson.addProperty("subtask", issueType.isSubTask());
issueTypeJson.addProperty("expand", "fields");
MutableIssue issuePattern = ComponentAccessor.getComponentOfType(IssueFactory.class).getIssue();
issuePattern.setProjectId(project.getId());
issuePattern.setIssueTypeId(issueType.getId());
IssueCreationHelperBean issueCreationHelperBean = ComponentAccessor
.getComponentOfType(IssueCreationHelperBean.class);
FieldScreenRenderer fieldScreenRenderer = issueCreationHelperBean
.createFieldScreenRenderer(issuePattern);
Map<String, FieldMetaBean> fieldsMap = getFieldMetadataBeans(issuePattern, issueType, project,
fieldScreenRenderer);
Gson gson = new Gson();
issueTypeJson.add("fields", gson.toJsonTree(fieldsMap));
issueTypesJsonArray.add(issueTypeJson);
}
projectJson.add("issuetypes", issueTypesJsonArray);
projJsonArray.add(projectJson);
}
}
JsonObject jsonObject = new JsonObject();
jsonObject.add("projects", projJsonArray);
jsonObject.addProperty("expand", "projects");
jsonObject.addProperty("total", Integer.valueOf(projJsonArray.size()));
return jsonObject;