Fixes bug and efficiency on fetching DMPs.
This commit is contained in:
parent
7bac52267a
commit
2453cde47f
|
@ -100,7 +100,7 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
joinColumns = {@JoinColumn(name = "\"dmp\"", referencedColumnName = "\"ID\"")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "\"datasetprofile\"", referencedColumnName = "\"ID\"")}
|
||||
)
|
||||
private List<DatasetProfile> associatedDmps;
|
||||
private Set<DatasetProfile> associatedDmps;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
|
@ -237,10 +237,10 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
this.project = project;
|
||||
}
|
||||
|
||||
public List<DatasetProfile> getAssociatedDmps() {
|
||||
public Set<DatasetProfile> getAssociatedDmps() {
|
||||
return associatedDmps;
|
||||
}
|
||||
public void setAssociatedDmps(List<DatasetProfile> associatedDmps) {
|
||||
public void setAssociatedDmps(Set<DatasetProfile> associatedDmps) {
|
||||
this.associatedDmps = associatedDmps;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
|
|||
associatedProfileDoc.appendChild(associatedProfilesElement);
|
||||
dataManagementPlanEntity.setAssociatedDmps(XmlBuilder.generateXml(associatedProfileDoc));*/
|
||||
|
||||
List<DatasetProfile> datasetProfiles = new LinkedList<>();
|
||||
Set<DatasetProfile> datasetProfiles = new HashSet<>();
|
||||
for (AssociatedProfile profile : this.profiles) {
|
||||
datasetProfiles.add(profile.toData());
|
||||
}
|
||||
|
|
|
@ -175,7 +175,8 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
if (this.researchers != null && !this.researchers.isEmpty())
|
||||
entity.setResearchers(new HashSet<>(this.researchers.stream().map(item -> item.toDataModel()).collect(Collectors.toList())));
|
||||
if (this.project != null) entity.setProject(this.project.toDataModel());
|
||||
if (this.profiles != null) {
|
||||
if (this.profiles != null)
|
||||
entity.setAssociatedDmps(this.profiles.stream().map(x -> x.toData()).collect(Collectors.toSet()));
|
||||
/*Document associatedProfileDoc = XmlBuilder.getDocument();
|
||||
Element associatedProfilesElement = associatedProfileDoc.createElement("profiles");
|
||||
for (AssociatedProfile associatedProfile : this.profiles) {
|
||||
|
@ -183,13 +184,6 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
}
|
||||
associatedProfileDoc.appendChild(associatedProfilesElement);
|
||||
entity.setAssociatedDmps(XmlBuilder.generateXml(associatedProfileDoc));*/
|
||||
|
||||
List<DatasetProfile> datasetProfiles = new LinkedList<>();
|
||||
for (AssociatedProfile profile : this.profiles) {
|
||||
datasetProfiles.add(profile.toData());
|
||||
}
|
||||
entity.setAssociatedDmps(datasetProfiles);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue