Exemple #1
0
  @Override
  public void deleteStagedModel(String uuid, long groupId, String className, String extraData)
      throws PortalException, SystemException {

    JournalFolder folder =
        JournalFolderLocalServiceUtil.fetchJournalFolderByUuidAndGroupId(uuid, groupId);

    if (folder != null) {
      JournalFolderLocalServiceUtil.deleteFolder(folder);
    }
  }
Exemple #2
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());
    }
  }
Exemple #3
0
  @Override
  protected void doImportStagedModel(PortletDataContext portletDataContext, JournalFolder folder)
      throws Exception {

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

    if (folder.getParentFolderId() != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) {

      StagedModelDataHandlerUtil.importReferenceStagedModel(
          portletDataContext, folder, JournalFolder.class, folder.getParentFolderId());
    }

    Map<Long, Long> folderIds =
        (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(JournalFolder.class);

    long parentFolderId =
        MapUtil.getLong(folderIds, folder.getParentFolderId(), folder.getParentFolderId());

    ServiceContext serviceContext = portletDataContext.createServiceContext(folder);

    JournalFolder importedFolder = null;

    long groupId = portletDataContext.getScopeGroupId();

    if (portletDataContext.isDataStrategyMirror()) {
      JournalFolder existingFolder =
          JournalFolderLocalServiceUtil.fetchJournalFolderByUuidAndGroupId(
              folder.getUuid(), groupId);

      if (existingFolder == null) {
        serviceContext.setUuid(folder.getUuid());

        importedFolder =
            JournalFolderLocalServiceUtil.addFolder(
                userId,
                groupId,
                parentFolderId,
                folder.getName(),
                folder.getDescription(),
                serviceContext);
      } else {
        importedFolder =
            JournalFolderLocalServiceUtil.updateFolder(
                userId,
                existingFolder.getFolderId(),
                parentFolderId,
                folder.getName(),
                folder.getDescription(),
                false,
                serviceContext);
      }
    } else {
      importedFolder =
          JournalFolderLocalServiceUtil.addFolder(
              userId,
              groupId,
              parentFolderId,
              folder.getName(),
              folder.getDescription(),
              serviceContext);
    }

    portletDataContext.importClassedModel(folder, importedFolder);
  }