use of net.sourceforge.processdash.log.defects.DefectLog in project processdash by dtuma.
the class HierarchySynchronizer method saveDefect.
public void saveDefect(final String path, final Defect d) {
PropertyKey key = hierarchy.findExistingKey(path);
final String filename = hierarchy.pget(key).getDefectLog();
if (StringUtils.hasValue(filename)) {
DefectLog log = new DefectLog(dataDirectory + filename, path, dataRepository);
log.writeDefect(d);
}
}
use of net.sourceforge.processdash.log.defects.DefectLog in project processdash by dtuma.
the class DefectLogEditor method rename.
public static void rename(DashHierarchy oldProps, DashHierarchy newProps, String oldPrefix, String newPrefix, ProcessDashboard dashboard) {
PropertyKey oldKey = PropertyKey.fromPath(oldPrefix);
String oldLogName = oldProps.pget(oldKey).getDefectLog();
if (oldLogName != null && oldLogName.length() > 0) {
// don't need to worry.
return;
}
DefectLogID oldLog = oldProps.defectLog(oldKey, dashboard.getDirectory());
if (oldLog == null) {
// we don't need to worry.
return;
}
String logPath = oldLog.path.path();
oldPrefix = oldPrefix.substring(logPath.length() + 1);
PropertyKey newKey = PropertyKey.fromPath(newPrefix);
DefectLogID newLog = newProps.defectLog(newKey, dashboard.getDirectory());
if (newLog == null) {
// Should this ever happen???
return;
}
String newLogPath = newLog.path.path();
newPrefix = newPrefix.substring(newLogPath.length() + 1);
if (oldPrefix.equals(newPrefix)) {
// the node owning the defect log, we don't need to worry.
return;
}
if (!oldLog.filename.equals(newLog.filename)) {
// Should this ever happen???
return;
}
DefectLog log = new DefectLog(newLog.filename, newLogPath, null);
log.performInternalRename(oldPrefix, newPrefix);
}
use of net.sourceforge.processdash.log.defects.DefectLog 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.DefectLog 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.DefectLog 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