use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class HierarchySynchronizer method getProcessDataList.
private List getProcessDataList(String name) {
List result = new LinkedList();
String dataName = "/" + processID + "/" + name;
SimpleData val = data.getSimpleValue(dataName);
if (val instanceof StringData)
val = ((StringData) val).asList();
if (val instanceof ListData) {
ListData l = (ListData) val;
for (int i = 0; i < l.size(); i++) result.add(l.get(i));
}
return result;
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class ArchiveMetricsFileImporter method addImportMetadata.
private void addImportMetadata(Map<String, String> packageIDs) {
String prefix = METADATA_DATA_NAME + "/" + EXPORTED_TAG + ".";
defns.put(METADATA_DATA_NAME, TagData.getInstance());
if (owner != null)
defns.put(prefix + OWNER_ATTR, StringData.create(owner));
if (exportTimestamp != null)
defns.put(prefix + WHEN_ATTR, new DateData(exportTimestamp, false));
if (XMLUtils.hasValue(srcDatasetID))
defns.put(prefix + FROM_DATASET_ID_ATTR, StringData.create(srcDatasetID));
ListData packageList = new ListData();
String packagePrefix = prefix + PACKAGE_ELEM + "/";
for (Map.Entry<String, String> e : packageIDs.entrySet()) {
String id = e.getKey();
String version = e.getValue();
packageList.add(id);
packageList.add(version);
defns.put(packagePrefix + id, StringData.create(version));
}
defns.put(prefix + PACKAGE_ELEM, packageList);
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class WorkflowScriptSource method getScripts.
public List<ScriptID> getScripts(String path) {
// Get the list of workflow URL specs for the enclosing team project.
DataRepository data = context.getData();
StringBuffer projectPathBuf = new StringBuffer(path);
ListData urlSpecList = ListData.asListData(data.getInheritableValue(projectPathBuf, dataName));
// this team project doesn't have any associated workflow URLs.
if (urlSpecList == null || urlSpecList.test() == false)
return null;
// construct a list of path segments we should examine. The first
// segment is the path to the team project itself. Then we include
// the name of each nested component or subtask within the project
// on the path to the currently active task.
String projectPath = projectPathBuf.toString();
List<String> pathSegments = new ArrayList<String>();
pathSegments.add(projectPath);
if (path.length() > projectPath.length() + 1) {
String relSubpath = path.substring(projectPath.length() + 1);
pathSegments.addAll(Arrays.asList(relSubpath.split("/")));
}
// find the list of workflow scripts that are associated with the
// currently active task and its ancestors.
LinkedHashSet result = collectScripts(data, urlSpecList, pathSegments);
if (result.isEmpty())
return null;
// for efficiency purposes, we built the list in backwards order.
// reverse it so the URLs appear in the order the user wrote them.
ArrayList<ScriptID> listResult = new ArrayList<ScriptID>(result);
Collections.reverse(listResult);
return listResult;
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class SelectPspRollup method getRollupSelector.
public static String getRollupSelector(DataContext ctx, String formElemName, String defaultRollupName) {
ListData rollups = ListData.asListData(ctx.getSimpleValue(PSP_ROLLUP_LIST));
if (rollups == null || rollups.size() < 2)
return null;
if (defaultRollupName == null) {
SimpleData d = ctx.getSimpleValue(HierarchySynchronizer.PSP_SUBSET);
if (d != null)
defaultRollupName = d.format();
else
defaultRollupName = PSP_DEFAULT_ROLLUP;
}
StringBuilder result = new StringBuilder();
result.append("<select name=\"" + formElemName + "\">");
for (int i = 0; i < rollups.size(); i++) {
String oneRollup = (String) rollups.get(i);
String oneRollupHtml = HTMLUtils.escapeEntities(oneRollup);
result.append("<option");
if (oneRollup.equals(defaultRollupName))
result.append(" selected=\"selected\"");
result.append(" value=\"").append(oneRollupHtml).append("\">").append(oneRollupHtml);
}
result.append("</select>");
return result.toString();
}
use of net.sourceforge.processdash.data.ListData in project processdash by dtuma.
the class StudataExporter method getProjectPaths.
private List getProjectPaths() {
DashHierarchy hier = getDashboardContext().getHierarchy();
PropertyKey parent = hier.findExistingKey(getPrefix());
int numKids = hier.getNumChildren(parent);
List projectPaths = new ArrayList(numKids);
ListData projectPathsData = new ListData();
for (int i = 0; i < numKids; i++) {
PropertyKey child = hier.getChildKey(parent, i);
projectPaths.add(child.path());
projectPathsData.add(StringData.create(child.path()));
}
getDataRepository().putValue("///STUDATA_List", projectPathsData);
return projectPaths;
}
Aggregations