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;
}
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";
}
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;
}
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");
}
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) {
}
}
}
Aggregations