IDEMPIERE-2623 Limit and offset in queryData WebService
This commit is contained in:
parent
da2f37fbe0
commit
abef172dd0
|
@ -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
|
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:
|
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 -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
|
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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -1478,6 +1478,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID());
|
POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID());
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
int rowCnt = 0;
|
||||||
|
int offset = modelCRUD.getOffset();
|
||||||
|
int limit = modelCRUD.getLimit();
|
||||||
|
|
||||||
PreparedStatement pstmtquery = null;
|
PreparedStatement pstmtquery = null;
|
||||||
ResultSet rsquery = null;
|
ResultSet rsquery = null;
|
||||||
|
@ -1539,6 +1542,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
DataSet ds = resp.addNewDataSet();
|
DataSet ds = resp.addNewDataSet();
|
||||||
while (rsquery.next ()) {
|
while (rsquery.next ()) {
|
||||||
cnt++;
|
cnt++;
|
||||||
|
if ((offset >= cnt) || (limit > 0 && offset+limit < cnt))
|
||||||
|
continue;
|
||||||
|
rowCnt++;
|
||||||
DataRow dr = ds.addNewDataRow();
|
DataRow dr = ds.addNewDataRow();
|
||||||
for (int i = 0; i < poinfo.getColumnCount(); i++) {
|
for (int i = 0; i < poinfo.getColumnCount(); i++) {
|
||||||
String columnName = poinfo.getColumnName(i);
|
String columnName = poinfo.getColumnName(i);
|
||||||
|
@ -1561,10 +1567,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.setSuccess(true);
|
resp.setSuccess(true);
|
||||||
resp.setRowCount(cnt);
|
resp.setRowCount(rowCnt);
|
||||||
resp.setNumRows(cnt);
|
resp.setNumRows(rowCnt);
|
||||||
resp.setTotalRows(cnt);
|
resp.setTotalRows(cnt);
|
||||||
resp.setStartRow(1);
|
resp.setStartRow(offset);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -263,6 +263,8 @@
|
||||||
</xsd:restriction>
|
</xsd:restriction>
|
||||||
</xsd:simpleType>
|
</xsd:simpleType>
|
||||||
</xsd:element>
|
</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:element name="DataRow" type="tns:DataRow" minOccurs="0" maxOccurs="1"/>
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
|
|
Loading…
Reference in New Issue