Liferay 6.2-ce-ga5

com.liferay.portlet.messageboards.trash
Class MBThreadTrashHandler

java.lang.Object
  extended by com.liferay.portal.kernel.trash.BaseTrashHandler
      extended by com.liferay.portlet.messageboards.trash.MBThreadTrashHandler
All Implemented Interfaces:
TrashHandler

public class MBThreadTrashHandler
extends BaseTrashHandler

Implements trash handling for message boards thread entity.


Constructor Summary
MBThreadTrashHandler()
           
 
Method Summary
 void deleteTrashEntry(long classPK)
          Deletes the model entity with the primary key.
 String getClassName()
          Returns the class name handled by this trash handler.
 ContainerModel getContainerModel(long containerModelId)
          Returns the container model with the primary key.
 String getContainerModelClassName()
          Returns the parent container model's class name.
 String getContainerModelName()
          Returns the name of the container model (e.g. folder name).
 List<ContainerModel> getContainerModels(long classPK, long parentContainerModelId, int start, int end)
          Returns a range of all the container models that are children of the parent container model identified by the container model ID.
 int getContainerModelsCount(long classPK, long parentContainerModelId)
          Returns the number of container models that are children of the parent container model identified by the container model ID.
 String getRestoreContainedModelLink(PortletRequest portletRequest, long classPK)
           
 String getRestoreContainerModelLink(PortletRequest portletRequest, long classPK)
          Returns the link to the location to which the model entity was restored.
 String getRestoreMessage(PortletRequest portletRequest, long classPK)
          Returns the message describing the location to which the model entity was restored.
protected  PortletURL getRestoreURL(PortletRequest portletRequest, long classPK, boolean isContainerModel)
           
 TrashEntry getTrashEntry(long classPK)
           
 TrashRenderer getTrashRenderer(long classPK)
          Returns the trash renderer associated to the model entity with the primary key.
protected  boolean hasPermission(PermissionChecker permissionChecker, long classPK, String actionId)
           
 boolean hasTrashPermission(PermissionChecker permissionChecker, long groupId, long classPK, String trashActionId)
          Returns true if the user has the required permission to perform the trash action on the model entity with the primary key.
 boolean isInTrash(long classPK)
          Returns true if the model entity with the primary key is in the Recycle Bin.
 boolean isInTrashContainer(long classPK)
          Returns true if the model entity with the primary key is in a container that is in the Recycle Bin.
 boolean isMovable()
          Returns true if the entity can be moved from one container model (such as a folder) to another.
 boolean isRestorable(long classPK)
          Returns true if the model entity can be restored to its original location.
 void moveEntry(long userId, long classPK, long containerModelId, ServiceContext serviceContext)
          Moves the entity with the class primary key to the container model with the class primary key
 void moveTrashEntry(long userId, long classPK, long containerModelId, ServiceContext serviceContext)
          Moves the model entity with the primary key out of the Recycle Bin to a new destination identified by the container model ID.
 void restoreTrashEntry(long userId, long classPK)
          Restores the model entity with the primary key.
 
Methods inherited from class com.liferay.portal.kernel.trash.BaseTrashHandler
addDeletionSystemEvent, checkDuplicateEntry, checkDuplicateTrashEntry, getAssetRendererFactory, getDeleteMessage, getParentContainerModel, getParentContainerModel, getParentContainerModels, getRootContainerModelName, getSubcontainerModelName, getSystemEventClassName, getTrashContainedModelName, getTrashContainedModelsCount, getTrashContainedModelTrashRenderers, getTrashContainerModelName, getTrashContainerModelsCount, getTrashContainerModelTrashRenderers, isContainerModel, isDeletable, isTrashEntry, restoreRelatedTrashEntry, updateTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBThreadTrashHandler

public MBThreadTrashHandler()
Method Detail

deleteTrashEntry

public void deleteTrashEntry(long classPK)
                      throws PortalException,
                             SystemException
Description copied from interface: TrashHandler
Deletes the model entity with the primary key.

Parameters:
classPK - the primary key of the model entity to delete
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

getClassName

public String getClassName()
Description copied from interface: TrashHandler
Returns the class name handled by this trash handler.

Returns:
the class name handled by this trash handler

getContainerModel

public ContainerModel getContainerModel(long containerModelId)
                                 throws PortalException,
                                        SystemException
Description copied from interface: TrashHandler
Returns the container model with the primary key.

Specified by:
getContainerModel in interface TrashHandler
Overrides:
getContainerModel in class BaseTrashHandler
Parameters:
containerModelId - the primary key of the container model
Returns:
the container model with the primary key
Throws:
PortalException - if a container model with the primary key could not be found
SystemException - if a system exception occurred

getContainerModelClassName

public String getContainerModelClassName()
Description copied from interface: TrashHandler
Returns the parent container model's class name.

Specified by:
getContainerModelClassName in interface TrashHandler
Overrides:
getContainerModelClassName in class BaseTrashHandler

getContainerModelName

public String getContainerModelName()
Description copied from interface: TrashHandler
Returns the name of the container model (e.g. folder name).

Specified by:
getContainerModelName in interface TrashHandler
Overrides:
getContainerModelName in class BaseTrashHandler
Returns:
the name of the container model

getContainerModels

public List<ContainerModel> getContainerModels(long classPK,
                                               long parentContainerModelId,
                                               int start,
                                               int end)
                                        throws PortalException,
                                               SystemException
Description copied from interface: TrashHandler
Returns a range of all the container models that are children of the parent container model identified by the container model ID. These container models must be able to contain the model entity identified by the primary key.

This method checks for the view permission when retrieving the container models.

Useful when paginating results. Returns a maximum of end - start instances. The start and end values are not primary keys but, rather, indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Specified by:
getContainerModels in interface TrashHandler
Overrides:
getContainerModels in class BaseTrashHandler
Parameters:
classPK - the primary key of a model entity the container models must be able to contain
parentContainerModelId - the primary key of the parent container model
start - the lower bound of the range of results
end - the upper bound of the range of results (not inclusive)
Returns:
the range of matching container models
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

getContainerModelsCount

public int getContainerModelsCount(long classPK,
                                   long parentContainerModelId)
                            throws PortalException,
                                   SystemException
Description copied from interface: TrashHandler
Returns the number of container models that are children of the parent container model identified by the container model ID. These container models must be able to contain the model entity identified by the primary key.

This method checks for the view permission when counting the container models.

Specified by:
getContainerModelsCount in interface TrashHandler
Overrides:
getContainerModelsCount in class BaseTrashHandler
Parameters:
classPK - the primary key of a model entity the container models must be able to contain
parentContainerModelId - the primary key of the parent container model
Returns:
the number of matching container models
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

getRestoreContainedModelLink

public String getRestoreContainedModelLink(PortletRequest portletRequest,
                                           long classPK)
                                    throws PortalException,
                                           SystemException
Specified by:
getRestoreContainedModelLink in interface TrashHandler
Overrides:
getRestoreContainedModelLink in class BaseTrashHandler
Throws:
PortalException
SystemException

getRestoreContainerModelLink

public String getRestoreContainerModelLink(PortletRequest portletRequest,
                                           long classPK)
                                    throws PortalException,
                                           SystemException
Description copied from interface: TrashHandler
Returns the link to the location to which the model entity was restored.

Specified by:
getRestoreContainerModelLink in interface TrashHandler
Overrides:
getRestoreContainerModelLink in class BaseTrashHandler
Parameters:
portletRequest - the portlet request
classPK - the primary key of the restored model entity
Returns:
the restore link
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

getRestoreMessage

public String getRestoreMessage(PortletRequest portletRequest,
                                long classPK)
                         throws PortalException,
                                SystemException
Description copied from interface: TrashHandler
Returns the message describing the location to which the model entity was restored.

Specified by:
getRestoreMessage in interface TrashHandler
Overrides:
getRestoreMessage in class BaseTrashHandler
Parameters:
portletRequest - the portlet request
classPK - the primary key of the restored model entity
Returns:
the restore message
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

getTrashEntry

public TrashEntry getTrashEntry(long classPK)
                         throws PortalException,
                                SystemException
Specified by:
getTrashEntry in interface TrashHandler
Overrides:
getTrashEntry in class BaseTrashHandler
Throws:
PortalException
SystemException

getTrashRenderer

public TrashRenderer getTrashRenderer(long classPK)
                               throws PortalException,
                                      SystemException
Description copied from interface: TrashHandler
Returns the trash renderer associated to the model entity with the primary key.

Specified by:
getTrashRenderer in interface TrashHandler
Overrides:
getTrashRenderer in class BaseTrashHandler
Parameters:
classPK - the primary key of the model entity
Returns:
the trash renderer associated to the model entity
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

hasTrashPermission

public boolean hasTrashPermission(PermissionChecker permissionChecker,
                                  long groupId,
                                  long classPK,
                                  String trashActionId)
                           throws PortalException,
                                  SystemException
Description copied from interface: TrashHandler
Returns true if the user has the required permission to perform the trash action on the model entity with the primary key.

This method is a mapper for special Recycle Bin operations that are not real permissions. The implementations of this method should translate these virtual permissions to real permission checks.

Specified by:
hasTrashPermission in interface TrashHandler
Overrides:
hasTrashPermission in class BaseTrashHandler
Parameters:
permissionChecker - the permission checker
groupId - the primary key of the group
classPK - the primary key of the model entity
trashActionId - the trash action permission to check
Returns:
true if the user has the required permission; false otherwise
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

isInTrash

public boolean isInTrash(long classPK)
                  throws PortalException,
                         SystemException
Description copied from interface: TrashHandler
Returns true if the model entity with the primary key is in the Recycle Bin.

Parameters:
classPK - the primary key of the model entity
Returns:
true if the model entity is in the Recycle Bin; false otherwise
Throws:
PortalException - if a model entity with the primary key could not be found in the portal
SystemException - if a system exception occurred

isInTrashContainer

public boolean isInTrashContainer(long classPK)
                           throws PortalException,
                                  SystemException
Description copied from interface: TrashHandler
Returns true if the model entity with the primary key is in a container that is in the Recycle Bin.

Specified by:
isInTrashContainer in interface TrashHandler
Overrides:
isInTrashContainer in class BaseTrashHandler
Parameters:
classPK - the primary key of the model entity
Returns:
true if the model entity with the primary key is in a container that is in the Recycle Bin; false otherwise
Throws:
PortalException - if a model entity with the primary key could not be found in the portal
SystemException - if a system exception occurred

isMovable

public boolean isMovable()
Description copied from interface: TrashHandler
Returns true if the entity can be moved from one container model (such as a folder) to another.

Specified by:
isMovable in interface TrashHandler
Overrides:
isMovable in class BaseTrashHandler
Returns:
true if the entity can be moved from one container model to another; false otherwise

isRestorable

public boolean isRestorable(long classPK)
                     throws PortalException,
                            SystemException
Description copied from interface: TrashHandler
Returns true if the model entity can be restored to its original location.

This method usually returns false if the container (e.g. folder) of the model entity is no longer available (e.g. moved to the Recycle Bin or deleted).

Specified by:
isRestorable in interface TrashHandler
Overrides:
isRestorable in class BaseTrashHandler
Parameters:
classPK - the primary key of the model entity
Returns:
true if the model entity can be restored to its original location; false otherwise
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

moveEntry

public void moveEntry(long userId,
                      long classPK,
                      long containerModelId,
                      ServiceContext serviceContext)
               throws PortalException,
                      SystemException
Description copied from interface: TrashHandler
Moves the entity with the class primary key to the container model with the class primary key

Specified by:
moveEntry in interface TrashHandler
Overrides:
moveEntry in class BaseTrashHandler
Parameters:
userId - the user ID
classPK - the primary key of the model entity
containerModelId - the primary key of the destination container model
serviceContext - the service context to be applied
Throws:
PortalException - if a model entity with the primary key or the destination container model with the primary key could not be found
SystemException - if a system exception occurred

moveTrashEntry

public void moveTrashEntry(long userId,
                           long classPK,
                           long containerModelId,
                           ServiceContext serviceContext)
                    throws PortalException,
                           SystemException
Description copied from interface: TrashHandler
Moves the model entity with the primary key out of the Recycle Bin to a new destination identified by the container model ID.

Specified by:
moveTrashEntry in interface TrashHandler
Overrides:
moveTrashEntry in class BaseTrashHandler
Parameters:
userId - the user ID
classPK - the primary key of the model entity
containerModelId - the primary key of the destination container model
serviceContext - the service context to be applied
Throws:
PortalException - if a model entity with the primary key or the destination container model with the primary key could not be found
SystemException - if a system exception occurred

restoreTrashEntry

public void restoreTrashEntry(long userId,
                              long classPK)
                       throws PortalException,
                              SystemException
Description copied from interface: TrashHandler
Restores the model entity with the primary key.

Parameters:
userId - the user ID
classPK - the primary key of the model entity to restore
Throws:
PortalException - if a model entity with the primary key could not be found
SystemException - if a system exception occurred

getRestoreURL

protected PortletURL getRestoreURL(PortletRequest portletRequest,
                                   long classPK,
                                   boolean isContainerModel)
                            throws PortalException,
                                   SystemException
Throws:
PortalException
SystemException

hasPermission

protected boolean hasPermission(PermissionChecker permissionChecker,
                                long classPK,
                                String actionId)
                         throws PortalException,
                                SystemException
Specified by:
hasPermission in class BaseTrashHandler
Throws:
PortalException
SystemException

Liferay 6.2-ce-ga5