#7636: [Bug fix] Copy dataset from latest activity or dataset listing: Reverting some changes from commit:b6c28be3b3

1. DatasetListingModel.java: Added  field DatasetProfileOverviewModel profile, getter/setter and set profile in methods "fromDataModel()" and "toDataModel()".
2. RecentActivityModel.java: Added field DatasetProfileOverviewModel profile and getter/setter.
3. RecentDatasetModel.java: Set profile in methods "fromEntity()" and "fromDmpEntity()".
This commit is contained in:
Konstantina Galouni 2022-03-28 17:02:57 +03:00
parent 78895a1df1
commit 650e0ceb06
3 changed files with 24 additions and 0 deletions

View File

@ -18,6 +18,7 @@ public abstract class RecentActivityModel<T extends DataEntity, S extends DataMo
private String grant;
private Date finalizedAt;
private Date publishedAt;
private DatasetProfileOverviewModel profile;
private int type;
private List<UserInfoListingModel> users;
private Boolean isPublic;
@ -94,6 +95,14 @@ public abstract class RecentActivityModel<T extends DataEntity, S extends DataMo
this.publishedAt = publishedAt;
}
public DatasetProfileOverviewModel getProfile() {
return profile;
}
public void setProfile(DatasetProfileOverviewModel profile) {
this.profile = profile;
}
public int getType() {
return type;
}

View File

@ -1,6 +1,7 @@
package eu.eudat.models.data.dashboard.recent.model;
import eu.eudat.data.entities.Dataset;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import java.util.Date;
@ -37,6 +38,7 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
this.setVersion(entity.getDmp() != null ? entity.getDmp().getVersion(): 0);
this.setFinalizedAt(entity.getFinalizedAt());
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()): null);
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");
@ -55,6 +57,7 @@ public class RecentDatasetModel extends RecentActivityModel<Dataset, RecentDatas
this.setVersion(entity.getDmp() != null ? entity.getDmp().getVersion(): 0);
this.setFinalizedAt(entity.getFinalizedAt());
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date());
this.setProfile(entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()) : null);
this.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : "");

View File

@ -4,6 +4,7 @@ import eu.eudat.data.entities.DMP;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.entities.Grant;
import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import java.util.ArrayList;
import java.util.Date;
@ -18,6 +19,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private String grant;
private String dmp;
private String dmpId;
private DatasetProfileOverviewModel profile;
private int status;
private Date created;
private Date modified;
@ -63,6 +65,14 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.dmpId = dmpId;
}
public DatasetProfileOverviewModel getProfile() {
return profile;
}
public void setProfile(DatasetProfileOverviewModel profile) {
this.profile = profile;
}
public int getStatus() {
return status;
}
@ -137,6 +147,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "";
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : "";
this.profile = entity.getProfile() != null ? new DatasetProfileOverviewModel().fromDataModel(entity.getProfile()) : null;
this.description = entity.getDescription();
this.status = entity.getStatus();
if (entity.getFinalizedAt() == null && entity.getStatus() == Dataset.Status.FINALISED.getValue()) {
@ -173,6 +184,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
dmp.setPublic(this.getPublic());
dmp.setFinalizedAt(this.getFinalizedAt());
entity.setDmp(dmp);
entity.setProfile(this.getProfile() != null ? this.getProfile().toDataModel() : null);
return entity;
}