public ResourceTreeEntity(FolderConfig folderConfig) throws UnsupportedEncodingException { this.type = ResourceType.FOLDER; this.name = folderConfig.getName(); this.fullPath = folderConfig.getFullPathList(); this.url = "/resourcetree/" + new NamespaceKey(this.fullPath).toUrlEncodedString(); }
protected Folder getFolderFromConfig(FolderConfig config, List<CatalogItem> children) { return new Folder(config.getId().getId(), config.getFullPathList(), String.valueOf(config.getTag()), children); }
namespaceService.deleteFolder(new NamespaceKey(config.getFullPathList()), version); } else { throw new UnsupportedOperationException(String.format("Catalog item [%s] of type [%s] can not be deleted.", id, object.getClass().getName()));
protected void updateFolder(Folder folder, NamespaceAttribute... attributes) throws NamespaceException { NamespaceKey namespaceKey = new NamespaceKey(folder.getPath()); FolderConfig folderConfig = namespaceService.getFolder(namespaceKey); Preconditions.checkArgument(CollectionUtils.isEqualCollection(folder.getPath(), folderConfig.getFullPathList()), "Folder path is immutable."); NameSpaceContainer rootContainer = getRootContainer(folder.getPath()); if (rootContainer.getType() == NameSpaceContainer.Type.SOURCE) { throw new UnsupportedOperationException("Can not update a folder inside a source"); } namespaceService.addOrUpdateFolder(namespaceKey, getFolderConfig(folder), attributes); }
public static CatalogItem fromFolderConfig(FolderConfig folderConfig) { return new Builder() .setId(folderConfig.getId().getId()) .setPath(Lists.newArrayList(folderConfig.getFullPathList())) .setTag(String.valueOf(folderConfig.getTag())) .setType(CatalogItemType.CONTAINER) .setContainerType(ContainerSubType.FOLDER) .build(); }
FolderConfig config = (FolderConfig) object; Folder folder = getFolderFromConfig(config, getChildrenForPath(new NamespaceKey(config.getFullPathList()))); return Optional.of((CatalogEntity) folder); } else if (object instanceof CatalogEntity) {
SchemaEntity schemaEntityFolder1 = new SchemaEntity(com.dremio.common.utils.PathUtils.constructFullPath(folderConfig1.getFullPathList()), SchemaEntity.SchemaEntityType.FOLDER, "testuser"); SchemaEntity schemaEntityFolder2 = new SchemaEntity(com.dremio.common.utils.PathUtils.constructFullPath(folderConfig2.getFullPathList()), SchemaEntity.SchemaEntityType.FOLDER, "testuser");
folder.setType(NameSpaceContainer.Type.FOLDER); containerList2.add(folder); when(namespaceService.list(new NamespaceKey(folderConfig1.getFullPathList()))).thenReturn(containerList2); childrenForPath = catalogServiceHelper.getChildrenForPath(new NamespaceKey(folderConfig1.getFullPathList())); assertEquals(childrenForPath.size(), 1);