2018-06-27 12:29:21 +02:00
|
|
|
package eu.eudat.models.data.dmp;
|
2017-12-20 15:52:09 +01:00
|
|
|
|
2019-05-28 09:22:58 +02:00
|
|
|
import eu.eudat.data.entities.DatasetProfile;
|
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;
|
|
|
|
|
|
|
|
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;
|
2017-12-20 15:52:09 +01:00
|
|
|
private String label;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
public String getLabel() {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLabel(String label) {
|
|
|
|
this.label = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Element toXml(Document doc) {
|
|
|
|
Element profile = doc.createElement("profile");
|
2018-02-16 11:34:02 +01:00
|
|
|
profile.setAttribute("profileId", this.id.toString());
|
|
|
|
profile.setAttribute("label", this.label);
|
2017-12-20 15:52:09 +01:00
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public AssociatedProfile fromXml(Element item) {
|
2017-12-22 09:31:05 +01:00
|
|
|
this.id = 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
|
|
|
|
|
|
|
public DatasetProfile toData() {
|
|
|
|
DatasetProfile profile = new DatasetProfile();
|
|
|
|
profile.setId(this.id);
|
|
|
|
profile.setLabel(this.label);
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public AssociatedProfile fromData(DatasetProfile entity) {
|
|
|
|
this.id = entity.getId();
|
|
|
|
this.label = entity.getLabel();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|