/** * Process SQL statement if one exists in the invData object and passes it to the chained * processors. * * @param entityManager * {@link EntityManager} needed for DB persistence. * @param invData * Invocation data to be processed. * @param topInvocationParent * Top invocation object. */ private void processSqlStatementData(EntityManager entityManager, InvocationSequenceData invData, InvocationSequenceData topInvocationParent) { SqlStatementData sqlStatementData = invData.getSqlStatementData(); if (null != sqlStatementData) { topInvocationParent.setNestedSqlStatements(Boolean.TRUE); sqlStatementData.addInvocationParentId(topInvocationParent.getId()); passToChainedProcessors(sqlStatementData, entityManager); } }
/** * * @return One {@link SqlStatementData} with random values. */ private static SqlStatementData getSqlStatementInstance() { Random random = new Random(); SqlStatementData sqlData = new SqlStatementData(new Timestamp(random.nextLong()), random.nextLong(), random.nextLong(), random.nextLong(), "New Sql String"); sqlData.setCount(random.nextLong()); sqlData.setCpuDuration(random.nextDouble()); sqlData.calculateCpuMax(random.nextDouble()); sqlData.calculateCpuMin(random.nextDouble()); sqlData.setDuration(random.nextDouble()); sqlData.setExclusiveCount(random.nextLong()); sqlData.setExclusiveDuration(random.nextDouble()); sqlData.calculateExclusiveMax(random.nextDouble()); sqlData.calculateExclusiveMin(random.nextDouble()); sqlData.setId(random.nextLong()); sqlData.addInvocationParentId(random.nextLong()); sqlData.setPreparedStatement(true); return sqlData; }