Adds Templates (Dataset Profiles) on DMP listing.
This commit is contained in:
parent
e591e47736
commit
e138b18dc1
|
@ -1,12 +1,19 @@
|
||||||
package eu.eudat.models.data.listingmodels;
|
package eu.eudat.models.data.listingmodels;
|
||||||
|
|
||||||
import eu.eudat.data.entities.DMP;
|
import eu.eudat.data.entities.DMP;
|
||||||
|
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||||
import eu.eudat.models.DataModel;
|
import eu.eudat.models.DataModel;
|
||||||
|
import eu.eudat.models.data.dmp.AssociatedProfile;
|
||||||
import eu.eudat.models.data.dmp.Organisation;
|
import eu.eudat.models.data.dmp.Organisation;
|
||||||
import eu.eudat.logic.utilities.helpers.LabelBuilder;
|
import eu.eudat.logic.utilities.helpers.LabelBuilder;
|
||||||
import eu.eudat.models.data.urls.DatasetUrlListing;
|
import eu.eudat.models.data.urls.DatasetUrlListing;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -24,6 +31,7 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
private int status;
|
private int status;
|
||||||
private UUID groupId;
|
private UUID groupId;
|
||||||
private List<DatasetUrlListing> datasets;
|
private List<DatasetUrlListing> datasets;
|
||||||
|
private List<AssociatedProfile> associatedProfiles;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -102,6 +110,13 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AssociatedProfile> getAssociatedProfiles() {
|
||||||
|
return associatedProfiles;
|
||||||
|
}
|
||||||
|
public void setAssociatedProfiles(List<AssociatedProfile> associatedProfiles) {
|
||||||
|
this.associatedProfiles = associatedProfiles;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataManagementPlanListingModel fromDataModel(DMP entity) {
|
public DataManagementPlanListingModel fromDataModel(DMP entity) {
|
||||||
this.id = entity.getId().toString();
|
this.id = entity.getId().toString();
|
||||||
|
@ -120,6 +135,22 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
|
||||||
this.modifiedTime = entity.getModified();
|
this.modifiedTime = entity.getModified();
|
||||||
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
|
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
|
||||||
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
|
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (entity.getAssociatedDmps() != null && !entity.getAssociatedDmps().isEmpty()) {
|
||||||
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,5 @@ export interface DmpListingModel {
|
||||||
groupId: string;
|
groupId: string;
|
||||||
version: number;
|
version: number;
|
||||||
datasets: any[];
|
datasets: any[];
|
||||||
|
associatedProfiles: any[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row d-flex align-items-center my-1">
|
<div class="row d-flex align-items-center my-1">
|
||||||
<mat-icon class="col-auto type-icon">storage</mat-icon>
|
<mat-icon class="col-auto type-icon">storage</mat-icon>
|
||||||
<h4 class="col-auto m-0 p-0">4</h4>
|
<h4 class="col-auto m-0 p-0">{{dmp.associatedProfiles.length}}</h4>
|
||||||
<div class="col-auto dmp-chip ml-2">TEMPLATE</div>
|
<div class="row" *ngFor="let profile of dmp.associatedProfiles">
|
||||||
<div class="col-auto dmp-chip ml-2">TEMPLATE</div>
|
<div class="col-auto dmp-chip ml-2">{{profile.label}}</div>
|
||||||
<div class="col-auto dmp-chip ml-2">TEMPLATE</div>
|
</div>
|
||||||
<div class="col-auto dmp-chip ml-2">TEMPLATE</div>
|
|
||||||
<div class="col-auto dmp-chip ml-2">TEMPLATE</div>
|
|
||||||
<div class="col-auto dmp-chip ml-2">TEMPLATE</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row d-flex align-items-center my-1">
|
<div class="row d-flex align-items-center my-1">
|
||||||
<mat-icon class="col-auto type-icon">settings</mat-icon>
|
<mat-icon class="col-auto type-icon">settings</mat-icon>
|
||||||
|
|
Loading…
Reference in New Issue