diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java index 05b14d287..e9e26da2b 100644 --- a/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java +++ b/dmp-backend/data/src/main/java/eu/eudat/data/entities/DMP.java @@ -160,6 +160,13 @@ public class DMP implements DataEntity { @Convert(converter = DateToUTCConverter.class) private Date finalizedDat; + @Column(name = "\"isPublic\"", nullable = false) + private boolean isPublic; + + @Column(name= "\"PublishedDat\"") + @Convert(converter = DateToUTCConverter.class) + private Date publishedDat; + public String getDescription() { return description; @@ -294,6 +301,20 @@ public class DMP implements DataEntity { this.finalizedDat = finalizedDat; } + public boolean isPublic() { + return isPublic; + } + public void setPublic(boolean aPublic) { + isPublic = aPublic; + } + + public Date getPublishedDat() { + return publishedDat; + } + public void setPublishedDat(Date publishedDat) { + this.publishedDat = publishedDat; + } + @Override public void update(DMP entity) { this.associatedDmps = entity.associatedDmps; @@ -307,8 +328,10 @@ public class DMP implements DataEntity { this.researchers = entity.getResearchers(); this.organisations = entity.getOrganisations(); this.dmpProperties = entity.getDmpProperties(); + this.isPublic = entity.isPublic; this.setModified(new Date()); if (entity.getStatus().equals(DMPStatus.FINALISED.getValue())) this.setFinalizedDat(new Date()); + if (entity.isPublic) this.setPublishedDat(new Date()); if (entity.getUsers() != null) this.users = entity.getUsers(); } diff --git a/dmp-db-scema/updates/01/DMPPublishedDat.sql b/dmp-db-scema/updates/01/DMPPublishedDat.sql new file mode 100644 index 000000000..a817113b3 --- /dev/null +++ b/dmp-db-scema/updates/01/DMPPublishedDat.sql @@ -0,0 +1,6 @@ +ALTER TABLE public."DMP" +ADD "PublishedDat" timestamp(6) with time zone + +UPDATE public."DMP" +SET "PublishedDat" = "FinalizedDat" +where "isPublic" = True \ No newline at end of file diff --git a/dmp-db-scema/updates/01/DMPisPublic.sql b/dmp-db-scema/updates/01/DMPisPublic.sql new file mode 100644 index 000000000..aef4dca4d --- /dev/null +++ b/dmp-db-scema/updates/01/DMPisPublic.sql @@ -0,0 +1,7 @@ +alter table public."DMP" +Add "isPublic" boolean NOT NULL Default False; + +UPDATE public."DMP" + SET "isPublic" = True + WHERE "Status" = 1 + \ No newline at end of file