-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13092 from SORMAS-Foundation/feature-13043_bulk_a…
…ction_send_emails_with_uploaded_attached_docs #13043 - Bulk action - send emails with uploaded attached documents
- Loading branch information
Showing
53 changed files
with
1,689 additions
and
189 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
sormas-api/src/main/java/de/symeda/sormas/api/DocumentHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* ****************************************************************************** | ||
* * SORMAS® - Surveillance Outbreak Response Management & Analysis System | ||
* * Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI) | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU General Public License as published by | ||
* * the Free Software Foundation, either version 3 of the License, or | ||
* * (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU General Public License | ||
* * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package de.symeda.sormas.api; | ||
|
||
import de.symeda.sormas.api.utils.FileExtensionNotAllowedException; | ||
|
||
public class DocumentHelper { | ||
|
||
public static String getFileExtension(String fileName) { | ||
int index = fileName.lastIndexOf('.'); | ||
if (index > 0) { | ||
return fileName.substring(index); | ||
} else { | ||
throw new FileExtensionNotAllowedException(String.format("File name (%s) is not properly formatted", fileName)); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
sormas-api/src/main/java/de/symeda/sormas/api/docgeneneration/EmailAttachementDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* ****************************************************************************** | ||
* * SORMAS® - Surveillance Outbreak Response Management & Analysis System | ||
* * Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI) | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU General Public License as published by | ||
* * the Free Software Foundation, either version 3 of the License, or | ||
* * (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU General Public License | ||
* * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package de.symeda.sormas.api.docgeneneration; | ||
|
||
import java.io.Serializable; | ||
|
||
import de.symeda.sormas.api.document.DocumentDto; | ||
|
||
public class EmailAttachementDto implements Serializable { | ||
|
||
private static final long serialVersionUID = -6376903475087381451L; | ||
|
||
private final DocumentDto document; | ||
|
||
private final byte[] content; | ||
|
||
public EmailAttachementDto(DocumentDto document, byte[] content) { | ||
this.document = document; | ||
this.content = content; | ||
} | ||
|
||
public DocumentDto getDocument() { | ||
return document; | ||
} | ||
|
||
public byte[] getContent() { | ||
return content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
sormas-api/src/main/java/de/symeda/sormas/api/document/DocumentRelatedEntityDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* ****************************************************************************** | ||
* * SORMAS® - Surveillance Outbreak Response Management & Analysis System | ||
* * Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI) | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU General Public License as published by | ||
* * the Free Software Foundation, either version 3 of the License, or | ||
* * (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU General Public License | ||
* * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package de.symeda.sormas.api.document; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Pattern; | ||
import javax.validation.constraints.Size; | ||
|
||
import de.symeda.sormas.api.i18n.Validations; | ||
import de.symeda.sormas.api.utils.DataHelper; | ||
import de.symeda.sormas.api.utils.FieldConstraints; | ||
import de.symeda.sormas.api.utils.pseudonymization.PseudonymizableDto; | ||
|
||
public class DocumentRelatedEntityDto extends PseudonymizableDto { | ||
|
||
public static final String RELATED_ENTITY_UUID = "relatedEntityUuid"; | ||
public static final String RELATED_ENTITY_TYPE = "relatedEntityType"; | ||
|
||
@NotNull | ||
private DocumentReferenceDto document; | ||
@NotBlank(message = Validations.requiredField) | ||
@Pattern(regexp = UUID_REGEX, message = Validations.patternNotMatching) | ||
@Size(min = FieldConstraints.CHARACTER_LIMIT_UUID_MIN, max = FieldConstraints.CHARACTER_LIMIT_UUID_MAX, message = Validations.textSizeNotInRange) | ||
private String relatedEntityUuid; | ||
@NotNull(message = Validations.requiredField) | ||
private DocumentRelatedEntityType relatedEntityType; | ||
|
||
public DocumentRelatedEntityDto() { | ||
} | ||
|
||
public static DocumentRelatedEntityDto build(DocumentRelatedEntityType documentRelatedEntityType, String relatedEntityUuid) { | ||
DocumentRelatedEntityDto documentRelatedEntities = new DocumentRelatedEntityDto(); | ||
documentRelatedEntities.setUuid(DataHelper.createUuid()); | ||
documentRelatedEntities.setRelatedEntityType(documentRelatedEntityType); | ||
documentRelatedEntities.setRelatedEntityUuid(relatedEntityUuid); | ||
return documentRelatedEntities; | ||
} | ||
|
||
public DocumentReferenceDto getDocument() { | ||
return document; | ||
} | ||
|
||
public void setDocument(DocumentReferenceDto document) { | ||
this.document = document; | ||
} | ||
|
||
public String getRelatedEntityUuid() { | ||
return relatedEntityUuid; | ||
} | ||
|
||
public void setRelatedEntityUuid(String relatedEntityUuid) { | ||
this.relatedEntityUuid = relatedEntityUuid; | ||
} | ||
|
||
public DocumentRelatedEntityType getRelatedEntityType() { | ||
return relatedEntityType; | ||
} | ||
|
||
public void setRelatedEntityType(DocumentRelatedEntityType relatedEntityType) { | ||
this.relatedEntityType = relatedEntityType; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
sormas-api/src/main/java/de/symeda/sormas/api/document/DocumentRelatedEntityFacade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* ****************************************************************************** | ||
* * SORMAS® - Surveillance Outbreak Response Management & Analysis System | ||
* * Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI) | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU General Public License as published by | ||
* * the Free Software Foundation, either version 3 of the License, or | ||
* * (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU General Public License | ||
* * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package de.symeda.sormas.api.document; | ||
|
||
import javax.ejb.Remote; | ||
|
||
@Remote | ||
public interface DocumentRelatedEntityFacade { | ||
} |
28 changes: 28 additions & 0 deletions
28
sormas-api/src/main/java/de/symeda/sormas/api/externalemail/AttachmentException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* ****************************************************************************** | ||
* * SORMAS® - Surveillance Outbreak Response Management & Analysis System | ||
* * Copyright © 2016-2024 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI) | ||
* * | ||
* * This program is free software: you can redistribute it and/or modify | ||
* * it under the terms of the GNU General Public License as published by | ||
* * the Free Software Foundation, either version 3 of the License, or | ||
* * (at your option) any later version. | ||
* * | ||
* * This program is distributed in the hope that it will be useful, | ||
* * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* * GNU General Public License for more details. | ||
* * | ||
* * You should have received a copy of the GNU General Public License | ||
* * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package de.symeda.sormas.api.externalemail; | ||
|
||
public class AttachmentException extends Exception { | ||
|
||
public AttachmentException(String message) { | ||
super(message); | ||
} | ||
} |
24 changes: 16 additions & 8 deletions
24
sormas-api/src/main/java/de/symeda/sormas/api/externalemail/ExternalEmailFacade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,49 @@ | ||
/* | ||
* SORMAS® - Surveillance Outbreak Response Management & Analysis System | ||
* Copyright © 2016-2023 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package de.symeda.sormas.api.externalemail; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import javax.ejb.Remote; | ||
import javax.validation.Valid; | ||
|
||
import de.symeda.sormas.api.ReferenceDto; | ||
import de.symeda.sormas.api.common.progress.ProcessedEntity; | ||
import de.symeda.sormas.api.docgeneneration.DocumentTemplateException; | ||
import de.symeda.sormas.api.docgeneneration.DocumentWorkflow; | ||
import de.symeda.sormas.api.document.DocumentReferenceDto; | ||
import de.symeda.sormas.api.person.PersonReferenceDto; | ||
import de.symeda.sormas.api.utils.ValidationException; | ||
|
||
@Remote | ||
public interface ExternalEmailFacade { | ||
|
||
List<String> getTemplateNames(DocumentWorkflow documentWorkflow); | ||
|
||
List<DocumentReferenceDto> getAttachableDocuments(DocumentWorkflow documentWorkflow, String relatedEntityUuid); | ||
List<DocumentReferenceDto> getAttachableDocuments(DocumentWorkflow documentWorkflow, String relatedEntityUuid); | ||
|
||
void sendEmail(@Valid ExternalEmailOptionsDto options) throws DocumentTemplateException, ExternalEmailException; | ||
void sendEmail(@Valid ExternalEmailOptionsDto options) | ||
throws DocumentTemplateException, ExternalEmailException, AttachmentException, ValidationException; | ||
|
||
boolean isAttachmentAvailable(PersonReferenceDto personReferenceDto); | ||
List<ProcessedEntity> sendBulkEmail(@Valid ExternalEmailOptionsWithAttachmentsDto options, List<ReferenceDto> rootEntityReferences) | ||
throws IOException; | ||
|
||
boolean isAttachmentAvailable(PersonReferenceDto personReferenceDto); | ||
|
||
Set<String> getAttachableFileExtensions(); | ||
} |
Oops, something went wrong.