branch feature/6010-search-document updated (4e6da96 -> e9101fc)
This is an automated email from the git hooks/post-receive script. New change to branch feature/6010-search-document in repository coselmar. See http://git.codelutin.com/coselmar.git from 4e6da96 prepare service for search in documents new e9101fc enable search by keywords on Documents The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit e9101fcf89b6ac3682c5e6f7965859a0462e60b1 Author: Yannick Martel <martel@©odelutin.com> Date: Mon Nov 10 11:54:53 2014 +0100 enable search by keywords on Documents Summary of changes: .../persistence/entity/DocumentTopiaDao.java | 17 +++++++++++++++++ .../coselmar/services/v1/DocumentsWebService.java | 2 +- coselmar-ui/src/main/webapp/js/coselmar-services.js | 20 ++++++++++---------- 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6010-search-document in repository coselmar. See http://git.codelutin.com/coselmar.git commit e9101fcf89b6ac3682c5e6f7965859a0462e60b1 Author: Yannick Martel <martel@©odelutin.com> Date: Mon Nov 10 11:54:53 2014 +0100 enable search by keywords on Documents --- .../persistence/entity/DocumentTopiaDao.java | 17 +++++++++++++++++ .../coselmar/services/v1/DocumentsWebService.java | 2 +- coselmar-ui/src/main/webapp/js/coselmar-services.js | 20 ++++++++++---------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java b/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java new file mode 100644 index 0000000..535a9ca --- /dev/null +++ b/coselmar-persistence/src/main/java/fr/ifremer/coselmar/persistence/entity/DocumentTopiaDao.java @@ -0,0 +1,17 @@ +package fr.ifremer.coselmar.persistence.entity; + +import java.util.List; + +public class DocumentTopiaDao extends AbstractDocumentTopiaDao<Document> { + + public List<Document> findAllContainingAllKeywords(List<String> keywords) { + + InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<Document> queryBuilder = newQueryBuilder(); + for (String keyword : keywords) { + queryBuilder.addContains(Document.PROPERTY_KEYWORDS, keyword); + } + List<Document> documents = queryBuilder.findAll(); + return documents; + } + +} //DocumentTopiaDao diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java index f3cf869..89d585c 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/DocumentsWebService.java @@ -46,7 +46,7 @@ public class DocumentsWebService extends CoselmarWebServiceSupport { List<Document> documentList; if (searchKeywords != null && !searchKeywords.isEmpty()) { - documentList = getDocumentDao().forContains(Document.PROPERTY_KEYWORDS, searchKeywords).findAll(); + documentList = getDocumentDao().findAllContainingAllKeywords(searchKeywords); } else { documentList = getDocumentDao().findAll(); } diff --git a/coselmar-ui/src/main/webapp/js/coselmar-services.js b/coselmar-ui/src/main/webapp/js/coselmar-services.js index fec056c..100c478 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-services.js @@ -14,8 +14,8 @@ function Document(resource){ formData.append("uploadFile", file); formData.append("document", JSON.stringify(metadata)); // Save the document - var docResource = resource('http://localhost:8081/services/v1/documents', null, { -// var docResource = resource('v1/documents', null, { +// var docResource = resource('http://localhost:8081/services/v1/documents', null, { + var docResource = resource('v1/documents', null, { 'upload': { method:'POST', transformRequest: angular.identity, @@ -31,8 +31,8 @@ function Document(resource){ this.getDocument = function(id, scope){ // Load the document - var docResource = resource('http://localhost:8081/services/v1/documents/:documentId', {documentId:'@documentId'}); -// var docResource = resource('v1/documents/:documentId', {documentId:'@documentId'}); +// var docResource = resource('http://localhost:8081/services/v1/documents/:documentId', {documentId:'@documentId'}); + var docResource = resource('v1/documents/:documentId', {documentId:'@documentId'}); docResource.get({documentId:id}, function(document){ console.log(document); scope.document = document; @@ -42,15 +42,15 @@ function Document(resource){ this.deleteDocument = function(id, scope, successFunction){ // Load the document - var docResource = resource('http://localhost:8081/services/v1/documents/:documentId', {documentId:'@id'}); -// var docResource = resource('v1/documents/:documentId', {documentId:'@documentId'}); +// var docResource = resource('http://localhost:8081/services/v1/documents/:documentId', {documentId:'@id'}); + var docResource = resource('v1/documents/:documentId', {documentId:'@documentId'}); docResource.delete({documentId:id}, successFunction); } this.getDocumentFile = function(id, scope){ // Load the document -// var docResource = resource('http://localhost:8081/services/v1/documents/:documentId/file', {documentId:'@documentId'}); - var docResource = resource('v1/documents/:documentId/file', {documentId:'@documentId'}); + var docResource = resource('http://localhost:8081/services/v1/documents/:documentId/file', {documentId:'@documentId'}); +// var docResource = resource('v1/documents/:documentId/file', {documentId:'@documentId'}); docResource.get({documentId:id}, function(file){ // redirect to document page ? }); @@ -60,8 +60,8 @@ function Document(resource){ // Load all documents console.log("loading all documents"); - var docResource = resource('http://localhost:8081/services/v1/documents', {searchKeywords : scope.searchKeywords}); -// var docResource = resource('v1/documents'); +// var docResource = resource('http://localhost:8081/services/v1/documents', {searchKeywords : scope.searchKeywords}); + var docResource = resource('v1/documents', {searchKeywords : scope.searchKeywords}); docResource.query(function(documents){ scope.documents = documents; }, function(errorResult) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm