Mercurial > hg > AnnotationManagerN4J
changeset 76:4e2dc67997a0
save text quote from Annotator.
author | casties |
---|---|
date | Fri, 06 Jun 2014 09:26:21 +0200 |
parents | 25eb2e1df106 |
children | f2ff7de7b49d |
files | src/main/java/de/mpiwg/itgroup/annotations/Annotation.java src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java |
diffstat | 3 files changed, 36 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/Annotation.java Fri Mar 21 13:32:41 2014 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/Annotation.java Fri Jun 06 09:26:21 2014 +0200 @@ -75,6 +75,10 @@ */ protected FragmentTypes fragmentType; + /** + * The selected text of the annotation target. + */ + protected String quote; /** * The Resource that is annotated e.g. a book. @@ -286,6 +290,20 @@ } /** + * @return the quote + */ + public String getQuote() { + return quote; + } + + /** + * @param quote the quote to set + */ + public void setQuote(String quote) { + this.quote = quote; + } + + /** * @return the resource */ public Resource getResource() {
--- a/src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java Fri Mar 21 13:32:41 2014 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java Fri Jun 06 09:26:21 2014 +0200 @@ -519,6 +519,7 @@ annot.setUri((String) annotNode.getProperty("id", null)); annot.setBodyText((String) annotNode.getProperty("bodyText", null)); annot.setBodyUri((String) annotNode.getProperty("bodyUri", null)); + annot.setQuote((String) annotNode.getProperty("quote", null)); /* * get annotation target and resource from relation */ @@ -701,6 +702,14 @@ if (bodyUri != null) { annotNode.setProperty("bodyUri", bodyUri); } + + /* + * the annotation quote + */ + String quote = annot.getQuote(); + if (quote != null) { + annotNode.setProperty("quote", quote); + } /* * the annotation target
--- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java Fri Mar 21 13:32:41 2014 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java Fri Jun 06 09:26:21 2014 +0200 @@ -226,6 +226,9 @@ if (annot.getResourceUri() != null) { jo.put("resource", annot.getResourceUri()); } + if (annot.getQuote() != null) { + jo.put("quote", annot.getQuote()); + } /* * user @@ -508,6 +511,12 @@ annot.setBodyText(jo.getString("text")); } /* + * annotation quote + */ + if (jo.has("quote")) { + annot.setQuote(jo.getString("quote")); + } + /* * check authentication */ String authUser = checkAuthToken(entity);