test_class.declarator: contentType =
        new MediaType(
            MediaType.APPLICATION_JSON.getType(),
            MediaType.APPLICATION_JSON.getSubtype(),
            Charset.forName("utf8"))
test_class.modifier: private
test_class.original_string: private MediaType contentType =
        new MediaType(
            MediaType.APPLICATION_JSON.getType(),
            MediaType.APPLICATION_JSON.getSubtype(),
            Charset.forName("utf8"));
test_class.type: MediaType
test_class.var_name: contentType
test_class.declarator: mockMvc
test_class.modifier: private
test_class.original_string: private MockMvc mockMvc;
test_class.type: MockMvc
test_class.var_name: mockMvc
test_class.declarator: mappingJackson2HttpMessageConverter
test_class.modifier: private
test_class.original_string: private HttpMessageConverter<?> mappingJackson2HttpMessageConverter;
test_class.type: HttpMessageConverter<?>
test_class.var_name: mappingJackson2HttpMessageConverter
test_class.declarator: TEST_DEFAULT_SPACE = "public"
test_class.modifier: public static final
test_class.original_string: public static final String TEST_DEFAULT_SPACE = "public";
test_class.type: String
test_class.var_name: TEST_DEFAULT_SPACE
test_class.declarator: TEST_DEFAULT_TENANT = "default"
test_class.modifier: public static final
test_class.original_string: public static final String TEST_DEFAULT_TENANT = "default";
test_class.type: String
test_class.var_name: TEST_DEFAULT_TENANT
test_class.declarator: spaceRepository
test_class.modifier: @Autowired private
test_class.original_string: @Autowired private SpaceRepository spaceRepository;
test_class.type: SpaceRepository
test_class.var_name: spaceRepository
test_class.declarator: tenantRepository
test_class.modifier: @Autowired private
test_class.original_string: @Autowired private TenantRepository tenantRepository;
test_class.type: TenantRepository
test_class.var_name: tenantRepository
test_class.declarator: webApplicationContext
test_class.modifier: @Autowired private
test_class.original_string: @Autowired private WebApplicationContext webApplicationContext;
test_class.type: WebApplicationContext
test_class.var_name: webApplicationContext
test_class.file: rest-backend/src/test/java/org/eclipse/steady/backend/rest/SpaceControllerTest.java
test_class.identifier: SpaceControllerTest
test_case.body: @Test
    public void testReadOnlySpace() throws Exception {
      assertEquals(0, this.spaceRepository.count());
      final Tenant d_tenant = this.createDefaultTenant();
      final Space d_space = this.createSpace(d_tenant, TEST_DEFAULT_SPACE, true);
      assertEquals(1, this.spaceRepository.count());
  
      // Change to read-only (should work)
      d_space.setReadOnly(true);
      MockHttpServletRequestBuilder post_builder =
          put("/spaces/" + d_space.getSpaceToken())
              .content(JacksonUtil.asJsonString(d_space))
              .contentType(MediaType.APPLICATION_JSON)
              .header(Constants.HTTP_TENANT_HEADER, d_tenant.getTenantToken())
              .accept(MediaType.APPLICATION_JSON);
      mockMvc
          .perform(post_builder)
          .andExpect(status().isOk())
          .andExpect(content().contentType(contentType))
          .andExpect(jsonPath("$.default", is(true)))
          .andExpect(jsonPath("$.spaceName", is(TEST_DEFAULT_SPACE)));
  
      // Change to read-write (should fail)
      d_space.setReadOnly(false);
      post_builder =
          put("/spaces/" + d_space.getSpaceToken())
              .content(JacksonUtil.asJsonString(d_space))
              .contentType(MediaType.APPLICATION_JSON)
              .header(Constants.HTTP_TENANT_HEADER, d_tenant.getTenantToken())
              .accept(MediaType.APPLICATION_JSON);
      mockMvc.perform(post_builder).andExpect(status().isBadRequest());
    }
test_case.class_method_signature: SpaceControllerTest.testReadOnlySpace()
test_case.full_signature: @Test public void testReadOnlySpace()
test_case.identifier: testReadOnlySpace
test_case.invocations: assertEquals count createDefaultTenant createSpace assertEquals count setReadOnly accept header contentType content put getSpaceToken asJsonString getTenantToken andExpect andExpect andExpect andExpect perform isOk status contentType content jsonPath is jsonPath is setReadOnly accept header contentType content put getSpaceToken asJsonString getTenantToken andExpect perform isBadRequest status
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReadOnlySpace()
focal_class.declarator: log = LoggerFactory.getLogger(SpaceController.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger log = LoggerFactory.getLogger(SpaceController.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: SPACE_DO_NOT_DELETE = "vulas.backend.space.doNotDelete"
focal_class.modifier: private static
focal_class.original_string: private static String SPACE_DO_NOT_DELETE = "vulas.backend.space.doNotDelete";
focal_class.type: String
focal_class.var_name: SPACE_DO_NOT_DELETE
focal_class.declarator: SPACE_DO_NOT_CLEAN = "vulas.backend.space.doNotClean"
focal_class.modifier: private static
focal_class.original_string: private static String SPACE_DO_NOT_CLEAN = "vulas.backend.space.doNotClean";
focal_class.type: String
focal_class.var_name: SPACE_DO_NOT_CLEAN
focal_class.declarator: SPACE_DO_NOT_MODIFY = "vulas.backend.space.doNotModify"
focal_class.modifier: private static
focal_class.original_string: private static String SPACE_DO_NOT_MODIFY = "vulas.backend.space.doNotModify";
focal_class.type: String
focal_class.var_name: SPACE_DO_NOT_MODIFY
focal_class.declarator: spaceRepository
focal_class.modifier: private
focal_class.original_string: private SpaceRepository spaceRepository;
focal_class.type: SpaceRepository
focal_class.var_name: spaceRepository
focal_class.declarator: tenantRepository
focal_class.modifier: private
focal_class.original_string: private TenantRepository tenantRepository;
focal_class.type: TenantRepository
focal_class.var_name: tenantRepository
focal_class.declarator: appRepository
focal_class.modifier: private
focal_class.original_string: private ApplicationRepository appRepository;
focal_class.type: ApplicationRepository
focal_class.var_name: appRepository
focal_class.declarator: appExporter
focal_class.modifier: private final
focal_class.original_string: private final ApplicationExporter appExporter;
focal_class.type: ApplicationExporter
focal_class.var_name: appExporter
focal_class.declarator: cacheFilter
focal_class.modifier: private final
focal_class.original_string: private final Filter cacheFilter;
focal_class.type: Filter
focal_class.var_name: cacheFilter
focal_class.file: rest-backend/src/main/java/org/eclipse/steady/backend/rest/SpaceController.java
focal_class.identifier: SpaceController
focal_class.class_method_signature: SpaceController.SpaceController(
        TenantRepository tenantRepository,
        SpaceRepository spaceRepository,
        ApplicationRepository appRepository,
        ApplicationExporter appExporter,
        Filter cacheFilter)
focal_class.full_signature: @Autowired  SpaceController(
        TenantRepository tenantRepository,
        SpaceRepository spaceRepository,
        ApplicationRepository appRepository,
        ApplicationExporter appExporter,
        Filter cacheFilter)
focal_class.identifier: SpaceController
focal_class.modifiers: @Autowired
focal_class.parameters: (
        TenantRepository tenantRepository,
        SpaceRepository spaceRepository,
        ApplicationRepository appRepository,
        ApplicationExporter appExporter,
        Filter cacheFilter)
focal_class.signature:  SpaceController(
        TenantRepository tenantRepository,
        SpaceRepository spaceRepository,
        ApplicationRepository appRepository,
        ApplicationExporter appExporter,
        Filter cacheFilter)
focal_class.class_method_signature: SpaceController.getAllSpaces(
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping( value = "", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) public ResponseEntity<Collection<Space>> getAllSpaces(
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: getAllSpaces
focal_class.modifiers: @RequestMapping( value = "", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) public
focal_class.parameters: (
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Collection<Space>>
focal_class.signature: ResponseEntity<Collection<Space>> getAllSpaces(
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.getDefaultSpace(
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping( value = "default", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) public ResponseEntity<Space> getDefaultSpace(
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: getDefaultSpace
focal_class.modifiers: @RequestMapping( value = "default", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) public
focal_class.parameters: (
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> getDefaultSpace(
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.searchSpaces(
        @RequestParam(value = "propertyName", required = true) String propertyName,
        @RequestParam(value = "mode", required = false, defaultValue = "EQUALS") ComparisonMode mode,
        @RequestParam(value = "caseSensitivity", required = false, defaultValue = "CASE_SENSITIVE")
            CaseSensitivity caseSensitivity,
        @RequestParam(value = "value", required = true) String[] value,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping( value = "search", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) public ResponseEntity<List<Space>> searchSpaces(
        @RequestParam(value = "propertyName", required = true) String propertyName,
        @RequestParam(value = "mode", required = false, defaultValue = "EQUALS") ComparisonMode mode,
        @RequestParam(value = "caseSensitivity", required = false, defaultValue = "CASE_SENSITIVE")
            CaseSensitivity caseSensitivity,
        @RequestParam(value = "value", required = true) String[] value,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: searchSpaces
focal_class.modifiers: @RequestMapping( value = "search", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"}) public
focal_class.parameters: (
        @RequestParam(value = "propertyName", required = true) String propertyName,
        @RequestParam(value = "mode", required = false, defaultValue = "EQUALS") ComparisonMode mode,
        @RequestParam(value = "caseSensitivity", required = false, defaultValue = "CASE_SENSITIVE")
            CaseSensitivity caseSensitivity,
        @RequestParam(value = "value", required = true) String[] value,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<List<Space>>
focal_class.signature: ResponseEntity<List<Space>> searchSpaces(
        @RequestParam(value = "propertyName", required = true) String propertyName,
        @RequestParam(value = "mode", required = false, defaultValue = "EQUALS") ComparisonMode mode,
        @RequestParam(value = "caseSensitivity", required = false, defaultValue = "CASE_SENSITIVE")
            CaseSensitivity caseSensitivity,
        @RequestParam(value = "value", required = true) String[] value,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.isSpaceExisting(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping(value = "/{token:.+}", method = RequestMethod.OPTIONS) public ResponseEntity<Space> isSpaceExisting(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: isSpaceExisting
focal_class.modifiers: @RequestMapping(value = "/{token:.+}", method = RequestMethod.OPTIONS) public
focal_class.parameters: (
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> isSpaceExisting(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.getSpace(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping(value = "/{token:.+}", method = RequestMethod.GET) public ResponseEntity<Space> getSpace(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: getSpace
focal_class.modifiers: @RequestMapping(value = "/{token:.+}", method = RequestMethod.GET) public
focal_class.parameters: (
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> getSpace(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping( value = "", method = RequestMethod.POST, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"}) public ResponseEntity<Space> createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: createSpace
focal_class.modifiers: @RequestMapping( value = "", method = RequestMethod.POST, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"}) public
focal_class.parameters: (
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.modifySpace(
        @PathVariable String token,
        @RequestBody Space new_space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping( value = "/{token:.+}", method = RequestMethod.PUT, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"}) public ResponseEntity<Space> modifySpace(
        @PathVariable String token,
        @RequestBody Space new_space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: modifySpace
focal_class.modifiers: @RequestMapping( value = "/{token:.+}", method = RequestMethod.PUT, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"}) public
focal_class.parameters: (
        @PathVariable String token,
        @RequestBody Space new_space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> modifySpace(
        @PathVariable String token,
        @RequestBody Space new_space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.cleanSpace(
        @PathVariable String token,
        @RequestParam(value = "clean", required = true) Boolean clean,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping(value = "/{token:.+}", method = RequestMethod.POST) public ResponseEntity<Space> cleanSpace(
        @PathVariable String token,
        @RequestParam(value = "clean", required = true) Boolean clean,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: cleanSpace
focal_class.modifiers: @RequestMapping(value = "/{token:.+}", method = RequestMethod.POST) public
focal_class.parameters: (
        @PathVariable String token,
        @RequestParam(value = "clean", required = true) Boolean clean,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> cleanSpace(
        @PathVariable String token,
        @RequestParam(value = "clean", required = true) Boolean clean,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.deleteSpace(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.full_signature: @RequestMapping(value = "/{token:.+}", method = RequestMethod.DELETE) public ResponseEntity<Space> deleteSpace(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.identifier: deleteSpace
focal_class.modifiers: @RequestMapping(value = "/{token:.+}", method = RequestMethod.DELETE) public
focal_class.parameters: (
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.return: ResponseEntity<Space>
focal_class.signature: ResponseEntity<Space> deleteSpace(
        @PathVariable String token,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_class.class_method_signature: SpaceController.getApplications(
        @PathVariable String token,
        @RequestParam(value = "includeSpaceProperties", required = false, defaultValue = "")
            final String[] includeSpaceProperties,
        @RequestParam(value = "includeGoalConfiguration", required = false, defaultValue = "")
            final String[] includeGoalConfiguration,
        @RequestParam(value = "includeGoalSystemInfo", required = false, defaultValue = "")
            final String[] includeGoalSystemInfo,
        @RequestParam(value = "includeBugs", required = false, defaultValue = "false")
            final String includeBugs,
        @RequestParam(value = "includeExemptions", required = false, defaultValue = "false")
            final String includeExemptions,
        @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false) final String tenant,
        HttpServletRequest request,
        HttpServletResponse response)
focal_class.full_signature: @RequestMapping(value = "/{token:.+}/apps", method = RequestMethod.GET) public void getApplications(
        @PathVariable String token,
        @RequestParam(value = "includeSpaceProperties", required = false, defaultValue = "")
            final String[] includeSpaceProperties,
        @RequestParam(value = "includeGoalConfiguration", required = false, defaultValue = "")
            final String[] includeGoalConfiguration,
        @RequestParam(value = "includeGoalSystemInfo", required = false, defaultValue = "")
            final String[] includeGoalSystemInfo,
        @RequestParam(value = "includeBugs", required = false, defaultValue = "false")
            final String includeBugs,
        @RequestParam(value = "includeExemptions", required = false, defaultValue = "false")
            final String includeExemptions,
        @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false) final String tenant,
        HttpServletRequest request,
        HttpServletResponse response)
focal_class.identifier: getApplications
focal_class.modifiers: @RequestMapping(value = "/{token:.+}/apps", method = RequestMethod.GET) public
focal_class.parameters: (
        @PathVariable String token,
        @RequestParam(value = "includeSpaceProperties", required = false, defaultValue = "")
            final String[] includeSpaceProperties,
        @RequestParam(value = "includeGoalConfiguration", required = false, defaultValue = "")
            final String[] includeGoalConfiguration,
        @RequestParam(value = "includeGoalSystemInfo", required = false, defaultValue = "")
            final String[] includeGoalSystemInfo,
        @RequestParam(value = "includeBugs", required = false, defaultValue = "false")
            final String includeBugs,
        @RequestParam(value = "includeExemptions", required = false, defaultValue = "false")
            final String includeExemptions,
        @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false) final String tenant,
        HttpServletRequest request,
        HttpServletResponse response)
focal_class.return: void
focal_class.signature: void getApplications(
        @PathVariable String token,
        @RequestParam(value = "includeSpaceProperties", required = false, defaultValue = "")
            final String[] includeSpaceProperties,
        @RequestParam(value = "includeGoalConfiguration", required = false, defaultValue = "")
            final String[] includeGoalConfiguration,
        @RequestParam(value = "includeGoalSystemInfo", required = false, defaultValue = "")
            final String[] includeGoalSystemInfo,
        @RequestParam(value = "includeBugs", required = false, defaultValue = "false")
            final String includeBugs,
        @RequestParam(value = "includeExemptions", required = false, defaultValue = "false")
            final String includeExemptions,
        @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false) final String tenant,
        HttpServletRequest request,
        HttpServletResponse response)
focal_method.body: @RequestMapping(
        value = "",
        method = RequestMethod.POST,
        consumes = {"application/json;charset=UTF-8"},
        produces = {"application/json;charset=UTF-8"})
    public ResponseEntity<Space> createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant) {
      final StopWatch sw =
          new StopWatch(
                  "Create space ["
                      + (space == null ? null : space.getSpaceName())
                      + "] "
                      + "for tenant token ["
                      + tenant
                      + "] ")
              .start();
  
      try {
        // Check arguments
        if (space == null) {
          log.error("No space submitted");
          return new ResponseEntity<Space>(HttpStatus.BAD_REQUEST);
        } else if (!space.hasNameAndDescription()) {
          log.error("Work spaces require a name and description");
          return new ResponseEntity<Space>(HttpStatus.BAD_REQUEST);
        } else if (space.isReadOnly()) {
          log.error("Work spaces cannot be created with read-only set to true");
          return new ResponseEntity<Space>(HttpStatus.BAD_REQUEST);
        }
  
        // Check whether tenant exists or retrieve default
        Tenant t = null;
        try {
          t = this.tenantRepository.getTenant(tenant);
        } catch (EntityNotFoundException enfe) {
          log.error("Tenant [" + tenant + "] not found");
          return new ResponseEntity<Space>(HttpStatus.NOT_FOUND);
        } catch (Exception e) {
          log.error("Error retrieving tenant [" + tenant + "]: " + e);
          return new ResponseEntity<Space>(HttpStatus.NOT_FOUND);
        }
  
        // check that only 1 default space per tenant is created
        if (space.isDefault() && this.spaceRepository.findDefault(t.getTenantToken()) != null) {
          log.error(
              "A default space for the given tenant already exists, adjust the configuration"
                  + " accordingly");
          return new ResponseEntity<Space>(HttpStatus.BAD_REQUEST);
        }
  
        // Always create token, whatever has been submitted
        space.setTenant(t);
        space.setSpaceToken(TokenUtil.generateToken());
        this.spaceRepository.customSave(space);
  
        sw.stop();
        return new ResponseEntity<Space>(space, HttpStatus.CREATED);
      } catch (Exception enfe) {
        sw.stop(enfe);
        return new ResponseEntity<Space>(HttpStatus.INTERNAL_SERVER_ERROR);
      }
    }
focal_method.class_method_signature: SpaceController.createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_method.full_signature: @RequestMapping( value = "", method = RequestMethod.POST, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"}) public ResponseEntity<Space> createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_method.identifier: createSpace
focal_method.invocations: start getSpaceName error hasNameAndDescription error isReadOnly error getTenant error error isDefault findDefault getTenantToken error setTenant setSpaceToken generateToken customSave stop stop
focal_method.modifiers: @RequestMapping( value = "", method = RequestMethod.POST, consumes = {"application/json;charset=UTF-8"}, produces = {"application/json;charset=UTF-8"}) public
focal_method.parameters: (
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)
focal_method.return: ResponseEntity<Space>
focal_method.signature: ResponseEntity<Space> createSpace(
        @RequestBody Space space,
        @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
            String tenant)