2018-06-27 12:29:21 +02:00
|
|
|
package eu.eudat.models.data.dmp;
|
2017-12-20 15:52:09 +01:00
|
|
|
|
2023-07-25 14:04:39 +02:00
|
|
|
import eu.eudat.data.entities.DescriptionTemplate;
|
2018-06-27 12:29:21 +02:00
|
|
|
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
2017-12-20 15:52:09 +01:00
|
|
|
import org.w3c.dom.Document;
|
|
|
|
import org.w3c.dom.Element;
|
|
|
|
|
2023-09-11 07:57:09 +02:00
|
|
|
import java.util.Map;
|
2017-12-20 15:52:09 +01:00
|
|
|
import java.util.UUID;
|
|
|
|
|
2018-02-01 10:08:06 +01:00
|
|
|
|
2018-02-16 11:34:02 +01:00
|
|
|
public class AssociatedProfile implements XmlSerializable<AssociatedProfile> {
|
2017-12-22 09:31:05 +01:00
|
|
|
private UUID id;
|
2023-09-12 14:36:06 +02:00
|
|
|
private UUID descriptionTemplateId;
|
2017-12-20 15:52:09 +01:00
|
|
|
private String label;
|
2023-09-11 07:57:09 +02:00
|
|
|
private Map<String, Object> data;
|
2017-12-20 15:52:09 +01:00
|
|
|
|
2017-12-22 09:31:05 +01:00
|
|
|
public UUID getId() {
|
|
|
|
return id;
|
2017-12-20 15:52:09 +01:00
|
|
|
}
|
|
|
|
|
2017-12-22 09:31:05 +01:00
|
|
|
public void setId(UUID id) {
|
|
|
|
this.id = id;
|
2017-12-20 15:52:09 +01:00
|
|
|
}
|
|
|
|
|
2023-09-12 14:36:06 +02:00
|
|
|
public UUID getDescriptionTemplateId() {
|
|
|
|
return descriptionTemplateId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
|
|
|
|
this.descriptionTemplateId = descriptionTemplateId;
|
|
|
|
}
|
|
|
|
|
2017-12-20 15:52:09 +01:00
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
|
|
|
|
2023-09-11 07:57:09 +02:00
|
|
|
public Map<String, Object> getData() {
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setData(Map<String, Object> data) {
|
|
|
|
this.data = data;
|
|
|
|
}
|
|
|
|
|
2017-12-20 15:52:09 +01:00
|
|
|
@Override
|
|
|
|
public Element toXml(Document doc) {
|
|
|
|
Element profile = doc.createElement("profile");
|
2023-09-12 14:36:06 +02:00
|
|
|
profile.setAttribute("profileId", this.descriptionTemplateId.toString());
|
2018-02-16 11:34:02 +01:00
|
|
|
profile.setAttribute("label", this.label);
|
2017-12-20 15:52:09 +01:00
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public AssociatedProfile fromXml(Element item) {
|
2023-09-12 14:36:06 +02:00
|
|
|
this.descriptionTemplateId = UUID.fromString(item.getAttribute("profileId"));
|
2017-12-20 15:52:09 +01:00
|
|
|
this.label = item.getAttribute("label");
|
|
|
|
return this;
|
|
|
|
}
|
2019-05-28 09:22:58 +02:00
|
|
|
|
2023-07-25 14:04:39 +02:00
|
|
|
public DescriptionTemplate toData() {
|
|
|
|
DescriptionTemplate profile = new DescriptionTemplate();
|
2023-09-12 14:36:06 +02:00
|
|
|
profile.setId(this.descriptionTemplateId);
|
2019-05-28 09:22:58 +02:00
|
|
|
profile.setLabel(this.label);
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
2023-07-25 14:04:39 +02:00
|
|
|
public AssociatedProfile fromData(DescriptionTemplate entity) {
|
2023-09-12 14:36:06 +02:00
|
|
|
this.descriptionTemplateId = entity.getId();
|
2019-05-28 09:22:58 +02:00
|
|
|
this.label = entity.getLabel();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|