Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String getQueryData() {
- IPentahoSession userSession = PentahoSessionHolder.getSession();
- IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, userSession);
- IContentGenerator cda;
- try {
- cda = pluginManager.getContentGenerator("cda", userSession);
- } catch (Exception e) {
- logger.error("Failed to acquire CDA plugin to query");
- return null;
- }
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- IOutputHandler outputHandler = new SimpleOutputHandler(outputStream, false);
- IParameterProvider requestParams = new SimpleParameterProvider(requestMap);
- Map<String,Object> pathMap = new HashMap<String,Object>();
- pathMap.put("path", "/doQuery");
- IParameterProvider pathParams = new SimpleParameterProvider(pathMap);
- Map<String, IParameterProvider> paramProvider = new HashMap<String, IParameterProvider>();
- paramProvider.put(IParameterProvider.SCOPE_REQUEST,requestParams);
- paramProvider.put("path",pathParams);
- try {
- cda.setSession(userSession);
- cda.setOutputHandler(outputHandler);
- cda.setParameterProviders(paramProvider);
- cda.createContent();
- return outputStream.toString();
- } catch (Exception e) {
- logger.error("Failed to execute query: " + e.toString());
- return null;
- }
- }
Add Comment
Please, Sign In to add comment