test_class.declarator: objectMapper = new ObjectMapper()
test_class.modifier: protected
test_class.original_string: protected ObjectMapper objectMapper = new ObjectMapper();
test_class.type: ObjectMapper
test_class.var_name: objectMapper
test_class.file: modules/flowable-rest/src/test/java/org/flowable/rest/service/api/form/FormDataResourceTest.java
test_class.identifier: FormDataResourceTest
test_class.superclass: extends BaseSpringRestTestCase
test_case.body: @Test
      @Deployment
      public void testGetFormData() throws Exception {
          Map<String, Object> variableMap = new HashMap<>();
          variableMap.put("SpeakerName", "John Doe");
          Address address = new Address();
          variableMap.put("address", address);
          ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", variableMap);
          Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  
          CloseableHttpResponse response = executeRequest(
                  new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_FORM_DATA) + "?taskId=" + task.getId()), HttpStatus.SC_OK);
  
          // Check resulting task
          JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
          closeResponse(response);
  
          assertThatJson(responseNode)
                  .when(Option.IGNORING_EXTRA_FIELDS, Option.IGNORING_ARRAY_ORDER)
                  .isEqualTo("{"
                          + "formProperties: [ {"
                          + "  id: 'room',"
                          + "  name: null,"
                          + "  type: null,"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false"
                          + "},"
                          + "{"
                          + "  id: 'duration',"
                          + "  name: null,"
                          + "  type: 'long',"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false"
                          + "},"
                          + "{"
                          + "  id: 'speaker',"
                          + "  name: null,"
                          + "  type: null,"
                          + "  value: 'John Doe',"
                          + "  readable: true,"
                          + "  writable: false,"
                          + "  required: false"
                          + "},"
                          + "{"
                          + "  id: 'street',"
                          + "  name: null,"
                          + "  type: null,"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: true"
                          + "},"
                          + "{"
                          + "  id: 'start',"
                          + "  name: null,"
                          + "  type: 'date',"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false,"
                          + "  datePattern: 'dd-MMM-yyyy'"
                          + "},"
                          + "{"
                          + "  id: 'end',"
                          + "  name: 'End',"
                          + "  type: 'date',"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false,"
                          + "  datePattern: 'dd/MM/yyyy'"
                          + "},"
                          + "{"
                          + "id: 'direction',"
                          + "  name: null,"
                          + "  type: 'enum',"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false,"
                          + "  datePattern: null,"
                          + "  enumValues: [ {"
                          + "    id: 'left',"
                          + "    name: 'Go Left'"
                          + "  },"
                          + "  {"
                          + "    id: 'right',"
                          + "    name: 'Go Right'"
                          + "  },"
                          + "  {"
                          + "    id: 'up',"
                          + "    name: 'Go Up'"
                          + "  },"
                          + "  {"
                          + "    id: 'down',"
                          + "    name: 'Go Down'"
                          + "   } ]"
                          + "} ]"
                          + "}"
                  );
  
          response = executeRequest(new HttpGet(
                          SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_FORM_DATA) + "?processDefinitionId=" + processInstance
                                  .getProcessDefinitionId()),
                  HttpStatus.SC_OK);
  
          // Check resulting task
          responseNode = objectMapper.readTree(response.getEntity().getContent());
          closeResponse(response);
  
          assertThatJson(responseNode)
                  .when(Option.IGNORING_EXTRA_FIELDS, Option.IGNORING_ARRAY_ORDER)
                  .isEqualTo("{"
                          + "formProperties: [ {"
                          + "  id: 'number',"
                          + "  name: 'Number',"
                          + "  type: 'long',"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false"
                          + "},"
                          + "{"
                          + "  id: 'description',"
                          + "  name: 'Description',"
                          + "  type: null,"
                          + "  value: null,"
                          + "  readable: true,"
                          + "  writable: true,"
                          + "  required: false"
                          + "} ]"
                          + "}"
                  );
  
          closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_FORM_DATA) + "?processDefinitionId=123"),
                  HttpStatus.SC_NOT_FOUND));
  
          closeResponse(executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_FORM_DATA) + "?processDefinitionId2=123"),
                  HttpStatus.SC_BAD_REQUEST));
      }
test_case.class_method_signature: FormDataResourceTest.testGetFormData()
test_case.full_signature: @Test @Deployment public void testGetFormData()
test_case.identifier: testGetFormData
test_case.invocations: put put startProcessInstanceByKey singleResult processInstanceId createTaskQuery getId executeRequest createRelativeResourceUrl getId readTree getContent getEntity closeResponse isEqualTo when assertThatJson executeRequest createRelativeResourceUrl getProcessDefinitionId readTree getContent getEntity closeResponse isEqualTo when assertThatJson closeResponse executeRequest createRelativeResourceUrl closeResponse executeRequest createRelativeResourceUrl
test_case.modifiers: @Test @Deployment public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetFormData()
focal_class.declarator: restResponseFactory
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected RestResponseFactory restResponseFactory;
focal_class.type: RestResponseFactory
focal_class.var_name: restResponseFactory
focal_class.declarator: formService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected FormService formService;
focal_class.type: FormService
focal_class.var_name: formService
focal_class.declarator: restApiInterceptor
focal_class.modifier: @Autowired(required=false)
      protected
focal_class.original_string: @Autowired(required=false)
      protected BpmnRestApiInterceptor restApiInterceptor;
focal_class.type: BpmnRestApiInterceptor
focal_class.var_name: restApiInterceptor
focal_class.file: modules/flowable-rest/src/main/java/org/flowable/rest/service/api/form/FormDataResource.java
focal_class.identifier: FormDataResource
focal_class.class_method_signature: FormDataResource.getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_class.full_signature: @ApiOperation(value = "Get form data", tags = { "Forms" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates that form data could be queried."), @ApiResponse(code = 404, message = "Indicates that form data could not be found.") }) @GetMapping(value = "/form/form-data", produces = "application/json") public FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_class.identifier: getFormData
focal_class.modifiers: @ApiOperation(value = "Get form data", tags = { "Forms" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates that form data could be queried."), @ApiResponse(code = 404, message = "Indicates that form data could not be found.") }) @GetMapping(value = "/form/form-data", produces = "application/json") public
focal_class.parameters: (@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_class.return: FormDataResponse
focal_class.signature: FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_class.class_method_signature: FormDataResource.submitForm(@RequestBody SubmitFormRequest submitRequest, HttpServletRequest request, HttpServletResponse response)
focal_class.full_signature: @ApiOperation(value = "Submit task form data", tags = { "Forms" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates request was successful and the form data was submitted"), @ApiResponse(code = 204, message = "If TaskId has been provided, Indicates request was successful and the form data was submitted. Returns empty"), @ApiResponse(code = 400, message = "Indicates an parameter was passed in the wrong format. The status-message contains additional information.") }) @PostMapping(value = "/form/form-data", produces = "application/json") public ProcessInstanceResponse submitForm(@RequestBody SubmitFormRequest submitRequest, HttpServletRequest request, HttpServletResponse response)
focal_class.identifier: submitForm
focal_class.modifiers: @ApiOperation(value = "Submit task form data", tags = { "Forms" }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates request was successful and the form data was submitted"), @ApiResponse(code = 204, message = "If TaskId has been provided, Indicates request was successful and the form data was submitted. Returns empty"), @ApiResponse(code = 400, message = "Indicates an parameter was passed in the wrong format. The status-message contains additional information.") }) @PostMapping(value = "/form/form-data", produces = "application/json") public
focal_class.parameters: (@RequestBody SubmitFormRequest submitRequest, HttpServletRequest request, HttpServletResponse response)
focal_class.return: ProcessInstanceResponse
focal_class.signature: ProcessInstanceResponse submitForm(@RequestBody SubmitFormRequest submitRequest, HttpServletRequest request, HttpServletResponse response)
focal_method.body: @ApiOperation(value = "Get form data", tags = { "Forms" }, notes = "")
      @ApiResponses(value = {
              @ApiResponse(code = 200, message = "Indicates that form data could be queried."),
              @ApiResponse(code = 404, message = "Indicates that form data could not be found.") })
      @GetMapping(value = "/form/form-data", produces = "application/json")
      public FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request) {
  
          if (taskId == null && processDefinitionId == null) {
              throw new FlowableIllegalArgumentException("The taskId or processDefinitionId parameter has to be provided");
          }
  
          if (taskId != null && processDefinitionId != null) {
              throw new FlowableIllegalArgumentException("Not both a taskId and a processDefinitionId parameter can be provided");
          }
  
          FormData formData = null;
          String id = null;
          if (taskId != null) {
              formData = formService.getTaskFormData(taskId);
              id = taskId;
          } else {
              formData = formService.getStartFormData(processDefinitionId);
              id = processDefinitionId;
          }
  
          if (formData == null) {
              throw new FlowableObjectNotFoundException("Could not find a form data with id '" + id + "'.", FormData.class);
          }
          
          if (restApiInterceptor != null) {
              restApiInterceptor.accessFormData(formData);
          }
  
          return restResponseFactory.createFormDataResponse(formData);
      }
focal_method.class_method_signature: FormDataResource.getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_method.full_signature: @ApiOperation(value = "Get form data", tags = { "Forms" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates that form data could be queried."), @ApiResponse(code = 404, message = "Indicates that form data could not be found.") }) @GetMapping(value = "/form/form-data", produces = "application/json") public FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_method.identifier: getFormData
focal_method.invocations: getTaskFormData getStartFormData accessFormData createFormDataResponse
focal_method.modifiers: @ApiOperation(value = "Get form data", tags = { "Forms" }, notes = "") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates that form data could be queried."), @ApiResponse(code = 404, message = "Indicates that form data could not be found.") }) @GetMapping(value = "/form/form-data", produces = "application/json") public
focal_method.parameters: (@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)
focal_method.return: FormDataResponse
focal_method.signature: FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId,
              @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId, HttpServletRequest request)