Ignore:
Timestamp:
Sep 6, 2012, 5:02:59 PM (12 years ago)
Author:
casties
Branch:
default
Message:

more work on HTML UI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotationStoreGroups.java

    r18 r19  
    3535        String id = (String) getRequest().getAttributes().get("id");
    3636        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>";
    3839        store = getAnnotationStore();
    3940        if (id == null) {
    4041            // list all groups
    41             List<Group> groups = store.getGroups("*");
     42            List<Group> groups = store.getGroups("uri", "*");
    4243            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());
    4446            }
    4547           
    4648        }
    47         retString += "</table>\n</body>\n</html>";
     49        result += "</table>\n</body>\n</html>";
    4850       
    4951        logger.debug("sending:");
    50         logger.debug(retString);
    51         return new StringRepresentation(retString,MediaType.TEXT_HTML);
     52        logger.debug(result);
     53        return new StringRepresentation(result,MediaType.TEXT_HTML);
    5254    }
    5355
    5456    protected AnnotationStore getAnnotationStore() {
    5557        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();
    6059        }
    6160        return store;
Note: See TracChangeset for help on using the changeset viewer.