Search in sources :

Example 61 with ListData

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;
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) NodeList(org.w3c.dom.NodeList) SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) LinkedList(java.util.LinkedList) ListData(net.sourceforge.processdash.data.ListData) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData)

Example 62 with ListData

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);
}
Also used : DateData(net.sourceforge.processdash.data.DateData) HashMap(java.util.HashMap) Map(java.util.Map) ListData(net.sourceforge.processdash.data.ListData)

Example 63 with ListData

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ArrayList(java.util.ArrayList) ScriptID(net.sourceforge.processdash.process.ScriptID) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) ListData(net.sourceforge.processdash.data.ListData)

Example 64 with ListData

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();
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) ListData(net.sourceforge.processdash.data.ListData)

Example 65 with ListData

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;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

ListData (net.sourceforge.processdash.data.ListData)129 SimpleData (net.sourceforge.processdash.data.SimpleData)20 ArrayList (java.util.ArrayList)18 List (java.util.List)16 Iterator (java.util.Iterator)15 StringData (net.sourceforge.processdash.data.StringData)15 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)9 Map (java.util.Map)8 HashSet (java.util.HashSet)7 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 LinkedList (java.util.LinkedList)5 DoubleData (net.sourceforge.processdash.data.DoubleData)5 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)5 LocalizedString (net.sourceforge.processdash.util.LocalizedString)5 NodeList (org.w3c.dom.NodeList)5 Date (java.util.Date)4 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)4 Element (org.w3c.dom.Element)4