Java Code Examples for org.apache.commons.configuration.tree.ConfigurationNode#getChildren()

The following examples show how to use org.apache.commons.configuration.tree.ConfigurationNode#getChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLScenarioFactory.java    From qaf with MIT License 5 votes vote down vote up
private void addSteps(ConfigurationNode defination, ArrayList<Object[]> statements) {
	for (Object o : defination.getChildren()) {
		Node stepNode = (Node) o;
		if (stepNode.getName().equalsIgnoreCase("STEP")) {
			String name = getAttribute(stepNode, "name", null);
			String inParams = getAttribute(stepNode, "params", "[]");
			if (!inParams.startsWith("[")) {
				Object[] params = new Object[] { toObject(inParams) };
				inParams = gson.toJson(params);
			}
			String outParams = getAttribute(stepNode, "result", "");
			statements.add(new String[] { name, inParams, outParams });
		}
	}
}
 
Example 2
Source File: ExtensionQuickStart.java    From zap-extensions with Apache License 2.0 5 votes vote down vote up
private ConfigurationNode getFirstChildNode(ConfigurationNode node, String childName) {
    List<ConfigurationNode> list = node.getChildren(childName);
    if (list.size() > 0) {
        return list.get(0);
    }
    return null;
}
 
Example 3
Source File: VarOneConfiguration.java    From varOne with MIT License 5 votes vote down vote up
private String getStringValue(String name, String d) {
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if (properties == null || properties.size() == 0) {
		return d;
	}
	for (ConfigurationNode p : properties) {
		if (p.getChildren("name") != null && p.getChildren("name").size() > 0 
				&& name.equals(((ConfigurationNode) p.getChildren("name").get(0)).getValue())) {
			return (String) ((ConfigurationNode) p.getChildren("value").get(0)).getValue();
		}
	}
	return d;
}
 
Example 4
Source File: VarOneConfiguration.java    From varOne with MIT License 5 votes vote down vote up
private int getIntValue(String name, int d) {
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if (properties == null || properties.size() == 0) {
		return d;
	}
	for (ConfigurationNode p : properties) {
		if (p.getChildren("name") != null && p.getChildren("name").size() > 0 
				&& name.equals(((ConfigurationNode) p.getChildren("name").get(0)).getValue())) {
			return Integer.parseInt((String) ((ConfigurationNode) p.getChildren("value").get(0)).getValue());
		}
	}
	return d;	
}
 
Example 5
Source File: VarOneConfiguration.java    From varOne with MIT License 5 votes vote down vote up
private long getLongValue(String name, long d) {
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if (properties == null || properties.size() == 0) {
		return d;
	}
	for (ConfigurationNode p : properties) {
		if (p.getChildren("name") != null && p.getChildren("name").size() > 0 
				&& name.equals(((ConfigurationNode) p.getChildren("name").get(0)).getValue())) {
			return Long.parseLong((String) ((ConfigurationNode) p.getChildren("value").get(0)).getValue());
		}
	}
	return d;	
}
 
Example 6
Source File: VarOneConfiguration.java    From varOne with MIT License 5 votes vote down vote up
private float getFloatValue(String name, float d) {
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if (properties == null || properties.size() == 0) {
		return d;
	}
	for (ConfigurationNode p : properties) {
		if (p.getChildren("name") != null && p.getChildren("name").size() > 0 
				&& name.equals(((ConfigurationNode) p.getChildren("name").get(0)).getValue())) {
			return Float.parseFloat((String) ((ConfigurationNode) p.getChildren("value").get(0)).getValue());
		}
	}
	return d;	
}
 
Example 7
Source File: VarOneConfiguration.java    From varOne with MIT License 5 votes vote down vote up
private boolean getBooleanValue(String name, boolean d) {
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if (properties == null || properties.size() == 0) {
		return d;
	}
	for (ConfigurationNode p : properties) {
		if (p.getChildren("name") != null && p.getChildren("name").size() > 0 
				&& name.equals(((ConfigurationNode) p.getChildren("name").get(0)).getValue())) {
			return Boolean.parseBoolean((String) ((ConfigurationNode) p.getChildren("value").get(0)).getValue());	
		}	
	}
	return d;	
}
 
Example 8
Source File: VarOnedConfiguration.java    From varOne with MIT License 5 votes vote down vote up
public String getStringValue(String name, String d) {
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if (properties == null || properties.size() == 0) {
		return d;
	}
	for (ConfigurationNode p : properties) {
		if (p.getChildren("name") != null && p.getChildren("name").size() > 0 
				&& name.equals(((ConfigurationNode) p.getChildren("name").get(0)).getValue())) {
			return (String) ((ConfigurationNode) p.getChildren("value").get(0)).getValue();
		}
	}
	return d;
}
 
Example 9
Source File: ExplorerConfiguration.java    From Explorer with Apache License 2.0 5 votes vote down vote up
private String getStringValue(String name, String d){
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if(properties==null || properties.size()==0) return d;
	for(ConfigurationNode p : properties){
		if(p.getChildren("name")!=null && p.getChildren("name").size()>0 && name.equals(p.getChildren("name").get(0).getValue())){
			return (String) p.getChildren("value").get(0).getValue();
		}
	}
	return d;
}
 
Example 10
Source File: ExplorerConfiguration.java    From Explorer with Apache License 2.0 5 votes vote down vote up
private int getIntValue(String name, int d){
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if(properties==null || properties.size()==0) return d;
	for(ConfigurationNode p : properties){
		if(p.getChildren("name")!=null && p.getChildren("name").size()>0 && name.equals(p.getChildren("name").get(0).getValue())){
			return Integer.parseInt((String) p.getChildren("value").get(0).getValue());
		}
	}
	return d;
}
 
Example 11
Source File: ExplorerConfiguration.java    From Explorer with Apache License 2.0 5 votes vote down vote up
private long getLongValue(String name, long d){
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if(properties==null || properties.size()==0) return d;
	for(ConfigurationNode p : properties){
		if(p.getChildren("name")!=null && p.getChildren("name").size()>0 && name.equals(p.getChildren("name").get(0).getValue())){
			return Long.parseLong((String) p.getChildren("value").get(0).getValue());
		}
	}
	return d;
}
 
Example 12
Source File: ExplorerConfiguration.java    From Explorer with Apache License 2.0 5 votes vote down vote up
private float getFloatValue(String name, float d){
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if(properties==null || properties.size()==0) return d;
	for(ConfigurationNode p : properties){
		if(p.getChildren("name")!=null && p.getChildren("name").size()>0 && name.equals(p.getChildren("name").get(0).getValue())){
			return Float.parseFloat((String) p.getChildren("value").get(0).getValue());
		}
	}
	return d;
}
 
Example 13
Source File: ExplorerConfiguration.java    From Explorer with Apache License 2.0 5 votes vote down vote up
private boolean getBooleanValue(String name, boolean d){
	List<ConfigurationNode> properties = getRootNode().getChildren();
	if(properties==null || properties.size()==0) return d;
	for(ConfigurationNode p : properties){
		if(p.getChildren("name")!=null && p.getChildren("name").size()>0 && name.equals(p.getChildren("name").get(0).getValue())){
			return Boolean.parseBoolean((String) p.getChildren("value").get(0).getValue());
		}
	}
	return d;
}