This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit 0865a71a454e4a386a0c33a046e346a8526b4a9d Author: Yannick Martel <martel@©odelutin.com> Date: Mon Jan 18 18:38:11 2016 +0100 refs-60 #7911 add citation in document - persistence & services part --- .../V1_4_0_1__7911_add_citation_in_documents.sql | 23 +++++++++++++++++++++ .../src/main/xmi/coselmar-model.properties | 1 + .../src/main/xmi/coselmar-model.zargo | Bin 10955 -> 11007 bytes .../fr/ifremer/coselmar/beans/DocumentBean.java | 13 +++++++++++- .../ifremer/coselmar/beans/DocumentSearchBean.java | 4 ++-- .../coselmar/converter/BeanEntityConverter.java | 6 +++++- .../indexation/DocumentsIndexationServiceTest.java | 16 +++++++------- 7 files changed, 51 insertions(+), 12 deletions(-) diff --git a/coselmar-persistence/src/main/resources/db/migration/V1_4_0_1__7911_add_citation_in_documents.sql b/coselmar-persistence/src/main/resources/db/migration/V1_4_0_1__7911_add_citation_in_documents.sql new file mode 100644 index 0000000..23d18fa --- /dev/null +++ b/coselmar-persistence/src/main/resources/db/migration/V1_4_0_1__7911_add_citation_in_documents.sql @@ -0,0 +1,23 @@ +--- +-- #%L +-- Coselmar :: Persistence +-- %% +-- Copyright (C) 2014 - 2016 Ifremer, Code Lutin +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/gpl-3.0.html>. +-- #L% +--- + +ALTER TABLE document ADD citation VARCHAR(255); diff --git a/coselmar-persistence/src/main/xmi/coselmar-model.properties b/coselmar-persistence/src/main/xmi/coselmar-model.properties index 3a95bfc..1ee6952 100644 --- a/coselmar-persistence/src/main/xmi/coselmar-model.properties +++ b/coselmar-persistence/src/main/xmi/coselmar-model.properties @@ -29,6 +29,7 @@ model.tagvalue.useEnumerationName=true # Text fr.ifremer.coselmar.persistence.entity.Document.attribute.summary.tagValue.hibernateAttributeType=text fr.ifremer.coselmar.persistence.entity.Document.attribute.comment.tagValue.hibernateAttributeType=text +fr.ifremer.coselmar.persistence.entity.Document.attribute.citation.tagValue.hibernateAttributeType=text fr.ifremer.coselmar.persistence.entity.Question.attribute.summary.tagValue.hibernateAttributeType=text fr.ifremer.coselmar.persistence.entity.Question.attribute.conclusion.tagValue.hibernateAttributeType=text \ No newline at end of file diff --git a/coselmar-persistence/src/main/xmi/coselmar-model.zargo b/coselmar-persistence/src/main/xmi/coselmar-model.zargo index 1f35409..85a95b3 100644 Binary files a/coselmar-persistence/src/main/xmi/coselmar-model.zargo and b/coselmar-persistence/src/main/xmi/coselmar-model.zargo differ 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 390e366..f8c855f 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 @@ -52,6 +52,7 @@ public class DocumentBean implements Serializable { protected Date publicationDate; protected String comment; protected String fileName; + protected String citation; // Document could be internal file or external link protected boolean withFile; @@ -68,7 +69,7 @@ public class DocumentBean implements Serializable { String type, String summary, String language, Date publicationDate, String authors, String license, String copyright, boolean withFile, String mimeType, String externalUrl, - String comment, String fileName) { + String comment, String fileName, String citation) { this.id = id; this.name = name; this.ownerName = ownerName; @@ -100,6 +101,8 @@ public class DocumentBean implements Serializable { this.comment = comment; this.authorizedUsers = new HashSet<>(0); + + this.citation = citation; } public String getId() { @@ -302,4 +305,12 @@ public class DocumentBean implements Serializable { } this.authorizedUsers.add(userBean); } + + public String getCitation() { + return citation; + } + + public void setCitation(String citation) { + this.citation = citation; + } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentSearchBean.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentSearchBean.java index 27daa5d..0fe4745 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentSearchBean.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/beans/DocumentSearchBean.java @@ -53,8 +53,8 @@ public class DocumentSearchBean extends DocumentBean { String type, String summary, String language, Date publicationDate, String authors, String license, String copyright, boolean withFile, String mimeType, String externalUrl, - String comment, String fileName) { - super(id, name, ownerName, ownerId, privacy, depositDate, keywords, type, summary, language, publicationDate, authors, license, copyright, withFile, mimeType, externalUrl, comment, fileName); + String comment, String fileName, String citation) { + super(id, name, ownerName, ownerId, privacy, depositDate, keywords, type, summary, language, publicationDate, authors, license, copyright, withFile, mimeType, externalUrl, comment, fileName, citation); } public Integer getLimit() { 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 defead1..9af8254 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 @@ -95,7 +95,9 @@ public class BeanEntityConverter { document.getMimeType(), document.getExternalUrl(), document.getComment(), - document.getFileName() + document.getFileName(), + + document.getCitation() ); } @@ -351,6 +353,8 @@ public class BeanEntityConverter { document.setComment(documentBean.getComment()); document.setFileName(documentBean.getFileName()); + document.setCitation(documentBean.getCitation()); + return document; } diff --git a/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java b/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java index ee2311b..f1a4cba 100644 --- a/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java +++ b/coselmar-rest/src/test/java/fr/ifremer/coselmar/services/indexation/DocumentsIndexationServiceTest.java @@ -65,7 +65,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Ceci n'est pas un document", "John Doe", "user001", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("document", "test"), "testDocument", "This is not a fake document used for test", "fr", null, "Jack, Jane", - null, null, false, null, "http://somewhere", "no comment", null); + null, null, false, null, "http://somewhere", "no comment", null, null); documentsIndexationService.indexDocument(documentOne); @@ -122,7 +122,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Ceci n'est pas un document", "John Doe", "user001", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("document", "test"), "testDocument", "This is not a fake document used for test", "fr", null, "Jack, Jane", - null, null, false, null, "http://somewhere", "no comment", null); + null, null, false, null, "http://somewhere", "no comment", null, null); documentsIndexationService.indexDocument(documentOne); @@ -147,7 +147,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest new Date(), Lists.newArrayList("test", "update"), "testDocument", // "This is a fake doc updated for test", "fr", null, "James, JJ", "This is a faked doct updated for test", "fr", null, "James, JJ", - null, null, false, null, "http://somewhere", "no comment", null); + null, null, false, null, "http://somewhere", "no comment", null, null); documentsIndexationService.updateDocument(documentOne); @@ -220,7 +220,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Ceci n'est pas un document", "John Doe", "user001", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("document", "test"), "testDocument", "This is not a fake document used for test", "fr", null, "Jack, Jane", - null, null, false, null, "http://somewhere", "no comment", null); + null, null, false, null, "http://somewhere", "no comment", null, null); documentsIndexationService.indexDocument(documentOne); @@ -230,7 +230,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Tardis documentation", "The Doctor", "user003", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("tardis", "documentation", "old", "new", "borrowed", "blue"), "testDocument", "This is part of document about the TARDIS", "fr", null, "The Doctor, Rose, Amy, River, Clara", - null, null, false, null, "http://tardis.wikia.com/wiki/TARDIS", "no comment", null); + null, null, false, null, "http://tardis.wikia.com/wiki/TARDIS", "no comment", null, null); documentsIndexationService.indexDocument(documentTwo); @@ -264,7 +264,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Ceci n'est pas un document", "John Doe", "user001", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("document", "test"), "testDocument", "This is not a fake document used for test", "fr", null, "Jack, Jane", - null, null, false, null, "http://somewhere", "no comment", null); + null, null, false, null, "http://somewhere", "no comment", null, null); documentsIndexationService.indexDocument(documentOne); @@ -272,7 +272,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Another document", "Amy Pond", "user002", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("document", "test", "fish"), "testDocument", "This is just an other document used for test", "fr", null, "Amy, Rory", - null, null, false, null, "http://somewhere", "no comment", null); + null, null, false, null, "http://somewhere", "no comment", null, null); documentsIndexationService.indexDocument(documentTwo); @@ -280,7 +280,7 @@ public class DocumentsIndexationServiceTest extends AbstractCoselmarServiceTest "Tardis documentation", "The Doctor", "user003", Privacy.PUBLIC.name(), new Date(), Lists.newArrayList("tardis", "documentation", "old", "new", "borrowed", "blue"), "testDocument", "This is part of documentation about the TARDIS", "fr", null, "The Doctor, Rose, Amy, River, Clara", - null, null, false, null, "http://tardis.wikia.com/wiki/TARDIS", "no comment", null); + null, null, false, null, "http://tardis.wikia.com/wiki/TARDIS", "no comment", null, null); documentsIndexationService.indexDocument(documentThree); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.