-
Notifications
You must be signed in to change notification settings - Fork 0
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 #4 from samply/feature/frontend-dto
Feature/frontend dto
- Loading branch information
Showing
18 changed files
with
298 additions
and
44 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
src/main/java/de/samply/annotations/EmailSenderIfError.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,17 @@ | ||
package de.samply.annotations; | ||
|
||
import de.samply.email.EmailRecipientType; | ||
import de.samply.email.EmailTemplateType; | ||
|
||
import java.lang.annotation.*; | ||
|
||
@Repeatable(EmailSendersIfError.class) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface EmailSenderIfError { | ||
|
||
// Recipients of the email | ||
EmailRecipientType[] recipients() default {}; | ||
|
||
EmailTemplateType templateType(); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/de/samply/annotations/EmailSendersIfError.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,12 @@ | ||
package de.samply.annotations; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.METHOD) | ||
public @interface EmailSendersIfError { | ||
EmailSenderIfError[] value(); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package de.samply.frontend.dto; | ||
|
||
import de.samply.project.state.ProjectBridgeheadState; | ||
import jakarta.validation.constraints.NotNull; | ||
|
||
import java.time.Instant; | ||
|
||
public class DtoFactory { | ||
|
||
public static Project convert(@NotNull de.samply.db.model.Project project) { | ||
return new Project( | ||
project.getCode(), | ||
project.getCreatorEmail(), | ||
project.getCreatedAt(), | ||
project.getExpiresAt(), | ||
project.getArchivedAt(), | ||
project.getModifiedAt(), | ||
project.getState(), | ||
project.getType(), | ||
project.getQuery().getQuery(), | ||
project.getQuery().getHumanReadable(), | ||
project.getQuery().getQueryFormat(), | ||
project.getQuery().getOutputFormat(), | ||
project.getQuery().getTemplateId(), | ||
project.getQuery().getLabel(), | ||
project.getQuery().getDescription(), | ||
project.getQuery().getExplorerUrl(), | ||
project.getQuery().getContext() | ||
); | ||
} | ||
|
||
public static Notification convert(@NotNull de.samply.db.model.Notification notification) { | ||
return new Notification( | ||
notification.getEmail(), | ||
notification.getTimestamp(), | ||
notification.getProject().getCode(), | ||
notification.getBridgehead(), | ||
notification.getOperationType(), | ||
notification.getDetails(), | ||
notification.getError() | ||
); | ||
} | ||
|
||
public static ProjectDocument convert(@NotNull de.samply.db.model.ProjectDocument projectDocument) { | ||
return new ProjectDocument( | ||
projectDocument.getProject().getCode(), | ||
projectDocument.getOriginalFilename(), | ||
projectDocument.getUrl(), | ||
projectDocument.getCreatedAt(), | ||
projectDocument.getBridgehead(), | ||
projectDocument.getCreatorEmail(), | ||
projectDocument.getLabel(), | ||
projectDocument.getDocumentType() | ||
); | ||
} | ||
|
||
public static ProjectBridgehead convert(@NotNull de.samply.db.model.ProjectBridgehead projectBridgehead) { | ||
return new ProjectBridgehead( | ||
projectBridgehead.getProject().getCode(), | ||
projectBridgehead.getBridgehead(), | ||
projectBridgehead.getState(), | ||
projectBridgehead.getModifiedAt() | ||
); | ||
} | ||
|
||
} |
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,16 @@ | ||
package de.samply.frontend.dto; | ||
|
||
import de.samply.notification.OperationType; | ||
|
||
import java.time.Instant; | ||
|
||
public record Notification( | ||
String email, | ||
Instant timestamp, | ||
String projectCode, | ||
String bridgehead, | ||
OperationType operationType, | ||
String details, | ||
String error | ||
) { | ||
} |
Oops, something went wrong.