}
public DependentInputWithDynamicValues(DependentInputElement dependentInputElement, Report report, Input parentInput, int depth) throws BadReportSyntaxException {
super(dependentInputElement,report, depth,parentInput);
if (dependentInputElement.getWhen().size() > 1) throw new BadReportSyntaxException("there must be only one 'when' element if it's value is '*'");
// just get first when element:
WhenElement whenElement = dependentInputElement.getWhen().get(0);
this.description = whenElement.getDescription();
this.datatype = whenElement.getDatatype();
this.attributeValues = Input.getValuesFromAttribute(whenElement.getValues() );
defaultVal = getDefaultValue(whenElement.getDefault(),this.datatype);
// grab query elements and control element from this crappy data structure:
List<QueryElement> queryElements = new ArrayList<QueryElement>();
for (Object object : whenElement.getControlAndQueryOrGeneratedQuery()) {
if (object instanceof QueryElement) {
queryElements.add((QueryElement)object);
} else {
controlElement = (ControlElement)object;
}
}
if (queryElements.size() == 0) {
throw new BadReportSyntaxException("there must be one query inside of a dependent input with dynamic values");
}
// only grab one query:
query = QueryFactory.getQuery(queryElements.get(0),report);
// set control attribute: