001/* 002 * JGrapes Event Driven Framework 003 * Copyright (C) 2017-2018 Michael N. Lipp 004 * 005 * This program is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Affero General Public License as published by 007 * the Free Software Foundation; either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, but 011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 013 * for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License along 016 * with this program; if not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jgrapes.webconsole.base.events; 020 021import org.jdrupes.json.JsonArray; 022import org.jgrapes.core.Event; 023import org.jgrapes.webconsole.base.RenderSupport; 024 025/** 026 * A decoded notification (as defined by the JSON RPC specification) that 027 * invokes a method on a web console component model. Usually, though 028 * not necessarily, the web console component component responds by sending a 029 * {@link NotifyConletView} to update the web console component representation. 030 * 031 *  032 * 033 * @startuml NotifyConletModelSeq.svg 034 * hide footbox 035 * 036 * Browser -> WebConsole: "notifyConletModel" 037 * activate WebConsole 038 * WebConsole -> Conlet: NotifyConletModel 039 * deactivate WebConsole 040 * activate Conlet 041 * Conlet -> WebConsole: NotifyConletView 042 * deactivate Conlet 043 * activate WebConsole 044 * WebConsole -> Browser: "notifyConletView" 045 * deactivate WebConsole 046 * 047 * @enduml 048 */ 049@SuppressWarnings("PMD.DataClass") 050public class NotifyConletModel extends Event<Void> { 051 052 private final RenderSupport renderSupport; 053 private final String conletId; 054 private final String method; 055 private final JsonArray params; 056 057 /** 058 * Creates a new event. 059 * 060 * @param renderSupport the render support from the web console in case 061 * the response requires it 062 * @param conletId the web console component model that the notification 063 * is directed at 064 * @param method the method to be executed 065 * @param params parameters 066 */ 067 public NotifyConletModel(RenderSupport renderSupport, 068 String conletId, String method, JsonArray params) { 069 this.renderSupport = renderSupport; 070 this.conletId = conletId; 071 this.method = method; 072 this.params = params; 073 } 074 075 /** 076 * Returns the render support. 077 * 078 * @return the render support 079 */ 080 public RenderSupport renderSupport() { 081 return renderSupport; 082 } 083 084 /** 085 * Returns the web console component id. 086 * 087 * @return the web console component id 088 */ 089 public String conletId() { 090 return conletId; 091 } 092 093 /** 094 * Returns the method. 095 * 096 * @return the method 097 */ 098 public String method() { 099 return method; 100 } 101 102 /** 103 * Returns the parameters. 104 * 105 * @return the parameters 106 */ 107 public JsonArray params() { 108 return params; 109 } 110}