# HG changeset patch # User casties # Date 1423588277 -3600 # Node ID acd44dfec9c86797bc4e417b80fac1bdf58d1afc # Parent fcb6fe10e08c10a5ebe08995216efd1477441d7e added last update field for annotations in database. diff -r fcb6fe10e08c -r acd44dfec9c8 src/main/java/de/mpiwg/itgroup/annotations/Annotation.java --- a/src/main/java/de/mpiwg/itgroup/annotations/Annotation.java Tue Feb 10 17:45:56 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/Annotation.java Tue Feb 10 18:11:17 2015 +0100 @@ -97,6 +97,11 @@ protected String created; /** + * The last update date of this annotation. + */ + protected String updated; + + /** * The user or group that has admin permissions. * null means any user. */ @@ -373,7 +378,15 @@ this.created = created; } - /** + public String getUpdated() { + return updated; + } + + public void setUpdated(String updated) { + this.updated = updated; + } + + /** * @return the adminPermission */ public Actor getAdminPermission() { diff -r fcb6fe10e08c -r acd44dfec9c8 src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java --- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java Tue Feb 10 17:45:56 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java Tue Feb 10 18:11:17 2015 +0100 @@ -610,10 +610,18 @@ * creation date */ if (annot.getCreated() == null) { - // set creation date + // new - set creation date SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); String ct = format.format(Calendar.getInstance().getTime()); annot.setCreated(ct); + } else { + /* + * update date + */ + // not new - set last update date + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + String ct = format.format(Calendar.getInstance().getTime()); + annot.setUpdated(ct); } /* diff -r fcb6fe10e08c -r acd44dfec9c8 src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java --- a/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java Tue Feb 10 17:45:56 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationResource.java Tue Feb 10 18:11:17 2015 +0100 @@ -64,7 +64,7 @@ @Override protected void doInit() throws ResourceException { super.doInit(); - // id from URI /annotations/persons/{id} + // id from URI /annotations/annotation/{id} requestId = (String) getRequest().getAttributes().get("id"); logger.fine("annoation-id=" + requestId); // get store instance @@ -86,7 +86,7 @@ } /** - * GET with HTML content type. Shows the person. + * GET with HTML content type. Shows the annotation. * * @param entity * @return @@ -120,7 +120,7 @@ result += "\n\n\n"; */ } else { - // output person content + // output content result = "\n

Annotation

\n"; result += String.format("

All annotations

", this.getReference().getParentRef()); result += ""; @@ -131,6 +131,8 @@ result += String.format("\n", annotation.getQuote()); result += String.format("\n", annotation.getResourceUri()); result += String.format("\n", annotation.getCreatorName()); + result += String.format("\n", annotation.getCreated()); + result += String.format("\n", annotation.getUpdated()); result += "
quote%s
resource%s
creator%s
created%s
updated%s
\n"; result += "
\n"; result += "";