Search in sources :

Example 6 with Defect

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();
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) Defect(net.sourceforge.processdash.log.defects.Defect) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 7 with Defect

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);
    }
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) Iterator(java.util.Iterator) Defect(net.sourceforge.processdash.log.defects.Defect) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

Defect (net.sourceforge.processdash.log.defects.Defect)7 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)3 Enumeration (java.util.Enumeration)2 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)2 ParseException (java.text.ParseException)1 Iterator (java.util.Iterator)1 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)1 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)1 Prop (net.sourceforge.processdash.hier.Prop)1 DefectWorkflowPhaseUpdater (net.sourceforge.processdash.log.defects.DefectWorkflowPhaseUpdater)1 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)1 WorkflowInfo (net.sourceforge.processdash.process.WorkflowInfo)1