Search in sources :

Example 6 with DatabasePlugin

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));
}
Also used : DatabasePlugin(net.sourceforge.processdash.tool.db.DatabasePlugin) QueryRunner(net.sourceforge.processdash.tool.db.QueryRunner) HashSet(java.util.HashSet)

Example 7 with DatabasePlugin

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;
}
Also used : DatabasePlugin(net.sourceforge.processdash.tool.db.DatabasePlugin) EventListenerList(javax.swing.event.EventListenerList) List(java.util.List) LinkedList(java.util.LinkedList) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) LockUncertainException(net.sourceforge.processdash.util.lock.LockUncertainException) TamperException(net.sourceforge.processdash.security.TamperDeterrent.TamperException) CannotCreateLockException(net.sourceforge.processdash.util.lock.CannotCreateLockException) IOException(java.io.IOException) SentLockMessageException(net.sourceforge.processdash.util.lock.SentLockMessageException) ReadOnlyLockFailureException(net.sourceforge.processdash.util.lock.ReadOnlyLockFailureException) FileNotFoundException(java.io.FileNotFoundException) OfflineLockLostException(net.sourceforge.processdash.util.lock.OfflineLockLostException) HttpException(net.sourceforge.processdash.util.HttpException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException) ListData(net.sourceforge.processdash.data.ListData)

Example 8 with DatabasePlugin

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);
    }
}
Also used : DatabasePlugin(net.sourceforge.processdash.tool.db.DatabasePlugin) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

DatabasePlugin (net.sourceforge.processdash.tool.db.DatabasePlugin)8 QueryRunner (net.sourceforge.processdash.tool.db.QueryRunner)4 ListData (net.sourceforge.processdash.data.ListData)3 IOException (java.io.IOException)2 List (java.util.List)2 DashboardContext (net.sourceforge.processdash.DashboardContext)2 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 TreeMap (java.util.TreeMap)1 EventListenerList (javax.swing.event.EventListenerList)1 PDashContext (net.sourceforge.processdash.api.PDashContext)1 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)1 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)1 TamperException (net.sourceforge.processdash.security.TamperDeterrent.TamperException)1 DataReloader (net.sourceforge.processdash.tool.db.DataReloader)1 ProjectLocator (net.sourceforge.processdash.tool.db.ProjectLocator)1 WorkflowHistDataHelper (net.sourceforge.processdash.tool.db.WorkflowHistDataHelper)1