argos/dmp-backend/web/src/main/java/eu/eudat/publicapi/models/associatedprofile/AssociatedProfilePublicMode...

58 lines
1.5 KiB
Java

package eu.eudat.publicapi.models.associatedprofile;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.util.UUID;
public class AssociatedProfilePublicModel implements XmlSerializable<AssociatedProfilePublicModel> {
private UUID id;
private String label;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
@Override
public Element toXml(Document doc) {
Element profile = doc.createElement("profile");
profile.setAttribute("profileId", this.id.toString());
profile.setAttribute("label", this.label);
return profile;
}
@Override
public AssociatedProfilePublicModel fromXml(Element item) {
this.id = UUID.fromString(item.getAttribute("profileId"));
this.label = item.getAttribute("label");
return this;
}
public DatasetProfile toData() {
DatasetProfile profile = new DatasetProfile();
profile.setId(this.id);
profile.setLabel(this.label);
return profile;
}
public AssociatedProfilePublicModel fromData(DatasetProfile entity) {
this.id = entity.getId();
this.label = entity.getLabel();
return this;
}
}