Changeset 19:f0f55ab768c9 in AnnotationManagerN4J for src/main/java/de/mpiwg/itgroup/annotations/restlet
- Timestamp:
- Sep 6, 2012, 5:02:59 PM (13 years ago)
- Branch:
- default
- Location:
- src/main/java/de/mpiwg/itgroup/annotations/restlet
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotationStoreGroups.java
r18 r19 35 35 String id = (String) getRequest().getAttributes().get("id"); 36 36 logger.debug("group-id=" + id); 37 String retString="<html><body>\n<h1>Groups</h1>\n<table>"; 37 String result="<html><body>\n<h1>Groups</h1>\n<table>"; 38 result += "<tr><th>id</th><th>name</th><th>uri</th></tr>"; 38 39 store = getAnnotationStore(); 39 40 if (id == null) { 40 41 // list all groups 41 List<Group> groups = store.getGroups(" *");42 List<Group> groups = store.getGroups("uri", "*"); 42 43 for (Group group : groups) { 43 retString += String.format("<tr><td>uri=%s</td></tr>\n", group.getUri()); 44 String groupLink = group.getId(); 45 result += String.format("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", groupLink, group.getId(), group.getName(), group.getUri()); 44 46 } 45 47 46 48 } 47 re tString+= "</table>\n</body>\n</html>";49 result += "</table>\n</body>\n</html>"; 48 50 49 51 logger.debug("sending:"); 50 logger.debug(re tString);51 return new StringRepresentation(re tString,MediaType.TEXT_HTML);52 logger.debug(result); 53 return new StringRepresentation(result,MediaType.TEXT_HTML); 52 54 } 53 55 54 56 protected AnnotationStore getAnnotationStore() { 55 57 if (store == null) { 56 ServletContext sc = (ServletContext) getContext().getServerDispatcher().getContext().getAttributes() 57 .get("org.restlet.ext.servlet.ServletContext"); 58 logger.debug("Getting AnnotationStore from Context"); 59 store = (AnnotationStore) sc.getAttribute(BaseRestlet.ANNSTORE_KEY); 58 store = ((BaseRestlet) getApplication()).getAnnotationStore(); 60 59 } 61 60 return store; -
src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java
r18 r19 16 16 import java.util.regex.Pattern; 17 17 18 import javax.servlet.ServletContext;19 20 18 import net.oauth.jsontoken.Checker; 21 19 import net.oauth.jsontoken.JsonToken; … … 38 36 import de.mpiwg.itgroup.annotations.Actor; 39 37 import de.mpiwg.itgroup.annotations.Annotation; 40 import de.mpiwg.itgroup.annotations.NS;41 38 import de.mpiwg.itgroup.annotations.Annotation.FragmentTypes; 42 39 import de.mpiwg.itgroup.annotations.Group; 40 import de.mpiwg.itgroup.annotations.NS; 43 41 import de.mpiwg.itgroup.annotations.Person; 44 42 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; … … 62 60 protected AnnotationStore getAnnotationStore() { 63 61 if (store == null) { 64 ServletContext sc = (ServletContext) getContext().getServerDispatcher().getContext().getAttributes() 65 .get("org.restlet.ext.servlet.ServletContext"); 66 logger.debug("Getting AnnotationStore from Context"); 67 store = (AnnotationStore) sc.getAttribute(BaseRestlet.ANNSTORE_KEY); 62 store = ((BaseRestlet) getApplication()).getAnnotationStore(); 68 63 } 69 64 return store; -
src/main/java/de/mpiwg/itgroup/annotations/restlet/BaseRestlet.java
r18 r19 166 166 167 167 /** 168 * @return the store 169 */ 170 public AnnotationStore getAnnotationStore() { 171 return store; 172 } 173 174 /** 168 175 * returns consumer secret for consumer key. returns null if consumer key 169 176 * doesn't exist.
Note: See TracChangeset
for help on using the changeset viewer.