-
Notifications
You must be signed in to change notification settings - Fork 40
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
1 parent
d994ba7
commit 76198ec
Showing
10 changed files
with
197 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '1.0' | ||
type: 'Schema' | ||
entity: | ||
uuid: | ||
versionUuid: | ||
version: '' | ||
name: 'Resource' | ||
description: '' | ||
abstract: true | ||
definition: |
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,8 @@ | ||
version: 1.0 | ||
type: User | ||
entity: | ||
uuid: | ||
firstName: Albert | ||
lastName: Einstein | ||
email: [email protected] | ||
password: password |
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
26 changes: 26 additions & 0 deletions
26
src/main/java/nl/dtls/fairdatapoint/service/seeder/EntitySeeder.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,26 @@ | ||
package nl.dtls.fairdatapoint.service.seeder; | ||
|
||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import nl.dtls.fairdatapoint.config.properties.InstanceProperties; | ||
import nl.dtls.fairdatapoint.service.seeder.entity.EntitiesContainer; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class EntitySeeder { | ||
private static final String DSO_SCHEMA_VERSION = "1.0.0"; | ||
|
||
private final InstanceProperties instanceProperties; | ||
|
||
public EntitiesContainer loadLocal() { | ||
final EntitiesContainer container = new EntitiesContainer(); | ||
|
||
// TODO: list YAML/JSON files in directory | ||
// TODO: load files one by one and add elements | ||
|
||
return container; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/nl/dtls/fairdatapoint/service/seeder/entity/EntitiesContainer.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,19 @@ | ||
package nl.dtls.fairdatapoint.service.seeder.entity; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
@Data | ||
public class EntitiesContainer { | ||
|
||
private final SettingsDSO settings = null; | ||
|
||
private final Map<UUID, UserDSO> users = new HashMap<>(); | ||
|
||
private final Map<UUID, MetadataSchemaDSO> schemas = new HashMap<>(); | ||
|
||
private final Map<UUID, ResourceDefinitionDSO> resourceDefinitions = new HashMap<>(); | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/nl/dtls/fairdatapoint/service/seeder/entity/MetadataSchemaDSO.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,34 @@ | ||
package nl.dtls.fairdatapoint.service.seeder.entity; | ||
|
||
import lombok.Data; | ||
import nl.dtls.fairdatapoint.entity.schema.MetadataSchemaState; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Data | ||
public class MetadataSchemaDSO { | ||
|
||
private UUID uuid = UUID.randomUUID(); | ||
|
||
private UUID versionUuid = UUID.randomUUID(); | ||
|
||
private String name; | ||
|
||
private String version = "1.0.0"; | ||
|
||
private String description = ""; | ||
|
||
private Boolean abstractSchema = false; | ||
|
||
private MetadataSchemaState state = MetadataSchemaState.LATEST; | ||
|
||
private String definition; | ||
|
||
private String suggestedResourceName = null; | ||
|
||
private String suggestedUrlPrefix = null; | ||
|
||
private List<UUID> extendSchemaUuids = new ArrayList<>(); | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/nl/dtls/fairdatapoint/service/seeder/entity/ResourceDefinitionDSO.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,38 @@ | ||
package nl.dtls.fairdatapoint.service.seeder.entity; | ||
|
||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
import nl.dtls.fairdatapoint.api.dto.resource.ResourceDefinitionChildDTO; | ||
import nl.dtls.fairdatapoint.api.dto.resource.ResourceDefinitionLinkDTO; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
@Data | ||
public class ResourceDefinitionDSO { | ||
|
||
@NotBlank | ||
private UUID uuid; | ||
|
||
@NotBlank | ||
private String name; | ||
|
||
@NotNull | ||
private String urlPrefix; | ||
|
||
@NotNull | ||
private List<UUID> metadataSchemaUuids; | ||
|
||
@NotNull | ||
private List<String> targetClassUris; | ||
|
||
@NotNull | ||
@Valid | ||
private List<ResourceDefinitionChildDTO> children; | ||
|
||
@NotNull | ||
@Valid | ||
private List<ResourceDefinitionLinkDTO> externalLinks; | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/nl/dtls/fairdatapoint/service/seeder/entity/SettingsDSO.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,37 @@ | ||
package nl.dtls.fairdatapoint.service.seeder.entity; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.Data; | ||
import nl.dtls.fairdatapoint.api.dto.settings.*; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
public class SettingsDSO { | ||
|
||
private String clientUrl; | ||
|
||
private String persistentUrl; | ||
|
||
@JsonInclude | ||
private String appTitle; | ||
|
||
@JsonInclude | ||
private String appSubtitle; | ||
|
||
private String appTitleFromConfig; | ||
|
||
private String appSubtitleFromConfig; | ||
|
||
private List<SettingsMetricDTO> metadataMetrics; | ||
|
||
private SettingsPingDTO ping; | ||
|
||
private SettingsRepositoryDTO mainRepository; | ||
|
||
private SettingsRepositoryDTO draftsRepository; | ||
|
||
private SettingsSearchDTO search; | ||
|
||
private SettingsFormsDTO forms; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/nl/dtls/fairdatapoint/service/seeder/entity/UserDSO.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,22 @@ | ||
package nl.dtls.fairdatapoint.service.seeder.entity; | ||
|
||
import lombok.Data; | ||
import nl.dtls.fairdatapoint.entity.user.UserRole; | ||
|
||
import java.util.UUID; | ||
|
||
@Data | ||
public class UserDSO { | ||
|
||
private UUID uuid = UUID.randomUUID(); | ||
|
||
private String firstName; | ||
|
||
private String lastName; | ||
|
||
private String email; | ||
|
||
private String password; | ||
|
||
private UserRole role = UserRole.USER; | ||
} |