Search in sources :

Example 56 with IParameterProvider

use of org.pentaho.platform.api.engine.IParameterProvider in project pentaho-platform by pentaho.

the class ActionSequenceParameterUiContentGenerator method getPathParameters.

@SuppressWarnings("unchecked")
public IParameterProvider getPathParameters() {
    // $NON-NLS-1$
    IParameterProvider pathParams = this.parameterProviders.get("path");
    SimpleParameterSetter parameters = new SimpleParameterSetter();
    Iterator pathParamIterator = pathParams.getParameterNames();
    while (pathParamIterator.hasNext()) {
        String param = (String) pathParamIterator.next();
        parameters.setParameter(param, pathParams.getParameter(param));
    }
    this.pathParameters = parameters;
    return parameters;
}
Also used : IParameterProvider(org.pentaho.platform.api.engine.IParameterProvider) SimpleParameterSetter(org.pentaho.platform.engine.services.solution.SimpleParameterSetter) Iterator(java.util.Iterator)

Example 57 with IParameterProvider

use of org.pentaho.platform.api.engine.IParameterProvider in project pdi-platform-plugin by pentaho.

the class ParameterContentGenerator method createContent.

@Override
public void createContent(OutputStream out) throws Exception {
    IParameterProvider pathParams = parameterProviders.get(PATH);
    IParameterProvider requestParams = parameterProviders.get(IParameterProvider.SCOPE_REQUEST);
    RepositoryFile file = null;
    if (pathParams != null) {
        file = (RepositoryFile) pathParams.getParameter(FILE);
    } else {
        IUnifiedRepository repo = PentahoSystem.get(IUnifiedRepository.class, null);
        String path = URLDecoder.decode(requestParams.getStringParameter(PATH, StringUtils.EMPTY), LocaleHelper.UTF_8);
        file = repo.getFile(idTopath(path));
    }
    IPdiContentProvider provider = (IPdiContentProvider) PentahoSystem.get(IPluginManager.class).getBean(IPdiContentProvider.class.getSimpleName());
    String[] userParams = provider.getUserParameters(file.getPath());
    ParametersBean paramBean = new ParametersBean(userParams, requestParameterToStringMap(requestParams));
    String response = paramBean.getParametersXmlString();
    out.write(response.getBytes(LocaleHelper.getSystemEncoding()));
    out.flush();
}
Also used : IParameterProvider(org.pentaho.platform.api.engine.IParameterProvider) IPdiContentProvider(org.pentaho.platform.api.util.IPdiContentProvider) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Aggregations

IParameterProvider (org.pentaho.platform.api.engine.IParameterProvider)57 HashMap (java.util.HashMap)27 SimpleParameterProvider (org.pentaho.platform.engine.core.solution.SimpleParameterProvider)21 ArrayList (java.util.ArrayList)14 List (java.util.List)11 Test (org.junit.Test)11 SimpleUrlFactory (org.pentaho.platform.util.web.SimpleUrlFactory)11 ByteArrayOutputStream (java.io.ByteArrayOutputStream)10 IOException (java.io.IOException)9 Iterator (java.util.Iterator)8 SimpleOutputHandler (org.pentaho.platform.engine.core.output.SimpleOutputHandler)8 HttpRequestParameterProvider (org.pentaho.platform.web.http.request.HttpRequestParameterProvider)8 MockHttpServletRequest (com.mockrunner.mock.web.MockHttpServletRequest)7 MockHttpServletResponse (com.mockrunner.mock.web.MockHttpServletResponse)7 IOutputHandler (org.pentaho.platform.api.engine.IOutputHandler)6 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)6 IRuntimeContext (org.pentaho.platform.api.engine.IRuntimeContext)6 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)6 SimpleParameterSetter (org.pentaho.platform.engine.services.solution.SimpleParameterSetter)6 OutputStream (java.io.OutputStream)5