Search in sources :

Example 26 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class StudataExporter method getProjectPaths.

private List getProjectPaths() {
    DashHierarchy hier = getDashboardContext().getHierarchy();
    PropertyKey parent = hier.findExistingKey(getPrefix());
    int numKids = hier.getNumChildren(parent);
    List projectPaths = new ArrayList(numKids);
    ListData projectPathsData = new ListData();
    for (int i = 0; i < numKids; i++) {
        PropertyKey child = hier.getChildKey(parent, i);
        projectPaths.add(child.path());
        projectPathsData.add(StringData.create(child.path()));
    }
    getDataRepository().putValue("///STUDATA_List", projectPathsData);
    return projectPaths;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) ListData(net.sourceforge.processdash.data.ListData)

Example 27 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class StudataExporter method getStudentProfilePath.

private String getStudentProfilePath() {
    DashHierarchy hier = getDashboardContext().getHierarchy();
    PropertyKey parent = hier.findExistingKey(getPrefix());
    int numKids = hier.getNumChildren(parent);
    for (int i = 0; i < numKids; i++) {
        PropertyKey child = hier.getChildKey(parent, i);
        String path = child.path();
        if (hasTag(path, "PspForEngV3_Student_Profile"))
            return path;
    }
    // still allow the name and programming language to be exported.
    return getPrefix() + "/No Student Profile Found";
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 28 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class MigrationToolTeam method getDataFileName.

private String getDataFileName(DashboardContext ctx, String path) {
    DashHierarchy hier = ctx.getHierarchy();
    PropertyKey key = hier.findExistingKey(path);
    if (key == null) {
        logger.severe("No property key found for '" + path + "'");
        return null;
    }
    Prop p = hier.pget(key);
    if (p == null) {
        logger.severe("No prop found for '" + path + "'");
        return null;
    }
    String dataFileName = p.getDataFile();
    if (dataFileName == null) {
        logger.severe("No datafile associated with '" + path + "'");
        return null;
    }
    return dataFileName;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 29 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class ConvertTeamProjectMCF method findProject.

/**
     * Locates the enclosing team project, and sets the values of the
     * {@link #projectRoot} and {@link #processID} fields accordingly. If there
     * is no enclosing team project, both will be set to null.
     */
private void findProject() throws MigrationException {
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(getPrefix());
    while (key != null) {
        String templateID = hierarchy.getID(key);
        if (templateID != null && templateID.endsWith(MASTER_ROOT)) {
            throw new MigrationException("notSupportedMaster");
        }
        String teamTemplateID = getTeamPID(templateID);
        if (teamTemplateID != null) {
            projectRoot = key.path();
            processID = teamTemplateID;
            return;
        }
        key = key.getParent();
    }
    throw new MigrationException("notTeamProject");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 30 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class DataExtractionScaffold method init.

public void init() throws Exception {
    DashController.setDataDirectory(dataDirectory);
    String dataDirPath = dataDirectory.getAbsolutePath() + System.getProperty("file.separator");
    // load and initialize settings
    String settingsFilename = dataDirPath + InternalSettings.getSettingsFilename();
    InternalSettings.initialize(settingsFilename);
    InternalSettings.setReadOnly(true);
    InternalSettings.set(SCAFFOLD_MODE_SETTING, "true");
    InternalSettings.set("templates.disableSearchPath", "true");
    InternalSettings.set("export.disableAutoExport", "true");
    InternalSettings.set("slowNetwork", "true");
    for (Map.Entry<String, String> e : extraSettings.entrySet()) {
        InternalSettings.set(e.getKey(), e.getValue());
    }
    extraSettings = null;
    // reset the template loader search path
    TemplateLoader.resetTemplateURLs();
    // setup the defect analyzer
    DefectAnalyzer.setDataDirectory(dataDirPath);
    // possibly initialize external resource mappings
    if (useExternalResourceMappingFile)
        ExternalResourceManager.getInstance().initializeMappings(dataDirectory, ExternalResourceManager.INITIALIZATION_MODE_ARCHIVE);
    // create the data repository.
    data = new DataRepository();
    DashHierarchy templates = TemplateLoader.loadTemplates(data);
    data.setDatafileSearchURLs(TemplateLoader.getTemplateURLs());
    // open and load the the user's work breakdown structure
    hierarchy = new DashHierarchy(null);
    String hierFilename = dataDirPath + Settings.getFile("stateFile");
    hierarchy.loadXML(hierFilename, templates);
    data.setNodeComparator(hierarchy);
    // create the time log
    timeLog = new WorkingTimeLog(dataDirectory);
    DashboardTimeLog.setDefault(timeLog);
    // open all the datafiles that were specified in the properties file.
    data.startInconsistency();
    openDataFiles(dataDirPath, PropertyKey.ROOT);
    data.openDatafile("", dataDirPath + "global.dat");
    // import data files
    DataImporter.setDynamic(false);
    ImportManager.init(data);
    data.finishInconsistency();
    // configure the task dependency resolver
    EVTaskDependencyResolver.init(this);
    EVTaskDependencyResolver.getInstance().setDynamic(false);
    if (createWebServer) {
        DashboardURLStreamHandlerFactory.disable();
        try {
            webServer = new WebServer();
            webServer.setDashboardContext(this);
            webServer.setData(data);
            webServer.setProps(hierarchy);
            webServer.setRoots(TemplateLoader.getTemplateURLs());
            WebServer.setOutputCharset(getWebCharset());
        } catch (IOException ioe) {
        }
    }
}
Also used : WebServer(net.sourceforge.processdash.net.http.WebServer) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) IOException(java.io.IOException) HashMap(java.util.HashMap) Map(java.util.Map) WorkingTimeLog(net.sourceforge.processdash.log.time.WorkingTimeLog)

Aggregations

DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)56 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)40 ArrayList (java.util.ArrayList)7 ListData (net.sourceforge.processdash.data.ListData)6 List (java.util.List)5 HashMap (java.util.HashMap)4 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)4 Point (java.awt.Point)3 Iterator (java.util.Iterator)3 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)3 SimpleData (net.sourceforge.processdash.data.SimpleData)3 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)3 IOException (java.io.IOException)2 Enumeration (java.util.Enumeration)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)2 Prop (net.sourceforge.processdash.hier.Prop)2 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)2 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)2