@Override public void toJson(Writer writer) throws IOException { JsonArray scripts = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { scripts.append(scriptResource.toJsonValue()); } toJson(writer, "addPageResources", Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), cssSource(), scripts); }
params.asString(0), RenderMode.valueOf( params.asString(1))), channel); break; view.renderSupport(), params.asString(0)), channel); break; List<String> previewLayout = params.asArray(0).stream().map( value -> (String) value).collect(Collectors.toList()); List<String> tabsLayout = params.asArray(1).stream().map( value -> (String) value).collect(Collectors.toList()); JsonObject xtraInfo = (JsonObject) params.get(2); fire(new PortalLayoutChanged( previewLayout, tabsLayout, xtraInfo), channel); params.asString(0), RenderMode.valueOf(params.asString(1)), (Boolean) params.asBoolean(2)), channel); break; fire(new SetLocale(Locale.forLanguageTag(params.asString(0))), channel); break; params.asString(0), params.asString(1), params.size() <= 2 ? JsonArray.EMPTY_ARRAY : params.asArray(2)),
Map<String, String> data = getStore(channel); JsonArray params = (JsonArray) event.request().params(); params.asArray(0).arrayStream().forEach(item -> { String key = item.asString(0); if (key.startsWith(keyStart)) { data.put(key.substring( keyStart.length() - 1), item.asString(1));
rpc.params().asString(0))) { portalSession.discard(); return;
params.asString(0), RenderMode.valueOf( params.asString(1))), channel); break; view.renderSupport(), params.asString(0)), channel); break; List<String> previewLayout = params.asArray(0).stream().map( value -> (String) value).collect(Collectors.toList()); List<String> tabsLayout = params.asArray(1).stream().map( value -> (String) value).collect(Collectors.toList()); JsonObject xtraInfo = (JsonObject) params.get(2); fire(new PortalLayoutChanged( previewLayout, tabsLayout, xtraInfo), channel); params.asString(0), RenderMode.valueOf(params.asString(1)), (Boolean) params.asBoolean(2)), channel); break; fire(new SetLocale(Locale.forLanguageTag(params.asString(0))), channel); break; fire(new SetTheme(params.asString(0)), channel); break; params.asString(0), params.asString(1),
Store data = getStore(channel); JsonArray params = (JsonArray) event.request().params(); params.asArray(0).arrayStream().forEach(item -> { String key = item.asString(0); if (key.startsWith(keyStart)) { data.put(key.substring( keyStart.length() - 1), item.asString(1));
rpc.params().asString(0))) { portalSession.discard(); return;
@Override public void toJson(Writer writer) throws IOException { JsonArray scripts = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { scripts.append(scriptResource.toJsonValue()); } toJson(writer, "addPageResources", Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), cssSource(), scripts); }
/** * Handle JSON input. * * @param event the event * @param channel the channel * @throws InterruptedException the interrupted exception * @throws IOException Signals that an I/O exception has occurred. */ @SuppressWarnings("PMD.DataflowAnomalyAnalysis") @Handler(channels = PortalChannel.class) public void onJsonInput(JsonInput event, PortalSession channel) throws InterruptedException, IOException { // Send events to portlets on portal's channel JsonArray params = event.request().params(); switch (event.request().method()) { // NOPMD case "setTheme": { fire(new SetTheme(params.asString(0)), channel); break; } default: // Ignore unknown break; } }
/** * Provides the JSON representation of the information. * * @return the json object */ public JsonObject toJsonValue() { JsonObject obj = JsonObject.create(); if (scriptUri != null) { obj.setField("uri", scriptUri.toString()); } if (scriptSource != null) { obj.setField("source", scriptSource); } JsonArray strArray = JsonArray.create(); for (String req : requires) { strArray.append(req); } obj.setField("requires", strArray); strArray = JsonArray.create(); for (String prov : provides) { strArray.append(prov); } obj.setField("provides", strArray); return obj; } }
@Override public void toJson(Writer writer) throws IOException { JsonArray strArray = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { strArray.append(scriptResource.toJsonValue()); } toJson(writer, "addPortletType", portletType(), displayName(), Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), strArray, isInstantiable()); } }
@Override public void toJson(Writer writer) throws IOException { JsonArray strArray = JsonArray.create(); for (ScriptResource scriptResource : scriptResources()) { strArray.append(scriptResource.toJsonValue()); } toJson(writer, "addPortletType", portletType(), displayName(), Arrays.stream(cssUris()).map( uri -> uri.toString()).toArray(String[]::new), strArray, isInstantiable()); } }