#304 - ElasticSearch integration part 1 / doc store integration

This commit is contained in:
Robin Bygrave
2016-03-01 15:36:44 +13:00
parent cb1fe297d6
commit 8d3b4a0407
209 changed files with 6736 additions and 573 deletions
@@ -0,0 +1,73 @@
package com.avaje.ebeaninternal.server.deploy;
import com.avaje.ebean.annotation.DocCode;
import com.avaje.ebean.annotation.DocProperty;
import com.avaje.ebean.annotation.DocSortable;
import com.avaje.ebeanservice.docstore.api.mapping.DocPropertyOptions;
/**
* The options for document property collected when reading deployment mapping.
*/
public class DeployDocPropertyOptions {
private Boolean code;
private Boolean sortable;
private Boolean store;
private Float boost;
private String nullValue;
/**
* Read the DocProperty deployment options.
*/
public void setDocProperty(DocProperty doc) {
code = checkDefault(doc.code());
sortable = checkDefault(doc.sortable());
store = checkDefault(doc.store());
boost = checkDefault(doc.boost());
nullValue = checkDefault(doc.nullValue());
}
/**
* Read the DocSortable deployment options.
*/
public void setDocSortable(DocSortable doc) {
sortable = Boolean.TRUE;
store = checkDefault(doc.store());
boost = checkDefault(doc.boost());
nullValue = checkDefault(doc.nullValue());
}
/**
* Read the DocCode deployment options.
*/
public void setDocCode(DocCode doc) {
code = Boolean.TRUE;
store = checkDefault(doc.store());
boost = checkDefault(doc.boost());
nullValue = checkDefault(doc.nullValue());
}
private String checkDefault(String s) {
return "".equals(s) ? null : s;
}
private Float checkDefault(float boost) {
return (boost == 1) ? null : boost;
}
private Boolean checkDefault(boolean store) {
return (store) ? Boolean.TRUE : null;
}
/**
* Return the DocPropertyOptions with the collected options.
*/
public DocPropertyOptions create() {
return new DocPropertyOptions(code, sortable, store, boost, nullValue);
}
}