mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
Remove unused Lucene references including Query.UserIndex and associated methods
This commit is contained in:
1 parent
db3140512f
commit
0014ea3501
22 files changed
+266
-603
No files matched your search
@@ -6,9 +6,6 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.InvalidNameException;
|
||||
import javax.naming.ldap.LdapName;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
|
||||
@@ -21,172 +18,156 @@ import com.avaje.ebeaninternal.server.type.DataBind;
|
||||
*/
|
||||
public interface IdBinder {
|
||||
|
||||
/**
|
||||
* Initialise the binder.
|
||||
*/
|
||||
public void initialise();
|
||||
|
||||
/**
|
||||
* Convert the Id value as a Lucene string term.
|
||||
*/
|
||||
public String writeTerm(Object idValue);
|
||||
/**
|
||||
* Initialise the binder.
|
||||
*/
|
||||
public void initialise();
|
||||
|
||||
/**
|
||||
* Convert the Lucene string term into an Id value.
|
||||
*/
|
||||
public Object readTerm(String idTermValue);
|
||||
/**
|
||||
* Write the Id value to binary DataOuput.
|
||||
*/
|
||||
public void writeData(DataOutput dataOutput, Object idValue) throws IOException;
|
||||
|
||||
/**
|
||||
* Write the Id value to binary DataOuput.
|
||||
*/
|
||||
public void writeData(DataOutput dataOutput, Object idValue) throws IOException;
|
||||
/**
|
||||
* Read the Id value from the binary DataInput.
|
||||
*/
|
||||
public Object readData(DataInput dataInput) throws IOException;
|
||||
|
||||
/**
|
||||
* Read the Id value from the binary DataInput.
|
||||
*/
|
||||
public Object readData(DataInput dataInput) throws IOException;
|
||||
/**
|
||||
* Return the name(s) of the Id property(s). Comma delimited if there is more
|
||||
* than one.
|
||||
* <p>
|
||||
* This can be used to include in a query.
|
||||
* </p>
|
||||
*/
|
||||
public String getIdProperty();
|
||||
|
||||
/**
|
||||
* Adds RDN's to the LdapName using the id value.
|
||||
*/
|
||||
public void createLdapNameById(LdapName name, Object id) throws InvalidNameException;
|
||||
/**
|
||||
* Find a BeanProperty that is mapped to the database column.
|
||||
*/
|
||||
public BeanProperty findBeanProperty(String dbColumnName);
|
||||
|
||||
/**
|
||||
* Adds RDN's to the LdapName using the id value from the bean.
|
||||
*/
|
||||
public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException;
|
||||
/**
|
||||
* Return the number of scalar properties for this id.
|
||||
*/
|
||||
public int getPropertyCount();
|
||||
|
||||
/**
|
||||
* Return the name(s) of the Id property(s).
|
||||
* Comma delimited if there is more than one.
|
||||
* <p>
|
||||
* This can be used to include in a query.
|
||||
* </p>
|
||||
*/
|
||||
public String getIdProperty();
|
||||
/**
|
||||
* Return false if the id is a simple scalar and false if it is embedded or
|
||||
* concatenated.
|
||||
*/
|
||||
public boolean isComplexId();
|
||||
|
||||
/**
|
||||
* Find a BeanProperty that is mapped to the database column.
|
||||
*/
|
||||
public BeanProperty findBeanProperty(String dbColumnName);
|
||||
|
||||
/**
|
||||
* Return the number of scalar properties for this id.
|
||||
*/
|
||||
public int getPropertyCount();
|
||||
|
||||
/**
|
||||
* Return false if the id is a simple scalar and false if it is embedded or concatenated.
|
||||
*/
|
||||
public boolean isComplexId();
|
||||
|
||||
/**
|
||||
* Return the default order by that may need to be used if the query includes a many property.
|
||||
*/
|
||||
public String getDefaultOrderBy();
|
||||
|
||||
public String getOrderBy(String pathPrefix, boolean ascending);
|
||||
|
||||
/**
|
||||
* Return the values as an array of scalar bindable values.
|
||||
* <p>
|
||||
* For concatenated keys that use an Embedded bean or multiple id properties
|
||||
* this determines the field values are returns them as an Object array.
|
||||
* </p>
|
||||
* <p>
|
||||
* Added primarily for Query.addWhere().add(Expr.idEq()) support.
|
||||
* </p>
|
||||
*/
|
||||
public Object[] getBindValues(Object idValue);
|
||||
|
||||
/**
|
||||
* Return the id values for a given bean.
|
||||
*/
|
||||
public Object[] getIdValues(Object bean);
|
||||
|
||||
/**
|
||||
* Build a string of the logical expressions.
|
||||
* <p>
|
||||
* Typically used to build a id = ? string.
|
||||
* </p>
|
||||
*/
|
||||
public String getAssocOneIdExpr(String prefix, String operator);
|
||||
|
||||
/**
|
||||
* Return the logical id in expression taking into account embedded id's.
|
||||
*/
|
||||
public String getAssocIdInExpr(String prefix);
|
||||
/**
|
||||
* Return the default order by that may need to be used if the query includes
|
||||
* a many property.
|
||||
*/
|
||||
public String getDefaultOrderBy();
|
||||
|
||||
/**
|
||||
* Binds an id value to a prepared statement.
|
||||
*/
|
||||
public void bindId(DataBind dataBind, Object value) throws SQLException;
|
||||
public String getOrderBy(String pathPrefix, boolean ascending);
|
||||
|
||||
/**
|
||||
* Bind the id value to a SqlUpdate statement.
|
||||
*/
|
||||
public void bindId(DefaultSqlUpdate sqlUpdate, Object value);
|
||||
|
||||
public void addIdInBindValue(SpiExpressionRequest request, Object value);
|
||||
|
||||
/**
|
||||
* Return the sql for binding the id using an IN clause.
|
||||
*/
|
||||
public String getBindIdInSql(String baseTableAlias);
|
||||
|
||||
/**
|
||||
* Return the binding expression (like "?" or "(?,?)")for the Id.
|
||||
*/
|
||||
public String getIdInValueExpr(int size);
|
||||
|
||||
/**
|
||||
* Same as getIdInValueExpr but for delete by id.
|
||||
*/
|
||||
public String getIdInValueExprDelete(int size);
|
||||
|
||||
public void buildSelectExpressionChain(String prefix, List<String> selectChain);
|
||||
|
||||
/**
|
||||
* Read the id value from the result set and set it to the bean also returning it.
|
||||
*/
|
||||
public Object readSet(DbReadContext ctx, Object bean) throws SQLException;
|
||||
/**
|
||||
* Return the values as an array of scalar bindable values.
|
||||
* <p>
|
||||
* For concatenated keys that use an Embedded bean or multiple id properties
|
||||
* this determines the field values are returns them as an Object array.
|
||||
* </p>
|
||||
* <p>
|
||||
* Added primarily for Query.addWhere().add(Expr.idEq()) support.
|
||||
* </p>
|
||||
*/
|
||||
public Object[] getBindValues(Object idValue);
|
||||
|
||||
/**
|
||||
* Ignore the appropriate number of scalar properties for this id.
|
||||
*/
|
||||
public void loadIgnore(DbReadContext ctx);
|
||||
|
||||
/**
|
||||
* Read the id value from the result set and return it.
|
||||
*/
|
||||
public Object read(DbReadContext ctx) throws SQLException;
|
||||
/**
|
||||
* Return the id values for a given bean.
|
||||
*/
|
||||
public Object[] getIdValues(Object bean);
|
||||
|
||||
/**
|
||||
* Append to the select clause.
|
||||
*/
|
||||
public void appendSelect(DbSqlContext ctx, boolean subQuery);
|
||||
|
||||
/**
|
||||
* Return the sql for binding the id to. This includes table alias and columns that make up the id.
|
||||
*/
|
||||
public String getBindIdSql(String baseTableAlias);
|
||||
|
||||
/**
|
||||
* Return the id properties in flat form.
|
||||
*/
|
||||
public BeanProperty[] getProperties();
|
||||
|
||||
/**
|
||||
* Cast or convert the Id value if necessary and optionally set it.
|
||||
* <p>
|
||||
* The Id value is not assumed to be the correct type so it is converted to
|
||||
* the correct type. Typically this is because we could get a Integer, Long
|
||||
* or BigDecimal depending on the JDBC driver and situation.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the bean is not null, then the value is set to the bean.
|
||||
* </p>
|
||||
*/
|
||||
public Object convertSetId(Object idValue, Object bean);
|
||||
/**
|
||||
* Build a string of the logical expressions.
|
||||
* <p>
|
||||
* Typically used to build a id = ? string.
|
||||
* </p>
|
||||
*/
|
||||
public String getAssocOneIdExpr(String prefix, String operator);
|
||||
|
||||
/**
|
||||
* Return the logical id in expression taking into account embedded id's.
|
||||
*/
|
||||
public String getAssocIdInExpr(String prefix);
|
||||
|
||||
/**
|
||||
* Binds an id value to a prepared statement.
|
||||
*/
|
||||
public void bindId(DataBind dataBind, Object value) throws SQLException;
|
||||
|
||||
/**
|
||||
* Bind the id value to a SqlUpdate statement.
|
||||
*/
|
||||
public void bindId(DefaultSqlUpdate sqlUpdate, Object value);
|
||||
|
||||
public void addIdInBindValue(SpiExpressionRequest request, Object value);
|
||||
|
||||
/**
|
||||
* Return the sql for binding the id using an IN clause.
|
||||
*/
|
||||
public String getBindIdInSql(String baseTableAlias);
|
||||
|
||||
/**
|
||||
* Return the binding expression (like "?" or "(?,?)")for the Id.
|
||||
*/
|
||||
public String getIdInValueExpr(int size);
|
||||
|
||||
/**
|
||||
* Same as getIdInValueExpr but for delete by id.
|
||||
*/
|
||||
public String getIdInValueExprDelete(int size);
|
||||
|
||||
public void buildSelectExpressionChain(String prefix, List<String> selectChain);
|
||||
|
||||
/**
|
||||
* Read the id value from the result set and set it to the bean also returning
|
||||
* it.
|
||||
*/
|
||||
public Object readSet(DbReadContext ctx, Object bean) throws SQLException;
|
||||
|
||||
/**
|
||||
* Ignore the appropriate number of scalar properties for this id.
|
||||
*/
|
||||
public void loadIgnore(DbReadContext ctx);
|
||||
|
||||
/**
|
||||
* Read the id value from the result set and return it.
|
||||
*/
|
||||
public Object read(DbReadContext ctx) throws SQLException;
|
||||
|
||||
/**
|
||||
* Append to the select clause.
|
||||
*/
|
||||
public void appendSelect(DbSqlContext ctx, boolean subQuery);
|
||||
|
||||
/**
|
||||
* Return the sql for binding the id to. This includes table alias and columns
|
||||
* that make up the id.
|
||||
*/
|
||||
public String getBindIdSql(String baseTableAlias);
|
||||
|
||||
/**
|
||||
* Return the id properties in flat form.
|
||||
*/
|
||||
public BeanProperty[] getProperties();
|
||||
|
||||
/**
|
||||
* Cast or convert the Id value if necessary and optionally set it.
|
||||
* <p>
|
||||
* The Id value is not assumed to be the correct type so it is converted to
|
||||
* the correct type. Typically this is because we could get a Integer, Long or
|
||||
* BigDecimal depending on the JDBC driver and situation.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the bean is not null, then the value is set to the bean.
|
||||
* </p>
|
||||
*/
|
||||
public Object convertSetId(Object idValue, Object bean);
|
||||
|
||||
}
|
||||
@@ -6,11 +6,6 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.InvalidNameException;
|
||||
import javax.naming.ldap.LdapName;
|
||||
import javax.naming.ldap.Rdn;
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
@@ -99,23 +94,6 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public void createLdapNameById(LdapName name, Object id) throws InvalidNameException {
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object v = props[i].getValue(id);
|
||||
Rdn rdn = new Rdn(props[i].getDbColumn(), v);
|
||||
name.add(rdn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException {
|
||||
Object id = embIdProperty.getValue(bean);
|
||||
createLdapNameById(name, id);
|
||||
}
|
||||
|
||||
public BeanDescriptor<?> getIdBeanDescriptor() {
|
||||
return idDesc;
|
||||
}
|
||||
@@ -228,42 +206,6 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
return idInValueSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the lucene string term value into embedded id.
|
||||
*/
|
||||
public Object readTerm(String idTermValue) {
|
||||
|
||||
String[] split = idTermValue.split("|");
|
||||
if (split.length != props.length){
|
||||
String msg = "Failed to split ["+idTermValue+"] using | for id.";
|
||||
throw new PersistenceException(msg);
|
||||
}
|
||||
Object embId = idDesc.createBean();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object v = props[i].getScalarType().parse(split[i]);
|
||||
props[i].setValue(embId, v);
|
||||
}
|
||||
return embId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the embedded id as a Lucene string term value.
|
||||
*/
|
||||
public String writeTerm(Object idValue) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object v = props[i].getValue(idValue);
|
||||
String formatValue = props[i].getScalarType().format(v);
|
||||
if (i > 0){
|
||||
sb.append("|");
|
||||
}
|
||||
sb.append(formatValue);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object[] getIdValues(Object bean) {
|
||||
bean = embIdProperty.getValue(bean);
|
||||
Object[] bindvalues = new Object[props.length];
|
||||
|
||||
@@ -6,9 +6,6 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.InvalidNameException;
|
||||
import javax.naming.ldap.LdapName;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
|
||||
@@ -21,132 +18,118 @@ import com.avaje.ebeaninternal.server.type.DataBind;
|
||||
*/
|
||||
public final class IdBinderEmpty implements IdBinder {
|
||||
|
||||
private static final String bindIdSql = "";
|
||||
|
||||
private static final BeanProperty[] properties = new BeanProperty[0];
|
||||
|
||||
public IdBinderEmpty() {
|
||||
private static final String bindIdSql = "";
|
||||
|
||||
}
|
||||
public void initialise(){
|
||||
|
||||
}
|
||||
|
||||
public Object readTerm(String idTermValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String writeTerm(Object idValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getOrderBy(String pathPrefix, boolean ascending){
|
||||
return pathPrefix;
|
||||
}
|
||||
|
||||
public void buildSelectExpressionChain(String prefix, List<String> selectChain) {
|
||||
}
|
||||
|
||||
public void createLdapNameById(LdapName name, Object id) throws InvalidNameException {
|
||||
}
|
||||
|
||||
public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException {
|
||||
}
|
||||
|
||||
public int getPropertyCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getIdProperty() {
|
||||
return null;
|
||||
}
|
||||
private static final BeanProperty[] properties = new BeanProperty[0];
|
||||
|
||||
public BeanProperty findBeanProperty(String dbColumnName) {
|
||||
return null;
|
||||
}
|
||||
public boolean isComplexId(){
|
||||
return true;
|
||||
}
|
||||
public IdBinderEmpty() {
|
||||
|
||||
}
|
||||
|
||||
public String getDefaultOrderBy() {
|
||||
// this should never happen?
|
||||
return "";
|
||||
}
|
||||
|
||||
public BeanProperty[] getProperties() {
|
||||
return properties;
|
||||
}
|
||||
public void initialise() {
|
||||
|
||||
public String getBindIdSql(String baseTableAlias) {
|
||||
return bindIdSql;
|
||||
}
|
||||
|
||||
public String getAssocOneIdExpr(String prefix, String operator){
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getAssocIdInExpr(String prefix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addIdInBindValue(SpiExpressionRequest request, Object value) {
|
||||
|
||||
}
|
||||
|
||||
public String getIdInValueExprDelete(int size) {
|
||||
return getIdInValueExpr(size);
|
||||
}
|
||||
|
||||
public String getIdInValueExpr(int size) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getBindIdInSql(String baseTableAlias) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] getIdValues(Object bean){
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] getBindValues(Object idValue){
|
||||
return new Object[]{idValue};
|
||||
}
|
||||
|
||||
public void bindId(DefaultSqlUpdate sqlUpdate, Object value) {
|
||||
|
||||
}
|
||||
|
||||
public void bindId(DataBind dataBind, Object value) throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
public void loadIgnore(DbReadContext ctx) {
|
||||
}
|
||||
public String getOrderBy(String pathPrefix, boolean ascending) {
|
||||
return pathPrefix;
|
||||
}
|
||||
|
||||
public void buildSelectExpressionChain(String prefix, List<String> selectChain) {
|
||||
}
|
||||
|
||||
public int getPropertyCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getIdProperty() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public BeanProperty findBeanProperty(String dbColumnName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isComplexId() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getDefaultOrderBy() {
|
||||
// this should never happen?
|
||||
return "";
|
||||
}
|
||||
|
||||
public BeanProperty[] getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getBindIdSql(String baseTableAlias) {
|
||||
return bindIdSql;
|
||||
}
|
||||
|
||||
public String getAssocOneIdExpr(String prefix, String operator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getAssocIdInExpr(String prefix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addIdInBindValue(SpiExpressionRequest request, Object value) {
|
||||
|
||||
}
|
||||
|
||||
public String getIdInValueExprDelete(int size) {
|
||||
return getIdInValueExpr(size);
|
||||
}
|
||||
|
||||
public String getIdInValueExpr(int size) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getBindIdInSql(String baseTableAlias) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] getIdValues(Object bean) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object[] getBindValues(Object idValue) {
|
||||
return new Object[] { idValue };
|
||||
}
|
||||
|
||||
public void bindId(DefaultSqlUpdate sqlUpdate, Object value) {
|
||||
|
||||
}
|
||||
|
||||
public void bindId(DataBind dataBind, Object value) throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
public void loadIgnore(DbReadContext ctx) {
|
||||
}
|
||||
|
||||
public Object readSet(DbReadContext ctx, Object bean) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object read(DbReadContext ctx) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void appendSelect(DbSqlContext ctx, boolean subQuery) {
|
||||
}
|
||||
|
||||
public Object convertSetId(Object idValue, Object bean) {
|
||||
return idValue;
|
||||
}
|
||||
|
||||
public Object readData(DataInput dataOutput) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void writeData(DataOutput dataOutput, Object idValue) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
public Object readSet(DbReadContext ctx, Object bean) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object read(DbReadContext ctx) throws SQLException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void appendSelect(DbSqlContext ctx, boolean subQuery) {
|
||||
}
|
||||
|
||||
public Object convertSetId(Object idValue, Object bean){
|
||||
return idValue;
|
||||
}
|
||||
|
||||
public Object readData(DataInput dataOutput) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void writeData(DataOutput dataOutput, Object idValue) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,9 +8,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.naming.InvalidNameException;
|
||||
import javax.naming.ldap.LdapName;
|
||||
import javax.naming.ldap.Rdn;
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
@@ -83,24 +80,6 @@ public final class IdBinderMultiple implements IdBinder {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void createLdapNameById(LdapName name, Object id) throws InvalidNameException {
|
||||
|
||||
if (id instanceof Map<?,?> == false){
|
||||
throw new RuntimeException("Expecting a Map for concatinated key");
|
||||
}
|
||||
|
||||
Map<?,?> mapId = (Map<?,?>)id;
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
|
||||
Object v = mapId.get(props[i].getName());
|
||||
if (v == null){
|
||||
throw new RuntimeException("No value in Map for key "+props[i].getName());
|
||||
}
|
||||
|
||||
Rdn rdn = new Rdn(props[i].getDbColumn(), v);
|
||||
name.add(rdn);
|
||||
}
|
||||
}
|
||||
|
||||
public void buildSelectExpressionChain(String prefix, List<String> selectChain) {
|
||||
|
||||
@@ -109,19 +88,11 @@ public final class IdBinderMultiple implements IdBinder {
|
||||
}
|
||||
}
|
||||
|
||||
public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException {
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
|
||||
Object v = props[i].getValue(bean);
|
||||
Rdn rdn = new Rdn(props[i].getDbColumn(), v);
|
||||
name.add(rdn);
|
||||
}
|
||||
}
|
||||
|
||||
public int getPropertyCount() {
|
||||
return props.length;
|
||||
}
|
||||
public int getPropertyCount() {
|
||||
return props.length;
|
||||
}
|
||||
|
||||
public String getIdProperty() {
|
||||
return idProperties;
|
||||
@@ -229,40 +200,6 @@ public final class IdBinderMultiple implements IdBinder {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object readTerm(String idTermValue) {
|
||||
|
||||
String[] split = idTermValue.split("|");
|
||||
if (split.length != props.length){
|
||||
String msg = "Failed to split ["+idTermValue+"] using | for id.";
|
||||
throw new PersistenceException(msg);
|
||||
}
|
||||
Map<String, Object> uidMap = new LinkedHashMap<String, Object>();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object v = props[i].getScalarType().parse(split[i]);
|
||||
uidMap.put(props[i].getName(), v);
|
||||
}
|
||||
return uidMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String writeTerm(Object idValue) {
|
||||
|
||||
Map<String, ?> uidMap = (Map<String, ?>) idValue;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object v = uidMap.get(props[i].getName());
|
||||
String formatValue = props[i].getScalarType().format(v);
|
||||
if (i > 0){
|
||||
sb.append("|");
|
||||
}
|
||||
sb.append(formatValue);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object readData(DataInput dataInput) throws IOException {
|
||||
|
||||
LinkedHashMap<String,Object> map = new LinkedHashMap<String, Object>();
|
||||
|
||||
@@ -6,10 +6,6 @@ import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.InvalidNameException;
|
||||
import javax.naming.ldap.LdapName;
|
||||
import javax.naming.ldap.Rdn;
|
||||
|
||||
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
|
||||
import com.avaje.ebeaninternal.server.core.DefaultSqlUpdate;
|
||||
import com.avaje.ebeaninternal.server.core.InternString;
|
||||
@@ -48,14 +44,6 @@ public final class IdBinderSimple implements IdBinder {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public Object readTerm(String idTermValue) {
|
||||
return scalarType.parse(idTermValue);
|
||||
}
|
||||
|
||||
public String writeTerm(Object idValue) {
|
||||
return scalarType.format(idValue);
|
||||
}
|
||||
|
||||
public String getOrderBy(String pathPrefix, boolean ascending){
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -73,16 +61,6 @@ public final class IdBinderSimple implements IdBinder {
|
||||
|
||||
idProperty.buildSelectExpressionChain(prefix, selectChain);
|
||||
}
|
||||
|
||||
public void createLdapNameById(LdapName name, Object id) throws InvalidNameException {
|
||||
Rdn rdn = new Rdn(idProperty.getDbColumn(), id);
|
||||
name.add(rdn);
|
||||
}
|
||||
|
||||
public void createLdapNameByBean(LdapName name, Object bean) throws InvalidNameException {
|
||||
Object id = idProperty.getValue(bean);
|
||||
createLdapNameById(name, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 1.
|
||||
|
||||
Reference in new issue
Block a user