mirror of
https://github.com/sismics/docs.git
synced 2024-11-14 10:27:55 +01:00
Return file count on GET /document/list
This commit is contained in:
parent
62a5840777
commit
870a44da0d
@ -145,7 +145,8 @@ public class DocumentDao {
|
||||
Map<String, Object> parameterMap = new HashMap<String, Object>();
|
||||
List<String> criteriaList = new ArrayList<String>();
|
||||
|
||||
StringBuilder sb = new StringBuilder("select distinct d.DOC_ID_C c0, d.DOC_TITLE_C c1, d.DOC_DESCRIPTION_C c2, d.DOC_CREATEDATE_D c3, d.DOC_LANGUAGE_C c4, s.SHA_ID_C is not null c5 ");
|
||||
StringBuilder sb = new StringBuilder("select distinct d.DOC_ID_C c0, d.DOC_TITLE_C c1, d.DOC_DESCRIPTION_C c2, d.DOC_CREATEDATE_D c3, d.DOC_LANGUAGE_C c4, s.SHA_ID_C is not null c5, ");
|
||||
sb.append(" (select count(f.FIL_ID_C) from T_FILE f where f.FIL_DELETEDATE_D is null and f.FIL_IDDOC_C = d.DOC_ID_C) c6 ");
|
||||
sb.append(" from T_DOCUMENT d ");
|
||||
sb.append(" left join T_SHARE s on s.SHA_IDDOCUMENT_C = d.DOC_ID_C and s.SHA_DELETEDATE_D is null ");
|
||||
|
||||
@ -211,6 +212,7 @@ public class DocumentDao {
|
||||
documentDto.setCreateTimestamp(((Timestamp) o[i++]).getTime());
|
||||
documentDto.setLanguage((String) o[i++]);
|
||||
documentDto.setShared((Boolean) o[i++]);
|
||||
documentDto.setFileCount(((Number) o[i++]).intValue());
|
||||
documentDtoList.add(documentDto);
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,8 @@ public class DocumentDto {
|
||||
*/
|
||||
private Boolean shared;
|
||||
|
||||
private Integer fileCount;
|
||||
|
||||
/**
|
||||
* Getter de id.
|
||||
*
|
||||
@ -146,4 +148,20 @@ public class DocumentDto {
|
||||
public void setLanguage(String language) {
|
||||
this.language = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter of fileCount.
|
||||
* @return fileCount
|
||||
*/
|
||||
public Integer getFileCount() {
|
||||
return fileCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter of fileCount.
|
||||
* @param fileCount fileCount
|
||||
*/
|
||||
public void setFileCount(Integer fileCount) {
|
||||
this.fileCount = fileCount;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
- Show number of files on documents list (client/server)
|
||||
- Show number of files on documents list (client)
|
@ -171,6 +171,7 @@ public class DocumentResource extends BaseResource {
|
||||
document.put("create_date", documentDto.getCreateTimestamp());
|
||||
document.put("shared", documentDto.getShared());
|
||||
document.put("language", documentDto.getLanguage());
|
||||
document.put("file_count", documentDto.getFileCount());
|
||||
|
||||
// Get tags
|
||||
List<TagDto> tagDtoList = tagDao.getByDocumentId(documentDto.getId());
|
||||
|
@ -16,7 +16,8 @@ App.controller('Navigation', function($scope, $http, $state, $rootScope, User, R
|
||||
setInterval(function() {
|
||||
$scope.$apply(function() {
|
||||
Restangular.one('app/log').get({
|
||||
limit: 100,
|
||||
// Error count will be wrong if there is more than 10 errors in 10 seconds
|
||||
limit: 10,
|
||||
level: 'ERROR'
|
||||
}).then(function(data) {
|
||||
// Add new errors
|
||||
|
@ -109,6 +109,7 @@ public class TestDocumentResource extends BaseJerseyTest {
|
||||
Assert.assertTrue(documents.length() == 1);
|
||||
Assert.assertEquals(document1Id, documents.getJSONObject(0).getString("id"));
|
||||
Assert.assertEquals("eng", documents.getJSONObject(0).getString("language"));
|
||||
Assert.assertEquals(1, documents.getJSONObject(0).getInt("file_count"));
|
||||
Assert.assertEquals(1, tags.length());
|
||||
Assert.assertEquals(tag1Id, tags.getJSONObject(0).getString("id"));
|
||||
Assert.assertEquals("SuperTag", tags.getJSONObject(0).getString("name"));
|
||||
|
Loading…
Reference in New Issue
Block a user