public void testQuery() throws PureException { InstituteService service = new InstituteService(); String name = null; try { name = new String(("¾¼Ã").getBytes("iso-8859-1"), "utf-8"); } catch (Exception ex) { ex.printStackTrace(System.err); } System.out.println(name); IObjects institutes = service.queryByName("¾¼Ã", "6", null); System.out.println("size: " + institutes.getSize()); for (int i = 0; i < institutes.getSize(); i++) { System.out.println(((Institute) institutes.next()).getName()); } }
/** Shows object list in page. */ protected ActionForward doList() throws PureException { SearchForm thisform = (SearchForm) form; List colInfos = null; IObjects iobjs = null; List objList = null; Pager pager = new Pager(); // 1. to fetch the objects in current page try { pager.setPageSize(thisform.getPageSize()); pager.setCurrPageIndex(thisform.getPage()); int nMaxSize = pager.getPageSize() * (pager.getCurrPageIndex() + 1); iobjs = getIObjects(nMaxSize); if (iobjs == null) { pager.setItemCount(0); } else { pager.setItemCount(iobjs.getSize()); objList = iobjs.toList(pager); } } finally { if (iobjs != null) iobjs.clear(); } // 2. to prepare the head titles if (objList != null && objList.size() > 0) { ListHelper lh = new ListHelper(); lh.setSenery(getScenery()); colInfos = lh.prepareColsInfo( thisform.getColunms(), getInclude(), getExclude(), getReplace(), thisform.getEntityMetadata().getName(), true); lh.clear(); } // 3. to prepare the result in page String sTitle = getTitle(); request.setAttribute("title", sTitle == null ? "ап╠М" : sTitle); request.setAttribute("headTable", getHeadTable()); request.setAttribute("objs", objList); request.setAttribute("pager", pager); request.setAttribute("colInfos", colInfos); request.setAttribute("tailedButtons", getTailedButtons()); request.setAttribute("metaDatas", thisform.getEntityMetadata().getProperties()); request.setAttribute("submitee", getSubmitee()); request.setAttribute("scenery", getScenery()); request.setAttribute("needExport", new Boolean(isNeedExport())); request.setAttribute("needRowSelector", new Boolean(isNeedRowSelector())); if (isNeedSerial()) { request.setAttribute("needSerial", new Boolean(true)); } return mapping.findForward("success"); }