Liferay 7.0-ce-m3

com.liferay.portlet.wiki.trash
Class WikiPageTrashHandler

java.lang.Object
  extended by com.liferay.portal.kernel.trash.BaseTrashHandler
      extended by com.liferay.portlet.wiki.trash.BaseWikiTrashHandler
          extended by com.liferay.portlet.wiki.trash.WikiPageTrashHandler
All Implemented Interfaces:
TrashHandler

public class WikiPageTrashHandler
extends BaseWikiTrashHandler

Implements trash handling for the wiki page entity.


Constructor Summary
WikiPageTrashHandler()
           
 
Method Summary
 SystemEvent addDeletionSystemEvent(long userId, long groupId, long classPK, String classUuid, String referrerClassName)
           
protected  void checkRestorableEntry(long classPK, long trashEntryId, long containerModelId, String originalTitle, String newName)
           
 void checkRestorableEntry(long classPK, long containerModelId, String newName)
           
 void checkRestorableEntry(TrashEntry trashEntry, long containerModelId, String newName)
          Checks if a duplicate trash entry already exists in the destination container.
 void deleteTrashEntry(long classPK)
          Deletes the model entity with the primary key.
 String getClassName()
          Returns the class name handled by this trash handler.
 ContainerModel getParentContainerModel(long classPK)
          Returns the parent container model of the model entity with the primary key.
 ContainerModel getParentContainerModel(TrashedModel trashedModel)
           
 List<ContainerModel> getParentContainerModels(long classPK)
          Returns all the parent container models of the model entity with the primary key ordered by hierarchy.
 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)
           
 String getTrashContainerModelName()
          Returns the name of the container model.
 int getTrashContainerModelsCount(long classPK)
          Returns the number of container models that are children of the parent container model identified by the primary key.
 List<TrashRenderer> getTrashContainerModelTrashRenderers(long classPK, int start, int end)
          Returns a range of all the trash renderers of model entities that are children of the parent container model identified by the primary key.
 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 isContainerModel()
          Returns true if the entity is a container model.
 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 isRootContainerModelMovable()
           
 void restoreRelatedTrashEntry(String className, long classPK)
          Restores the model entity that is related to the model entity with the class name and class PK.
 void restoreTrashEntry(long userId, long classPK)
          Restores the model entity with the primary key.
 void updateTitle(long classPK, String name)
          Updates the title of the model entity with the primary key.
 
Methods inherited from class com.liferay.portlet.wiki.trash.BaseWikiTrashHandler
getContainerModel, getContainerModelClassName, getContainerModelName, getContainerModels, getContainerModelsCount, getDestinationContainerModelId, getRootContainerModelClassName, getRootContainerModelId, getRootContainerModels, getRootContainerModelsCount, getRootContainerModelTitle, getSubcontainerModelName, moveEntry, moveTrashEntry
 
Methods inherited from class com.liferay.portal.kernel.trash.BaseTrashHandler
checkDuplicateEntry, checkDuplicateTrashEntry, getAssetRendererFactory, getContainerModelClassName, getContainerModelName, getDeleteMessage, getRootContainerModelName, getSystemEventClassName, getTrashContainedModelName, getTrashContainedModelsCount, getTrashContainedModelTrashRenderers, isDeletable, isRestorable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WikiPageTrashHandler

public WikiPageTrashHandler()
Method Detail

addDeletionSystemEvent

public SystemEvent addDeletionSystemEvent(long userId,
                                          long groupId,
                                          long classPK,
                                          String classUuid,
                                          String referrerClassName)
                                   throws PortalException
Specified by:
addDeletionSystemEvent in interface TrashHandler
Overrides:
addDeletionSystemEvent in class BaseTrashHandler
Throws:
PortalException

checkRestorableEntry

public void checkRestorableEntry(long classPK,
                                 long containerModelId,
                                 String newName)
                          throws PortalException
Specified by:
checkRestorableEntry in interface TrashHandler
Overrides:
checkRestorableEntry in class BaseTrashHandler
Throws:
PortalException

checkRestorableEntry

public void checkRestorableEntry(TrashEntry trashEntry,
                                 long containerModelId,
                                 String newName)
                          throws PortalException
Description copied from interface: TrashHandler
Checks if a duplicate trash entry already exists in the destination container.

This method is used to check for duplicates when a trash entry is being restored or moved out of the Recycle Bin.

Specified by:
checkRestorableEntry in interface TrashHandler
Overrides:
checkRestorableEntry in class BaseTrashHandler
Parameters:
trashEntry - the trash entry to check
containerModelId - the primary key of the destination (e.g. folder)
newName - the new name to be assigned to the trash entry (optionally null to forego renaming the trash entry)
Throws:
PortalException - if a duplicate trash entry already existed in the destination container

deleteTrashEntry

public void deleteTrashEntry(long classPK)
                      throws PortalException
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

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

getParentContainerModel

public ContainerModel getParentContainerModel(long classPK)
                                       throws PortalException
Description copied from interface: TrashHandler
Returns the parent container model of the model entity with the primary key.

Specified by:
getParentContainerModel in interface TrashHandler
Overrides:
getParentContainerModel in class BaseTrashHandler
Parameters:
classPK - the primary key of a model entity the container models must be able to contain
Returns:
the parent container model of the model entity with the primary key
Throws:
PortalException - if a portal exception occurred

getParentContainerModel

public ContainerModel getParentContainerModel(TrashedModel trashedModel)
Specified by:
getParentContainerModel in interface TrashHandler
Overrides:
getParentContainerModel in class BaseTrashHandler

getParentContainerModels

public List<ContainerModel> getParentContainerModels(long classPK)
                                              throws PortalException
Description copied from interface: TrashHandler
Returns all the parent container models of the model entity with the primary key ordered by hierarchy.

For example, if the primary key is for a file entry inside folder C, which is inside folder B, which is inside folder A; this method returns container models for folders A, B, and C.

Specified by:
getParentContainerModels in interface TrashHandler
Overrides:
getParentContainerModels in class BaseTrashHandler
Parameters:
classPK - the primary key of a model entity the container models must be able to contain
Returns:
all the matching parent container models of the model entity
Throws:
PortalException - if a portal exception occurred

getRestoreContainedModelLink

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

getRestoreContainerModelLink

public String getRestoreContainerModelLink(PortletRequest portletRequest,
                                           long classPK)
                                    throws PortalException
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

getRestoreMessage

public String getRestoreMessage(PortletRequest portletRequest,
                                long classPK)
                         throws PortalException
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

getTrashContainerModelName

public String getTrashContainerModelName()
Description copied from interface: TrashHandler
Returns the name of the container model.

For example, "folder" may be the container model name for a file entry.

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

getTrashContainerModelsCount

public int getTrashContainerModelsCount(long classPK)
                                 throws PortalException
Description copied from interface: TrashHandler
Returns the number of container models that are children of the parent container model identified by the primary key.

For example, for a folder with subfolders and documents, the number of folders (excluding those explicitly moved to the recycle bin) is returned.

Specified by:
getTrashContainerModelsCount in interface TrashHandler
Overrides:
getTrashContainerModelsCount in class BaseTrashHandler
Parameters:
classPK - the primary key of a container model
Returns:
the number of container models that are children of the parent container model identified by the primary key
Throws:
PortalException - if a portal exception occurred

getTrashContainerModelTrashRenderers

public List<TrashRenderer> getTrashContainerModelTrashRenderers(long classPK,
                                                                int start,
                                                                int end)
                                                         throws PortalException
Description copied from interface: TrashHandler
Returns a range of all the trash renderers of model entities that are children of the parent container model identified by the primary key.

For example, for a folder with subfolders and documents, the range of renderers representing folders (excluding those explicitly moved to the recycle bin) is returned.

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:
getTrashContainerModelTrashRenderers in interface TrashHandler
Overrides:
getTrashContainerModelTrashRenderers in class BaseTrashHandler
Parameters:
classPK - the primary key of a 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 trash renderers of model entities
Throws:
PortalException - if a portal exception occurred

getTrashEntry

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

getTrashRenderer

public TrashRenderer getTrashRenderer(long classPK)
                               throws PortalException
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

hasTrashPermission

public boolean hasTrashPermission(PermissionChecker permissionChecker,
                                  long groupId,
                                  long classPK,
                                  String trashActionId)
                           throws PortalException
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

isContainerModel

public boolean isContainerModel()
Description copied from interface: TrashHandler
Returns true if the entity is a container model.

Specified by:
isContainerModel in interface TrashHandler
Overrides:
isContainerModel in class BaseTrashHandler
Returns:
true if the entity is a container model; false otherwise

isInTrash

public boolean isInTrash(long classPK)
                  throws PortalException
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

isInTrashContainer

public boolean isInTrashContainer(long classPK)
                           throws PortalException
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

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

isRootContainerModelMovable

public boolean isRootContainerModelMovable()
Specified by:
isRootContainerModelMovable in interface TrashHandler
Overrides:
isRootContainerModelMovable in class BaseTrashHandler

restoreRelatedTrashEntry

public void restoreRelatedTrashEntry(String className,
                                     long classPK)
                              throws PortalException
Description copied from interface: TrashHandler
Restores the model entity that is related to the model entity with the class name and class PK. For example, restoreRelatedTrashEntry( String, long) restores the attachment related to the wiki page with the class name and class PK.

Specified by:
restoreRelatedTrashEntry in interface TrashHandler
Overrides:
restoreRelatedTrashEntry in class BaseTrashHandler
Parameters:
className - the class name of the model entity with a related model entity to restore
classPK - the primary key of the model entity with a related model entity to restore
Throws:
PortalException - if a model entity with the primary key could not be found

restoreTrashEntry

public void restoreTrashEntry(long userId,
                              long classPK)
                       throws PortalException
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

updateTitle

public void updateTitle(long classPK,
                        String name)
                 throws PortalException
Description copied from interface: TrashHandler
Updates the title of the model entity with the primary key. This method is called by EditEntryAction before restoring the model entity via its restore rename action.

Specified by:
updateTitle in interface TrashHandler
Overrides:
updateTitle in class BaseTrashHandler
Parameters:
classPK - the primary key of the model entity
name - the title to be assigned
Throws:
PortalException - if a model entity with the primary key could not be found

checkRestorableEntry

protected void checkRestorableEntry(long classPK,
                                    long trashEntryId,
                                    long containerModelId,
                                    String originalTitle,
                                    String newName)
                             throws PortalException
Throws:
PortalException

getRestoreURL

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

hasPermission

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

Liferay 7.0-ce-m3