Search in sources :

Example 1 with EventFilter

use of org.jenkinsci.plugins.pubsub.EventFilter in project blueocean-plugin by jenkinsci.

the class SSEConnection method subscribe.

public void subscribe(String channel) throws IOException {
    // constructor is not public
    // EventFilter f = new EventFilter();
    JSONObject o = new JSONObject();
    o.put("jenkins_channel", channel);
    EventFilter f = (EventFilter) o.toBean(EventFilter.class);
    configure(Collections.singletonList(f), Collections.<EventFilter>emptyList());
}
Also used : JSONObject(net.sf.json.JSONObject) EventFilter(org.jenkinsci.plugins.pubsub.EventFilter)

Example 2 with EventFilter

use of org.jenkinsci.plugins.pubsub.EventFilter in project blueocean-plugin by jenkinsci.

the class SSEConnection method toJSONArray.

private JSONArray toJSONArray(Collection<EventFilter> filters) {
    JSONArray a = new JSONArray();
    for (EventFilter f : filters) {
        JSONObject o = new JSONObject();
        o.putAll(f);
        a.add(o);
    }
    return a;
}
Also used : JSONObject(net.sf.json.JSONObject) JSONArray(net.sf.json.JSONArray) EventFilter(org.jenkinsci.plugins.pubsub.EventFilter)

Aggregations

JSONObject (net.sf.json.JSONObject)2 EventFilter (org.jenkinsci.plugins.pubsub.EventFilter)2 JSONArray (net.sf.json.JSONArray)1