Search in sources :

Example 1 with Defect

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);
}
Also used : Defect(net.sourceforge.processdash.log.defects.Defect) ParseException(java.text.ParseException)

Example 2 with Defect

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();
}
Also used : Enumeration(java.util.Enumeration) Defect(net.sourceforge.processdash.log.defects.Defect)

Example 3 with Defect

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

Example 4 with Defect

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

Example 5 with Defect

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);
        }
    }
}
Also used : DefectWorkflowPhaseUpdater(net.sourceforge.processdash.log.defects.DefectWorkflowPhaseUpdater) WorkflowInfo(net.sourceforge.processdash.process.WorkflowInfo) Defect(net.sourceforge.processdash.log.defects.Defect)

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