示例#1
0
  private void doArchiveContent(
      UserEntity importer, ContentKey contentKey, ImportResult importResult) {
    final ContentEntity content = contentDao.findByKey(contentKey);

    if (content == null) {
      return;
    }

    boolean contentArchived = contentStorer.archiveMainVersion(importer, content);
    if (contentArchived) {
      importResult.addArchived(content);

      UnassignContentCommand unassignContentCommand = new UnassignContentCommand();
      unassignContentCommand.setContentKey(content.getKey());
      unassignContentCommand.setUnassigner(importer.getKey());
      contentStorer.unassignContent(unassignContentCommand);
    } else {
      importResult.addAlreadyArchived(content);
    }
  }
示例#2
0
  private void doDeleteContent(
      UserEntity importer, ContentKey contentKey, ImportResult importResult) {
    final ContentEntity content = contentDao.findByKey(contentKey);

    if (content == null) {
      // content must have been removed by another process during the import
    } else {
      contentStorer.deleteContent(importer, content);
      importResult.addDeleted(content);
    }
  }