-
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.
- Loading branch information
Showing
13 changed files
with
146 additions
and
39 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
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 |
---|---|---|
@@ -1,27 +1,66 @@ | ||
package de.samply.frontend.dto; | ||
|
||
import de.samply.db.model.ProjectDocument; | ||
import de.samply.project.state.ProjectBridgeheadState; | ||
import jakarta.validation.constraints.NotNull; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
import java.time.Instant; | ||
|
||
public class DtoFactory { | ||
|
||
public Project convert (@NotNull de.samply.db.model.Project project){ | ||
return new Project(); | ||
//TODO | ||
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 Notification convert (@NotNull de.samply.db.model.Notification notification){ | ||
return new Notification(); | ||
//TODO | ||
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 OtherDocument convert(@NotNull ProjectDocument projectDocument){ | ||
return new OtherDocument(); | ||
//TODO | ||
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 |
---|---|---|
@@ -1,4 +1,16 @@ | ||
package de.samply.frontend.dto; | ||
|
||
public record Notification() { | ||
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 | ||
) { | ||
} |
This file was deleted.
Oops, something went wrong.
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,4 +1,30 @@ | ||
package de.samply.frontend.dto; | ||
|
||
public record Project() { | ||
import de.samply.project.ProjectType; | ||
import de.samply.project.state.ProjectState; | ||
import de.samply.query.OutputFormat; | ||
import de.samply.query.QueryFormat; | ||
|
||
import java.time.Instant; | ||
import java.time.LocalDate; | ||
|
||
public record Project( | ||
String code, | ||
String creatorEmail, | ||
Instant createdAt, | ||
LocalDate expiresAt, | ||
Instant archivedAt, | ||
Instant modifiedAt, | ||
ProjectState state, | ||
ProjectType type, | ||
String query, | ||
String humanReadable, | ||
QueryFormat queryFormat, | ||
OutputFormat outputFormat, | ||
String templateId, | ||
String label, | ||
String description, | ||
String explorerUrl, | ||
String queryContext | ||
) { | ||
} |
11 changes: 10 additions & 1 deletion
11
src/main/java/de/samply/frontend/dto/ProjectBridgehead.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,4 +1,13 @@ | ||
package de.samply.frontend.dto; | ||
|
||
public record ProjectBridgehead() { | ||
import de.samply.project.state.ProjectBridgeheadState; | ||
|
||
import java.time.Instant; | ||
|
||
public record ProjectBridgehead( | ||
String projectCode, | ||
String bridgehead, | ||
ProjectBridgeheadState state, | ||
Instant modifiedAt | ||
) { | ||
} |
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,18 @@ | ||
package de.samply.frontend.dto; | ||
|
||
import de.samply.document.DocumentType; | ||
|
||
import java.time.Instant; | ||
|
||
public record ProjectDocument( | ||
String projectCode, | ||
String originalFilename, | ||
String url, | ||
Instant createdAt, | ||
String bridgehead, | ||
String creatorEmail, | ||
String label, | ||
DocumentType type | ||
) { | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
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