Skip to content
Snippets Groups Projects
Commit 1da071b3 authored by Martin Vogel's avatar Martin Vogel
Browse files

#414 Adjust to renamed model classes

parent 892d828d
No related branches found
No related tags found
2 merge requests!2#414 Remaining changes from MR,!1planning#414 Methoden Signaturen (Zwischenstand)
......@@ -5,20 +5,20 @@ import de.fitko.fitconnect.api.domain.auth.OAuthToken;
import de.fitko.fitconnect.api.domain.model.metadata.Metadata;
import de.fitko.fitconnect.api.domain.model.metadata.attachment.Attachment;
import de.fitko.fitconnect.api.domain.model.metadata.data.Data;
import de.fitko.fitconnect.api.domain.model.submission.SubmissionRequest;
import de.fitko.fitconnect.api.domain.model.submission.CreatedSubmission;
import de.fitko.fitconnect.api.domain.model.submission.SubmissionForPickup;
import de.fitko.fitconnect.api.domain.model.submission.SubmissionSubmit;
import de.fitko.fitconnect.api.domain.validation.ValidationResult;
import de.fitko.fitconnect.api.exceptions.*;
import java.io.File;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
/**
* A technical system that creates a submission via the FIT-Connect Submission API.
* <p>
* The Sender acts as a common interface wrapping all client functionality to authenticate <p>
* and create a valid {@link SubmissionRequest} including encrypted {@link Data} and {@link Attachment}s
* and create a valid {@link SubmissionSubmit} including encrypted {@link Data} and {@link Attachment}s
*
* @see <a href="https://docs.fitko.de/fit-connect/docs/sending/overview">Sending Submissions</a>
*/
......@@ -36,39 +36,39 @@ public interface Sender {
* Encrypts the submission data payload (json or xml) with JWE (JSON-Web-Encryption).
*
* @param publicKey the public encryption key the data is encrypted with
* @param data the {@link Data} payload that is encrypted
* @param data the {@link Data} payload that is encrypted
* @return the JWE-encrypted {@link Data}, is empty if en error occurred
*/
Optional<Data> encryptSubmissionData(final RSAKey publicKey, final Data data);
Data encryptSubmissionData(final RSAKey publicKey, final Data data) throws EncryptionException;
/**
* Encrypts the submission attachment binary data with JWE (JSON-Web-Encryption).
*
* @param publicKey the public encryption key the attachment is encrypted with
* @param publicKey the public encryption key the attachment is encrypted with
* @param attachment the {@link Attachment} that is encrypted
* @return the JWE-encrypted {@link Attachment}, is empty if en error occurred
*/
Optional<Attachment> encryptAttachment(final RSAKey publicKey, final Attachment attachment);
Attachment encryptAttachment(final RSAKey publicKey, final Attachment attachment) throws EncryptionException;
/**
* Authenticates the {@link Sender} against the FitConnect-Auth-API and retrieves an {@link OAuthToken}.
*
* @param clientId a unique client identifier
* @param clientId a unique client identifier
* @param clientSecret the applications secret key
* @param scope 1 or more client scopes that determine if a submission is accepted by the client
* @param scope 1 or more client scopes that determine if a submission is accepted by the client
* @return {@link OAuthToken}, is empty if an error occurred
*/
Optional<OAuthToken> retrieveOAuthToken(final String clientId, final String clientSecret, final String... scope);
OAuthToken retrieveOAuthToken(final String clientId, final String clientSecret, final String... scope) throws AuthenticationException;
/**
* Creates and uploads a {@link Metadata} object that contains {@link Data}, {@link Attachment} and their hashes so a subscriber
* can verify the integrity.
*
* @param data {@link Data} object of the json or xml payload
* @param data {@link Data} object of the json or xml payload
* @param attachments a list of binary {@link Attachment}s
* @return a valid {@link Metadata} object with hashed {@link Data} and {@link Attachment}s, is empty if an error occurred
*/
Optional<Metadata> createMetadata(final Data data, final List<Attachment> attachments);
Metadata createMetadata(final Data data, final List<Attachment> attachments) throws MetadataNotCreatedException;
/**
* Creates and uploads a {@link Metadata} object that contains {@link Data}, {@link Attachment} and their hashes so a subscriber
......@@ -77,30 +77,28 @@ public interface Sender {
* @param attachments a list of binary {@link Attachment}s
* @return a valid {@link Metadata} object with hashed {@link Data} and {@link Attachment}s, is empty if an error occurred
*/
Optional<Metadata> createMetadata(final List<Attachment> attachments);
Metadata createMetadata(final List<Attachment> attachments) throws MetadataNotCreatedException;
/**
* Creates and announces a new {@link SubmissionRequest}
* Creates and announces a new {@link SubmissionSubmit}
*
* @param submission with a destinationId, a list of attachmentIds and a serviceType
* @return the created submission
*/
Optional<CreatedSubmission> createSubmission(SubmissionRequest submission);
SubmissionForPickup createSubmission(SubmissionSubmit submission) throws SubmissionNotCreatedException;
/**
* Posts the announced {@link SubmissionRequest}
* Posts the announced {@link SubmissionSubmit}
*
* @param submissionId identifier of the announced submission
* @param submissionId identifier of the announced submission
* @param encryptedMetadata the encrypted metadata
*
* @return the submission
*/
Optional<CreatedSubmission> sendSubmission(UUID submissionId, Metadata encryptedMetadata);
SubmissionForPickup sendSubmission(UUID submissionId, Metadata encryptedMetadata) throws SubmissionNotSentException;
void uploadAttachments(UUID submissionId, List<Attachment> encryptedAttachments);
void uploadAttachments(UUID submissionId, List<Attachment> encryptedAttachments) throws AttachmentUploadException;
Optional<Attachment> createAttachment(File file);
Attachment createAttachment(File file) throws AttachmentCreationException;
RSAKey getEncryptionKeyForDestination(UUID destinationId);
RSAKey getEncryptionKeyForDestination(UUID destinationId) throws KeyNotRetrievedException;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment