Changeset 19:f0f55ab768c9 in AnnotationManagerN4J for src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotationStoreGroups.java
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;
Note: See TracChangeset
for help on using the changeset viewer.