use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class ResultSet method getList.
private static ListData getList(DataRepository data, String forParam, String[] conditions, String orderBy, String basePrefix) {
// construct an applicable ResultSetSearchExpression.
ResultSetSearchExpression rsse = new ResultSetSearchExpression(data, forParam, basePrefix, conditions, orderBy);
// see if someone else has already generated a list name for
// our ResultSetSearchExpression. If not, generate one.
String listName;
synchronized (listNames) {
listName = (String) listNames.get(rsse);
if (listName == null) {
int num = listNumber++;
listName = DataRepository.createDataName(FAKE_DATA_NAME, "List" + num);
listNames.put(rsse, listName);
}
}
// fetch the value of the named list.
ListData result = lookupList(data, listName);
// save it in the repository.
if (result == null)
synchronized (listName) {
result = lookupList(data, listName);
if (result == null) {
String expression = rsse.buildExpression();
try {
data.putExpression(listName, "", expression);
} catch (MalformedValueException mve) {
System.err.println("malformed value!");
data.putValue(listName, new ListData());
}
data.addDataListener(listName, NULL_LISTENER);
result = lookupList(data, listName);
}
}
return result;
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class DefectUtil method getInheritedPhaseList.
protected static Enumeration getInheritedPhaseList(String defectPath, DataRepository data) {
Object inheritedPhaseList = data.getInheritableValue(defectPath, "Effective_Defect_Phase_List");
ListData list = null;
if (inheritedPhaseList instanceof ListData)
list = (ListData) inheritedPhaseList;
else if (inheritedPhaseList instanceof StringData)
list = ((StringData) inheritedPhaseList).asList();
if (list == null)
return null;
Vector result = new Vector();
for (int i = 0; i < list.size(); i++) result.add(list.get(i).toString());
return result.elements();
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class DefectAnalyzer method run.
public static void run(DashHierarchy props, DataRepository data, String prefix, Map queryParameters, Task t) {
if (queryParameters.containsKey(DB_MODE_PARAM)) {
DatabasePlugin plugin = QueryUtils.getDatabasePlugin(data);
ListData criteria = getDatabaseCriteria(data, prefix, queryParameters);
String pid = getProcessID(data, prefix);
if (plugin != null && criteria != null && pid != null)
ImportedDefectManager.run(plugin, criteria.asList(), pid, t);
} else {
String[] prefixes = ResultSet.getPrefixList(data, queryParameters, prefix);
boolean includeChildren = !queryParameters.containsKey(NO_CHILDREN_PARAM);
run(props, data, prefixes, includeChildren, t);
}
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class DefectAnalyzer method getDatabaseCriteria.
private static ListData getDatabaseCriteria(DataRepository data, String prefix, Map queryParameters) {
String dataName = (String) queryParameters.get("for");
if (dataName.startsWith("[") && dataName.endsWith("]"))
dataName = dataName.substring(1, dataName.length() - 1);
dataName = DataRepository.createDataName(prefix, dataName);
ListData criteria = ListData.asListData(data.getSimpleValue(dataName));
return criteria;
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class EditSubprojectList method doAdd.
/*
* Methods to handle values posted to this form
*/
private void doAdd() throws IOException {
Map subprojects = getSubprojects();
ListData validSubprojects = findValidSubprojectNames();
String shortName = getParameter(SHORT_NAME);
String path = getParameter(PATH);
String shortNameError = validateShortName(null, shortName, subprojects);
String pathError = validatePath(null, path, subprojects, validSubprojects);
if (shortNameError != null || pathError != null) {
// there are problems with the values entered. Send the user
// back to the add page to try again.
showAddPage(shortName, shortNameError, path, pathError);
return;
}
int i = 0;
while (getValue(i, SHORT_NAME) != null) i++;
String num = getNum(i);
logger.log(Level.FINE, "Master project {0} adding subproject [{1} => {2}]", new Object[] { getPrefix(), shortName, path });
putValue(num, SHORT_NAME, shortName.trim());
putValue(num, PATH, path);
recalcDependentData();
writeCloseWindow(true);
}
Aggregations