From c727ac3a56f0a47e0ed072ea78f25979b85b5382 Mon Sep 17 00:00:00 2001 From: jendib Date: Sat, 9 May 2015 23:34:43 +0200 Subject: [PATCH] Refactor, TODO --- .../com/sismics/docs/rest/resource/DocumentResource.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java index 3e876c99..af836c23 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/DocumentResource.java @@ -103,7 +103,7 @@ public class DocumentResource extends BaseResource { document.put("description", documentDb.getDescription()); document.put("create_date", documentDb.getCreateDate().getTime()); document.put("language", documentDb.getLanguage()); - document.put("creator", userDao.getById(documentDb.getUserId()).getUsername()); + // TODO Add "shared" and "file_count" -> rewrite the query in SQL if (principal.isAnonymous()) { // No tags in anonymous mode (sharing) @@ -123,6 +123,10 @@ public class DocumentResource extends BaseResource { document.put("tags", tags); } + // Below is specific to GET /document/id + + document.put("creator", userDao.getById(documentDb.getUserId()).getUsername()); + // Add ACL List aclDtoList = aclDao.getBySourceId(documentId); List aclList = new ArrayList<>(); @@ -190,8 +194,8 @@ public class DocumentResource extends BaseResource { document.put("title", documentDto.getTitle()); document.put("description", documentDto.getDescription()); document.put("create_date", documentDto.getCreateTimestamp()); - document.put("shared", documentDto.getShared()); document.put("language", documentDto.getLanguage()); + document.put("shared", documentDto.getShared()); document.put("file_count", documentDto.getFileCount()); // Get tags added by the current user on this document