ContentDownloadHandlerFactory インターフェース
名前空間
使用方法
ContentDownloadHandler getContentDownloadHandler(List<ID> ids, ContentDownloadContext context);
ContentDownloadHandlerFactory のメソッド
ContentDownloadHandlerFactory のメソッドは次のとおりです。
getContentDownloadHandler(var1, var2)
署名
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}