Example usage for com.liferay.portal.kernel.trash TrashHandler isMovable

List of usage examples for com.liferay.portal.kernel.trash TrashHandler isMovable

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.trash TrashHandler isMovable.

Prototype

@Deprecated
public boolean isMovable();

Source Link

Document

Returns true if the entity can be moved from one container model (such as a folder) to another.

Usage

From source file:com.liferay.trash.web.internal.portlet.configuration.icon.RestoreTrashPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    TrashDisplayContext trashDisplayContext = new TrashDisplayContext(
            _portal.getHttpServletRequest(portletRequest), null);

    TrashHandler trashHandler = trashDisplayContext.getTrashHandler();

    if (trashHandler == null) {
        return false;
    }//  w w  w. j av a  2  s.c o m

    if (!trashHandler.isMovable()) {
        return false;
    }

    if (trashHandler.isContainerModel()) {
        return false;
    }

    TrashEntry trashEntry = trashDisplayContext.getTrashEntry();

    if (trashEntry != null) {
        try {
            if (!trashHandler.isRestorable(trashEntry.getClassPK())) {
                return false;
            }

            if (!trashHandler.isInTrashContainer(trashEntry.getClassPK())) {
                return false;
            }
        } catch (Exception e) {
            return false;
        }
    }

    return true;
}