Example usage for com.liferay.portal.kernel.util FileUtil listDirs

List of usage examples for com.liferay.portal.kernel.util FileUtil listDirs

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util FileUtil listDirs.

Prototype

public static String[] listDirs(String fileName) 

Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore.java

License:Open Source License

@Override
public String[] getFileNames(long companyId, long repositoryId) {
    File repositoryDir = getRepositoryDir(companyId, repositoryId);

    String[] directories = FileUtil.listDirs(repositoryDir);

    List<String> fileNames = new ArrayList<String>();

    for (String directory : directories) {
        fileNames.addAll(getAdvancedFileNames(companyId, repositoryId,
                repositoryDir.getPath() + StringPool.SLASH + directory));
    }/*from w  w w  . j  a  v a2 s .  co  m*/

    return fileNames.toArray(new String[0]);
}

From source file:com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore.java

License:Open Source License

protected List<String> getAdvancedFileNames(long companyId, long repositoryId, String fileName) {

    List<String> fileNames = new ArrayList<String>();

    String shortFileName = FileUtil.getShortFileName(fileName);

    if (shortFileName.equals("DLFE") || Validator.isNumber(shortFileName)) {
        String[] curFileNames = FileUtil.listDirs(fileName);

        for (String curFileName : curFileNames) {
            fileNames.addAll(//w  ww .  ja  va  2  s.co m
                    getAdvancedFileNames(companyId, repositoryId, fileName + StringPool.SLASH + curFileName));
        }
    } else {
        if (shortFileName.endsWith(_HOOK_EXTENSION)) {
            shortFileName = FileUtil.stripExtension(shortFileName);
        }

        fileNames.add(shortFileName);
    }

    return fileNames;
}

From source file:com.liferay.portlet.documentlibrary.store.FileSystemStore.java

License:Open Source License

public String[] getFileNames(long companyId, long repositoryId) {
    File repositoryDir = getRepositoryDir(companyId, repositoryId);

    return FileUtil.listDirs(repositoryDir);
}

From source file:com.liferay.portlet.documentlibrary.store.FileSystemStore.java

License:Open Source License

@Override
public String[] getFileNames(long companyId, long repositoryId, String dirName) throws PortalException {

    File dirNameDir = getDirNameDir(companyId, repositoryId, dirName);

    if (!dirNameDir.exists()) {
        throw new NoSuchDirectoryException(dirNameDir.getPath());
    }/*from  w w w . j  av a2  s.c  o m*/

    String[] fileNames = FileUtil.listDirs(dirNameDir);

    Arrays.sort(fileNames);

    // Convert /${fileName} to /${dirName}/${fileName}

    for (int i = 0; i < fileNames.length; i++) {
        fileNames[i] = StringPool.SLASH + dirName + StringPool.SLASH + fileNames[i];
    }

    return fileNames;
}