Skip to content
Snippets Groups Projects

Validierung des Metadaten Schemas

Merged Martin Vogel requested to merge feature/566-check-metadata-schema into main
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
@@ -241,15 +241,15 @@ public class SenderClient {
/** Set encrypted metadata with data payload and attachments **/
logger.info("Adding data payload with mime-type {} to submission", this.dataPayload.mimeType);
final DataPayload data = getEncryptedData(this.dataPayload, destination, encryptionKey);
final Metadata metadata = createMetadata(hashedAttachments, dataPayload);
final DataPayload dataToSend = getEncryptedData(this.dataPayload, destination, encryptionKey);
final Metadata metadata = createMetadata(hashedAttachments, dataToSend);
final ValidationResult validatedMetadata = sender.validateMetadata(metadata, metadataSchema);
if (validatedMetadata.hasError()) {
logger.error("Metadata does not match schema", validatedMetadata.getError());
sender.rejectSubmission(submissionId, destinationId, announcedSubmission.getCaseId());
return Optional.empty();
}
submission.setEncryptedData(data.getEncryptedData());
submission.setEncryptedData(dataToSend.getEncryptedData());
submission.setEncryptedMetadata(sender.encryptObject(encryptionKey, metadata));
/** submit submission **/
Loading