public String processRequest(String strActionValue) throws ProcessingException { FrameworkDefaultLogger.debug("Inside S_FrameWork_Query_OperationWorkerBean::processRequest()."); String sReturnValue = null; javax.transaction.UserTransaction userTransaction = UserTransactionService.getUserTransaction(); try { userTransaction.begin(); sReturnValue = callProcessRequest(strActionValue); userTransaction.commit(); } catch (Exception exc) { try { userTransaction.rollback(); } catch (Exception ex) { sReturnValue = "DATA_VALIDATION_ERROR"; FrameworkDefaultLogger.error( "Inside S_FrameWork_Query_OperationWorkerBean:" + ErrorService.errorStackToString(ex)); } FrameworkDefaultLogger.error( "Inside S_FrameWork_Query_OperationWorkerBean:" + ErrorService.errorStackToString(exc)); throw new ProcessingException( "S_FrameWork_Query_OperationWorkerBean:processRequest() - " + exc); } return sReturnValue; }
/** * Loads all S_FrameWork_Query_OperationValueObjects through the business facade using information * in the HttpServletRequest. * * @return String as result * @exception ProcessingException */ public String loadAllS_FrameWork_Query_Operations() throws ProcessingException { String sReturnValue = null; FrameworkDefaultLogger.debug( "Inside S_FrameWork_Query_OperationWorkerBean::loadAllS_FrameWork_Query_Operations"); try { // load the PADJBValueObject // Collection coll = S_FrameWork_Query_OperationProxy.getS_FrameWork_Query_Operations(); Collection coll = S_FrameWork_Query_OperationProxy.getS_FrameWork_Query_OperationsInSelectSql( "select * from S_FrameWork_Query_Operation", null); ApplicationUSOM objectManager = (ApplicationUSOM) getUSOM(); objectManager.setS_FrameWork_Query_Operations(coll); } catch (Exception exc) { FrameworkDefaultLogger.error( "Inside S_FrameWork_Query_OperationWorkerBean:loadS_FrameWork_Query_Operations() - " + ErrorService.errorStackToString(exc)); throw new ProcessingException( "PADJBWorkerBean:loadAllS_FrameWork_Query_Operations() - successfully loaded all S_FrameWork_Query_OperationValueObjects - " + exc); } return (sReturnValue); }
// return the records count number according sql public long getRecordsCountFromSql(String sql) throws FrameworkDAOException { // Initialize values ResultSet ret = null; Statement stmt = null; Connection connection = null; int count = 0; try { // String sSQL = sql; connection = ((DatabaseQuerier) getConnection()).getSafeConnection(); stmt = connection.createStatement(); ret = stmt.executeQuery(sql); while (ret.next()) { count++; } } catch (Exception exc) { throw new FrameworkDAOException( "S_Framework_Entry_UIDAO:getRecordsCountFromSql - " + exc, exc); } finally { String errorMsg = "Inside S_Framework_Entry_UIDAO:getRecordsCountFromSql()"; try { if (ret != null) { ret.close(); ret = null; } } catch (Exception e) { FrameworkDefaultLogger.error(errorMsg + " - 关闭时出错!\n" + e); } try { if (stmt != null) { stmt.close(); stmt = null; } } catch (Exception e) { FrameworkDefaultLogger.error(errorMsg + " - 关闭时出错!\n" + e); } try { if (connection != null) { connection.close(); connection = null; } } catch (Exception e) { FrameworkDefaultLogger.error(errorMsg + " - 关闭时出错!\n" + e); } } return count; }
/** * @return * @throws FrameworkDAOException */ public long getMaxOIDForS_Framework_Entry_UIValueObjects() throws FrameworkDAOException { // Initialize values ResultSet ret = null; Statement stmt = null; Connection connection = null; long count = 0; String sGetMaxOIDSql = "select max(testid) from test"; try { connection = ((DatabaseQuerier) getConnection()).getSafeConnection(); stmt = connection.createStatement(); ret = stmt.executeQuery(sGetMaxOIDSql); while (ret.next()) { count = ret.getLong(1); } } catch (Exception exc) { throw new FrameworkDAOException( "S_Framework_Entry_UIDAO:getMaxOIDForS_Framework_Entry_UIValueObjects - " + exc, exc); } finally { String errorMsg = "Inside S_Framework_Entry_UIDAO:getMaxOIDForS_Framework_Entry_UIValueObjects()"; try { if (ret != null) { ret.close(); ret = null; } } catch (Exception e) { FrameworkDefaultLogger.error(errorMsg + " - 关闭时出错!\n" + e); } try { if (stmt != null) { stmt.close(); stmt = null; } } catch (Exception e) { FrameworkDefaultLogger.error(errorMsg + " - 关闭时出错!\n" + e); } try { if (connection != null) { connection.close(); connection = null; } } catch (Exception e) { FrameworkDefaultLogger.error(errorMsg + " - 关闭时出错!\n" + e); } } return count; }
/** * Deletes a S_FrameWork_Query_OperationValueObject through the business facade using information * in the HttpServletRequest. * * @return String as result * @exception ProcessingException */ public String deleteS_FrameWork_Query_Operation() throws ProcessingException { String sReturnValue = null; FrameworkDefaultLogger.debug( "Inside S_FrameWork_Query_OperationWorkerBean::deleteS_FrameWork_Query_Operation"); ApplicationUSOM objectManager = (ApplicationUSOM) getUSOM(); try { // S_FrameWork_Query_OperationPrimaryKey primaryKey = getPrimaryKeyFromServletRequest(); S_FrameWork_Query_OperationPrimaryKey primaryKey = new S_FrameWork_Query_OperationPrimaryKey( this.getServletRequestParameter("queryoperationid")); IS_FrameWork_Query_OperationValueObject valueObject = S_FrameWork_Query_OperationProxy.getS_FrameWork_Query_Operation(primaryKey); // delete the S_FrameWork_Query_OperationValueObject if (valueObject != null) { new S_FrameWork_Query_OperationProxy(valueObject).delete(); FrameworkDefaultLogger.debug( "S_FrameWork_Query_OperationWorkerBean:deleteS_FrameWork_Query_Operation() - successfully delete S_FrameWork_Query_OperationValueObject with key field(s) - " + primaryKey.toString()); // write the log PublicFunction.writeSystemLog( this.currentUser, new Long(2), valueObject, this.beforeSaveValueObject); // update the cached list ValueObjectListProxy voList = objectManager.getS_FrameWork_Query_Operations(); if (voList != null) { Collection coll = voList.getDataValues(); Iterator tempIterator = coll.iterator(); ArrayList tmpColl = new ArrayList(); while (tempIterator.hasNext()) { S_FrameWork_Query_OperationValueObject tmpObj = (S_FrameWork_Query_OperationValueObject) tempIterator.next(); if (!(tmpObj.getS_FrameWork_Query_OperationPrimaryKey()) .equals(valueObject.getS_FrameWork_Query_OperationPrimaryKey())) { tmpColl.add(tmpObj); } } objectManager.setS_FrameWork_Query_Operations(tmpColl); } } } catch (Exception exc) { String sErrorMsg = " S_FrameWork_Query_OperationWorkerBean:deleteS_FrameWork_Query_Operation() - " + exc; FrameworkDefaultLogger.error(sErrorMsg); PublicFunction.CustomProcessingException(objectManager, "删除记录时出错,请重新操作!", sErrorMsg, exc); // throw new // ProcessingException("S_FrameWork_Query_OperationWorkerBean:saveS_FrameWork_Query_Operation() - " + // sErrorMsg); } return (sReturnValue); }
/** * Creates a S_FrameWork_Query_OperationValueObject through the business facade using information * in the HttpServletRequest. * * @return String as result * @exception ProcessingException */ public String createS_FrameWork_Query_Operation() throws ProcessingException { String sReturnValue = null; FrameworkDefaultLogger.debug( "Inside S_FrameWork_Query_OperationWorkerBean::createS_FrameWork_Query_Operation"); ApplicationUSOM objectManager = (ApplicationUSOM) getUSOM(); try { // Create the S_FrameWork_Query_OperationValueObject by calling the // static createS_FrameWork_Query_Operation method on S_FrameWork_Query_OperationProxy this.m_S_FrameWork_Query_OperationValueObject = setDefault( (S_FrameWork_Query_OperationValueObject) this.m_S_FrameWork_Query_OperationValueObject, "CreateEdit", "CREATE_S_FrameWork_Query_Operation"); IS_FrameWork_Query_OperationValueObject valueObject = S_FrameWork_Query_OperationProxy.createS_FrameWork_Query_Operation( this.m_S_FrameWork_Query_OperationValueObject); if (valueObject != null) { FrameworkDefaultLogger.debug( "S_FrameWork_Query_OperationWorkerBean:createS_FrameWork_Query_Operation() - successfully created S_FrameWork_Query_OperationValueObject - " + valueObject.toString()); // assign the S_FrameWork_Query_OperationValueObject to the ApplicationUSOM objectManager.setCurrentS_FrameWork_Query_Operation(valueObject); // update the cached usom ValueObjectListProxy voList = objectManager.getS_FrameWork_Query_Operations(); if (voList != null) { Collection coll = voList.getDataValues(); coll.add(valueObject); objectManager.setS_FrameWork_Query_Operations(coll); } // log the action PublicFunction.writeSystemLog( this.currentUser, new Long(1), valueObject, this.beforeSaveValueObject); sReturnValue = loadAllS_FrameWork_Query_Operations(); } } catch (Exception exc) { String sErrorMsg = " Inside WorkerBean:createS_FrameWork_Query_Operation() - " + exc; FrameworkDefaultLogger.error(sErrorMsg); PublicFunction.CustomProcessingException(objectManager, "保存新增记录时出错,请重新操作!", sErrorMsg, exc); // throw new // ProcessingException("S_FrameWork_Query_OperationWorkerBean:createS_FrameWork_Query_Operation() - " + // sErrorMsg); } return (sReturnValue); }
/** * Loads a S_FrameWork_Query_OperationValueObject through the business facade using information in * the HttpServletRequest. * * @return String as result * @exception ProcessingException */ public String loadS_FrameWork_Query_Operation() throws ProcessingException { String sReturnValue = null; FrameworkDefaultLogger.debug( "Inside S_FrameWork_Query_OperationWorkerBean::loadS_FrameWork_Query_Operation"); ApplicationUSOM objectManager = (ApplicationUSOM) getUSOM(); IS_FrameWork_Query_OperationValueObject valueObject = null; try { // load the S_FrameWork_Query_OperationValueObject S_FrameWork_Query_OperationPrimaryKey primaryKey = getPrimaryKeyFromServletRequest(); valueObject = S_FrameWork_Query_OperationProxy.getS_FrameWork_Query_Operation(primaryKey); if (valueObject != null) { FrameworkDefaultLogger.debug( "S_FrameWork_Query_OperationWorkerBean:loadS_FrameWork_Query_Operation() - successfully loaded - " + valueObject.toString()); // assign the S_FrameWork_Query_OperationValueObject to the ApplicationUSOM objectManager.setCurrentS_FrameWork_Query_Operation(valueObject); // write the log PublicFunction.writeSystemLog( this.currentUser, new Long(5), valueObject, this.beforeSaveValueObject); } } catch (Exception exc) { String sErrorMsg = " S_FrameWork_Query_OperationWorkerBean:loadS_FrameWork_Query_Operation() - " + exc; FrameworkDefaultLogger.error(sErrorMsg); PublicFunction.CustomProcessingException(objectManager, "读取记录时出错,请重新操作!", sErrorMsg, exc); throw new ProcessingException( "S_FrameWork_Query_OperationWorkerBean:saveS_FrameWork_Query_Operation() - " + sErrorMsg); } return (sReturnValue); }
/** * Saves a S_FrameWork_Query_OperationValueObject through the business facade using information in * the HttpServletRequest. * * @return String as result * @exception ProcessingException */ public String saveS_FrameWork_Query_Operation() throws ProcessingException { String sReturnValue = null; FrameworkDefaultLogger.debug( "Inside S_FrameWork_Query_OperationWorkerBean::saveS_FrameWork_Query_Operation"); ApplicationUSOM objectManager = (ApplicationUSOM) getUSOM(); try { // save the S_FrameWork_Query_OperationValueObject this.m_S_FrameWork_Query_OperationValueObject = setDefault( (S_FrameWork_Query_OperationValueObject) this.m_S_FrameWork_Query_OperationValueObject, "CreateEdit", "save_S_FrameWork_Query_Operation"); // added by wzp IS_FrameWork_Query_OperationProxy proxy = new S_FrameWork_Query_OperationProxy(this.m_S_FrameWork_Query_OperationValueObject); IS_FrameWork_Query_OperationValueObject valueObject = proxy.saveS_FrameWork_Query_Operation(); if (valueObject != null) { FrameworkDefaultLogger.debug( "S_FrameWork_Query_OperationWorkerBean:save() - successfully saved S_FrameWork_Query_OperationValueObject - " + valueObject.toString()); // assign the S_FrameWork_Query_OperationValueObject to the ApplicationUSOM objectManager.setCurrentS_FrameWork_Query_Operation(valueObject); // write the sytem log PublicFunction.writeSystemLog( this.currentUser, new Long(3), valueObject, this.beforeSaveValueObject); // update the cached list ValueObjectListProxy voList = objectManager.getS_FrameWork_Query_Operations(); if (voList != null) { Collection coll = voList.getDataValues(); Iterator tempIterator = coll.iterator(); ArrayList tmpColl = new ArrayList(); while (tempIterator.hasNext()) { S_FrameWork_Query_OperationValueObject tmpObj = (S_FrameWork_Query_OperationValueObject) tempIterator.next(); if ((tmpObj.getS_FrameWork_Query_OperationPrimaryKey()) .equals(beforeSaveValueObject.getS_FrameWork_Query_OperationPrimaryKey())) { tmpColl.add(valueObject); } else { tmpColl.add(tmpObj); } } objectManager.setS_FrameWork_Query_Operations(tmpColl); } } } catch (Exception exc) { String sErrorMsg = " S_FrameWork_Query_OperationWorkerBean:saveS_FrameWork_Query_Operation() - " + exc; FrameworkDefaultLogger.error(sErrorMsg); PublicFunction.CustomProcessingException(objectManager, "保存记录时出错,请重新操作!", sErrorMsg, exc); // throw new // ProcessingException("S_FrameWork_Query_OperationWorkerBean:saveS_FrameWork_Query_Operation() - " + // sErrorMsg); } return (sReturnValue); }