test_class.file: phantasm-at-rest/src/test/java/com/chiralbehaviors/CoRE/phantasm/resources/WorkspaceResourceTest.java
test_class.identifier: WorkspaceResourceTest
test_class.superclass: extends AbstractModelTest
test_case.body: @Test
      public void testSerializeWorkspace() throws Exception {
          WorkspaceResource resource = new WorkspaceResource();
          String serialized = resource.serializeWorkspace(null,
                                                          WellKnownObject.KERNEL_IRI,
                                                          model.create());
          assertNotNull(serialized);
      }
test_case.class_method_signature: WorkspaceResourceTest.testSerializeWorkspace()
test_case.full_signature: @Test public void testSerializeWorkspace()
test_case.identifier: testSerializeWorkspace
test_case.invocations: serializeWorkspace create assertNotNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSerializeWorkspace()
focal_class.declarator: log       = LoggerFactory.getLogger(WorkspaceResource.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log       = LoggerFactory.getLogger(WorkspaceResource.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: QUERY     = "query"
focal_class.modifier: static final
focal_class.original_string: static final String         QUERY     = "query";
focal_class.type: String
focal_class.var_name: QUERY
focal_class.declarator: VARIABLES = "variables"
focal_class.modifier: static final
focal_class.original_string: static final String         VARIABLES = "variables";
focal_class.type: String
focal_class.var_name: VARIABLES
focal_class.declarator: cache = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<UUID, GraphQLSchema> cache = new ConcurrentHashMap<>();
focal_class.type: ConcurrentMap<UUID, GraphQLSchema>
focal_class.var_name: cache
focal_class.declarator: executionScope
focal_class.modifier: private final
focal_class.original_string: private final URLClassLoader                     executionScope;
focal_class.type: URLClassLoader
focal_class.var_name: executionScope
focal_class.declarator: metaSchema
focal_class.modifier: private final
focal_class.original_string: private final GraphQLSchema                      metaSchema;
focal_class.type: GraphQLSchema
focal_class.var_name: metaSchema
focal_class.declarator: objectMapper
focal_class.modifier: private final
focal_class.original_string: private final ObjectMapper                       objectMapper;
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: reflections
focal_class.modifier: private final
focal_class.original_string: private final Reflections                        reflections;
focal_class.type: Reflections
focal_class.var_name: reflections
focal_class.file: phantasm-at-rest/src/main/java/com/chiralbehaviors/CoRE/phantasm/resources/WorkspaceResource.java
focal_class.identifier: WorkspaceResource
focal_class.class_method_signature: WorkspaceResource.getVariables(Map request)
focal_class.full_signature: @SuppressWarnings({ "unchecked", "rawtypes" }) public static Map<String, Object> getVariables(Map request)
focal_class.identifier: getVariables
focal_class.modifiers: @SuppressWarnings({ "unchecked", "rawtypes" }) public static
focal_class.parameters: (Map request)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> getVariables(Map request)
focal_class.class_method_signature: WorkspaceResource.WorkspaceResource()
focal_class.full_signature: public  WorkspaceResource()
focal_class.identifier: WorkspaceResource
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  WorkspaceResource()
focal_class.class_method_signature: WorkspaceResource.WorkspaceResource(URLClassLoader executionScope)
focal_class.full_signature: public  WorkspaceResource(URLClassLoader executionScope)
focal_class.identifier: WorkspaceResource
focal_class.modifiers: public
focal_class.parameters: (URLClassLoader executionScope)
focal_class.signature:  WorkspaceResource(URLClassLoader executionScope)
focal_class.class_method_signature: WorkspaceResource.getWorkspaces(@Auth AuthorizedPrincipal principal,
                                                     @Context DSLContext create)
focal_class.full_signature: @Timed @GET public List<Map<String, Object>> getWorkspaces(@Auth AuthorizedPrincipal principal,
                                                     @Context DSLContext create)
focal_class.identifier: getWorkspaces
focal_class.modifiers: @Timed @GET public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                                     @Context DSLContext create)
focal_class.return: List<Map<String, Object>>
focal_class.signature: List<Map<String, Object>> getWorkspaces(@Auth AuthorizedPrincipal principal,
                                                     @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.loadSnapshot(@Auth AuthorizedPrincipal principal,
                               @Context HttpServletRequest request,
                               InputStream requestBody,
                               @Context DSLContext create)
focal_class.full_signature: @Timed @Path("loadSnapshot") @POST public void loadSnapshot(@Auth AuthorizedPrincipal principal,
                               @Context HttpServletRequest request,
                               InputStream requestBody,
                               @Context DSLContext create)
focal_class.identifier: loadSnapshot
focal_class.modifiers: @Timed @Path("loadSnapshot") @POST public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                               @Context HttpServletRequest request,
                               InputStream requestBody,
                               @Context DSLContext create)
focal_class.return: void
focal_class.signature: void loadSnapshot(@Auth AuthorizedPrincipal principal,
                               @Context HttpServletRequest request,
                               InputStream requestBody,
                               @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.loadWorkspace(@Auth AuthorizedPrincipal principal,
                                  @Context HttpServletRequest request,
                                  InputStream requestBody,
                                  @Context DSLContext create)
focal_class.full_signature: @Timed @Path("loadWorkspace") @POST public String loadWorkspace(@Auth AuthorizedPrincipal principal,
                                  @Context HttpServletRequest request,
                                  InputStream requestBody,
                                  @Context DSLContext create)
focal_class.identifier: loadWorkspace
focal_class.modifiers: @Timed @Path("loadWorkspace") @POST public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                  @Context HttpServletRequest request,
                                  InputStream requestBody,
                                  @Context DSLContext create)
focal_class.return: String
focal_class.signature: String loadWorkspace(@Auth AuthorizedPrincipal principal,
                                  @Context HttpServletRequest request,
                                  InputStream requestBody,
                                  @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.manifest(@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create)
focal_class.full_signature: @Timed @Path("manifest") @POST public String manifest(@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create)
focal_class.identifier: manifest
focal_class.modifiers: @Timed @Path("manifest") @POST public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create)
focal_class.return: String
focal_class.signature: String manifest(@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.workspaceGraphIql(@Auth AuthorizedPrincipal principal,
                                      @PathParam("workspace") String workspace)
focal_class.full_signature: @Path("{workspace}") @GET @Produces({ MediaType.TEXT_HTML }) public String workspaceGraphIql(@Auth AuthorizedPrincipal principal,
                                      @PathParam("workspace") String workspace)
focal_class.identifier: workspaceGraphIql
focal_class.modifiers: @Path("{workspace}") @GET @Produces({ MediaType.TEXT_HTML }) public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                      @PathParam("workspace") String workspace)
focal_class.return: String
focal_class.signature: String workspaceGraphIql(@Auth AuthorizedPrincipal principal,
                                      @PathParam("workspace") String workspace)
focal_class.class_method_signature: WorkspaceResource.workspaceMetaGraphIql(@Auth AuthorizedPrincipal principal,
                                          @PathParam("workspace") String workspace)
focal_class.full_signature: @Path("{workspace}/meta") @GET @Produces({ MediaType.TEXT_HTML }) public String workspaceMetaGraphIql(@Auth AuthorizedPrincipal principal,
                                          @PathParam("workspace") String workspace)
focal_class.identifier: workspaceMetaGraphIql
focal_class.modifiers: @Path("{workspace}/meta") @GET @Produces({ MediaType.TEXT_HTML }) public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                          @PathParam("workspace") String workspace)
focal_class.return: String
focal_class.signature: String workspaceMetaGraphIql(@Auth AuthorizedPrincipal principal,
                                          @PathParam("workspace") String workspace)
focal_class.class_method_signature: WorkspaceResource.query(@Auth AuthorizedPrincipal principal,
                                   @PathParam("workspace") String workspace,
                                   @SuppressWarnings("rawtypes") Map request,
                                   @Context DSLContext create)
focal_class.full_signature: @Timed @Path("{workspace}") @POST public ExecutionResult query(@Auth AuthorizedPrincipal principal,
                                   @PathParam("workspace") String workspace,
                                   @SuppressWarnings("rawtypes") Map request,
                                   @Context DSLContext create)
focal_class.identifier: query
focal_class.modifiers: @Timed @Path("{workspace}") @POST public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                   @PathParam("workspace") String workspace,
                                   @SuppressWarnings("rawtypes") Map request,
                                   @Context DSLContext create)
focal_class.return: ExecutionResult
focal_class.signature: ExecutionResult query(@Auth AuthorizedPrincipal principal,
                                   @PathParam("workspace") String workspace,
                                   @SuppressWarnings("rawtypes") Map request,
                                   @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.uuidFrom(String encoded)
focal_class.full_signature: private UUID uuidFrom(String encoded)
focal_class.identifier: uuidFrom
focal_class.modifiers: private
focal_class.parameters: (String encoded)
focal_class.return: UUID
focal_class.signature: UUID uuidFrom(String encoded)
focal_class.class_method_signature: WorkspaceResource.queryMeta(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @SuppressWarnings("rawtypes") Map request,
                                       @Context DSLContext create)
focal_class.full_signature: @Timed @Path("{workspace}/meta") @POST public ExecutionResult queryMeta(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @SuppressWarnings("rawtypes") Map request,
                                       @Context DSLContext create)
focal_class.identifier: queryMeta
focal_class.modifiers: @Timed @Path("{workspace}/meta") @POST public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @SuppressWarnings("rawtypes") Map request,
                                       @Context DSLContext create)
focal_class.return: ExecutionResult
focal_class.signature: ExecutionResult queryMeta(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @SuppressWarnings("rawtypes") Map request,
                                       @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_class.full_signature: @Timed @Path("{workspace}/serialize") @GET public String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_class.identifier: serializeWorkspace
focal_class.modifiers: @Timed @Path("{workspace}/serialize") @GET public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_class.return: String
focal_class.signature: String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.snapshot(@Auth AuthorizedPrincipal principal,
                             @Context DSLContext create)
focal_class.full_signature: @Timed @Path("snapshot") @GET public String snapshot(@Auth AuthorizedPrincipal principal,
                             @Context DSLContext create)
focal_class.identifier: snapshot
focal_class.modifiers: @Timed @Path("snapshot") @GET public
focal_class.parameters: (@Auth AuthorizedPrincipal principal,
                             @Context DSLContext create)
focal_class.return: String
focal_class.signature: String snapshot(@Auth AuthorizedPrincipal principal,
                             @Context DSLContext create)
focal_class.class_method_signature: WorkspaceResource.execute(GraphQLSchema schema, PhantasmContext crud,
                                      String query,
                                      Map<String, Object> variables)
focal_class.full_signature: private ExecutionResult execute(GraphQLSchema schema, PhantasmContext crud,
                                      String query,
                                      Map<String, Object> variables)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (GraphQLSchema schema, PhantasmContext crud,
                                      String query,
                                      Map<String, Object> variables)
focal_class.return: ExecutionResult
focal_class.signature: ExecutionResult execute(GraphQLSchema schema, PhantasmContext crud,
                                      String query,
                                      Map<String, Object> variables)
focal_class.superclass: extends TransactionalResource
focal_method.body: @Timed
      @Path("{workspace}/serialize")
      @GET
      public String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create) {
          return readOnly(principal, model -> {
              Agency p = model.getCurrentPrincipal()
                              .getPrincipal();
              UUID uuid = WorkspaceAccessor.uuidOf(workspace);
              Product definingProduct = model.records()
                                             .resolve(uuid);
              WorkspaceSnapshot snapshot = new WorkspaceSnapshot(definingProduct,
                                                                 model.create());
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              try {
                  snapshot.serializeTo(baos);
              } catch (Exception e) {
                  log.info(String.format("Failed serializing workspace snapshot by: %s:%s",
                                         p.getName(), p.getId()),
                           e);
                  throw new WebApplicationException(String.format("Failed serializing workspace snapshot: %s",
                                                                  e.getMessage()),
                                                    Status.BAD_REQUEST);
              }
              return baos.toString();
          }, create);
      }
focal_method.class_method_signature: WorkspaceResource.serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_method.full_signature: @Timed @Path("{workspace}/serialize") @GET public String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_method.identifier: serializeWorkspace
focal_method.invocations: readOnly getPrincipal getCurrentPrincipal uuidOf resolve records create serializeTo info format getName getId format getMessage toString
focal_method.modifiers: @Timed @Path("{workspace}/serialize") @GET public
focal_method.parameters: (@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)
focal_method.return: String
focal_method.signature: String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                       @PathParam("workspace") String workspace,
                                       @Context DSLContext create)