use of org.pentaho.pms.core.exception.PentahoMetadataException in project data-access by pentaho.
the class MetadataService method doXmlQueryToCdaJson.
/**
* Executes a XML query and returns a CDA compatible JSON serialization of the result set
*
* @param rowLimit
* @return
*/
public String doXmlQueryToCdaJson(String xml, int rowLimit) {
IPentahoResultSet resultSet = executeQuery(xml, rowLimit);
if (resultSet == null) {
return null;
}
String json = null;
try {
MetadataServiceUtil util = getMetadataServiceUtil();
Domain domain = util.getDomainObject(xml);
util.setDomain(domain);
String locale = LocaleHelper.getClosestLocale(LocaleHelper.getLocale().toString(), domain.getLocaleCodes());
json = util.createCdaJson(resultSet, locale);
} catch (JSONException e) {
// $NON-NLS-1$
error(Messages.getErrorString("MetadataService.ERROR_0007_JSON_ERROR"), e);
} catch (PentahoMetadataException e) {
// $NON-NLS-1$
error(Messages.getErrorString("MetadataService.ERROR_0007_BAD_QUERY_DOMAIN"), e);
}
return json;
}
Aggregations