use of net.sourceforge.processdash.log.defects.Defect in project processdash by dtuma.
the class DefectDialog method save.
public void save() {
refreshFixTimeFromStopwatch();
Defect d = new Defect();
d.date = fix_date.getDate();
if (d.date == null)
d.date = date;
d.number = defectNumber;
d.defect_type = (String) defect_type.getSelectedItem();
d.injected = (DefectPhase) phase_injected.getSelectedItem();
d.phase_injected = d.injected.legacyPhase;
d.removed = (DefectPhase) phase_removed.getSelectedItem();
d.phase_removed = d.removed.legacyPhase;
d.fix_time = fix_time.getText();
try {
d.fix_count = (int) FormatUtil.parseNumber(fix_count.getText());
d.fix_count = Math.max(0, d.fix_count);
} catch (ParseException nfe) {
d.fix_count = 1;
}
d.fix_defect = fix_defect.getText();
d.fix_pending = pendingSelector.isPending();
d.description = description.getText();
d.extra_attrs = extra_attrs;
defectLog.writeDefect(d);
defectNumber = d.number;
number.setText(formatDefectNum(d.number));
setDirty(false);
}
use of net.sourceforge.processdash.log.defects.Defect in project processdash by dtuma.
the class DefectLogEditor method updateDefectLog.
public void updateDefectLog(DefectLog dl) {
//System.out.println("In updateDefectLog");
Defect[] defects = dl.readDefects();
DefectListID dlid;
Enumeration values = defectLogs.elements();
while (values.hasMoreElements()) {
dlid = (DefectListID) values.nextElement();
if (areEqual(dlid.dl.getDefectLogFilename(), dl.getDefectLogFilename()) && areEqual(dlid.dl.getDataPrefix(), dl.getDataPrefix())) {
//System.out.println(" Found Log:" + dlid.pk.path());
//for (int ii = 0; ii < defects.length; ii++)
//System.out.println(" " + ii + ":" + defects[ii].toString());
defectLogs.put(dlid.pk, new DefectListID(dlid.pk, dl, defects));
break;
}
}
applyFilter();
}
use of net.sourceforge.processdash.log.defects.Defect in project processdash by dtuma.
the class DefectLogEditor method reload.
protected void reload() {
PropertyKey pKey;
Prop prop;
DefectLog dl;
String defLogName;
Defect[] defects;
defectLogs.clear();
Enumeration pKeys = useProps.keys();
while (pKeys.hasMoreElements()) {
pKey = (PropertyKey) pKeys.nextElement();
prop = useProps.pget(pKey);
defLogName = prop.getDefectLog();
if (defLogName != null && defLogName.length() != 0) {
dl = new DefectLog(dashboard.getDirectory() + defLogName, pKey.path(), data);
defects = dl.readDefects();
defectLogs.put(pKey, new DefectListID(pKey, dl, defects));
}
}
}
use of net.sourceforge.processdash.log.defects.Defect in project processdash by dtuma.
the class DefectLogEditor method moveDefect.
private String moveDefect(DefectListEntry src, DefectListID dest, DefectWorkflowPhaseUpdater workflowFixer, List phases) {
// if the defect is already in the right place, do nothing.
Defect defect = src.defect;
if (src.pk.equals(dest.pk))
return defect.number;
// remove the defect from its current defect log.
src.dl.deleteDefect(defect.number);
DefectDialog dlg = getDialogForDefect(src, false);
if (dlg != null)
dlg.dispose();
// check the defect phases for validity, and flag problems
if (workflowFixer != null) {
// if the defect was dropped into a team project, repair the
// workflow phase associations in the defect.
workflowFixer.analyze(dest.pk.path(), defect);
} else {
// if a defect with workflow phases was dropped outside a team
// project, flag the workflow phases as erroneous
flagWorkflowPhaseAsErroneous(defect.injected);
flagWorkflowPhaseAsErroneous(defect.removed);
}
// check the legacy phase types of the defect. If they are invalid for
// the new location, flag them as erroneous.
defect.phase_injected = checkPhase(defect.phase_injected, phases);
defect.phase_removed = checkPhase(defect.phase_removed, phases);
// add the defect to the new defect log
if (hasIntegerIdNumber(defect) || dest.dl.getDefect(defect.number) != null)
src.defect.number = null;
dest.dl.writeDefect(defect);
// return the ID number assigned to the defect in the new log.
return defect.number;
}
use of net.sourceforge.processdash.log.defects.Defect in project processdash by dtuma.
the class HierarchySynchronizer method updateWorkflowPhasesInDefects.
private void updateWorkflowPhasesInDefects() {
if (workflowXml != null) {
DefectWorkflowPhaseUpdater u = new DefectWorkflowPhaseUpdater(new WorkflowInfo(workflowXml), !whatIfMode) {
public void defectNeedsSave(String path, Defect d) {
saveDefect(path, d);
}
};
DefectAnalyzer.run(hierarchy, projectKey, true, u);
// Log a "sync change" to tell the user about invalid phases.
for (String path : u.getPathsWithNewInvalidPhases()) {
String msg = resources.format("Bad_Defect_Phase_FMT", path);
if (!changes.contains(msg))
changes.add(msg);
}
}
}
Aggregations