WorkspaceResource extends TransactionalResource { @Timed @GET public List<Map<String, Object>> getWorkspaces(@Auth AuthorizedPrincipal principal, @Context DSLContext create) { return mutate(principal, readOnlyModel -> { Kernel kernel = readOnlyModel.getKernel(); List<Map<String, Object>> workspaces = new ArrayList<>(); for (ExistentialRuleform definingProduct : readOnlyModel.getPhantasmModel() .getChildrenUuid(kernel.getWorkspace() .getId(), kernel.getIsA() .getInverse(), ExistentialDomain.Product)) { Map<String, Object> wsp = new TreeMap<>(); wsp.put("id", UuidUtil.encode(definingProduct.getId())); WorkspaceProperties properties = readOnlyModel.wrap(Workspace.class, definingProduct) .get_Properties(); wsp.put("name", properties.getName()); wsp.put("description", properties.getDescription()); wsp.put("iri", properties.getIri()); wsp.put("version", properties.getVersion()); workspaces.add(wsp); } return workspaces; }, create); } WorkspaceResource();  WorkspaceResource(URLClassLoader executionScope); @SuppressWarnings({ "unchecked", "rawtypes" }) static Map<String, Object> getVariables(Map request); @Timed @GET List<Map<String, Object>> getWorkspaces(@Auth AuthorizedPrincipal principal,
                                                   @Context DSLContext create); @Timed @Path("loadSnapshot") @POST void loadSnapshot(@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create); @Timed @Path("loadWorkspace") @POST String loadWorkspace(@Auth AuthorizedPrincipal principal,
                                @Context HttpServletRequest request,
                                InputStream requestBody,
                                @Context DSLContext create); @Timed @Path("manifest") @POST String manifest(@Auth AuthorizedPrincipal principal,
                           @Context HttpServletRequest request,
                           InputStream requestBody,
                           @Context DSLContext create); @Path("{workspace}") @GET @Produces({ MediaType.TEXT_HTML }) String workspaceGraphIql(@Auth AuthorizedPrincipal principal,
                                    @PathParam("workspace") String workspace); @Path("{workspace}/meta") @GET @Produces({ MediaType.TEXT_HTML }) String workspaceMetaGraphIql(@Auth AuthorizedPrincipal principal,
                                        @PathParam("workspace") String workspace); @Timed @Path("{workspace}") @POST ExecutionResult query(@Auth AuthorizedPrincipal principal,
                                 @PathParam("workspace") String workspace,
                                 @SuppressWarnings("rawtypes") Map request,
                                 @Context DSLContext create); @Timed @Path("{workspace}/meta") @POST ExecutionResult queryMeta(@Auth AuthorizedPrincipal principal,
                                     @PathParam("workspace") String workspace,
                                     @SuppressWarnings("rawtypes") Map request,
                                     @Context DSLContext create); @Timed @Path("{workspace}/serialize") @GET String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                     @PathParam("workspace") String workspace,
                                     @Context DSLContext create); @Timed @Path("snapshot") @GET String snapshot(@Auth AuthorizedPrincipal principal,
                           @Context DSLContext create);  }
@Test public void testWorkspaces() throws Exception { WorkspaceResource resource = new WorkspaceResource(); assertEquals(1, resource.getWorkspaces(model.getCurrentPrincipal(), model.create()) .size()); }