use of net.sourceforge.processdash.log.defects.Defect in project processdash by dtuma.
the class OpenDefectDialog method openExistingDefectDialog.
private void openExistingDefectDialog(DefectLogID defectLog, String id) throws TinyCGIException {
DefectLog log = new DefectLog(defectLog.filename, defectLog.path.path(), getDataRepository());
Defect defect = log.getDefect(id);
if (defect == null)
throw new TinyCGIException(404, "No defect found with ID '" + id + "' in " + defectLog.path.path());
DefectDialog dlg = DefectDialog.getDialogForDefect(getDash(), defectLog.filename, defectLog.path, defect, true);
dlg.setTitle(defectLog.path.path());
dlg.toFront();
}
use of net.sourceforge.processdash.log.defects.Defect 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);
}
}
Aggregations