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

View File

@ -1,6 +1,7 @@
package eu.eudat.models.data.dashboard.recent.model; package eu.eudat.models.data.dashboard.recent.model;
import eu.eudat.data.entities.Dataset; import eu.eudat.data.entities.Dataset;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import eu.eudat.models.data.listingmodels.UserInfoListingModel; import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import java.util.Date; 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.setVersion(entity.getDmp() != null ? entity.getDmp().getVersion(): 0);
this.setFinalizedAt(entity.getFinalizedAt()); this.setFinalizedAt(entity.getFinalizedAt());
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date()); 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.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : ""); this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : ""); 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.setVersion(entity.getDmp() != null ? entity.getDmp().getVersion(): 0);
this.setFinalizedAt(entity.getFinalizedAt()); this.setFinalizedAt(entity.getFinalizedAt());
this.setPublishedAt(entity.getDmp() != null ? entity.getDmp().getPublishedAt() : new Date()); 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.setGrant(entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "");
this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : ""); this.setDmp( entity.getDmp() != null ? entity.getDmp().getLabel() : "");
this.setDmpId(entity.getDmp() != null ? entity.getDmp().getId().toString() : ""); 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.Dataset;
import eu.eudat.data.entities.Grant; import eu.eudat.data.entities.Grant;
import eu.eudat.models.DataModel; import eu.eudat.models.DataModel;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -18,6 +19,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private String grant; private String grant;
private String dmp; private String dmp;
private String dmpId; private String dmpId;
private DatasetProfileOverviewModel profile;
private int status; private int status;
private Date created; private Date created;
private Date modified; private Date modified;
@ -63,6 +65,14 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.dmpId = dmpId; this.dmpId = dmpId;
} }
public DatasetProfileOverviewModel getProfile() {
return profile;
}
public void setProfile(DatasetProfileOverviewModel profile) {
this.profile = profile;
}
public int getStatus() { public int getStatus() {
return status; return status;
} }
@ -137,6 +147,7 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : ""; this.grant = entity.getDmp() != null ? entity.getDmp().getGrant().getLabel() : "";
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : ""; this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.dmpId = entity.getDmp() != null ? entity.getDmp().getId().toString() : ""; 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.description = entity.getDescription();
this.status = entity.getStatus(); this.status = entity.getStatus();
if (entity.getFinalizedAt() == null && entity.getStatus() == Dataset.Status.FINALISED.getValue()) { 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.setPublic(this.getPublic());
dmp.setFinalizedAt(this.getFinalizedAt()); dmp.setFinalizedAt(this.getFinalizedAt());
entity.setDmp(dmp); entity.setDmp(dmp);
entity.setProfile(this.getProfile() != null ? this.getProfile().toDataModel() : null);
return entity; return entity;
} }