@Override
  public IGViewFileVersionDisplayContext getIGViewFileVersionDisplayContext(
      IGViewFileVersionDisplayContext parentIGViewFileVersionDisplayContext,
      HttpServletRequest request,
      HttpServletResponse response,
      FileVersion fileVersion) {

    GoogleDocsMetadataHelper googleDocsMetadataHelper =
        new GoogleDocsMetadataHelper(
            _ddmStructureLocalService,
            (DLFileVersion) fileVersion.getModel(),
            _dlFileEntryMetadataLocalService,
            _storageEngine);

    if (googleDocsMetadataHelper.isGoogleDocs()) {
      return new GoogleDocsIGViewFileVersionDisplayContext(
          parentIGViewFileVersionDisplayContext,
          request,
          response,
          fileVersion,
          googleDocsMetadataHelper);
    }

    return parentIGViewFileVersionDisplayContext;
  }
コード例 #2
0
  public void addFileEntry(
      long userId, FileEntry fileEntry, FileVersion fileVersion, ServiceContext serviceContext)
      throws PortalException, SystemException {

    updateAsset(
        userId,
        fileEntry,
        fileVersion,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames(),
        serviceContext.getAssetLinkEntryIds());

    if (PropsValues.DL_FILE_ENTRY_COMMENTS_ENABLED) {
      mbMessageLocalService.addDiscussionMessage(
          fileEntry.getUserId(), fileEntry.getUserName(),
          fileEntry.getGroupId(), DLFileEntryConstants.getClassName(),
          fileEntry.getFileEntryId(), WorkflowConstants.ACTION_PUBLISH);
    }

    if (fileVersion instanceof LiferayFileVersion) {
      DLFileVersion dlFileVersion = (DLFileVersion) fileVersion.getModel();

      Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();

      workflowContext.put("event", DLSyncConstants.EVENT_ADD);

      WorkflowHandlerRegistryUtil.startWorkflowInstance(
          dlFileVersion.getCompanyId(),
          dlFileVersion.getGroupId(),
          userId,
          DLFileEntryConstants.getClassName(),
          dlFileVersion.getFileVersionId(),
          dlFileVersion,
          serviceContext,
          workflowContext);
    }

    registerDLProcessorCallback(fileEntry, null);
  }
コード例 #3
0
  public AssetEntry updateAsset(
      long userId,
      FileEntry fileEntry,
      FileVersion fileVersion,
      long[] assetCategoryIds,
      String[] assetTagNames,
      long[] assetLinkEntryIds)
      throws PortalException, SystemException {

    AssetEntry assetEntry = null;

    boolean visible = false;

    boolean addDraftAssetEntry = false;

    if (fileEntry instanceof LiferayFileEntry) {
      DLFileVersion dlFileVersion = (DLFileVersion) fileVersion.getModel();

      if (dlFileVersion.isApproved()) {
        visible = true;
      } else {
        String version = dlFileVersion.getVersion();

        if (!version.equals(DLFileEntryConstants.VERSION_DEFAULT)) {
          addDraftAssetEntry = true;
        }
      }
    } else {
      visible = true;
    }

    long fileEntryTypeId = getFileEntryTypeId(fileEntry);

    if (addDraftAssetEntry) {
      assetEntry =
          assetEntryLocalService.updateEntry(
              userId,
              fileEntry.getGroupId(),
              DLFileEntryConstants.getClassName(),
              fileVersion.getFileVersionId(),
              fileEntry.getUuid(),
              fileEntryTypeId,
              assetCategoryIds,
              assetTagNames,
              false,
              null,
              null,
              null,
              fileEntry.getMimeType(),
              fileEntry.getTitle(),
              fileEntry.getDescription(),
              null,
              null,
              null,
              0,
              0,
              null,
              false);
    } else {
      assetEntry =
          assetEntryLocalService.updateEntry(
              userId,
              fileEntry.getGroupId(),
              DLFileEntryConstants.getClassName(),
              fileEntry.getFileEntryId(),
              fileEntry.getUuid(),
              fileEntryTypeId,
              assetCategoryIds,
              assetTagNames,
              visible,
              null,
              null,
              null,
              fileEntry.getMimeType(),
              fileEntry.getTitle(),
              fileEntry.getDescription(),
              null,
              null,
              null,
              0,
              0,
              null,
              false);

      List<DLFileShortcut> dlFileShortcuts =
          dlFileShortcutPersistence.findByToFileEntryId(fileEntry.getFileEntryId());

      for (DLFileShortcut dlFileShortcut : dlFileShortcuts) {
        assetEntryLocalService.updateEntry(
            userId,
            dlFileShortcut.getGroupId(),
            DLFileShortcut.class.getName(),
            dlFileShortcut.getFileShortcutId(),
            dlFileShortcut.getUuid(),
            fileEntryTypeId,
            assetCategoryIds,
            assetTagNames,
            true,
            null,
            null,
            null,
            fileEntry.getMimeType(),
            fileEntry.getTitle(),
            fileEntry.getDescription(),
            null,
            null,
            null,
            0,
            0,
            null,
            false);
      }
    }

    assetLinkLocalService.updateLinks(
        userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED);

    return assetEntry;
  }