package fi.nls.oskari.proxy;

import fi.nls.oskari.control.ActionParameters;
import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;
import fi.nls.oskari.service.ProxyServiceConfig;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;

/**
 * Custom modifier for wfsquery proxy service. Overrides getConfig and returns proxy config
 * based on wfs layer mapping to given id parameter (requires parameter wfs_layer_id to work).
 */
public class MyPlacesProxyHandler extends ProxyServiceConfig {
    private static final Logger log = LogFactory.getLogger(MyPlacesProxyHandler.class);

    private static final String PARAM_CATEGORY_ID = "myCat";

    /**
     * Returns version of the config populated by wfs service info based on given id parameter.
     * @return
     */
    public ProxyServiceConfig getConfig(final ActionParameters params) {
        ProxyServiceConfig config = new ProxyServiceConfig();
        config.setEncoding(getEncoding());
        config.setUsername(getUsername());
        config.setPassword(getPassword());

        // passing all params - TODO: list allowed params in props
        final Enumeration<String> parmNames = params.getRequest().getParameterNames();
        final ArrayList<String> aList = Collections.list(parmNames);
        config.setParamNames(aList.toArray(new String[0]));
        config.setHeaders(getHeaders());

        final String requestedCategory = params.getHttpParam(PARAM_CATEGORY_ID);
        //(uuid='d3a216dd-077d-44ce-b79a-adf20ca88367'+OR+publisher_name+IS+NOT+NULL)
        final String userSpecificURL = getUrl() + "(uuid='" + params.getUser().getUuid() + "'+OR+publisher_name+IS+NOT+NULL)+AND+category_id=" + requestedCategory;
        // setup user specific base url
        config.setUrl(userSpecificURL);
        return config;
    }
}

@@ -74,78 +74,8 @@
 rs;%0A
-import fi.nls.oskari.log.LogFactory;%0Aimport fi.nls.oskari.log.Logger;%0A
 impo
@@ -470,96 +470,8 @@
 ig %7B
-%0A    private static final Logger log = LogFactory.getLogger(MyPlacesProxyHandler.class);
 %0A%0A  
@@ -1507,24 +1507,25 @@
 d() + %22'+OR+
+(
 publisher_na
@@ -1538,16 +1538,40 @@
 NOT+NULL
++AND+publisher_name%3C%3E'')
 )+AND+ca

Add publisher_name not empty to ECQL sent to geoserver