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

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

Introduction

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

Prototype

public static String encodeSafeFileName(String fileName) 

Source Link

Usage

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

License:Open Source License

public void updateFile(long companyId, long repositoryId, String fileName, String newFileName)
        throws PortalException, SystemException {

    String safeFileName = FileUtil.encodeSafeFileName(fileName);
    String safeNewFileName = FileUtil.encodeSafeFileName(newFileName);

    if (!safeFileName.equals(fileName)) {
        if (_store.hasFile(companyId, repositoryId, fileName, DLFileEntryConstants.VERSION_DEFAULT)) {

            safeFileName = fileName;//from  ww w.  j av a  2 s.  co m
        }
    }

    _store.updateFile(companyId, repositoryId, safeFileName, safeNewFileName);
}

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

License:Open Source License

public void updateFile(long companyId, long repositoryId, String fileName, String versionLabel, byte[] bytes)
        throws PortalException, SystemException {

    String safeFileName = FileUtil.encodeSafeFileName(fileName);

    renameUnsafeFile(companyId, repositoryId, fileName, safeFileName);

    _store.updateFile(companyId, repositoryId, safeFileName, versionLabel, bytes);
}

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

License:Open Source License

public void updateFile(long companyId, long repositoryId, String fileName, String versionLabel, File file)
        throws PortalException, SystemException {

    String safeFileName = FileUtil.encodeSafeFileName(fileName);

    renameUnsafeFile(companyId, repositoryId, fileName, safeFileName);

    _store.updateFile(companyId, repositoryId, safeFileName, versionLabel, file);
}

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

License:Open Source License

public void updateFile(long companyId, long repositoryId, String fileName, String versionLabel, InputStream is)
        throws PortalException, SystemException {

    String safeFileName = FileUtil.encodeSafeFileName(fileName);

    renameUnsafeFile(companyId, repositoryId, fileName, safeFileName);

    _store.updateFile(companyId, repositoryId, safeFileName, versionLabel, is);
}

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

License:Open Source License

public void updateFileVersion(long companyId, long repositoryId, String fileName, String fromVersionLabel,
        String toVersionLabel) throws PortalException, SystemException {

    String safeFileName = FileUtil.encodeSafeFileName(fileName);

    renameUnsafeFile(companyId, repositoryId, fileName, safeFileName);

    _store.updateFileVersion(companyId, repositoryId, safeFileName, fromVersionLabel, toVersionLabel);
}