1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-24 15:11:38 +00:00

Return tags on GET /document/list

This commit is contained in:
jendib
2013-08-07 11:42:57 +02:00
parent 0d7045bf24
commit 28fe7c8b02
3 changed files with 19 additions and 2 deletions

View File

@@ -122,6 +122,7 @@ public class DocumentResource extends BaseResource {
List<JSONObject> documents = new ArrayList<JSONObject>();
DocumentDao documentDao = new DocumentDao();
TagDao tagDao = new TagDao();
PaginatedList<DocumentDto> paginatedList = PaginatedLists.create(limit, offset);
SortCriteria sortCriteria = new SortCriteria(sortColumn, asc);
DocumentCriteria documentCriteria = new DocumentCriteria();
@@ -140,6 +141,18 @@ public class DocumentResource extends BaseResource {
document.put("title", documentDto.getTitle());
document.put("description", documentDto.getDescription());
document.put("create_date", documentDto.getCreateTimestamp());
// Get tags
List<TagDto> tagDtoList = tagDao.getByDocumentId(documentDto.getId());
List<JSONObject> tags = new ArrayList<JSONObject>();
for (TagDto tagDto : tagDtoList) {
JSONObject tag = new JSONObject();
tag.put("id", tagDto.getId());
tag.put("name", tagDto.getName());
tags.add(tag);
}
document.put("tags", tags);
documents.add(document);
}
response.put("total", paginatedList.getResultCount());