/* * Prepare a query specification with the property and input parameter values, * for use by an ODA driver before IQuery#prepare. */ @SuppressWarnings("restriction") private QuerySpecification populateQuerySpecification() throws DataException { if (this.querySpecificaton == null) { QuerySpecHelper querySpecHelper = new QuerySpecHelper(dataSource.getDriverName(), queryType); this.querySpecificaton = querySpecHelper.getFactoryHelper().createQuerySpecification(); } // add custom properties addPropertiesToQuerySpec(querySpecificaton); // add parameter defns addParametersToQuerySpec(querySpecificaton); return querySpecificaton; }
/** Adds input parameter values to the QuerySpecification. */ @SuppressWarnings("restriction") private void addParametersToQuerySpec(QuerySpecification querySpec) throws DataException { if (this.parameterHints == null) return; // nothing to add // iterate thru the collection to add parameter hints Iterator it = this.parameterHints.iterator(); while (it.hasNext()) { ParameterHint parameterHint = (ParameterHint) it.next(); // If the parameter is input parameter, add its value to query spec if (parameterHint.isInputMode()) { Object inputValue = getParameterInputValue(parameterHint); QuerySpecHelper.setParameterValue(querySpec, parameterHint, inputValue); } } }