Search in sources :

Example 1 with RootFolderAttributeView

use of org.entando.entando.aps.system.services.storage.RootFolderAttributeView in project entando-core by entando.

the class FileBrowserAction method getBreadCrumbsTargets.

public List<SelectItem> getBreadCrumbsTargets() {
    if (null == this.getProtectedFolder()) {
        return null;
    }
    List<SelectItem> items = new ArrayList<>();
    RootFolderAttributeView rootFolder = this.getRootFolder(this.getProtectedFolderBoolean());
    items.add(new SelectItem(null, rootFolder.getName()));
    String currentPath = this.getCurrentPath();
    if (StringUtils.isEmpty(currentPath)) {
        return items;
    }
    String[] folders = currentPath.split("/");
    for (int i = 0; i < folders.length; i++) {
        String folderName = folders[i];
        String subpath = null;
        if (i == 0) {
            subpath = folderName + "/";
        } else if (i == (folders.length - 1)) {
            subpath = currentPath;
        } else {
            int index = currentPath.indexOf(folderName) + folderName.length();
            subpath = currentPath.substring(0, index) + "/";
        }
        items.add(new SelectItem(subpath, folderName));
    }
    return items;
}
Also used : SelectItem(com.agiletec.aps.util.SelectItem) ArrayList(java.util.ArrayList) RootFolderAttributeView(org.entando.entando.aps.system.services.storage.RootFolderAttributeView)

Aggregations

SelectItem (com.agiletec.aps.util.SelectItem)1 ArrayList (java.util.ArrayList)1 RootFolderAttributeView (org.entando.entando.aps.system.services.storage.RootFolderAttributeView)1