dev.fitko.fitconnect.api.services.submission.SubmissionService Maven / Gradle / Ivy
package dev.fitko.fitconnect.api.services.submission;
import dev.fitko.fitconnect.api.domain.model.destination.Destination;
import dev.fitko.fitconnect.api.domain.model.metadata.Metadata;
import dev.fitko.fitconnect.api.domain.model.metadata.attachment.ApiAttachment;
import dev.fitko.fitconnect.api.domain.model.metadata.data.Data;
import dev.fitko.fitconnect.api.domain.model.submission.AnnounceSubmission;
import dev.fitko.fitconnect.api.domain.model.submission.CreatedSubmission;
import dev.fitko.fitconnect.api.domain.model.submission.ServiceType;
import dev.fitko.fitconnect.api.domain.model.submission.Submission;
import dev.fitko.fitconnect.api.domain.model.submission.SubmissionsForPickup;
import dev.fitko.fitconnect.api.domain.model.submission.SubmitSubmission;
import dev.fitko.fitconnect.api.exceptions.internal.RestApiException;
import java.io.InputStream;
import java.util.UUID;
/**
* A service that provides access to the FIT-Connect REST-API and allows creating and loading {@link Submission}s
* and {@link ApiAttachment}s.
*
* @see FIT-Connect Submission API
*/
public interface SubmissionService {
/**
* Announce a new submission. This step is necessary before actually {@link #sendSubmission(SubmitSubmission) sending} the submission.
*
* @param submission submission that contains all {@link ApiAttachment}s that should be announced, as well as a specified {@link ServiceType}
* @return announced submission with submissionId, caseId and destinationID
*
* @see Announcing a submission
*/
CreatedSubmission announceSubmission(AnnounceSubmission submission) throws RestApiException;
/**
* Send a submission that was already {@link #announceSubmission(AnnounceSubmission) announced} before.
*
* @param submission submission including the encrypted {@link Data} and {@link Metadata}
* @return the submission that was sent
*/
Submission sendSubmission(SubmitSubmission submission) throws RestApiException;
/**
* Get a {@link Submission} by id.
*
* @param submissionId unique submission identifier
* @return submission matching the given id
*/
Submission getSubmission(UUID submissionId) throws RestApiException;
/**
* Get all available submissions for a given {@link Destination}.
*
* @param destinationId unique destination identifier
* @param offset position in the dataset
* @param limit number of submissions in result (max. is 500)
* @return SubmissionsForPickup containing a list of submissions
*/
SubmissionsForPickup pollAvailableSubmissionsForDestination(UUID destinationId, int offset, int limit) throws RestApiException;
/**
* Upload an encrypted {@link ApiAttachment}.
*
* @param submissionId unique identifier of an announced submission
* @param attachmentId unique destination identifier
* @param encryptedAttachment JWE encrypted attachment payload
*/
void uploadAttachment(UUID submissionId, UUID attachmentId, String encryptedAttachment) throws RestApiException;
/**
* Upload an encrypted {@link ApiAttachment} with input-stream payload.
*
* @param submissionId unique identifier of an announced submission
* @param attachmentId unique destination identifier
* @param encryptedAttachment JWE encrypted attachment payload as input-stream
*/
void uploadAttachmentStream(UUID submissionId, UUID attachmentId, InputStream encryptedAttachment) throws RestApiException;
/**
* Get an {@link ApiAttachment} by id for a given {@link Submission}.
*
* @param submissionId unique submission identifier
* @param attachmentId unique attachment identifier
* @return encrypted string of the attachment data
*/
String getAttachment(UUID submissionId, UUID attachmentId) throws RestApiException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy