@Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, BlogsEntry entry)
      throws Exception {

    long userId = portletDataContext.getUserId(entry.getUserUuid());

    BlogsEntry existingEntry =
        fetchStagedModelByUuidAndGroupId(entry.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingEntry == null) || !existingEntry.isInTrash()) {
      return;
    }

    TrashHandler trashHandler = existingEntry.getTrashHandler();

    if (trashHandler.isRestorable(existingEntry.getEntryId())) {
      trashHandler.restoreTrashEntry(userId, existingEntry.getEntryId());
    }
  }
  @Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, WikiPage page)
      throws Exception {

    long userId = portletDataContext.getUserId(page.getUserUuid());

    WikiPage existingPage =
        fetchStagedModelByUuidAndGroupId(page.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingPage == null) || !existingPage.isInTrash()) {
      return;
    }

    TrashHandler trashHandler = existingPage.getTrashHandler();

    if (trashHandler.isRestorable(existingPage.getResourcePrimKey())) {
      trashHandler.restoreTrashEntry(userId, existingPage.getResourcePrimKey());
    }
  }
  @Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, WikiNode node)
      throws Exception {

    long userId = portletDataContext.getUserId(node.getUserUuid());

    WikiNode existingNode =
        WikiNodeLocalServiceUtil.fetchNodeByUuidAndGroupId(
            node.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingNode == null) || !existingNode.isInTrash()) {
      return;
    }

    TrashHandler trashHandler = existingNode.getTrashHandler();

    if (trashHandler.isRestorable(existingNode.getNodeId())) {
      trashHandler.restoreTrashEntry(userId, existingNode.getNodeId());
    }
  }
  @Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, FileEntry fileEntry)
      throws Exception {

    long userId = portletDataContext.getUserId(fileEntry.getUserUuid());

    FileEntry existingFileEntry =
        fetchStagedModelByUuidAndGroupId(fileEntry.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingFileEntry == null) || !existingFileEntry.isInTrash()) {
      return;
    }

    TrashHandler trashHandler =
        TrashHandlerRegistryUtil.getTrashHandler(DLFileEntry.class.getName());

    if (trashHandler.isRestorable(existingFileEntry.getFileEntryId())) {
      trashHandler.restoreTrashEntry(userId, existingFileEntry.getFileEntryId());
    }
  }
Example #5
0
  @Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, JournalFolder folder)
      throws Exception {

    long userId = portletDataContext.getUserId(folder.getUserUuid());

    JournalFolder existingFolder =
        JournalFolderLocalServiceUtil.fetchJournalFolderByUuidAndGroupId(
            folder.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingFolder == null) || !existingFolder.isInTrash()) {
      return;
    }

    TrashHandler trashHandler = existingFolder.getTrashHandler();

    if (trashHandler.isRestorable(existingFolder.getFolderId())) {
      trashHandler.restoreTrashEntry(userId, existingFolder.getFolderId());
    }
  }