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;
}
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);
}
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);
}
}
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();
}
}
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;
}
Aggregations