Example usage for com.liferay.portal.kernel.repository.model FileEntry isInTrashContainer

List of usage examples for com.liferay.portal.kernel.repository.model FileEntry isInTrashContainer

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.repository.model FileEntry isInTrashContainer.

Prototype

public boolean isInTrashContainer();

Source Link

Usage

From source file:com.liferay.document.library.internal.exportimport.data.handler.FileEntryStagedModelDataHandler.java

License:Open Source License

@Override
protected void validateExport(PortletDataContext portletDataContext, FileEntry fileEntry)
        throws PortletDataException {

    if ((fileEntry.getGroupId() != portletDataContext.getGroupId())
            && (fileEntry.getGroupId() != portletDataContext.getScopeGroupId())) {

        PortletDataException pde = new PortletDataException(PortletDataException.INVALID_GROUP);

        pde.setStagedModel(fileEntry);/*ww  w  .  j av  a  2s .  c  o m*/

        throw pde;
    }

    try {
        FileVersion fileVersion = fileEntry.getFileVersion();

        if (!portletDataContext.isInitialPublication()
                && !ArrayUtil.contains(getExportableStatuses(), fileVersion.getStatus())) {

            throw new PortletDataException(PortletDataException.STATUS_UNAVAILABLE);
        }
    } catch (PortletDataException pde) {
        throw pde;
    } catch (Exception e) {
        if (_log.isDebugEnabled()) {
            _log.debug(e, e);
        } else if (_log.isWarnEnabled()) {
            _log.warn("Unable to check workflow status for file entry " + fileEntry.getFileEntryId());
        }
    }

    if (fileEntry.isInTrash() || fileEntry.isInTrashContainer()) {
        PortletDataException pde = new PortletDataException(PortletDataException.STATUS_IN_TRASH);

        pde.setStagedModel(fileEntry);

        throw pde;
    }
}