Search in sources :

Example 1 with ReportExtractorException

use of com.axway.ats.log.report.exceptions.ReportExtractorException in project ats-framework by Axway.

the class ReportExtactor method extractRunEntities.

/**
     * extract the runs
     * 
     * @param runIds
     * @return
     */
private List<RunWrapper> extractRunEntities(int[] runIds) {
    StringBuilder whereClause = new StringBuilder();
    whereClause.append(" WHERE runId IN (");
    for (int runId : runIds) {
        whereClause.append(runId).append(", ");
    }
    whereClause.setLength(whereClause.lastIndexOf(","));
    whereClause.append(")");
    List<Run> dbRuns;
    try {
        dbRuns = dbReadAccess.getRuns(0, 10000, whereClause.toString(), "runId", true);
    } catch (DatabaseAccessException e) {
        throw new ReportExtractorException("Error loading runs " + whereClause, e);
    }
    List<RunWrapper> runs = new ArrayList<RunWrapper>();
    for (Run dbRun : dbRuns) {
        // load this run's suites
        List<Suite> suites;
        try {
            suites = dbReadAccess.getSuites(0, 10000, "WHERE runId=" + dbRun.runId, "suiteId", true, false);
        } catch (DatabaseAccessException e) {
            throw new ReportExtractorException("Error loading suites for run with id " + dbRun.runId, e);
        }
        RunWrapper run = new RunWrapper(dbRun, suites);
        runs.add(run);
    }
    return runs;
}
Also used : Suite(com.axway.ats.log.autodb.entities.Suite) ReportExtractorException(com.axway.ats.log.report.exceptions.ReportExtractorException) ArrayList(java.util.ArrayList) Run(com.axway.ats.log.autodb.entities.Run) DatabaseAccessException(com.axway.ats.log.autodb.exceptions.DatabaseAccessException)

Aggregations

Run (com.axway.ats.log.autodb.entities.Run)1 Suite (com.axway.ats.log.autodb.entities.Suite)1 DatabaseAccessException (com.axway.ats.log.autodb.exceptions.DatabaseAccessException)1 ReportExtractorException (com.axway.ats.log.report.exceptions.ReportExtractorException)1 ArrayList (java.util.ArrayList)1