99import java .util .Set ;
1010import java .util .UUID ;
1111import life .qbic .application .commons .SortOrder ;
12+ import life .qbic .projectmanagement .application .api .fair .DigitalObject ;
1213import life .qbic .projectmanagement .application .ValidationResult ;
1314import life .qbic .projectmanagement .application .batch .SampleUpdateRequest .SampleInformation ;
1415import life .qbic .projectmanagement .application .confounding .ConfoundingVariableService .ConfoundingVariableInformation ;
1516import life .qbic .projectmanagement .application .sample .SamplePreview ;
1617import life .qbic .projectmanagement .domain .model .sample .Sample ;
1718import life .qbic .projectmanagement .domain .model .sample .SampleRegistrationRequest ;
1819import org .springframework .lang .Nullable ;
20+ import org .springframework .util .MimeType ;
1921import reactor .core .publisher .Flux ;
2022import reactor .core .publisher .Mono ;
2123
@@ -216,7 +218,7 @@ Flux<SamplePreview> getSamplePreviews(String projectId, String experimentId, int
216218 * @param projectId the project id to which the sample belongs to
217219 * @param sampleId the sample id of the sample to find
218220 * @return a reactive container of {@link Sample} for the sample matching the sample id. For no
219- * matches a {@link Mono#empty()} is returned. Exceptions are * provided as
221+ * matches a {@link Mono#empty()} is returned. Exceptions are provided as
220222 * {@link Mono#error(Throwable)}.
221223 * @throws RequestFailedException in case the request cannot be executed
222224 * @since 1.10.0
@@ -236,6 +238,44 @@ Flux<SamplePreview> getSamplePreviews(String projectId, String experimentId, int
236238 */
237239 Flux <ValidationResponse > validate (Flux <ValidationRequest > requests );
238240
241+ /**
242+ * Requests a sample registration template in a desired {@link MimeType}.
243+ * <p>
244+ * If the mime type is not supported, a {@link UnsupportedMimeTypeException} will be provided as
245+ * {@link Mono#error(Throwable)}.
246+ *
247+ * @param projectId the project ID of the project the template should be created for
248+ * @param experimentId the experiment ID of the experiment the template should be created for
249+ * @param mimeType the mime type the digital object should be
250+ * @return a {@link Mono} with a {@link DigitalObject} providing the requested template
251+ * @throws AccessDeniedException if the user has insufficient rights
252+ * @throws RequestFailedException if the request cannot be executed
253+ * @throws UnsupportedMimeTypeException if the service cannot provide the requested
254+ * {@link MimeType}
255+ * @since 1.10.0
256+ */
257+ Mono <DigitalObject > sampleRegistrationTemplate (String projectId , String experimentId ,
258+ MimeType mimeType );
259+
260+ /**
261+ * Requests a sample update template in a desired {@link MimeType}.
262+ * <p>
263+ * If the mime type is not supported, a {@link UnsupportedMimeTypeException} will be provided as
264+ * {@link Mono#error(Throwable)}.
265+ *
266+ * @param projectId the project ID of the project the template should be created for
267+ * @param experimentId the experiment ID of the experiment the template should be created for
268+ * @param mimeType the mime type the digital object should be
269+ * @return a {@link Mono} with a {@link DigitalObject} providing the requested template
270+ * @throws AccessDeniedException if the user has insufficient rights
271+ * @throws RequestFailedException if the request cannot be executed
272+ * @throws UnsupportedMimeTypeException if the service cannot provide the requested
273+ * {@link MimeType}
274+ * @since 1.10.0
275+ */
276+ Mono <DigitalObject > sampleUpdateTemplate (String projectId , String experimentId ,
277+ MimeType mimeType );
278+
239279 /**
240280 * Container of an update request for a service call and part of the
241281 * {@link ProjectUpdateRequest}.
@@ -883,4 +923,16 @@ public AccessDeniedException(String message, Throwable cause) {
883923 }
884924 }
885925
926+ /**
927+ * Exception to indicate that a service implementation cannot handle a certain mime type.
928+ *
929+ * @since 1.10.0
930+ */
931+ class UnsupportedMimeTypeException extends RuntimeException {
932+
933+ public UnsupportedMimeTypeException (String message ) {
934+ super (message );
935+ }
936+ }
937+
886938}
0 commit comments