new DefectMetadata(editedSummary, editedPreamble,
component, version, severity, priority, status, fieldsMap));
if (defectId != null) {
Defect defect = new Defect();
defect.setNativeId(defectId);
defect.setVulnerabilities(vulnsWithoutDefects);
defect.setApplication(application);
Object sObj = null;
if (fieldsMap != null && status == null) {
sObj = fieldsMap.get("status")==null ? fieldsMap.get("Status") : fieldsMap.get("status");
}
status = (sObj != null ? String.valueOf(sObj) : status);
// By default, set status to Open
if (status == null)
status = "Open";
defect.setStatus(status);
defect.setDefectURL(dt.getBugURL(
application.getDefectTracker().getUrl(), defectId));
defectDao.saveOrUpdate(defect);
for (Vulnerability vulnerability : vulnsWithoutDefects) {
vulnerability.setDefect(defect);