file-transformer-base/src/main/java/eu/eudat/file/transformer/entities/descriptiontemplate/fielddata/ExternalDatasetDataEntity.java

61 lines
2.2 KiB
Java

package eu.eudat.file.transformer.entities.descriptiontemplate.fielddata;
import eu.eudat.file.transformer.enums.FieldDataExternalDatasetType;
import eu.eudat.file.transformer.enums.FieldType;
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class ExternalDatasetDataEntity extends BaseFieldDataEntity<ExternalDatasetDataEntity, ExternalDatasetData> {
@Override
public FieldType getFieldType() {
return FieldType.EXTERNAL_DATASETS;
}
private Boolean multiAutoComplete;
private FieldDataExternalDatasetType type;
public Boolean getMultiAutoComplete() {
return multiAutoComplete;
}
public void setMultiAutoComplete(Boolean multiAutoComplete) {
this.multiAutoComplete = multiAutoComplete;
}
public FieldDataExternalDatasetType getType() {
return type;
}
public void setType(FieldDataExternalDatasetType type) {
this.type = type;
}
/*@Override
public Element toXml(Document doc) {
Element root = doc.createElement("data");
root.setAttribute("label", this.getLabel());
if (this.getMultiAutoComplete() != null) {
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
}
if (this.getType() != null) {
root.setAttribute("type", this.getType().getValue());
}
return root;
}
@Override
public ExternalDatasetDataEntity fromXml(Element item) {
this.setLabel(item != null ? item.getAttribute("label") : "");
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
this.setType(item.getAttribute("type") != null ? FieldDataExternalDatasetType.of(item.getAttribute("type")): FieldDataExternalDatasetType.Other);
return this;
}*/
public ExternalDatasetDataEntity fromDefinition(ExternalDatasetData item) {
super.fromDefinition(item);
this.setMultiAutoComplete(item.getMultiAutoComplete());
this.setType(item.getType() != null ? item.getType(): FieldDataExternalDatasetType.Other);
return this;
}
}