use of org.teiid.api.exception.query.FunctionMetadataException in project teiid by teiid.
the class FunctionMetadataValidator method validateFunctionMethod.
/**
* Determine whether a FunctionMethod is valid. The following items are validated:
* <UL>
* <LI>Validate method name</LI>
* <LI>Validate description</LI>
* <LI>Validate category</LI>
* <LI>Validate invocation method</LI>
* <LI>Validate all input parameters</LI>
* <LI>Validate output parameter</LI>
* </UL>
* @param method The method to validate
* @param report The report to update during validation
*/
public static final void validateFunctionMethod(FunctionMethod method, ValidatorReport report, Map<String, Datatype> runtimeTypeMap) {
if (method == null) {
// $NON-NLS-1$ //$NON-NLS-2$
updateReport(report, method, QueryPlugin.Util.getString("ERR.015.001.0052", "FunctionMethod"));
// can't validate
return;
}
try {
// Validate attributes
validateName(method.getName());
validateDescription(method.getDescription());
validateCategory(method.getCategory());
validateInvocationMethod(method.getInvocationClass(), method.getInvocationMethod(), method.getPushdown());
// Validate input parameters
List<FunctionParameter> params = method.getInputParameters();
if (params != null && !params.isEmpty()) {
for (int i = 0; i < params.size(); i++) {
FunctionParameter param = params.get(i);
validateFunctionParameter(param);
param.setPosition(i + 1);
MetadataFactory.setDataType(param.getRuntimeType(), param, runtimeTypeMap, true);
param.getUUID();
}
}
// Validate output parameters
validateFunctionParameter(method.getOutputParameter());
method.getOutputParameter().setPosition(0);
MetadataFactory.setDataType(method.getOutputParameter().getRuntimeType(), method.getOutputParameter(), runtimeTypeMap, true);
} catch (FunctionMetadataException e) {
updateReport(report, method, e.getMessage());
}
}
Aggregations