Liferay 6.2-ce-ga5

com.liferay.portlet.wiki.trash
Class WikiNodeTrashHandler

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

public class WikiNodeTrashHandler
extends BaseTrashHandler

Implements trash handling for the wiki node entity.


Constructor Summary
WikiNodeTrashHandler()
           
 
Method Summary
 void checkDuplicateTrashEntry(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.
 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 getTrashContainedModelName()
          Returns the name of the contained model.
 int getTrashContainedModelsCount(long classPK)
          Returns the number of model entities (excluding container model entities) that are children of the parent container model identified by the primary key.
 List<TrashRenderer> getTrashContainedModelTrashRenderers(long classPK, int start, int end)
          Returns a range of all the trash renderers of model entities (excluding container models) 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 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.
 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.portal.kernel.trash.BaseTrashHandler
addDeletionSystemEvent, checkDuplicateEntry, getAssetRendererFactory, getContainerModel, getContainerModelClassName, getContainerModelName, getContainerModels, getContainerModelsCount, getDeleteMessage, getParentContainerModel, getParentContainerModel, getParentContainerModels, getRootContainerModelName, getSubcontainerModelName, getSystemEventClassName, getTrashContainerModelName, getTrashContainerModelsCount, getTrashContainerModelTrashRenderers, hasTrashPermission, isDeletable, isInTrashContainer, isMovable, isRestorable, isTrashEntry, moveEntry, moveTrashEntry, restoreRelatedTrashEntry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WikiNodeTrashHandler

public WikiNodeTrashHandler()
Method Detail

checkDuplicateTrashEntry

public void checkDuplicateTrashEntry(TrashEntry trashEntry,
                                     long containerModelId,
                                     String newName)
                              throws PortalException,
                                     SystemException
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:
checkDuplicateTrashEntry in interface TrashHandler
Overrides:
checkDuplicateTrashEntry 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
SystemException - if a system exception occurred

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

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)
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

getTrashContainedModelName

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

For example, "files" may be the model name for a folder and "pages" may be the model name for a wiki node.

Specified by:
getTrashContainedModelName in interface TrashHandler
Overrides:
getTrashContainedModelName in class BaseTrashHandler
Returns:
the name of the contained model

getTrashContainedModelsCount

public int getTrashContainedModelsCount(long classPK)
                                 throws SystemException
Description copied from interface: TrashHandler
Returns the number of model entities (excluding container 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 number of documents (excluding those explicitely moved to the recycle bin) is returned.

Specified by:
getTrashContainedModelsCount in interface TrashHandler
Overrides:
getTrashContainedModelsCount in class BaseTrashHandler
Parameters:
classPK - the primary key of a container model
Returns:
the number of model entities that are children of the parent container model identified by the primary key
Throws:
SystemException - if a system exception occurred

getTrashContainedModelTrashRenderers

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

For example, for a folder with subfolders and documents, a range of all the trash renderers of documents (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:
getTrashContainedModelTrashRenderers in interface TrashHandler
Overrides:
getTrashContainedModelTrashRenderers 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 trash renderers of model entities (excluding container models) that are children of the parent container model identified by the primary key
Throws:
PortalException - if a portal exception occurred
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

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,
                         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

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

updateTitle

public void updateTitle(long classPK,
                        String name)
                 throws PortalException,
                        SystemException
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
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