use of net.sourceforge.processdash.tool.db.DatabasePlugin 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.DatabasePlugin in project processdash by dtuma.
the class ProcessDashboard method createDatabasePlugin.
/**
* Create the database plugin and possibly start it.
*
* @return true if the plugin was started.
*/
private boolean createDatabasePlugin() {
try {
// create the database plugin object
List extensions = ExtensionManager.getExecutableExtensions(DatabasePlugin.EXTENSION_POINT_ID, this);
if (extensions == null || extensions.isEmpty())
return false;
// there should always only be one instance of this extension
// point. If multiple are present, go with the first one
DatabasePlugin plugin = (DatabasePlugin) extensions.get(0);
this.databasePlugin = plugin;
// register the plugin as an element in the data repository
ListData dbItem = new ListData();
dbItem.add(databasePlugin);
data.putValue(DatabasePlugin.DATA_REPOSITORY_NAME, dbItem);
data.pinElement(DatabasePlugin.DATA_REPOSITORY_NAME);
// setting, only start the plugin for team dashboard datasets.
if (Settings.getBool("tpidw.enabled", Settings.isTeamMode())) {
plugin.initialize();
data.addGlobalDefineDeclarations("#define DATABASE_PLUGIN t");
return true;
}
} catch (Exception e) {
// problem starting database plugin
logger.log(Level.SEVERE, "Unable to start the database plugin", e);
}
return false;
}
use of net.sourceforge.processdash.tool.db.DatabasePlugin in project processdash by dtuma.
the class DefectAnalyzer method run.
public static void run(DashHierarchy props, DataRepository data, String prefix, Map queryParameters, Task t) {
if (queryParameters.containsKey(DB_MODE_PARAM)) {
DatabasePlugin plugin = QueryUtils.getDatabasePlugin(data);
ListData criteria = getDatabaseCriteria(data, prefix, queryParameters);
String pid = getProcessID(data, prefix);
if (plugin != null && criteria != null && pid != null)
ImportedDefectManager.run(plugin, criteria.asList(), pid, t);
} else {
String[] prefixes = ResultSet.getPrefixList(data, queryParameters, prefix);
boolean includeChildren = !queryParameters.containsKey(NO_CHILDREN_PARAM);
run(props, data, prefixes, includeChildren, t);
}
}
Aggregations