クラス GridFsTemplate

java.lang.ObjectSE
org.springframework.data.mongodb.gridfs.GridFsTemplate
実装されているすべてのインターフェース:
ResourceLoaderResourcePatternResolverGridFsOperations

public class GridFsTemplate extends ObjectSE implements GridFsOperations, ResourcePatternResolver
コンテンツを MongoDB GridFS に保存するための GridFsOperations 実装。
作成者:
Oliver Gierke, Philipp Schneider, Thomas Darimont, Martin Baumgartner, Christoph Strobl, Mark Paluch, Hartmut Lang, Niklas Helge Hanft, Denis Zavedeev
  • コンストラクターの詳細

  • メソッドの詳細

    • store

      public org.bson.types.ObjectId store(InputStreamSE content, @Nullable StringSE filename, @Nullable StringSE contentType, @Nullable ObjectSE metadata)
      インターフェースからコピーされた説明: GridFsOperations
      指定されたメタデータを使用して、指定されたコンテンツを指定された名前とコンテンツ型でファイルに保存します。メタデータオブジェクトは書き込み前にマーシャリングされます。
      次で指定:
      インターフェース GridFsOperationsstore 
      パラメーター:
      content - null であってはなりません。
      filename - null または空であってはなりません。
      contentType - null でもかまいません。
      metadata - null でもかまいません
      戻り値:
      先ほど作成した GridFSFile の ObjectId
    • store

      public <T> T store(GridFsObject<T,InputStreamSE> upload)
      インターフェースからコピーされた説明: GridFsOperations
      指定された GridFsObject (おそらく GridFsUpload) を、指定された name を持つファイルに保存します。GridFsObject.getFileId() が設定されている場合、ファイルはその ID で保存され、設定されていない場合はサーバーが自動的に新しい ID を作成します。
      次で指定:
      インターフェース GridFsOperationsstore 
      型パラメーター:
      T - 基礎となる GridFSFile の ID 型
      パラメーター:
      upload - 保存される GridFsObject (おそらく GridFsUpload)。
      戻り値:
      保存されたファイルの ID。自動作成された値または GridFsObject.getFileId() のいずれかですが、null にはなりません。
    • find

      public com.mongodb.client.gridfs.GridFSFindIterable find(Query query)
      インターフェースからコピーされた説明: GridFsOperations
      指定されたクエリに一致するすべてのファイルを返します。現在、Query で定義されている Sort 条件は、MongoDB が GridFS ファイルアクセスの順序付けをサポートしていないため、考慮されないことに注意してください。
      次で指定:
      インターフェース GridFsOperationsfind 
      パラメーター:
      query - null であってはなりません。
      戻り値:
      結果を取得するには GridFSFindIterable を使用します。例: MongoIterable.into(java.util.Collection) を呼び出します。
      関連事項:
    • findOne

      public com.mongodb.client.gridfs.model.GridFSFile findOne(Query query)
      インターフェースからコピーされた説明: GridFsOperations
      指定されたクエリに一致する単一の GridFSFile を返します。一致するファイルがない場合には null を返します。
      次で指定:
      インターフェース GridFsOperationsfindOne 
      パラメーター:
      query - null であってはなりません。
      戻り値:
      null でもかまいません。
    • delete

      public void delete(Query query)
      インターフェースからコピーされた説明: GridFsOperations
      指定された Query に一致するすべてのファイルを削除します。
      次で指定:
      インターフェース GridFsOperationsdelete 
      パラメーター:
      query - null であってはなりません。
    • getClassLoader

      public ClassLoaderSE getClassLoader()
      次で指定:
      インターフェース ResourceLoadergetClassLoader 
    • getResource

      public GridFsResource getResource(StringSE location)
      インターフェースからコピーされた説明: GridFsOperations
      指定されたファイル名の GridFsResource を返します。
      次で指定:
      インターフェース GridFsOperationsgetResource 
      次で指定:
      インターフェース ResourceLoadergetResource 
      パラメーター:
      location - null であってはなりません。
      戻り値:
      リソース。返された GridFsResource が実際に存在するかどうかを確認するには、Resource.exists() を使用します。
      関連事項:
    • getResource

      public GridFsResource getResource(com.mongodb.client.gridfs.model.GridFSFile file)
      インターフェースからコピーされた説明: GridFsOperations
      GridFSFileGridFsResource を返します。
      次で指定:
      インターフェース GridFsOperationsgetResource 
      パラメーター:
      file - null であってはなりません。
      戻り値:
      ファイルのリソース。
    • getResources

      public GridFsResource[] getResources(StringSE locationPattern)
      インターフェースからコピーされた説明: GridFsOperations
      指定されたファイル名パターンに一致するすべての GridFsResource を返します。
      次で指定:
      インターフェース GridFsOperationsgetResources 
      次で指定:
      インターフェース ResourcePatternResolvergetResources 
      パラメーター:
      locationPattern - null であってはなりません。
      戻り値:
      何も見つからない場合は空の配列。
      関連事項:
    • getMappedQuery

      protected org.bson.Document getMappedQuery(org.bson.Document query)
      パラメーター:
      query - 指定されたクエリを QueryMapper に渡して型変換を適用します。
      戻り値:
      決して null にはなりません。
    • computeUploadOptionsFor

      protected com.mongodb.client.gridfs.model.GridFSUploadOptions computeUploadOptionsFor(@Nullable StringSE contentType, @Nullable org.bson.Document metadata)
      指定された contentType とメタデータ Document から、使用する GridFSUploadOptions を計算します。
      パラメーター:
      contentType - null でもかまいません。
      metadata - null でもかまいません
      戻り値:
      決して null にはなりません。
    • toDocument

      protected org.bson.Document toDocument(@Nullable ObjectSE value)
      指定された値を Document に変換します。
      パラメーター:
      value - null でもかまいません。
      戻り値:
      ソース値が null の場合、空の Document になります。