MaterialVO compVO = new MaterialVO();
compVO.setCompanyCodeSys01ITM03(pk.getCompanyCodeSys01ITM01());
compVO.setDescriptionSYS10("");
compVO.setItemCodeItm01ITM03(pk.getItemCodeITM01());
compVO.setQtyITM03(new BigDecimal(1));
DefaultMutableTreeNode node = new OpenSwingTreeNode(compVO);
DefaultTreeModel model = new DefaultTreeModel(node);
String sql2 = "'" + pk.getItemCodeITM01() + "'";
ArrayList nodes = new ArrayList();
ArrayList nodes2 = new ArrayList(); // current nodes...
Hashtable auxnodes = new Hashtable();
nodes.add(node);
// read from ITM03 table...
Response res = null;
java.util.List rows = null;
java.util.List auxlist = null;
DefaultMutableTreeNode auxnode,auxnode2 = null;
String currentItemCode = null;
do {
res = QueryUtil.getQuery(
conn,
new UserSessionParameters(username),
sql1+sql2+sql3,
values,
attribute2dbField,
MaterialVO.class,
"Y",
"N",
null,
new GridParams(),
true
);
if (!res.isError()) {
rows = ((VOListResponse)res).getRows();
auxnodes.clear();
nodes2 = new ArrayList();
sql2 = "";
// group items per item code parent...
for(int i=0;i<rows.size();i++) {
compVO = (MaterialVO)rows.get(i);
sql2 += "'"+compVO.getItemCodeItm01ITM03()+"',";
auxnode = new OpenSwingTreeNode(compVO);
auxlist = (ArrayList)auxnodes.get(compVO.getParentItemCodeItm01ITM03());
if (auxlist==null) {
auxlist = new ArrayList();
auxnodes.put(compVO.getParentItemCodeItm01ITM03(),auxlist);
}