IDEMPIERE-2623 Limit and offset in queryData WebService

This commit is contained in:
sauljabin 2015-05-15 12:52:37 -05:00
parent da2f37fbe0
commit abef172dd0
3 changed files with 30 additions and 4 deletions

View File

@ -11,9 +11,27 @@ the new webservice will have the following parameters:
Note, if you need to define new datatypes you need to define them in WEB-INF/xsd/idempiere-schema.xsd
and generate the idempiere-xmlbeans.jar again with this command:
scomp -out ./WEB-INF/lib/idempiere-xmlbeans.jar ./WEB-INF/xsd/idempiere-schema.xsd
scomp will generate the corresponding classes to manipulate the xml objects from the messages
To install xmlbeans Git Clone URL: git://git.apache.org/xmlbeans.git
cd xmlbeans/
./xbeanenv.sh
ant
Environment example:
export XMLBEANS_HOME=/opt/xmlbeans
export PATH=$PATH:$XMLBEANS_HOME/bin
export XMLBEANS_LIB=$XMLBEANS_HOME/build/lib
export JAVA_HOME=/usr/lib/jvm/java-1.7.0...(your path)
Apps:
ant
svn
git
The method will be called modelSetDocAction - the model in name indicates that the web service is going to be based on model classes, current web services are based in UI instead of model.

View File

@ -1478,6 +1478,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID());
int cnt = 0;
int rowCnt = 0;
int offset = modelCRUD.getOffset();
int limit = modelCRUD.getLimit();
PreparedStatement pstmtquery = null;
ResultSet rsquery = null;
@ -1539,6 +1542,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
DataSet ds = resp.addNewDataSet();
while (rsquery.next ()) {
cnt++;
if ((offset >= cnt) || (limit > 0 && offset+limit < cnt))
continue;
rowCnt++;
DataRow dr = ds.addNewDataRow();
for (int i = 0; i < poinfo.getColumnCount(); i++) {
String columnName = poinfo.getColumnName(i);
@ -1560,11 +1566,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
rsquery = null; pstmtquery = null;
}
resp.setSuccess(true);
resp.setRowCount(cnt);
resp.setNumRows(cnt);
resp.setSuccess(true);
resp.setRowCount(rowCnt);
resp.setNumRows(rowCnt);
resp.setTotalRows(cnt);
resp.setStartRow(1);
resp.setStartRow(offset);
return ret;
} finally {

View File

@ -263,6 +263,8 @@
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Offset" type="xsd:int" maxOccurs="1" minOccurs="0"/>
<xsd:element name="Limit" type="xsd:int" maxOccurs="1" minOccurs="0"/>
<xsd:element name="DataRow" type="tns:DataRow" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>