Adds finalized date on Datasets and DMPs on backend.

This commit is contained in:
gkolokythas 2019-06-04 12:00:50 +03:00
parent f14a1e63fd
commit 147eb2ce44
4 changed files with 43 additions and 42 deletions

View File

@ -155,10 +155,13 @@ public class DMP implements DataEntity<DMP, UUID> {
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@Column(name = "\"Description\"")
private String description;
@Column(name= "\"FinalizedDat\"")
@Convert(converter = DateToUTCConverter.class)
private Date finalizedDat;
public String getDescription() {
return description;
@ -286,6 +289,13 @@ public class DMP implements DataEntity<DMP, UUID> {
this.dmpProperties = dmpProperties;
}
public Date getFinalizedDat() {
return finalizedDat;
}
public void setFinalizedDat(Date finalizedDat) {
this.finalizedDat = finalizedDat;
}
@Override
public void update(DMP entity) {
this.associatedDmps = entity.associatedDmps;
@ -300,6 +310,7 @@ public class DMP implements DataEntity<DMP, UUID> {
this.organisations = entity.getOrganisations();
this.dmpProperties = entity.getDmpProperties();
this.setModified(new Date());
if (entity.getStatus().equals(DMPStatus.FINALISED.getValue())) this.setFinalizedDat(new Date());
if (entity.getUsers() != null) this.users = entity.getUsers();
}

View File

@ -140,11 +140,14 @@ public class Dataset implements DataEntity<Dataset, UUID> {
@Column(name = "\"Description\"")
private String description;
@Column(name= "\"FinalizedDat\"")
@Convert(converter = DateToUTCConverter.class)
private Date finalizedDat;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@ -153,7 +156,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public UserInfo getCreator() {
return creator;
}
public void setCreator(UserInfo creator) {
this.creator = creator;
}
@ -161,8 +163,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Short getStatus() {
return status;
}
public void setStatus(Short status) {
this.status = status;
}
@ -171,8 +171,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@ -181,8 +179,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
@ -191,8 +187,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Set<Registry> getRegistries() {
return registries;
}
public void setRegistries(Set<Registry> registries) {
this.registries = registries;
}
@ -200,7 +194,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Set<DatasetService> getServices() {
return services;
}
public void setServices(Set<DatasetService> services) {
this.services = services;
}
@ -208,8 +201,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
@ -218,8 +209,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@ -228,8 +217,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public DMP getDmp() {
return dmp;
}
public void setDmp(DMP dmp) {
this.dmp = dmp;
}
@ -238,8 +225,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
@ -248,8 +233,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public String getProperties() {
return properties;
}
public void setProperties(String properties) {
this.properties = properties;
}
@ -258,8 +241,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public DatasetProfile getProfile() {
return profile;
}
public void setProfile(DatasetProfile profile) {
this.profile = profile;
}
@ -268,7 +249,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Set<DatasetDataRepository> getDatasetDataRepositories() {
return datasetDataRepositories;
}
public void setDatasetDataRepositories(Set<DatasetDataRepository> datasetDataRepositories) {
this.datasetDataRepositories = datasetDataRepositories;
}
@ -276,8 +256,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
@ -285,7 +263,6 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public Set<DatasetExternalDataset> getDatasetExternalDatasets() {
return datasetExternalDatasets;
}
public void setDatasetExternalDatasets(Set<DatasetExternalDataset> datasetExternalDatasets) {
this.datasetExternalDatasets = datasetExternalDatasets;
}
@ -293,11 +270,17 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public boolean isPublic() {
return isPublic;
}
public void setPublic(boolean aPublic) {
isPublic = aPublic;
}
public Date getFinalizedDat() {
return finalizedDat;
}
public void setFinalizedDat(Date finalizedDat) {
this.finalizedDat = finalizedDat;
}
@Override
public void update(Dataset entity) {
this.setRegistries(entity.getRegistries());
@ -324,6 +307,7 @@ public class Dataset implements DataEntity<Dataset, UUID> {
this.setStatus(entity.getStatus());
this.setProfile(entity.getProfile());
this.setModified(new Date());
if (entity.getStatus().equals(Status.FINALISED.getValue())) this.setFinalizedDat(new Date());
if (entity.getCreator() != null) this.creator = entity.getCreator();
}

View File

@ -37,6 +37,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
private String description;
private String projectAbbreviation;
private String projectId;
private Date finalizedDat;
public String getId() {
@ -151,6 +152,14 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.projectId = projectId;
}
public Date getFinalizedDat() {
return finalizedDat;
}
public void setFinalizedDat(Date finalizedDat) {
this.finalizedDat = finalizedDat;
}
@Override
public DataManagementPlanListingModel fromDataModel(DMP entity) {
this.id = entity.getId().toString();
@ -173,6 +182,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.description = entity.getDescription();
this.projectAbbreviation = entity.getProject().getAbbreviation();
this.projectId = entity.getProject().getId().toString();
this.finalizedDat = entity.getFinalizedDat();
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
this.associatedProfiles = new LinkedList<>();
@ -180,19 +190,6 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
AssociatedProfile associatedProfile = new AssociatedProfile().fromData(datasetProfile);
this.associatedProfiles.add(associatedProfile);
}
/*Document viewStyleDoc = XmlBuilder.fromXml(entity.getAssociatedDmps());
Element item = (Element) viewStyleDoc.getElementsByTagName("profiles").item(0);
this.associatedProfiles = new LinkedList<>();
if (item != null) {
NodeList associatedProfilesElement = item.getChildNodes();
for (int temp = 0; temp < associatedProfilesElement.getLength(); temp++) {
Node associatedProfileElement = associatedProfilesElement.item(temp);
if (associatedProfileElement.getNodeType() == Node.ELEMENT_NODE) {
this.associatedProfiles.add(new AssociatedProfile().fromXml((Element) associatedProfileElement));
}
}
}*/
}
return this;

View File

@ -26,6 +26,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private String description;
private String projectAbbreviation;
private String projectId;
private Date finalizedDat;
public String getId() {
return id;
@ -132,6 +133,13 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.projectId = projectId;
}
public Date getFinalizedDat() {
return finalizedDat;
}
public void setFinalizedDat(Date finalizedDat) {
this.finalizedDat = finalizedDat;
}
@Override
public DatasetListingModel fromDataModel(Dataset entity) {
this.id = entity.getId().toString();
@ -149,6 +157,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.registries = LabelBuilder.getLabel(entity.getRegistries().stream().map(item -> new eu.eudat.models.data.dataset.Registry().fromDataModel(item)).collect(Collectors.toList()));
this.dataRepositories = LabelBuilder.getLabel(entity.getDatasetDataRepositories().stream().map(item -> new DataRepository().fromDataModel(item.getDataRepository())).collect(Collectors.toList()));
this.services = LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()));
this.finalizedDat = entity.getFinalizedDat();
return this;
}