diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java index baa830ddd..22fe5d6d6 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/funder/Funder.java @@ -90,7 +90,12 @@ public class Funder implements DataModel this.status = entity.getStatus(); this.created = entity.getCreated(); this.modified = entity.getModified(); - this.source = "Internal"; + String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); + if (source.equals("dmp")) { + this.source = "Internal"; + } else { + this.source = source; + } return this; } @@ -100,7 +105,15 @@ public class Funder implements DataModel entity.setId(this.id); entity.setLabel(this.label); entity.setType(this.type); - entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference); + if (this.source != null && this.source.equals("Internal")) this.source = "dmp"; + if (this.reference != null && !this.reference.trim().isEmpty() + && this.source != null && !this.source.trim().isEmpty()) { + if (this.source.equals(this.reference.substring(0, this.source.length()))) { + entity.setReference(this.reference); + } else { + entity.setReference(this.source.toLowerCase() + ":" + this.reference); + } + } entity.setDefinition(this.definition); entity.setCreated(this.created == null ? new Date() : this.created); entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.data.entities.Grant.Status.ACTIVE.getValue()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java index f8cde3ca3..56884fe73 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/grant/Grant.java @@ -177,7 +177,12 @@ public class Grant implements DataModel { this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null)); if (entity.getFunder() != null) this.funderId = entity.getFunder().getId(); - this.source = "Internal"; + String source = entity.getReference().substring(0, entity.getReference().indexOf(":")); + if (source.equals("dmp")) { + this.source = "Internal"; + } else { + this.source = source; + } return this; } @@ -189,7 +194,15 @@ public class Grant implements DataModel { entity.setAbbreviation(this.abbreviation); entity.setLabel(this.label); entity.setType(this.type); - entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference); + if (this.source != null && this.source.equals("Internal")) this.source = "dmp"; + if (this.reference != null && !this.reference.trim().isEmpty() + && this.source != null && !this.source.trim().isEmpty()) { + if (this.source.equals(this.reference.substring(0, this.source.length()))) { + entity.setReference(this.reference); + } else { + entity.setReference(this.source.toLowerCase() + ":" + this.reference); + } + } entity.setUri(this.uri); entity.setDefinition(this.definition); entity.setStartdate(this.startDate); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java index fe9da0885..8752e0bd6 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/project/Project.java @@ -165,7 +165,12 @@ public class Project implements DataModel
- - + + +
+
+ +
+
+
-