use of net.sourceforge.processdash.process.DefectTypeStandard in project processdash by dtuma.
the class Report4 method initValues.
/** Initialize internal data structures to zero */
private void initValues() {
categories = new LinkedList();
injCategories = new LinkedList();
remCategories = new LinkedList();
develPhases = getProcessListPlain("Development_Phase_List");
failPhases = getProcessListPlain("Failure_Phase_List");
allPhases = getProcessListPlain("Phase_List");
for (Iterator i = develPhases.iterator(); i.hasNext(); ) {
Category c = new InjCategory((String) i.next());
categories.add(c);
injCategories.add(c);
}
for (Iterator i = failPhases.iterator(); i.hasNext(); ) {
Category c = new RemCategory((String) i.next());
categories.add(c);
remCategories.add(c);
}
hasCompile = allPhases.contains("Compile");
if (hasCompile) {
atCompile = new AtEntryCategory(allPhases, "Compile");
remCompile = new FilteredByPhaseCategory(allPhases, "Compile");
categories.add(atCompile);
categories.add(remCompile);
}
totals = emptyRow();
defectCounts = new TreeMap();
if (strict) {
DefectTypeStandard dts = DefectTypeStandard.get(getPrefix(), getDataRepository());
for (int i = dts.options.size(); i-- > 0; ) getRow((String) dts.options.elementAt(i));
}
}
use of net.sourceforge.processdash.process.DefectTypeStandard in project processdash by dtuma.
the class Report5 method initValues.
/** Initialize internal data structures to zero */
private void initValues() {
String typeParam = getParameter("type");
reportType = 0;
for (int i = 0; i < PARAM_FLAG.length; i++) if (PARAM_FLAG[i].equals(typeParam)) {
reportType = i;
break;
}
defectData = new HashMap();
if (parameters.get("strict") != null) {
DefectTypeStandard dts = DefectTypeStandard.get(getPrefix(), getDataRepository());
for (int i = dts.options.size(); i-- > 0; ) getRow((String) dts.options.elementAt(i));
}
}
use of net.sourceforge.processdash.process.DefectTypeStandard in project processdash by dtuma.
the class EditDefectTypeStandards method handleImportForm.
private void handleImportForm() throws IOException {
writeHeader();
// retrieve the file that was uploaded in the form
byte[] file = (byte[]) parameters.remove("file_CONTENTS");
if (file == null || file.length == 0) {
showImportForm("Import.No_File_Uploaded");
return;
}
// parse the file as XML and find the defect type standards
NodeList nl = null;
try {
Element xml = XMLUtils.parse(new ByteArrayInputStream(file)).getDocumentElement();
if (DefectTypeStandard.STANDARDS_TAG.equals(xml.getTagName()))
nl = xml.getElementsByTagName(DefectTypeStandard.STANDARD_TAG);
} catch (Exception e) {
}
if (nl == null || nl.getLength() == 0) {
showImportForm("Import.Not_DTS_File");
return;
}
// parse the defect type standards from the XML
List<DefectTypeStandard> standards = new ArrayList();
for (int i = 0; i < nl.getLength(); i++) standards.add(new DefectTypeStandard((Element) nl.item(i)));
// display a page asking the user which standards they wish to import
writeHTMLHeader();
out.print("<h2>");
out.print(resources.getHTML("Import.Title"));
out.println("</h2>\n<p>");
out.print(resources.getHTML("Import.Confirm_Prompt"));
out.println("<form action='dtsEdit.class' method='POST'>");
out.print("<ul style='list-style:none'>");
for (int i = 0; i < standards.size(); i++) {
DefectTypeStandard standard = standards.get(i);
out.print("<li><input type='hidden' name='name" + i + "' value='");
out.print(XMLUtils.escapeAttribute(standard.getName()));
out.print("'/><input type='hidden' name='spec" + i + "' value='");
out.print(XMLUtils.escapeAttribute(standard.getSpec()));
out.print("'/><input type='checkbox' name='sel' value='" + i + "'/> ");
out.print(HTMLUtils.escapeEntities(standard.getName()));
out.print("</li>\n");
}
out.print("</ul>");
out.print("<p><input type=submit name='" + IMPORT_CONFIRM + "' value='");
out.print(resources.getHTML("Import"));
out.print("'> ");
out.print("<input type=submit name='cancel' value='");
out.print(resources.getHTML("Cancel"));
out.print("'>");
out.print("</form></body></html>");
}
use of net.sourceforge.processdash.process.DefectTypeStandard in project processdash by dtuma.
the class EditDefectTypeStandards method handleExport.
protected void handleExport() throws IOException {
List<DefectTypeStandard> standardsToExport = getStandardsToExport();
if (standardsToExport.isEmpty()) {
writeHeader();
showExportPage();
return;
}
out.print("Content-Type: text/xml\r\n");
out.print("Content-Disposition: attachment; " + "filename=\"defectTypeStandards.dtsxml\"\r\n\r\n");
out.flush();
XmlSerializer xml = XMLUtils.getXmlSerializer(true);
xml.setOutput(outStream, "UTF-8");
xml.startDocument("UTF-8", null);
xml.startTag(null, DefectTypeStandard.STANDARDS_TAG);
xml.attribute(null, "exportTime", XMLUtils.saveDate(new Date()));
xml.attribute(null, "srcDataset", DashController.getDatasetID());
for (DefectTypeStandard std : standardsToExport) {
std.getAsXml(xml, false);
}
xml.endTag(null, DefectTypeStandard.STANDARDS_TAG);
xml.endDocument();
}
use of net.sourceforge.processdash.process.DefectTypeStandard in project processdash by dtuma.
the class EditDefectTypeStandards method showEditBox.
protected void showEditBox(String standardName) throws IOException {
DefectTypeStandard defectTypeStandard = null;
if (standardName != null)
defectTypeStandard = DefectTypeStandard.getByName(standardName, getDataRepository());
out.print("<p>");
out.println(resources.getHTML("Edit_Instructions"));
out.print("<br><textarea name='" + CONTENTS + "' rows=12 cols=80>");
if (defectTypeStandard == null) {
out.print(resources.getHTML("Sample_Defect_Type"));
} else {
String type, description;
for (int i = 0; i < defectTypeStandard.options.size(); i++) {
type = (String) defectTypeStandard.options.elementAt(i);
description = (String) defectTypeStandard.comments.get(type);
out.print(HTMLUtils.escapeEntities(type));
if (description != null && description.length() > 0) {
out.print(" (");
out.print(HTMLUtils.escapeEntities(description));
out.print(")");
}
out.println();
}
}
out.println("</textarea>");
}
Aggregations