use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class EditDefectTypeStandards method getStandardsToExport.
private List<DefectTypeStandard> getStandardsToExport() {
String[] selected = (String[]) parameters.get("sel_ALL");
if (selected == null || selected.length == 0)
return Collections.EMPTY_LIST;
List<DefectTypeStandard> result = new ArrayList(selected.length);
DataRepository data = getDataRepository();
for (String selectedNum : selected) {
String selectedName = getParameter("std" + selectedNum);
DefectTypeStandard selectedStandard = DefectTypeStandard.getByName(selectedName, data);
if (selectedStandard != null)
result.add(selectedStandard);
}
return result;
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class EditDefectTypeStandards method showListOfDefinedStandards.
protected void showListOfDefinedStandards() throws IOException {
DataRepository data = getDataRepository();
String[] standards = DefectTypeStandard.getDefinedStandards(data);
boolean canEdit = canEdit();
String defaultName = DefectTypeStandard.get("", data).getName();
writeHTMLHeader();
out.print("<p>");
out.println(resources.getHTML("Welcome_Prompt"));
out.println("<ul>");
if (canEdit) {
out.print("<li><a href=\"dtsEdit.class?" + ACTION + "=" + CREATE + "\">");
out.print(resources.getHTML("Create_Option"));
out.println("</a></li>");
}
if (standards.length > 0) {
out.print("<li>");
out.print(resources.getHTML("Manage_Option"));
out.println("<table>");
for (int i = 0; i < standards.length; i++) {
String htmlName = HTMLUtils.escapeEntities(standards[i]);
String urlName = HTMLUtils.urlEncode(standards[i]);
out.print("<tr><td><ul><li>"<b>");
out.print(htmlName);
out.print("</b>"</li></ul></td>");
int numOptions = (canEdit ? OPTIONS.length : 1);
for (int o = 0; o < numOptions; o++) {
if (o == DEFAULT && standards[i].equals(defaultName)) {
out.print("<td><i>(default)</i></td>");
} else {
String opt = OPTIONS[o];
out.print("<td><a href='dtsEdit.class?" + ACTION + "=" + opt + "&" + NAME + "=" + urlName + "'>");
out.print(resources.getHTML(opt));
out.print("</a></td>");
}
}
out.println("</tr>");
}
out.print("</table></li>");
}
out.print("<li>");
if (canEdit) {
out.print("<a href=\"dtsEdit.class?" + ACTION + "=" + IMPORT + "\">");
out.print(resources.getHTML("Import_Option"));
out.println("</a> / ");
}
out.print("<a href=\"dtsEdit.class?" + ACTION + "=" + EXPORT + "\">");
out.print(resources.getHTML("Export_Option"));
out.println("</a></li>");
out.print("</ul></body></html>");
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class HistoricalDataReport method writeHeader.
/** Write the CGI header. */
protected void writeHeader() {
DataRepository data = getDataRepository();
String prefix = getPrefix();
String dataName = DataRepository.createDataName(prefix, DATA_NAME);
SimpleData d = data.getSimpleValue(dataName);
String subsetPrefix = null;
if (d != null)
subsetPrefix = d.format();
if (subsetPrefix == null || subsetPrefix.length() == 0)
subsetPrefix = DEFAULT_PREFIX;
out.print("Location: ");
out.print(WebServer.urlEncodePath(subsetPrefix));
out.print(DEST_URL);
out.print("\r\n\r\n");
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class OpenDocument method findFile.
/** Find a file in the document list.
* @param name the name of the file to find
* @return the XML element corresponding to the named document.
*/
protected Element findFile(String name) throws IOException {
// Look for an inheritable value for the FILE_XML element in the
// data repository.
DataRepository data = getDataRepository();
String pfx = getPrefix();
if (pfx == null)
pfx = "/";
StringBuffer prefix = new StringBuffer(pfx);
ListData list;
Element result = null;
SaveableData val;
for (val = data.getInheritableValue(prefix, FILE_XML_DATANAME); val != null; val = data.getInheritableValue(chop(prefix), FILE_XML_DATANAME)) {
if (val != null && !(val instanceof SimpleData))
val = val.getSimpleValue();
if (val instanceof StringData)
list = ((StringData) val).asList();
else if (val instanceof ListData)
list = (ListData) val;
else
list = null;
if (list != null)
for (int i = 0; i < list.size(); i++) {
String url = (String) list.get(i);
Document docList = getDocumentTree(url);
if (docList != null) {
result = (new FileFinder(name, docList)).file;
if (result != null)
return result;
}
}
if (prefix.length() == 0)
break;
}
return null;
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class RollupDatasetSelectElem method writeContents.
protected void writeContents() throws IOException {
DataRepository data = getDataRepository();
if (data == null)
return;
init(data);
// get the [Use_Rollup] data element for the current
// project. If it is null, return immediately.
String prefix = getPrefix();
if (prefix == null)
return;
String useRollupName = DataRepository.createDataName(prefix, "Use_Rollup");
ListData rollupIDs = getList(data, useRollupName);
if (rollupIDs == null)
return;
String tableStart = TABLE_START, tableEnd = "", tableRow;
for (int i = 0; i < rollupIDs.size(); i++) {
tableRow = getFragment(data, rollupIDs.get(i).toString());
if (tableRow != null && tableRow.length() > 0) {
out.print(tableStart);
out.print(tableRow);
tableStart = "";
tableEnd = TABLE_END;
}
}
out.print(tableEnd);
}
Aggregations