use of net.sourceforge.processdash.tool.db.QueryRunner in project processdash by dtuma.
the class WorkflowReport method getWorkflowsForCurrentProject.
private Map<String, String> getWorkflowsForCurrentProject(HttpServletRequest req) {
DashboardContext dash = (DashboardContext) PDashServletUtils.buildEnvironment(req).get(TinyCGI.DASHBOARD_CONTEXT);
DatabasePlugin databasePlugin = dash.getDatabasePlugin();
QueryUtils.waitForAllProjects(databasePlugin);
QueryRunner queryRunner = databasePlugin.getObject(QueryRunner.class);
PDashContext ctx = PDashServletUtils.getContext(req);
String projectID = ctx.getData().getString("Project_ID");
String workflowProcessIDPattern = DatabasePluginUtils.getWorkflowPhaseIdentifier(projectID, "%");
Map<String, String> result = new TreeMap<String, String>();
String query = Settings.isTeamMode() ? WORKFLOW_LIST_QUERY : WORKFLOW_LIST_QUERY_PERSONAL;
QueryUtils.mapColumns(result, //
queryRunner.queryHql(//
query, workflowProcessIDPattern));
return result;
}
use of net.sourceforge.processdash.tool.db.QueryRunner in project processdash by dtuma.
the class UserGroupUtil method getProjectIDsForFilter.
public static Set<String> getProjectIDsForFilter(UserFilter filter, DashboardContext ctx) {
if (filter == null)
return null;
Set<String> datasetIDs = filter.getDatasetIDs();
if (datasetIDs == null)
return null;
else if (datasetIDs.isEmpty())
return Collections.EMPTY_SET;
DatabasePlugin databasePlugin = ctx.getDatabasePlugin();
QueryUtils.waitForAllProjects(databasePlugin);
QueryRunner query = databasePlugin.getObject(QueryRunner.class);
return new HashSet(query.queryHql(PROJECT_FILTER_QUERY, datasetIDs));
}
use of net.sourceforge.processdash.tool.db.QueryRunner in project processdash by dtuma.
the class ImportedDefectManager method run.
/**
* Run a defect analysis against a set of defects that were imported by
* the database plugin
*
* @param plugin the database plugin
* @param dbCriteria the criteria to use against the database
* @param processID the ID of the base process to map phase data to
* @param t the analysis task to run
*/
public static void run(DatabasePlugin plugin, List dbCriteria, String processID, DefectAnalyzer.Task t) {
QueryRunner queryRunner = plugin.getObject(QueryRunner.class);
if (queryRunner == null)
return;
StringBuilder query = new StringBuilder(DEFECT_HQL_QUERY);
List args = new ArrayList();
args.add(processID);
args.add(processID);
QueryUtils.addCriteriaToHql(query, "d", args, dbCriteria);
List<DefectToAnalyze> defects = new ArrayList();
Map<Object, String> datasetIDs = QueryUtils.mapColumns(queryRunner.queryHql(DATASET_ID_QUERY));
List<Object[]> rawData = queryRunner.queryHql(query.toString(), args.toArray());
for (Object[] oneRow : rawData) {
String path = getDefectPathFromHqlResultRow(oneRow);
Defect d = getDefectFromHqlResultRow(oneRow, datasetIDs);
defects.add(new DefectToAnalyze(path, d));
}
Collections.sort(defects);
for (DefectToAnalyze defect : defects) t.analyze(defect.path, defect.defect);
}
Aggregations