Example usage for com.liferay.portal.kernel.util Constants MOVE_FROM_TRASH

List of usage examples for com.liferay.portal.kernel.util Constants MOVE_FROM_TRASH

Introduction

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

Prototype

String MOVE_FROM_TRASH

To view the source code for com.liferay.portal.kernel.util Constants MOVE_FROM_TRASH.

Click Source Link

Usage

From source file:blade.document.action.configurationicon.BladeActionConfigurationIcon.java

License:Apache License

private FileEntry _retrieveFile(HttpServletRequest request) {
    try {/*  www .ja  v a2  s .co  m*/
        long fileEntryId = ParamUtil.getLong(request, "fileEntryId");

        FileEntry fileEntry = null;

        if (fileEntryId > 0) {
            fileEntry = _dlAppService.getFileEntry(fileEntryId);
        }

        if (fileEntry == null) {
            return null;
        }

        String cmd = ParamUtil.getString(request, Constants.CMD);

        if (fileEntry.isInTrash() && !cmd.equals(Constants.MOVE_FROM_TRASH)) {

            return null;
        }

        return fileEntry;
    } catch (PortalException pe) {
        _log.error(pe);

        return null;
    }
}

From source file:com.liferay.document.library.web.internal.portlet.action.ActionUtil.java

License:Open Source License

public static FileEntry getFileEntry(HttpServletRequest request) throws PortalException {

    long fileEntryId = ParamUtil.getLong(request, "fileEntryId");

    FileEntry fileEntry = null;/*from w  w  w . ja  v a  2  s. c  o m*/

    if (fileEntryId > 0) {
        fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId);
    }

    if (fileEntry == null) {
        return null;
    }

    String cmd = ParamUtil.getString(request, Constants.CMD);

    if (fileEntry.isInTrash() && !cmd.equals(Constants.MOVE_FROM_TRASH)) {
        throw new NoSuchFileEntryException("{fileEntryId=" + fileEntryId + "}");
    }

    return fileEntry;
}