この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

ContentDownloadHandlerFactory インターフェース

カスタム ContentDownloadHandler のインスタンスを作成するために Salesforce がコールできるクラスファクトリを提供するには、このインターフェースを使用します。

名前空間

Sfc

使用方法

ContentDownloadHandler getContentDownloadHandler(List<ID> ids, ContentDownloadContext context);

ContentDownloadHandlerFactory のメソッド

ContentDownloadHandlerFactory のメソッドは次のとおりです。

getContentDownloadHandler(var1, var2)

指定されたコンテンツ ID のリストとダウンロードコンテキストに対する ContentDownloadHandler を返します。

署名

public Sfc.ContentDownloadHandler getContentDownloadHandler(List<Id> var1, Sfc.ContentDownloadContext var2)

パラメータ

var1
型: List<Id>
var2
型: Sfc.ContentDownloadContext

ContentDownloadHandlerFactory の実装例

この例では、Sfc.ContentDownloadHandlerFactory インターフェースを実装するクラスを作成し、モバイルデバイスへのコンテンツのダウンロードをブロックするダウンロードハンドラを返します。

1// Allow customization of the content Download experience
2public class ContentDownloadHandlerFactoryImpl implements Sfc.ContentDownloadHandlerFactory {
3
4  public Sfc.ContentDownloadHandler getContentDownloadHandler(List<ID> ids, Sfc.ContentDownloadContext context) {
5    Sfc.ContentDownloadHandler contentDownloadHandler = new Sfc.ContentDownloadHandler();
6
7    if(context == Sfc.ContentDownloadContext.MOBILE) {
8      contentDownloadHandler.isDownloadAllowed = false;
9      contentDownloadHandler.downloadErrorMessage = 'Downloading a file from a mobile device is not allowed.';
10      return contentDownloadHandler;
11    }
12    contentDownloadHandler.isDownloadAllowed = true;
13    return contentDownloadHandler;
14  }
15}