This is an automated email from the git hooks/post-receive script. New commit to branch feature/6011-6057-60058-documents-management in repository coselmar. See http://git.codelutin.com/coselmar.git commit 1fef1e3a17e15f1a2750f11a7cee6562c1d6d9f8 Author: Yannick Martel <martel@©odelutin.com> Date: Fri Nov 7 17:18:35 2014 +0100 complete Document view page & fix bundle module --- coselmar-bundle/src/main/webapp/WEB-INF/web.xml | 12 +++++++ .../fr/ifremer/coselmar/beans/DocumentBean.java | 4 ++- .../coselmar/converter/BeanEntityConverter.java | 10 ++++-- .../src/main/webapp/js/coselmar-services.js | 12 ++++--- coselmar-ui/src/main/webapp/views/document.html | 15 +++++++++ coselmar-ui/src/main/webapp/views/documents.html | 39 ++++++++++++---------- 6 files changed, 67 insertions(+), 25 deletions(-) diff --git a/coselmar-bundle/src/main/webapp/WEB-INF/web.xml b/coselmar-bundle/src/main/webapp/WEB-INF/web.xml index 5ac3d07..af6387d 100644 --- a/coselmar-bundle/src/main/webapp/WEB-INF/web.xml +++ b/coselmar-bundle/src/main/webapp/WEB-INF/web.xml @@ -7,4 +7,16 @@ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <display-name>Colsemar Traceability</display-name> + + <filter> + <filter-name>topiaTransaction</filter-name> + <filter-class> + fr.ifremer.coselmar.services.filter.CoselmarTopiaTransactionFilter + </filter-class> + </filter> + + <filter-mapping> + <filter-name>topiaTransaction</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> </web-app> \ No newline at end of file diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java index 2b1a4ff..b6b067a 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentBean.java @@ -17,14 +17,16 @@ public class DocumentBean implements Serializable { protected String privacy; protected Set<String> keywords; protected Date depositDate; + protected String mimeType; - public DocumentBean(String id, String name, String ownerName, String privacy, Date depositDate, Collection<String> keywords) { + public DocumentBean(String id, String name, String ownerName, String privacy, Date depositDate, Collection<String> keywords, String mimeType) { this.id = id; this.name = name; this.ownerName = ownerName; this.privacy = privacy; this.depositDate = depositDate; this.keywords = new HashSet<>(keywords); + this.mimeType = mimeType; } public String getId() { diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java index 685969d..26c884a 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java @@ -12,8 +12,14 @@ public class BeanEntityConverter { public static DocumentBean toBean(Document document) { String documentLightId = document.getTopiaId().replace(Document.class.getCanonicalName() + "_", ""); - Date depositeDate = new Date (document.getDepositDate().getTime()); - return new DocumentBean(documentLightId, document.getName(), "N/A", document.getPrivacy().name(), depositeDate, document.getKeywords()); + Date depositeDate = new Date(document.getDepositDate().getTime()); + return new DocumentBean(documentLightId, + document.getName(), + "N/A", + document.getPrivacy().name(), + depositeDate, + document.getKeywords(), + document.getMimeType()); } } diff --git a/coselmar-ui/src/main/webapp/js/coselmar-services.js b/coselmar-ui/src/main/webapp/js/coselmar-services.js index fc30500..d305d8d 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-services.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-services.js @@ -14,7 +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('http://localhost:8081/services/v1/documents', null, { + var docResource = resource('v1/documents', null, { 'upload': { method:'POST', transformRequest: angular.identity, @@ -30,7 +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('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; @@ -39,7 +41,8 @@ function Document(resource){ this.getDocumentFile = function(id, scope){ // Load the document - var docResource = resource('http://localhost:8081/services/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 ? }); @@ -48,7 +51,8 @@ function Document(resource){ this.getDocuments = function(scope){ // Load all documents console.log("loading all documents"); - var docResource = resource('http://localhost:8081/services/v1/documents'); +// var docResource = resource('http://localhost:8081/services/v1/documents'); + var docResource = resource('v1/documents'); docResource.query(function(documents){ scope.documents = documents; }, function(errorResult) { diff --git a/coselmar-ui/src/main/webapp/views/document.html b/coselmar-ui/src/main/webapp/views/document.html index 3b79321..7a80cc8 100644 --- a/coselmar-ui/src/main/webapp/views/document.html +++ b/coselmar-ui/src/main/webapp/views/document.html @@ -12,6 +12,14 @@ <td>{{document.name}}</td> </tr> <tr> + <td>Owner</td> + <td>{{document.ownerName}}</td> + </tr> + <tr> + <td>Type</td> + <td>{{document.mimeType}}</td> + </tr> + <tr> <td>Keywords</td> <td>{{document.keywords}}</td> </tr> @@ -19,6 +27,13 @@ <td>Privacy</td> <td>{{document.privacy}}</td> </tr> + <tr> + <td>Deposite Date</td> + <td>{{document.depositDate | date:'mediumDate'}}</td> + </tr> </table> + <div style="padding-left: 200px"> + <a href="/v1/documents/{{document.id}}/file" class="btn btn-primary">Download</a> + </div> </div> </div> \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/views/documents.html b/coselmar-ui/src/main/webapp/views/documents.html index a13e2c3..7157823 100644 --- a/coselmar-ui/src/main/webapp/views/documents.html +++ b/coselmar-ui/src/main/webapp/views/documents.html @@ -1,23 +1,26 @@ <div style="padding: 0px 0px 0px 30px"> - <div class="page-header" style="margin: 0"> - <h1> - <!-- Heading goes here --> - All Documents - </h1> - </div> + <div class="page-header" style="margin: 0"> + <h1> + <!-- Heading goes here --> + All Documents + </h1> + </div> + <div> <div> - <table class="table"> - <tr> - <th>Name</th> - <th>Privacy</th> - <th>Keywords</th> - </tr> - <tr ng-repeat="document in documents"> - <td><a href="#/documents/{{document.id}}">{{document.name}}</a></td> - <td>{{document.privacy}}</td> - <td>{{document.keywords}}</td> - </tr> - </table> + <a href="#/documents/new" class="btn btn-primary">Add a document</a> </div> + <table class="table"> + <tr> + <th>Name</th> + <th>Privacy</th> + <th>Keywords</th> + </tr> + <tr ng-repeat="document in documents"> + <td><a href="#/documents/{{document.id}}">{{document.name}}</a></td> + <td>{{document.privacy}}</td> + <td>{{document.keywords}}</td> + </tr> + </table> + </div> </div> \ No newline at end of file -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.