/** * <p>Get is show debug messages for this class.</p> * @param pClazz of bean * @throws Exception - an exception * @return is show debug messages? **/ @Override public final boolean getIsShowDebugMessages( final Class<?> pClazz) throws Exception { return this.logger.getIsShowDebugMessagesFor(pClazz); }
/** * <p>Setter for logger.</p> * @param pLogger reference **/ public final void setLogger(final ILogger pLogger) { this.logger = pLogger; this.isShowDebugMessages = this.logger .getIsShowDebugMessagesFor(getClass()); this.logDetailLevel = this.logger.getDetailLevel(); }
/** * <p>Rollback transaction to savepoint.</p> * @param pSavepointName savepoint name * @throws Exception - an exception **/ @Override public final void rollBackTransaction(final String pSavepointName) throws Exception { if (getLogger().getIsShowDebugMessagesFor(getClass())) { getLogger().debug(null, SrvDatabase.class, "try to rollback to savepoint: " + pSavepointName); } this.threadConnection.get(). rollback(savepointsMap.get(pSavepointName)); savepointsMap.remove(pSavepointName); }
/** * <p>Rollback transaction to savepoint.</p> * @param pSavepointName savepoint name * @throws Exception - an exception **/ @Override public final void rollBackTransaction(final String pSavepointName) throws Exception { //according https://code.google.com/p/android/issues/detail?id=38706 //its very easy to make simple things complicated if (getLogger().getIsShowDebugMessagesFor(getClass())) { getLogger().debug(null, SrvDatabase.class, "try to rollback to savepoint: " + pSavepointName); } executeQuery(";ROLLBACK TRANSACTION TO SAVEPOINT " + pSavepointName + ";"); }
/** * <p>Execute any SQL query that returns no data. * E.g. PRAGMA, etc.</p> * @param pQuery query * @throws Exception - an exception **/ @Override public final void executeQuery(final String pQuery) throws Exception { Statement stmt = null; try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "Thread ID=" + Thread.currentThread().getId() + ", try to execute query: " + pQuery); } stmt = getOrEstablishConnection().createStatement(); stmt.executeUpdate(pQuery); } catch (SQLException sqle) { String msg = sqle.getMessage() + ", RDBMS error code " + sqle.getErrorCode() + ", query:\n" + pQuery; throw new ExceptionWithCode(ASrvDatabase.SQL_EXEC_ERROR, msg); } finally { if (stmt != null) { stmt.close(); } } }
if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "Thread ID="
/** * <p>Retrieve records from DB.</p> * @param pSelect query SELECT * @return IRecordSet record set * @throws Exception - an exception **/ @Override public final IRecordSet<ResultSet> retrieveRecords(final String pSelect) throws Exception { try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "Thread ID=" + Thread.currentThread().getId() + ", try to retrieve records: " + pSelect); } final Statement stmt = getOrEstablishConnection().createStatement(); final ResultSet rs = stmt.executeQuery(pSelect); return new RecordSetJdbc(rs, stmt); } catch (SQLException sqle) { String msg = sqle.getMessage() + ", RDBMS error code " + sqle.getErrorCode() + ", query:\n" + pSelect; throw new ExceptionWithCode(ASrvDatabase.SQL_EXEC_ERROR, msg); } }
urlConnection.addRequestProperty("Content-Length", String.valueOf(paramStr.length())); boolean isDbg = getLogger().getIsShowDebugMessagesFor(getClass()); int dbgDetLev = this.logger.getDetailLevel(); if (isDbg && dbgDetLev > 30000) {
/** * <p>Execute any SQL query that returns no data. * E.g. PRAGMA, etc.</p> * @param pQuery query * @throws ExceptionWithCode - if an exception occured **/ @Override public final void executeQuery(final String pQuery) throws Exception { try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "try to execute query: " + pQuery); } this.sqliteDatabase.execSQL(pQuery); } catch (Exception ex) { String msg = ex.getMessage() + ", query:\n" + pQuery; ExceptionWithCode ewc = new ExceptionWithCode(SrvDatabase.SQL_EXEC_ERROR, msg); ewc.setStackTrace(ex.getStackTrace()); throw ewc; } }
pColumnsVals, pWhere); try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "Thread ID="
/** * <p>Execute SQL DELETE that returns affected rows. * It is to adapt Android insert/update/delete interface. * </p> * @param pTable table name * @param pWhere where conditions e.g. "itsId=2" or NULL -delete all * @return row count affected * @throws ExceptionWithCode - if an exception occured **/ @Override public final int executeDelete(final String pTable, final String pWhere) throws Exception { try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "try to delete t: " + pTable + " where: " + pWhere); } return this.sqliteDatabase.delete(pTable, pWhere, null); } catch (Exception ex) { String msg = ex.getMessage() + ", table: " + pTable + ", where: " + pWhere; ExceptionWithCode ewc = new ExceptionWithCode(SrvDatabase.SQL_EXEC_ERROR, msg); ewc.setStackTrace(ex.getStackTrace()); throw ewc; } }
String query = getHlpInsertUpdate().evalSqlInsert(pTable, pColumnsVals); try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "Thread ID="
public final <T> void fill(final Map<String, Object> pAddParam, final T pEntity, final IRequestData pReq) throws Exception { boolean isShowDbMsg = this.logger.getIsShowDebugMessagesFor(getClass()); int dbgDetLev = this.logger.getDetailLevel(); if (isShowDbMsg && dbgDetLev > 2) {
final String pWhere) throws Exception { try { if (getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000) { getLogger().debug(null, SrvDatabase.class, "try to update t: " + pTable
/** * <p>Retrieve records from DB.</p> * @param pSelect query SELECT * @return IRecordSet record set * @throws ExceptionWithCode - if an exception occured **/ @Override public final IRecordSet<Cursor> retrieveRecords(final String pSelect) throws ExceptionWithCode { try { boolean isDbg = getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000; if (isDbg) { getLogger().debug(null, SrvDatabase.class, "try to retrieve records: " + pSelect); } Cursor rs = this.sqliteDatabase.rawQuery(pSelect, null); RecordSetAndroid rsa = new RecordSetAndroid(rs); if (isDbg) { getLogger().debug(null, SrvDatabase.class, "Recordset: " + rsa); } return rsa; } catch (Exception ex) { String msg = ex.getMessage() + ", query:\n" + pSelect; ExceptionWithCode ewc = new ExceptionWithCode(SrvDatabase.SQL_EXEC_ERROR, msg); ewc.setStackTrace(ex.getStackTrace()); throw ewc; } }
.getFor(this.objectClass, pFieldName); Object fieldVal = getter.invoke(pObject); boolean isShowDbMsg = this.logger.getIsShowDebugMessagesFor(getClass()); int dbgDetLev = this.logger.getDetailLevel(); if (fieldVal == null) {
final ColumnsValues pColumnsVals) throws Exception { try { boolean isDbg = getLogger().getIsShowDebugMessagesFor(getClass()) && getLogger().getDetailLevel() > 30000; if (isDbg) {
/** * <p>Handle new accounting entry is created to check dirty. * This is implementation of dirty check for all accounts.</p> * @param pAddParam additional param * @param pAcc account * @param pSubaccId subaccount ID * @param pDateAt date at * @throws Exception - an exception **/ @Override public final synchronized void handleNewAccountEntry( final Map<String, Object> pAddParam, final Account pAcc, final Long pSubaccId, final Date pDateAt) throws Exception { if (lazyGetBalanceAtAllDirtyCheck(pAddParam).getLeastAccountingEntryDate() .getTime() > pDateAt.getTime()) { if (getLogger().getIsShowDebugMessagesFor(getClass())) { getLogger().debug(null, SrvBalanceStd.class, "changing least last entry date from " + this.balanceAtAllDirtyCheck .getLeastAccountingEntryDate() + " to " + pDateAt); } this.balanceAtAllDirtyCheck .setLeastAccountingEntryDate(pDateAt); getSrvOrm() .updateEntity(pAddParam, this.balanceAtAllDirtyCheck); } }
final String pFileName) throws Exception { this.isShowDebugMessages = this.logger .getIsShowDebugMessagesFor(getClass()); String nameBaseXml = "/" + pDirName + "/" + pFileName;
final List<Character> pUsedCids) throws Exception { this.isShowDebugMessages = this.logger .getIsShowDebugMessagesFor(getClass()); TtfOutputStream os = new TtfOutputStream(new ByteArrayOutputStream());