程式型IsoBean
# FastWeb 程式型IsoBean
本章節中,我們將學習如何製作一個程式型的IsoBean模組。程式型的IsoBean模組可配合其他Bean模組進行數據傳輸操作,比如可以使用程式型IsoBean模組讀取資料庫的數據並向其他IsoBean發送WebSocket訊息,從而實現主動推送更新的效果。程式型的IsoBean通常也不需要繫結Bean模組。
數據型IsoBean模組的設計順序如下:
- 配置節點資料庫
- 設計IsoBean模組
- 發佈IsoBean模組
以下程式型IsoBean的模組示例是配合 戰情型IsoBean 示例使用的,在檢視此示例前,請先檢視戰情型報表的示例說明,結合檢視此處的設定可助於理解。
# 1. 配置節點資料庫
配置節點資料庫的方式請參考 Node節點資料庫。如要使用的節點資料庫已建立,則可跳過此步驟。本示例中使用的FastWeb資料庫已內建于示例庫中,故此步驟省略。
# 2. 設計IsoBean模組
點選 [云服務工具]
- [IsoBean模組管理]
,打開IsoBean模組管理界面,點選 [新增]
按鈕,按照以下提示建立一個IsoBean模組。其他資訊中請注意要將 是否啟用?
選項進行勾選。填寫完成後,點選 [儲存]
按鈕。
建立完成後,選擇建立的IsoBean,點選 [API設計]
,建立的API請按照以下方式進行設定。
function RestAPI()
{
var D,Q,eventname,msg,l,s;
eventname = IIF(URLParams.Values["eventname"]=="",APIParams.Values["eventname"],URLParams.Values["eventname"]);
//獲取節點資料庫
Try
D = GetNodeDataLink("FastWeb");
Except{
//報錯時組裝JSON錯誤資訊
var DE = new TJSONObject();
DE.AddPair("status","error");
DE.AddPair("message","NodeData "+db+" not found.");
return(DE.ToString);
}
Q = new TFDQuery(nil);
Q.Connection = D;
l = new TStringList();
Try{
//更新表頭的數據
if (SameText(eventname,"updateheader"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 20000) AS INT) as dataMonthOrder,cast(floor(RAND() * 2000) AS INT) as dataNewMeber,cast(floor(RAND() * 8000) AS INT) as dataOnceConsume";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updateheader\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataMonthOrder\"," +
"\"paramvalue\": \"" + Q.FieldByName("dataMonthOrder").asString + "\"" +
"}," +
"{" +
"\"paramname\": \"dataNewMember\"," +
"\"paramvalue\": \"" + Q.FieldByName("dataNewMeber").asString + "\"" +
"}," +
"{" +
"\"paramname\": \"dataOnceConsume\"," +
"\"paramvalue\": \"" + Q.FieldByName("dataOnceConsume").asString + "\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表1
if (SameText(eventname,"updatechart1"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 20000) AS INT) as one,cast(floor(RAND() * 20000) AS INT) as two,cast(floor(RAND() * 20000) AS INT) as three," +
"cast(floor(RAND() * 20000) AS INT) as four,cast(floor(RAND() * 20000) AS INT) as five";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart1\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart1\"," +
"\"paramvalue\": \"" + Q.FieldByName("one").asString + "," +
Q.FieldByName("two").asString + "," +
Q.FieldByName("three").asString + "," +
Q.FieldByName("four").asString + "," +
Q.FieldByName("five").asString + "," +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表2
if (SameText(eventname,"updatechart2"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 2000) AS INT) as s1e1,cast(floor(RAND() * 2000) AS INT) as s1e2,cast(floor(RAND() * 2000) AS INT) as s1e3," +
"cast(floor(RAND() * 2000) AS INT) as s1e4,cast(floor(RAND() * 2000) AS INT) as s1e5,cast(floor(RAND() * 2000) AS INT) as s1e6," +
"cast(floor(RAND() * 2000) AS INT) as s1e7,cast(floor(RAND() * 2000) AS INT) as s1e8,cast(floor(RAND() * 2000) AS INT) as s1e9," +
"cast(floor(RAND() * 2000) AS INT) as s1e10,cast(floor(RAND() * 2000) AS INT) as s1e11,cast(floor(RAND() * 2000) AS INT) as s1e12," +
"cast(floor(RAND() * 2000) AS INT) as s2e1,cast(floor(RAND() * 2000) AS INT) as s2e2,cast(floor(RAND() * 2000) AS INT) as s2e3," +
"cast(floor(RAND() * 2000) AS INT) as s2e4,cast(floor(RAND() * 2000) AS INT) as s2e5,cast(floor(RAND() * 2000) AS INT) as s2e6," +
"cast(floor(RAND() * 2000) AS INT) as s2e7,cast(floor(RAND() * 2000) AS INT) as s2e8,cast(floor(RAND() * 2000) AS INT) as s2e9," +
"cast(floor(RAND() * 2000) AS INT) as s2e10,cast(floor(RAND() * 2000) AS INT) as s2e11,cast(floor(RAND() * 2000) AS INT) as s2e12";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart2\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart2series1\"," +
"\"paramvalue\": \"" + QuotedStr(Q.FieldByName("s1e1").asString) + "," + QuotedStr(Q.FieldByName("s1e2").asString) + "," + QuotedStr(Q.FieldByName("s1e3").asString) + "," +
QuotedStr(Q.FieldByName("s1e4").asString) + "," + QuotedStr(Q.FieldByName("s1e5").asString) + "," + QuotedStr(Q.FieldByName("s1e6").asString) + "," +
QuotedStr(Q.FieldByName("s1e7").asString) + "," + QuotedStr(Q.FieldByName("s1e8").asString) + "," + QuotedStr(Q.FieldByName("s1e9").asString) + "," +
QuotedStr(Q.FieldByName("s1e10").asString) + "," + QuotedStr(Q.FieldByName("s1e11").asString) + "," + QuotedStr(Q.FieldByName("s1e12").asString) + "," +
"\"" +
"}," +
"{" +
"\"paramname\": \"dataChart2series2\"," +
"\"paramvalue\": \"" + QuotedStr(Q.FieldByName("s2e1").asString) + "," + QuotedStr(Q.FieldByName("s2e2").asString) + "," + QuotedStr(Q.FieldByName("s2e3").asString) + "," +
QuotedStr(Q.FieldByName("s2e4").asString) + "," + QuotedStr(Q.FieldByName("s2e5").asString) + "," + QuotedStr(Q.FieldByName("s2e6").asString) + "," +
QuotedStr(Q.FieldByName("s2e7").asString) + "," + QuotedStr(Q.FieldByName("s2e8").asString) + "," + QuotedStr(Q.FieldByName("s2e9").asString) + "," +
QuotedStr(Q.FieldByName("s2e10").asString) + "," + QuotedStr(Q.FieldByName("s2e11").asString) + "," + QuotedStr(Q.FieldByName("s2e12").asString) + "," +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表3
if (SameText(eventname,"updatechart3"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 5) AS INT) as s1,cast(floor(RAND() * 5) AS INT) as s2,cast(floor(RAND() * 5) AS INT) as s3," +
"cast(floor(RAND() * 5) AS INT) as s4,cast(floor(RAND() * 5) AS INT) as s5,cast(floor(RAND() * 5) AS INT) as s6," +
"cast(floor(RAND() * 5) AS INT) as s7,cast(floor(RAND() * 5) AS INT) as s8,cast(floor(RAND() * 5) AS INT) as s9," +
"cast(floor(RAND() * 5) AS INT) as s10,cast(floor(RAND() * 5) AS INT) as s11,cast(floor(RAND() * 5) AS INT) as s12";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart3\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart3\"," +
"\"paramvalue\": \"" + Q.FieldByName("s1").asString + "," + Q.FieldByName("s2").asString + "," + Q.FieldByName("s3").asString + "," +
Q.FieldByName("s4").asString + "," + Q.FieldByName("s5").asString + "," + Q.FieldByName("s6").asString + "," +
Q.FieldByName("s7").asString + "," + Q.FieldByName("s8").asString + "," + Q.FieldByName("s9").asString + "," +
Q.FieldByName("s10").asString + "," + Q.FieldByName("s11").asString + "," + Q.FieldByName("s12").asString +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表4
if (SameText(eventname,"updatechart4"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 19+1) AS INT) as one,cast(floor(RAND() * 19+1) AS INT) as two,cast(floor(RAND() * 19+1) AS INT) as three," +
"cast(floor(RAND() * 19+1) AS INT) as four,cast(floor(RAND() * 19+1) AS INT) as five";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart4\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart4\"," +
"\"paramvalue\": \"{value:" + Q.FieldByName("one").asString + ",name:'No.1'}," +
"{value:" + Q.FieldByName("two").asString + ",name:'No.2'}," +
"{value:" + Q.FieldByName("three").asString + ",name:'No.3'}," +
"{value:" + Q.FieldByName("four").asString + ",name:'No.4'}," +
"{value:" + Q.FieldByName("five").asString + ",name:'No.5'}" +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表5
if (SameText(eventname,"updatechart5"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 50000) AS INT) as one,cast(floor(RAND() * 50000) AS INT) as two,cast(floor(RAND() * 50000) AS INT) as three," +
"cast(floor(RAND() * 50000) AS INT) as four,cast(floor(RAND() * 50000) AS INT) as five";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart5\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart5\"," +
"\"paramvalue\": \"" + Q.FieldByName("one").asString + "," +
Q.FieldByName("two").asString + "," +
Q.FieldByName("three").asString + "," +
Q.FieldByName("four").asString + "," +
Q.FieldByName("five").asString + "," +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表6
if (SameText(eventname,"updatechart6"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 6000) AS INT) as s1e1,cast(floor(RAND() * 6000) AS INT) as s1e2,cast(floor(RAND() * 6000) AS INT) as s1e3," +
"cast(floor(RAND() * 6000) AS INT) as s1e4,cast(floor(RAND() * 6000) AS INT) as s1e5,cast(floor(RAND() * 6000) AS INT) as s1e6," +
"cast(floor(RAND() * 6000) AS INT) as s1e7,cast(floor(RAND() * 6000) AS INT) as s1e8,cast(floor(RAND() * 6000) AS INT) as s1e9," +
"cast(floor(RAND() * 6000) AS INT) as s1e10,cast(floor(RAND() * 6000) AS INT) as s1e11,cast(floor(RAND() * 6000) AS INT) as s1e12," +
"cast(floor(RAND() * 6000) AS INT) as s2e1,cast(floor(RAND() * 6000) AS INT) as s2e2,cast(floor(RAND() * 6000) AS INT) as s2e3," +
"cast(floor(RAND() * 6000) AS INT) as s2e4,cast(floor(RAND() * 6000) AS INT) as s2e5,cast(floor(RAND() * 6000) AS INT) as s2e6," +
"cast(floor(RAND() * 6000) AS INT) as s2e7,cast(floor(RAND() * 6000) AS INT) as s2e8,cast(floor(RAND() * 6000) AS INT) as s2e9," +
"cast(floor(RAND() * 6000) AS INT) as s2e10,cast(floor(RAND() * 6000) AS INT) as s2e11,cast(floor(RAND() * 6000) AS INT) as s2e12";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart6\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart6series1\"," +
"\"paramvalue\": \"" + QuotedStr(Q.FieldByName("s1e1").asString) + "," + QuotedStr(Q.FieldByName("s1e2").asString) + "," + QuotedStr(Q.FieldByName("s1e3").asString) + "," +
QuotedStr(Q.FieldByName("s1e4").asString) + "," + QuotedStr(Q.FieldByName("s1e5").asString) + "," + QuotedStr(Q.FieldByName("s1e6").asString) + "," +
QuotedStr(Q.FieldByName("s1e7").asString) + "," + QuotedStr(Q.FieldByName("s1e8").asString) + "," + QuotedStr(Q.FieldByName("s1e9").asString) + "," +
QuotedStr(Q.FieldByName("s1e10").asString) + "," + QuotedStr(Q.FieldByName("s1e11").asString) + "," + QuotedStr(Q.FieldByName("s1e12").asString) + "," +
"\"" +
"}," +
"{" +
"\"paramname\": \"dataChart6series2\"," +
"\"paramvalue\": \"" + QuotedStr(Q.FieldByName("s2e1").asString) + "," + QuotedStr(Q.FieldByName("s2e2").asString) + "," + QuotedStr(Q.FieldByName("s2e3").asString) + "," +
QuotedStr(Q.FieldByName("s2e4").asString) + "," + QuotedStr(Q.FieldByName("s2e5").asString) + "," + QuotedStr(Q.FieldByName("s2e6").asString) + "," +
QuotedStr(Q.FieldByName("s2e7").asString) + "," + QuotedStr(Q.FieldByName("s2e8").asString) + "," + QuotedStr(Q.FieldByName("s2e9").asString) + "," +
QuotedStr(Q.FieldByName("s2e10").asString) + "," + QuotedStr(Q.FieldByName("s2e11").asString) + "," + QuotedStr(Q.FieldByName("s2e12").asString) + "," +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表7
if (SameText(eventname,"updatechart7"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 50) AS INT) as s1,cast(floor(RAND() * 50) AS INT) as s2,cast(floor(RAND() * 50) AS INT) as s3," +
"cast(floor(RAND() * 50) AS INT) as s4,cast(floor(RAND() * 50) AS INT) as s5,cast(floor(RAND() * 50) AS INT) as s6," +
"cast(floor(RAND() * 50) AS INT) as s7,cast(floor(RAND() * 50) AS INT) as s8,cast(floor(RAND() * 50) AS INT) as s9," +
"cast(floor(RAND() * 50) AS INT) as s10,cast(floor(RAND() * 50) AS INT) as s11,cast(floor(RAND() * 50) AS INT) as s12";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart7\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart7\"," +
"\"paramvalue\": \"" + Q.FieldByName("s1").asString + "," + Q.FieldByName("s2").asString + "," + Q.FieldByName("s3").asString + "," +
Q.FieldByName("s4").asString + "," + Q.FieldByName("s5").asString + "," + Q.FieldByName("s6").asString + "," +
Q.FieldByName("s7").asString + "," + Q.FieldByName("s8").asString + "," + Q.FieldByName("s9").asString + "," +
Q.FieldByName("s10").asString + "," + Q.FieldByName("s11").asString + "," + Q.FieldByName("s12").asString +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
//更新圖表8
if (SameText(eventname,"updatechart8"))
{
//以隨機數代替數據讀取
Q.SQL.Text = "select cast(floor(RAND() * 5000000) AS INT) as one,cast(floor(RAND() * 5000000) AS INT) as two,cast(floor(RAND() * 5000000) AS INT) as three," +
"cast(floor(RAND() * 5000000) AS INT) as four,cast(floor(RAND() * 5000000) AS INT) as five";
Q.Open;
msg = "{" +
"\"username\": \"demo\"," + //WebSocket訊息發送的目標使用者
"\"action\": \"callback\"," + //WebSocket訊息告知IsoBean執行的動作
"\"data\": {" +
"\"callbackcomponent\": \"dashboard-demo1\"," + //執行動作的目標元件名稱
"\"callbackeventname\": \"updatechart8\"," + //執行觸發OnAjaxEvent事件的 eventname(事件名稱)
"\"callbackparams\": [" + //傳輸的鍵值,可以有一對或者多對
"{" +
"\"paramname\": \"dataChart8\"," +
"\"paramvalue\": \"{value:" + Q.FieldByName("one").asString + ",name:'No.1'}," +
"{value:" + Q.FieldByName("two").asString + ",name:'No.2'}," +
"{value:" + Q.FieldByName("three").asString + ",name:'No.3'}," +
"{value:" + Q.FieldByName("four").asString + ",name:'No.4'}," +
"{value:" + Q.FieldByName("five").asString + ",name:'No.5'}" +
"\"" +
"}" +
"]" +
"}" +
"}";
//注意,此處的"https://"根據訪問的型別進行調整,如果使用http訪問FastWeb,此處應改為"http://";如果使用https訪問的,則此處應修改爲"https://"
s = UGCM.NetHttpPost("http://"+RequestInfo.Host+"?restapi=sendwsmsg",msg);
return s;
}
}
Finally{
Q.Free;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
API設計完成後,首先點選 [儲存]
圖示按鈕儲存,然後點選 [測試]
按鈕打開介面測試界面。
在介面測試的界面中,新建參數,名稱為 eventname
,設定的參數值見圖中的說明。設定完成後,點選關閉按鈕關閉界面。
# 3. 發佈IsoBean模組
儲存后,返回列表界面,選擇剛才建立的IsoBean模組,點選 [IsoBean發佈]
,打開 IsoBean 發佈的界面。
選擇要發佈的使用者,點選 [IsoBean 選擇...]
,從打開的IsoBean列表中選擇IsoBean模組,雙擊匯入至發佈列表中,點選 [儲存]
按鈕,然後點選 [確定]
按鈕關閉發佈界面。
重新返回API設計界面,參考 戰情型IsoBean 的預覽鏈接,點選 [測試]
圖示按鈕,打開界面。點選 [Send]
按鈕檢視運行的結果。如果返回的結果中包含執行成功的說明,且對應的戰情型IsoBean的標頭的數據內容發生變化時,則IsoBean的內容發佈成功。
按照本節開頭的方式將IsoBean發佈給其他使用者,之後,可使用 http://localhost:8888/?isobean=IB_nb-pro-0001_process_dashboarddemo1&userkey={user_guid}&eventname={eventname} (opens new window) 來發送更新戰情型IsoBean的更新請求。示例中指定了9種類型的更新方式,說明如下。
eventname 參數取值 | 說明 |
---|---|
eventname=updateheader | 更新標頭的數據,如果此參數未進行指定,則使用此作為預設參數值進行更新 |
eventname=updatechart1 | 更新圖表1的數據 |
eventname=updatechart2 | 更新圖表2的數據 |
eventname=updatechart3 | 更新圖表3的數據 |
eventname=updatechart4 | 更新圖表4的數據 |
eventname=updatechart5 | 更新圖表5的數據 |
eventname=updatechart6 | 更新圖表6的數據 |
eventname=updatechart7 | 更新圖表7的數據 |
eventname=updatechart8 | 更新圖表8的數據 |