Search in sources :

Example 31 with FolderItem

use of org.kie.workbench.common.screens.explorer.model.FolderItem in project kie-wb-common by kiegroup.

the class ExplorerServiceHelper method getItems.

private List<FolderItem> getItems(final Path packagePath, final ActiveOptions options) {
    final List<FolderItem> folderItems = new ArrayList<FolderItem>();
    final boolean includeTags = options.contains(Option.SHOW_TAG_FILTER);
    final org.uberfire.java.nio.file.Path nioPackagePath = Paths.convert(packagePath);
    if (Files.exists(nioPackagePath)) {
        final DirectoryStream<org.uberfire.java.nio.file.Path> nioPaths = ioService.newDirectoryStream(nioPackagePath, regularFileFilter);
        for (org.uberfire.java.nio.file.Path nioPath : nioPaths) {
            final org.uberfire.backend.vfs.Path path = Paths.convert(nioPath);
            if (Paths.isLock(path)) {
                continue;
            }
            final String lockedBy = Paths.readLockedBy(path);
            final FolderItem folderItem = new FolderItem(path, path.getFileName(), FolderItemType.FILE, false, lockedBy, includeTags ? metadataService.getTags(path) : Collections.<String>emptyList(), getRestrictedOperations(path));
            folderItems.add(folderItem);
        }
    }
    return folderItems;
}
Also used : Path(org.uberfire.backend.vfs.Path) ArrayList(java.util.ArrayList) FolderItem(org.kie.workbench.common.screens.explorer.model.FolderItem) Path(org.uberfire.backend.vfs.Path)

Aggregations

FolderItem (org.kie.workbench.common.screens.explorer.model.FolderItem)31 ArrayList (java.util.ArrayList)15 Path (org.uberfire.backend.vfs.Path)14 Test (org.junit.Test)13 Package (org.guvnor.common.services.project.model.Package)8 FolderListing (org.kie.workbench.common.screens.explorer.model.FolderListing)8 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)5 List (java.util.List)4 Set (java.util.Set)3 Inject (javax.inject.Inject)3 Module (org.guvnor.common.services.project.model.Module)3 FolderItemType (org.kie.workbench.common.screens.explorer.model.FolderItemType)3 ClientResourceType (org.uberfire.client.workbench.type.ClientResourceType)3 Window (com.google.gwt.user.client.Window)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 TreeSet (java.util.TreeSet)2 PostConstruct (javax.annotation.PostConstruct)2 Event (javax.enterprise.event.Event)2