Search in sources :

Example 1 with TagData

use of net.sourceforge.processdash.data.TagData in project processdash by dtuma.

the class TaskScheduleChartUtil method getContextTags.

private static SimpleDataContext getContextTags(boolean filterInEffect, boolean isRollup, boolean hideNames) {
    SimpleDataContext ctx = new SimpleDataContext();
    TagData tag = TagData.getInstance();
    ctx.put(EVSnippetEnvironment.EV_CONTEXT_KEY, tag);
    if (isRollup)
        ctx.put(EVSnippetEnvironment.ROLLUP_EV_CONTEXT_KEY, tag);
    if (filterInEffect)
        ctx.put(EVSnippetEnvironment.FILTERED_EV_CONTEXT_KEY, tag);
    if (hideNames)
        ctx.put(EVSnippetEnvironment.ANON_EV_CONTEXT_KEY, tag);
    return ctx;
}
Also used : TagData(net.sourceforge.processdash.data.TagData) SimpleDataContext(net.sourceforge.processdash.data.util.SimpleDataContext)

Example 2 with TagData

use of net.sourceforge.processdash.data.TagData in project processdash by dtuma.

the class HierarchyAlterer method readNodesAndLeaves.

/** Make a list of all the "leaf" and "node" data elements in the
     * repository.
     */
private static void readNodesAndLeaves(HashSet nodesAndLeaves, DataRepository data) {
    Iterator dataNames = data.getKeys(null, DATA_NAME_HINT);
    String name;
    while (dataNames.hasNext()) {
        name = (String) dataNames.next();
        if ((name.endsWith(NODE_TAG) || name.endsWith(LEAF_TAG)) && data.getValue(name) instanceof TagData)
            nodesAndLeaves.add(name);
    }
    /* "Pretend" that the data item "/node" is set.  We never want
         * that element to be set; claiming that it IS set will
         * effectively prevent setNodesAndLeaves() from setting it.
         */
    nodesAndLeaves.add(NODE_TAG);
}
Also used : Iterator(java.util.Iterator) TagData(net.sourceforge.processdash.data.TagData)

Example 3 with TagData

use of net.sourceforge.processdash.data.TagData in project processdash by dtuma.

the class DataExporterXMLv1 method writeDataElementsForNode.

private void writeDataElementsForNode(XmlSerializer xml, HashTree data, int depth) throws IOException {
    // write all the tags for this node first.
    for (Iterator iter = data.getContents(); iter.hasNext(); ) {
        Map.Entry e = (Map.Entry) iter.next();
        String dataName = (String) e.getKey();
        SimpleData dataValue = (SimpleData) e.getValue();
        if (dataValue instanceof TagData)
            writeDataElement(xml, dataName, dataValue, depth);
    }
    // now, write the rest of the data elements.
    for (Iterator iter = data.getContents(); iter.hasNext(); ) {
        Map.Entry e = (Map.Entry) iter.next();
        String dataName = (String) e.getKey();
        SimpleData dataValue = (SimpleData) e.getValue();
        if (!(dataValue instanceof TagData))
            writeDataElement(xml, dataName, dataValue, depth);
    }
    // finally, write all the children.
    for (Iterator iter = data.getChildren(); iter.hasNext(); ) {
        Map.Entry e = (Map.Entry) iter.next();
        String childName = (String) e.getKey();
        HashTree child = (HashTree) e.getValue();
        writeChildElement(xml, childName, child, depth);
    }
}
Also used : HashTree(net.sourceforge.processdash.util.HashTree) Iterator(java.util.Iterator) TagData(net.sourceforge.processdash.data.TagData) SimpleData(net.sourceforge.processdash.data.SimpleData) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 4 with TagData

use of net.sourceforge.processdash.data.TagData in project processdash by dtuma.

the class MoveProjectWorker method repairMasterProjectLinks.

/*
     * Methods to repair connections between master projects and subprojects
     */
private void repairMasterProjectLinks() {
    if (!StringUtils.hasValue(masterPrefix))
        return;
    String masterTagDataName = masterPrefix + "/" + processID + " Master Root Tag";
    Object tag = ctx.getData().getSimpleValue(masterTagDataName);
    if (!(tag instanceof TagData)) {
        couldNotRepairMasterLinks();
        return;
    }
    String url = WebServer.DASHBOARD_PROTOCOL + ":" + WebServer.urlEncodePath(masterPrefix) + "//" + processID + "/setup/subprojectEdit?do=update";
    try {
        InputStream in = new URL(url).openStream();
        while (in.read() != -1) ;
    } catch (Exception e) {
        couldNotRepairMasterLinks();
    }
}
Also used : InputStream(java.io.InputStream) TagData(net.sourceforge.processdash.data.TagData) URL(java.net.URL) LockFailureException(net.sourceforge.processdash.util.lock.LockFailureException) IOException(java.io.IOException) AlreadyLockedException(net.sourceforge.processdash.util.lock.AlreadyLockedException)

Example 5 with TagData

use of net.sourceforge.processdash.data.TagData in project processdash by dtuma.

the class SnippetDefinition method matchesContext.

/** Returns true if this snippet is appropriate for the given context */
public boolean matchesContext(DataContext ctx) {
    if (contexts.contains("*"))
        return true;
    boolean foundMatch = false;
    for (Iterator iter = contexts.iterator(); iter.hasNext(); ) {
        String contextName = (String) iter.next();
        boolean isProhibition = false;
        if (contextName.startsWith("!")) {
            contextName = contextName.substring(1);
            isProhibition = true;
        }
        if (ctx.getValue(contextName) instanceof TagData) {
            if (isProhibition)
                return false;
            else
                foundMatch = true;
        }
    }
    return foundMatch;
}
Also used : Iterator(java.util.Iterator) TagData(net.sourceforge.processdash.data.TagData)

Aggregations

TagData (net.sourceforge.processdash.data.TagData)5 Iterator (java.util.Iterator)3 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 SimpleData (net.sourceforge.processdash.data.SimpleData)1 SimpleDataContext (net.sourceforge.processdash.data.util.SimpleDataContext)1 HashTree (net.sourceforge.processdash.util.HashTree)1 AlreadyLockedException (net.sourceforge.processdash.util.lock.AlreadyLockedException)1 LockFailureException (net.sourceforge.processdash.util.lock.LockFailureException)1