private static void update0(int _nProductForm) throws PureException { IStatement query = null; IObjects result = null; try { int[] aValues = { // // 1964,// // 1978, 1979,// // 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989,// 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, // 2000, 2001, 2002, 2003, 2004, 2005, 2006 // }; IProductMgr mgr = (IProductMgr) ArkContentHelper.getContentMgrOf(Product.class); String strSQL = "SELECT {this.id},{this.serialNo},{this.publishDate} FROM {this}0 WHERE {this.productForm}=" + _nProductForm + " AND year({this.publishDate})=?"; for (int j = 0; j < aValues.length; j++) { query = mgr.createQuery(strSQL, 0); query.setInt(0, aValues[j]); result = query.executeQuery(); int max = getMaxSerialNo( "SELECT MAX({this.serialNo}) AS _MAX FROM {this} WHERE {this.productForm}=" + _nProductForm + " AND year({this.publishDate})=" + aValues[j]); // int max=2005608586; int i = max; for (Iterator iter = result.iterator(); iter.hasNext(); i++) { Product product = (Product) iter.next(); int nSerialNo = 0; if (max > 1) { nSerialNo = i; } else { nSerialNo = aValues[j] * 1000000 + 100000 * _nProductForm + i; } System.out.println(product.getId() + " : " + nSerialNo); product.setProperty("serialNo", nSerialNo); mgr.saveToTemp(product, false); } } } finally { DolphinHelper.clear(result, query); } }
/** @see com.pureinfo.ark.interaction.ActionBase#executeAction() */ public ActionForward executeAction() throws PureException { String[] sIds = request.getParameterValues("id"); int[] nIds = ActionFormUtil.Strings2Ints(sIds); IProductMgr productMgr = (IProductMgr) ArkContentHelper.getContentMgrOf(Product.class); Product product = null; try { for (int i = 0; i <= nIds.length - 1; i++) { product = (Product) productMgr.lookupTempById(nIds[i]); if (request.getParameter("role") == null) product.setDocSubmitted(true); else product.setDocSubmitted(false); productMgr.saveToTemp(product, false); } } finally { if (product != null) { product.clear(); } } request.setAttribute("forward", ProductConstants.PATH_SUCCESS_ALL_PRODUCT_CHECK_LIST_PAGE); if (request.getParameter("role") == null) request.setAttribute("message", "选中成果的材料已设置为提交!"); else request.setAttribute("message", "选中成果的材料已设置为未交!"); return mapping.findForward("success"); }