IDEMPIERE-2604 Use LIKE sentence in webservice queryData / integrate code by Jan Thielemann (jthielemann) https://www.youtube.com/watch?v=04V459i0vR4

This commit is contained in:
sauljabin 2015-05-06 17:25:10 -05:00
parent 686131b0f7
commit 395d6c5411
1 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,7 @@ import javax.xml.ws.WebServiceContext;
import org.apache.cxf.jaxrs.ext.MessageContext; import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.xmlbeans.StringEnumAbstractBase.Table; import org.apache.xmlbeans.StringEnumAbstractBase.Table;
import org.compiere.model.I_AD_Column;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MColumn; import org.compiere.model.MColumn;
import org.compiere.model.MLookup; import org.compiere.model.MLookup;
@ -1454,7 +1455,16 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
{ {
for (DataField field : modelCRUD.getDataRow().getFieldArray()) { for (DataField field : modelCRUD.getDataRow().getFieldArray()) {
if (m_webservicetype.isInputColumnNameAllowed(field.getColumn())) { if (m_webservicetype.isInputColumnNameAllowed(field.getColumn())) {
sqlquery += " AND " + field.getColumn() + "=?";
// Jan Thielemann Solution for query using the sentence like
X_WS_WebServiceFieldInput inputField = m_webservicetype.getFieldInput(field.getColumn());
I_AD_Column col = inputField.getAD_Column();
String sqlType = DisplayType.getSQLDataType(col.getAD_Reference_ID(), col.getColumnName(), col.getFieldLength());
if(sqlType.contains("CHAR"))
sqlquery += " AND " + field.getColumn() + " LIKE ?";
else
sqlquery += " AND " + field.getColumn() + "=?";
// End Jan Thielemann Solution for query using the sentence like
} else { } else {
throw new IdempiereServiceFault("Web service type " throw new IdempiereServiceFault("Web service type "
+ m_webservicetype.getValue() + ": input column " + m_webservicetype.getValue() + ": input column "