Source:
public ResponseEntity<NamespaceOperationResult> createNamespace( @ApiParam(value = "The name of the namespace to be created", required = true) final @PathVariable String namespace ) { String fakeTenantId = UUID.randomUUID().toString().replace("-", ""); IUserContext userContext = UserContext.user(SecurityContextHolder.getContext().getAuthentication(), fakeTenantId); Optional<NamespaceOperationResult> validationError = NamespaceValidator.validate(namespace, userContext); if (validationError.isPresent()) { return new ResponseEntity<>(validationError.get(), HttpStatus.BAD_REQUEST); } try { Set<String> fakeAdmins = new HashSet<>(); fakeAdmins.add(userContext.getUsername()); Set<String> fakeNamespaces = new HashSet<>(); fakeNamespaces.add(namespace); tenantService.createOrUpdateTenant( fakeTenantId, namespace, fakeAdmins, Optional.of(fakeNamespaces), Optional.ofNullable(null), Optional.ofNullable(null), userContext ); return new ResponseEntity<>(NamespaceOperationResult.success(), HttpStatus.OK); } catch (NamespaceExistException e) { return new ResponseEntity<>(NamespaceOperationResult.failure("Namespace already exist"), HttpStatus.CONFLICT); } catch (RestrictTenantPerOwnerException e) { return new ResponseEntity<>(NamespaceOperationResult.failure("Namespace Quota of 1 exceeded."), HttpStatus.CONFLICT); } catch (IllegalArgumentException | TenantAdminDoesntExistException | UpdateNotAllowedException | NewNamespacesNotSupersetException | NewNamespaceNotPrivateException e) { return new ResponseEntity<>(NamespaceOperationResult.failure(e.getMessage()), HttpStatus.BAD_REQUEST); } catch (Exception e) { LOGGER.error(e); return new ResponseEntity<>( NamespaceOperationResult.failure("Internal error. Consult the vorto administrators!"), HttpStatus.INTERNAL_SERVER_ERROR); } }

Target:
public ResponseEntity<NamespaceOperationResult> createNamespace( @ApiParam(value = "The name of the namespace to be created", required = true) final @PathVariable String namespace ) { String fakeTenantId = UUID.randomUUID().toString().replace("-", ""); IUserContext userContext = UserContext .user(SecurityContextHolder.getContext().getAuthentication(), fakeTenantId); Optional<NamespaceOperationResult> validationError = NamespaceValidator .validate(namespace, userContext); if (validationError.isPresent()) { return new ResponseEntity<>(validationError.get(), HttpStatus.BAD_REQUEST); } String lowercasedNamespace = namespace.toLowerCase(); try { Set<String> fakeAdmins = new HashSet<>(); fakeAdmins.add(userContext.getUsername()); Set<String> fakeNamespaces = new HashSet<>(); fakeNamespaces.add(namespace); tenantService.createOrUpdateTenant( fakeTenantId, lowercasedNamespace, fakeAdmins, Optional.of(fakeNamespaces), Optional.ofNullable(null), Optional.ofNullable(null), userContext ); return new ResponseEntity<>(NamespaceOperationResult.success(), HttpStatus.OK); } catch (NamespaceExistException e) { return new ResponseEntity<>(NamespaceOperationResult.failure("Namespace already exist"), HttpStatus.CONFLICT); } catch (RestrictTenantPerOwnerException e) { return new ResponseEntity<>( NamespaceOperationResult.failure("Namespace Quota of 1 exceeded."), HttpStatus.CONFLICT); } catch (IllegalArgumentException | TenantAdminDoesntExistException | UpdateNotAllowedException | NewNamespacesNotSupersetException | NewNamespaceNotPrivateException e) { return new ResponseEntity<>(NamespaceOperationResult.failure(e.getMessage()), HttpStatus.BAD_REQUEST); } catch (Exception e) { LOGGER.error(e); return new ResponseEntity<>( NamespaceOperationResult.failure("Internal error. Consult the vorto administrators!"), HttpStatus.INTERNAL_SERVER_ERROR); } }