Adds "isPublic" and "PublishedDat" properties on DMP.

This commit is contained in:
gkolokythas 2019-06-19 17:32:54 +03:00
parent f9292ee839
commit a40def3162
3 changed files with 36 additions and 0 deletions

View File

@ -160,6 +160,13 @@ public class DMP implements DataEntity<DMP, UUID> {
@Convert(converter = DateToUTCConverter.class) @Convert(converter = DateToUTCConverter.class)
private Date finalizedDat; private Date finalizedDat;
@Column(name = "\"isPublic\"", nullable = false)
private boolean isPublic;
@Column(name= "\"PublishedDat\"")
@Convert(converter = DateToUTCConverter.class)
private Date publishedDat;
public String getDescription() { public String getDescription() {
return description; return description;
@ -294,6 +301,20 @@ public class DMP implements DataEntity<DMP, UUID> {
this.finalizedDat = finalizedDat; 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 @Override
public void update(DMP entity) { public void update(DMP entity) {
this.associatedDmps = entity.associatedDmps; this.associatedDmps = entity.associatedDmps;
@ -307,8 +328,10 @@ public class DMP implements DataEntity<DMP, UUID> {
this.researchers = entity.getResearchers(); this.researchers = entity.getResearchers();
this.organisations = entity.getOrganisations(); this.organisations = entity.getOrganisations();
this.dmpProperties = entity.getDmpProperties(); this.dmpProperties = entity.getDmpProperties();
this.isPublic = entity.isPublic;
this.setModified(new Date()); this.setModified(new Date());
if (entity.getStatus().equals(DMPStatus.FINALISED.getValue())) this.setFinalizedDat(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(); if (entity.getUsers() != null) this.users = entity.getUsers();
} }

View File

@ -0,0 +1,6 @@
ALTER TABLE public."DMP"
ADD "PublishedDat" timestamp(6) with time zone
UPDATE public."DMP"
SET "PublishedDat" = "FinalizedDat"
where "isPublic" = True

View File

@ -0,0 +1,7 @@
alter table public."DMP"
Add "isPublic" boolean NOT NULL Default False;
UPDATE public."DMP"
SET "isPublic" = True
WHERE "Status" = 1