25
25
import org .springframework .lang .Nullable ;
26
26
27
27
import com .mongodb .client .gridfs .GridFSFindIterable ;
28
- import com .mongodb .gridfs .GridFSFile ;
29
28
30
29
/**
31
30
* Collection of operations to store and read files from MongoDB GridFS.
32
- *
31
+ *
33
32
* @author Oliver Gierke
34
33
* @author Philipp Schneider
35
34
* @author Thomas Darimont
@@ -40,98 +39,102 @@ public interface GridFsOperations extends ResourcePatternResolver {
40
39
41
40
/**
42
41
* Stores the given content into a file with the given name.
43
- *
42
+ *
44
43
* @param content must not be {@literal null}.
45
44
* @param filename must not be {@literal null} or empty.
46
- * @return the {@link GridFSFile} just created
45
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
47
46
*/
48
47
ObjectId store (InputStream content , String filename );
49
48
50
49
/**
51
50
* Stores the given content into a file with the given name.
52
- *
51
+ *
53
52
* @param content must not be {@literal null}.
54
53
* @param metadata can be {@literal null}.
55
- * @return the {@link GridFSFile} just created
54
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
56
55
*/
57
56
ObjectId store (InputStream content , @ Nullable Object metadata );
58
57
59
58
/**
60
59
* Stores the given content into a file with the given name.
61
- *
60
+ *
62
61
* @param content must not be {@literal null}.
63
62
* @param metadata can be {@literal null}.
64
- * @return the {@link GridFSFile} just created
63
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
65
64
*/
66
65
ObjectId store (InputStream content , @ Nullable Document metadata );
67
66
68
67
/**
69
68
* Stores the given content into a file with the given name and content type.
70
- *
69
+ *
71
70
* @param content must not be {@literal null}.
72
71
* @param filename must not be {@literal null} or empty.
73
72
* @param contentType can be {@literal null}.
74
- * @return the {@link GridFSFile} just created
73
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
75
74
*/
76
75
ObjectId store (InputStream content , @ Nullable String filename , @ Nullable String contentType );
77
76
78
77
/**
79
78
* Stores the given content into a file with the given name using the given metadata. The metadata object will be
80
79
* marshalled before writing.
81
- *
80
+ *
82
81
* @param content must not be {@literal null}.
83
82
* @param filename can be {@literal null} or empty.
84
83
* @param metadata can be {@literal null}.
85
- * @return the {@link GridFSFile} just created
84
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
86
85
*/
87
86
ObjectId store (InputStream content , @ Nullable String filename , @ Nullable Object metadata );
88
87
89
88
/**
90
89
* Stores the given content into a file with the given name and content type using the given metadata. The metadata
91
90
* object will be marshalled before writing.
92
- *
91
+ *
93
92
* @param content must not be {@literal null}.
94
93
* @param filename must not be {@literal null} or empty.
95
94
* @param contentType can be {@literal null}.
96
95
* @param metadata can be {@literal null}
97
- * @return the {@link GridFSFile} just created
96
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
98
97
*/
99
- ObjectId store (InputStream content , @ Nullable String filename , @ Nullable String contentType , @ Nullable Object metadata );
98
+ ObjectId store (InputStream content , @ Nullable String filename , @ Nullable String contentType ,
99
+ @ Nullable Object metadata );
100
100
101
101
/**
102
102
* Stores the given content into a file with the given name using the given metadata.
103
- *
103
+ *
104
104
* @param content must not be {@literal null}.
105
105
* @param filename must not be {@literal null} or empty.
106
106
* @param metadata can be {@literal null}.
107
- * @return the {@link GridFSFile} just created
107
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
108
108
*/
109
109
ObjectId store (InputStream content , @ Nullable String filename , @ Nullable Document metadata );
110
110
111
111
/**
112
112
* Stores the given content into a file with the given name and content type using the given metadata.
113
- *
113
+ *
114
114
* @param content must not be {@literal null}.
115
115
* @param filename must not be {@literal null} or empty.
116
116
* @param contentType can be {@literal null}.
117
117
* @param metadata can be {@literal null}.
118
- * @return the {@link GridFSFile} just created
118
+ * @return the {@link ObjectId} of the {@link com.mongodb.client.gridfs.model. GridFSFile} just created.
119
119
*/
120
- ObjectId store (InputStream content , @ Nullable String filename , @ Nullable String contentType , @ Nullable Document metadata );
120
+ ObjectId store (InputStream content , @ Nullable String filename , @ Nullable String contentType ,
121
+ @ Nullable Document metadata );
121
122
122
123
/**
123
124
* Returns all files matching the given query. Note, that currently {@link Sort} criterias defined at the
124
125
* {@link Query} will not be regarded as MongoDB does not support ordering for GridFS file access.
125
- *
126
+ *
126
127
* @see <a href="https://jira.mongodb.org/browse/JAVA-431">MongoDB Jira: JAVA-431</a>
127
128
* @param query must not be {@literal null}.
128
- * @return
129
+ * @return {@link GridFSFindIterable} to obtain results from. Eg. by calling
130
+ * {@link GridFSFindIterable#into(java.util.Collection)}.
129
131
*/
130
132
GridFSFindIterable find (Query query );
131
133
132
134
/**
133
- * Returns a single file matching the given query or {@literal null} in case no file matches.
134
- *
135
+ * Returns a single {@link com.mongodb.client.gridfs.model.GridFSFile} matching the given query or {@literal null} in
136
+ * case no file matches.
137
+ *
135
138
* @param query must not be {@literal null}.
136
139
* @return
137
140
*/
@@ -140,14 +143,14 @@ public interface GridFsOperations extends ResourcePatternResolver {
140
143
141
144
/**
142
145
* Deletes all files matching the given {@link Query}.
143
- *
146
+ *
144
147
* @param query must not be {@literal null}.
145
148
*/
146
149
void delete (Query query );
147
150
148
151
/**
149
- * Returns all {@link GridFsResource} with the given file name.
150
- *
152
+ * Returns the {@link GridFsResource} with the given file name.
153
+ *
151
154
* @param filename must not be {@literal null}.
152
155
* @return the resource if it exists or {@literal null}.
153
156
* @see ResourcePatternResolver#getResource(String)
@@ -156,7 +159,7 @@ public interface GridFsOperations extends ResourcePatternResolver {
156
159
157
160
/**
158
161
* Returns all {@link GridFsResource}s matching the given file name pattern.
159
- *
162
+ *
160
163
* @param filenamePattern must not be {@literal null}.
161
164
* @return
162
165
* @see ResourcePatternResolver#getResources(String)
0 commit comments