use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class EditSubprojectList method findValidSubprojectNames.
private void findValidSubprojectNames(ListData result, PropertyKey key, String templateID) {
DashHierarchy hier = getPSPProperties();
String id = hier.getID(key);
if (templateID.equals(id))
result.add(key.path());
else {
int numChildren = hier.getNumChildren(key);
for (int i = 0; i < numChildren; i++) findValidSubprojectNames(result, hier.getChildKey(key, i), templateID);
}
}
use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class OpenDefectDialog method getDefectLog.
private DefectLogID getDefectLog(String path) {
DashHierarchy hier = getPSPProperties();
PropertyKey key = hier.findExistingKey(path);
if (key == null)
return null;
ProcessDashboard dash = getDash();
DefectLogID defectLog = hier.defectLog(key, dash.getDirectory());
if (defectLog == null)
return null;
if (Filter.matchesFilter(dash.getBrokenDataPaths(), defectLog.path.path()))
return null;
return defectLog;
}
use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class DefectImportForm method importDefects.
private void importDefects(List defects) {
DashHierarchy hier = dashboardContext.getHierarchy();
PropertyKey defectLogKey = hier.findExistingKey(defectLogPath);
ProcessDashboard dashboard = (ProcessDashboard) dashboardContext;
String filename = hier.pget(defectLogKey).getDefectLog();
if (!StringUtils.hasValue(filename)) {
AbortImport.showError("Hierarchy_Changed", selectedPath);
return;
}
DefectLog defectLog = new DefectLog(dashboard.getDirectory() + filename, defectLogPath, dashboardContext.getData());
int addedCount = 0;
int updatedCount = 0;
int unchangedCount = 0;
for (Iterator i = defects.iterator(); i.hasNext(); ) {
Defect newDefect = (Defect) i.next();
Defect oldDefect = defectLog.getDefect(newDefect.number);
if (oldDefect == null) {
addedCount++;
defectLog.writeDefect(newDefect);
} else {
Defect originalDefect = (Defect) oldDefect.clone();
oldDefect.defect_type = merge(oldDefect.defect_type, newDefect.defect_type);
oldDefect.injected = merge(oldDefect.injected, newDefect.injected);
oldDefect.phase_injected = oldDefect.injected.legacyPhase;
oldDefect.removed = merge(oldDefect.removed, newDefect.removed);
oldDefect.phase_removed = oldDefect.removed.legacyPhase;
oldDefect.description = merge(oldDefect.description, newDefect.description);
oldDefect.fix_time = merge(oldDefect.fix_time, newDefect.fix_time);
oldDefect.fix_defect = merge(oldDefect.fix_defect, newDefect.fix_defect);
if (originalDefect.equals(oldDefect)) {
unchangedCount++;
} else {
updatedCount++;
defectLog.writeDefect(oldDefect);
}
}
}
if (addedCount == 0 && updatedCount == 0) {
JOptionPane.showMessageDialog(frame, resources.getStrings("Nothing_To_Do.Message"), resources.getString("Nothing_To_Do.Title"), JOptionPane.INFORMATION_MESSAGE);
} else if (addedCount < defects.size()) {
String title = resources.getString("Defects_Updated.Title");
Object[] message = new Object[4];
message[0] = resources.getStrings("Defects_Updated.Message");
message[1] = getUpdatedSegment("Added", addedCount);
message[2] = getUpdatedSegment("Unchanged", unchangedCount);
message[3] = getUpdatedSegment("Updated", updatedCount);
JOptionPane.showMessageDialog(frame, message, title, JOptionPane.INFORMATION_MESSAGE);
}
}
use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class TemplateLoader method loadTemplates.
public static DashHierarchy loadTemplates(DataRepository data) {
LOAD_TEMPLATES_PERMISSION.checkPermission();
DashHierarchy templates = new DashHierarchy(null);
ProfTimer pt = new ProfTimer(TemplateLoader.class, "TemplateLoader.loadTemplates");
List<URL> roots = new ArrayList<URL>(Arrays.asList(getTemplateURLs()));
pt.click("Got template roots");
for (int i = roots.size(); i-- > 0; ) {
String templateDirURL = roots.get(i).toString();
if (templateDirURL.startsWith("file:/")) {
/* If the /Templates directory exists as a local file
* somewhere, search through that directory for process
* templates.
*/
// strip "file:" from the beginning of the url.
String dirname = templateDirURL.substring(5);
dirname = HTMLUtils.urlDecode(dirname);
searchDirForTemplates(templates, dirname, data);
pt.click("searched dir '" + dirname + "' for templates");
} else if (templateDirURL.startsWith("jar:")) {
/* If the /Templates directory found is in a jar somewhere,
* search through the jar for process templates.
*/
// Strip "jar:" from the beginning and the "!/Templates/"
// from the end of the URL.
String jarFileURL = templateDirURL.substring(4, templateDirURL.indexOf('!'));
JarSearchResult searchResult = searchJarForTemplates(templates, jarFileURL, data);
// if this was an MCF JAR, remove its URL from the search path
if (searchResult == JarSearchResult.Mcf) {
logger.fine("Processed MCF URL " + templateDirURL);
mcf_url_list.add(roots.remove(i));
}
pt.click("searched jar '" + jarFileURL + "' for templates");
}
}
// find any missing MCFs that came bundled within a data backup file
searchExternalResourcesForMissingMcfs(templates, data);
// store the new list of template URLs, stripped of MCF JAR files
template_url_list = roots.toArray(new URL[roots.size()]);
generateRollupTemplates(templates, data);
createProcessRoot(templates);
pt.click("done loading templates");
return templates;
}
use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class TemplateLoader method loadProcessTemplate.
private static void loadProcessTemplate(DashHierarchy templates, InputStream in, boolean close) throws IOException {
DashHierarchy template = new DashHierarchy(null);
template.load(in, close);
createScriptMaps(template);
templates.putAll(template);
}
Aggregations