45 lines
930 B
Java
45 lines
930 B
Java
package eu.eudat.elastic.entities;
|
|
|
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
|
|
import java.io.IOException;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
|
|
public class DatasetTempalate implements ElasticEntity<DatasetTempalate> {
|
|
private UUID id;
|
|
private String name;
|
|
|
|
public UUID getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(UUID id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
@Override
|
|
public XContentBuilder toElasticEntity(XContentBuilder builder) throws IOException {
|
|
builder.startObject();
|
|
builder.field("id", this.id.toString());
|
|
builder.field("name", this.name);
|
|
builder.endObject();
|
|
return builder;
|
|
}
|
|
|
|
@Override
|
|
public DatasetTempalate fromElasticEntity(Map<String, Object> fields) {
|
|
this.id = UUID.fromString((String) fields.get("id"));
|
|
this.name = (String) fields.get("name");
|
|
return this;
|
|
}
|
|
}
|