workspace.setIsolated(isolated); catalog.add(workspace);
/** * Helper method that will make sure that the workspace associated to the provided namespace has * the same isolation. * * <p>If the associated namespace doesn't exists nothing will be done. * * @param namespace a catalog namespace */ private void syncWorkspaceIsolation(NamespaceInfo namespace) { // get the workspace associated to the namespace, may be NULL WorkspaceInfo workspace = catalog.getWorkspaceByName(namespace.getPrefix()); if (workspace != null && namespace.isIsolated() != workspace.isIsolated()) { // update the workspace isolation workspace.setIsolated(namespace.isIsolated()); catalog.save(workspace); } } }
/** * Helper method that updates the isolation state of an workspace and the corresponding * namespace. */ protected void updateWorkspaceIsolationState(String prefix, boolean isolated) { Catalog catalog = getCatalog(); // set the workspace isolation state using the provided one WorkspaceInfo workspace = catalog.getWorkspaceByName(prefix); workspace.setIsolated(isolated); catalog.save(workspace); // set the namespace isolation state using the provided one NamespaceInfo namespace = catalog.getNamespaceByPrefix(prefix); namespace.setIsolated(isolated); catalog.save(namespace); }
ws.setIsolated(isolated); catalog.add(ws); } else { ws.setIsolated(isolated); catalog.save(ws);
@PostMapping( consumes = { MediaType.TEXT_XML_VALUE, MediaType.APPLICATION_XML_VALUE, MediaTypeExtensions.TEXT_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE } ) @ResponseStatus(HttpStatus.CREATED) public ResponseEntity<String> namespacePost( @RequestBody NamespaceInfo namespace, UriComponentsBuilder builder) { catalog.add(namespace); String name = namespace.getName(); LOGGER.info("Added namespace " + name); // JD: we need to keep namespace and workspace in sync, so create a worksapce // if one does not already exists, we can remove this once we get to a point // where namespace is just an attribute on a layer, and not a containing element if (catalog.getWorkspaceByName(namespace.getPrefix()) == null) { WorkspaceInfo ws = catalog.getFactory().createWorkspace(); ws.setName(namespace.getPrefix()); ws.setIsolated(namespace.isIsolated()); catalog.add(ws); } // build the new path UriComponents uriComponents = getUriComponents(name, builder); HttpHeaders headers = new HttpHeaders(); headers.setLocation(uriComponents.toUri()); return new ResponseEntity<>(name, headers, HttpStatus.CREATED); }