ビュー管理webサービス
- Yellowfin Admin
- YUKA SAITO
ビューの更新
こちらの項目では、Yellowfinビューを更新するwebサービスを紹介します。これらは互いに連携することで機能し、次の順序で使用しなくてはいけません。
- EDITVIEW webサービスを使用して、指定したビューをドラフト(編集中)モードにします。
- 次に、ADDCOLUMNTOVIEW関数を使用してデータベースカラム(列)を追加することで、ビューを更新します。
- 変更内容を保存するために、PUBLISHVIEW webサービスを呼び出します。
こちらのwebサービスは、指定したビューを「ドラフト(編集中)」モードにすることで、他のwebサービスコールによる編集を可能にします。
リクエストパラメーター
以下の要素は、こちらのリクエストとともに渡されます。
リクエスト要素 | データ型 | 説明 |
LoginId | String | Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。 このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。 |
Password | String | 上記アカウントのパスワードです。 |
OrgId | Integer | Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。 |
OrgRef | String | オプション設定。ビューが所属するクライアント組織です。 |
Function | String | Webサービス関数です。こちらは、「EDITVIEW」に設定します。 |
ViewId | Integer | 編集するビューの内部IDです。 |
リクエストの例
以下は、こちらのリクエストのSOAP JAXの例です。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteAdministrationCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <function>EDITVIEW</function> <viewId>60543</viewId> </arg0> </web:remoteAdministrationCall> </soapenv:Body> </soapenv:Envelope>
応答パラメーター
返される応答には、これらのパラメーターが含まれます。
応答要素 | データ型 | 説明 |
StatusCode | String | Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。
|
応答の例
サービスは、今回のSOAPの例に基づき、以下の応答を返します。
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/"> <return> <errorCode>0</errorCode> <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages> <messages>Web Service Request Complete</messages> <sessionId>d256811ce7cdfc856baae8dd00737e88</sessionId> <statusCode>SUCCESS</statusCode> </return> </ns2:remoteAdministrationCallResponse> </S:Body> </S:Envelope>
こちらのwebサービスコールは、AdministrationViewFieldオブジェクトに提供された命名規則とカテゴリーを使用して、指定したビューに新規データベースカラム(列)を追加します。
リクエストパラメーター
以下の要素は、こちらのリクエストとともに渡されます。
リクエスト要素 | データ型 | 説明 |
LoginId | String | Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。 このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。 |
Password | String | 上記アカウントのパスワードです。 |
OrgId | Integer | Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。 |
OrgRef | String | オプション設定。ビューが所属するクライアント組織です。 |
Function | String | Webサービス関数です。こちらは、「ADDCOLUMNTOVIEW」に設定します。 |
ViewId | Integer | 編集するビューの内部IDです。 |
Parameters | String[] | 追加されるデータベーステーブルとカラム(列)名を含む文字列の配列です。例えば、「person」テーブル内の「first_name」カラム(列)の場合は、{“person”,”first_name”}となります。 |
Field | AdministrationViewField | 新規カラム(列)の定義を含むオブジェクトです。詳細は、以下の表を参照してください。 |
以下は、AdministrationViewFieldオブジェクトに要求されるパラメーターです。
オブジェクト要素 | データ型 | 説明 |
ShortDescription | String | ビュービルダーでの表示名として追加されるカラム(列)の名前です。 |
LongDescription | String | 追加されるカラム(列)の説明です。 |
FieldCategory | String | 新規作成したフィールドを配下に配置するカテゴリーです。例:「DIMENSION」、または「METRIC」 |
リクエストの例
以下は、こちらのリクエストのSOAP JAXの例です。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteAdministrationCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <function>ADDCOLUMNTOVIEW</function> <viewId>60543</viewId> <parameters>person</parameters> <parameters>first_name</parameters> <field> <shortDescription>Person Name</shortDescription> <longDescription>This is the name this person wants to be called</longDescription> <fieldCategory>People</fieldCategory> </field> </arg0> </web:remoteAdministrationCall> </soapenv:Body> </soapenv:Envelope>
応答パラメーター
返される応答には、これらのパラメーターが含まれます。
応答要素 | データ型 | 説明 |
StatusCode | String | Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。
|
応答の例
サービスは、今回のSOAPの例に基づき、以下の応答を返します。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteAdministrationCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <function>ADDCOLUMNTOVIEW</function> <viewId>100937</viewId> <parameters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"> <xsd:string>CAMP</xsd:string> <xsd:string>CAMPID</xsd:string> </parameters> <field> <shortDescription>CAMPID</shortDescription> <longDescription>Camp identification number.</longDescription> <fieldCategory>ID Folder</fieldCategory> </field> </arg0> </web:remoteAdministrationCall> </soapenv:Body> </soapenv:Envelope>
こちらのwebサービスは、レポートで使用するためにビューを保存し、公開します。この関数がEDITVIEWの後に呼び出されない場合は、webサービスセッションがタイムアウトするまで、ビューは編集不可能になります。
リクエストパラメーター
以下の要素は、こちらのリクエストとともに渡されます。
リクエスト要素 | データ型 | 説明 |
LoginId | String | Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。 このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。 |
Password | String | 上記アカウントのパスワードです。 |
OrgId | Integer | Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。 |
OrgRef | String | オプション設定。ビューが所属するクライアント組織です。 |
Function | String | Webサービス関数です。こちらは、「PUBLISHVIEW」に設定します。 |
ViewId | Integer | 編集するビューの内部IDです。 |
リクエストの例
以下は、こちらのリクエストのSOAP JAXの例です。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteAdministrationCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <function>PUBLISHVIEW</function> <viewId>60543</viewId> </arg0> </web:remoteAdministrationCall> </soapenv:Body> </soapenv:Envelope>
応答パラメーター
返される応答には、これらのパラメーターが含まれます。
応答要素 | データ型 | 説明 |
StatusCode | String | Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。
|
応答の例
サービスは、今回のSOAPの例に基づき、以下の応答を返します。
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/"> <return> <errorCode>0</errorCode> <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages> <messages>Web Service Request Complete</messages> <sessionId>50b03dd1649bbb123605aa801829095b</sessionId> <statusCode>SUCCESS</statusCode> </return> </ns2:remoteAdministrationCallResponse> </S:Body> </S:Envelope>
こちらのwebサービスは、ビューに新しいフォルダーを追加します。
リクエストパラメーター
以下の要素は、こちらのリクエストとともに渡されます。
リクエスト要素 | データ型 | 説明 |
LoginId | String | Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。 このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。 |
Password | String | 上記アカウントのパスワードです。 |
OrgId | Integer | Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。 |
Function | String | Webサービス関数です。こちらは、「ADDFOLDERTOVIEW」に設定します。 |
ViewId | Integer | 編集するビューの内部IDです。 |
Parameters | String [] | 追加されるデータベーステーブルとカラム(列)名を含む文字列の配列です。例えば、「person」テーブル内の「first_name」カラム(列)の場合は、{“person”,”first_name”}となります。 |
リクエストの例
以下は、こちらのリクエストのSOAP JAXの例です。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/"> <soapenv:Header/> <soapenv:Body> <web:remoteAdministrationCall> <arg0> <loginId>admin@yellowfin.com.au</loginId> <password>test</password> <orgId>1</orgId> <function>ADDFOLDERTOVIEW</function> <viewId>127187</viewId> <parameters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"> <xsd:string>Hey New Folder</xsd:string> </parameters> </arg0> </web:remoteAdministrationCall> </soapenv:Body> </soapenv:Envelope>
応答パラメーター
返される応答には、これらのパラメーターが含まれます。
応答要素 | データ型 | 説明 |
StatusCode | String | Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。
|
応答の例
サービスは、今回のSOAPの例に基づき、以下の応答を返します。
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:remoteAdministrationCallResponse xmlns:ns2="http://webservices.web.mi.hof.com/"> <return> <errorCode>0</errorCode> <messages>Successfully Authenticated User: admin@yellowfin.com.au</messages> <messages>Web Service Request Complete</messages> <sessionId>50b03dd1649bbb123605aa801829095b</sessionId> <statusCode>SUCCESS</statusCode> </return> </ns2:remoteAdministrationCallResponse> </S:Body> </S:Envelope>
こちらは、これらのwebサービスを一緒に使用する方法を示したJavaScriptの例です。
ビューwebサービスの完成例
以下は、EDITVIEW、ADDCOLUMNTOVIEW、PUBLISHVIEW webサービスの完成例です。(一緒に使用するためには、すべてを単一ファイルに含めます。)こちらを使用するには、以下の手順に従います。
- コードをコピーして、「ws_editview.jsp」として保存します。
- root(Yellowfin/appserver/webapps/ROOT)フォルダーにファイルを配置します。
- 環境に応じて、ホスト、ポート番号、管理ユーザー、追加するユーザーの詳細を調整します。
- インターネットブラウザから、「http://<host>:<port>/ws_editview.jsp」を実行します。
<%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ page import="java.text.*" %> <%@ page import="java.util.*" %> <%@ page import="com.hof.mi.web.service.*" %> <%@ page import="com.hof.mi.web.service.schedule.*" %> <%@ page import="com.hof.data.*" %> <%@ page import="com.hof.util.*" %> <%@ page import="com.hof.web.form.*" %> <html> <body> <% String userId = "admin@yellowfin.com.au"; String password = "test"; String cliOrgRef = null; %> <% String baseuri = request.getRequestURI(); int index = baseuri.lastIndexOf('/'); if (index >= 0) baseuri = baseuri.substring(0, index); String self = request.getServletPath(); self = self.substring(self.lastIndexOf('/') + 1); self = baseuri + "/" + self; %> <form action="<%=self%>" method="post"> <input type="hidden" name="cmd" value="editView" /> <h3>Edit View</h3> <input type="text" name="editViewId" /> <input type="submit" /> </form> <% AdministrationServiceResponse rs = null; AdministrationServiceRequest rsr = new AdministrationServiceRequest(); AdministrationServiceService ts = new AdministrationServiceServiceLocator("localhost", 8080, "/services/AdministrationService", false); AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService(); String cmd = request.getParameter("cmd"); String viewID = ""; /* * Place the view into DRAFT mode to enable web service editing */ if ("editView".equals(cmd)) { viewID = request.getParameter("editViewId"); rsr.setLoginId(userId); rsr.setPassword(password); rsr.setOrgId(new Integer(1)); //Client organization the specified view can be found in rsr.setOrgRef(cliOrgRef); rsr.setFunction("EDITVIEW"); if (viewID!=""){ //ViewId of the primary view entry rsr.setViewId(new Integer(viewID)); } rs = rssbs.remoteAdministrationCall(rsr); if ("SUCCESS".equals(rs.getStatusCode())) { out.write("Success"); } else { out.write("Failure"); } } %> <br><br> <form action="<%=self%>" method="post"> <input type="hidden" name="cmd" value="addView" /> <h3>Add Column to View</h3> ViewID: <input type="text" name="addViewId" /><br><br> Database Table Name: <input type="text" name="addTableName" /> Column Name: <input type="text" name="addColName" /><br><br> Field Name: <input type="text" name="addFieldName" /><br> Field Description: <input type="text" name="addFieldDesc" /><br> Field Category: <input type="text" name="addFieldCat" /><br> <input type="submit" /> </form> <% cmd = request.getParameter("cmd"); viewID = ""; String dbTbl=""; String dbCol=""; String fieldName=""; String fieldDesc=""; String fieldCat=""; if ("addView".equals(cmd)) { viewID = request.getParameter("addViewId"); dbTbl = request.getParameter("addTableName"); dbCol = request.getParameter("addColName"); fieldName = new String(request.getParameter("addFieldName").getBytes("iso-8859-1"),"UTF-8"); fieldDesc = new String(request.getParameter("addFieldDesc").getBytes("iso-8859-1"),"UTF-8"); fieldCat = new String(request.getParameter("addFieldCat").getBytes("iso-8859-1"), "UTF-8"); rsr = new AdministrationServiceRequest(); /* * Web service function to add a database column into a currently existing view. */ rsr.setLoginId(userId); rsr.setPassword(password); rsr.setOrgId(new Integer(1)); rsr.setOrgRef(cliOrgRef); rsr.setFunction("ADDCOLUMNTOVIEW"); if (viewID!=""){ rsr.setViewId(new Integer(viewID)); } AdministrationViewField field = new AdministrationViewField(); field.setShortDescription(fieldName); field.setLongDescription(fieldDesc); field.setFieldCategory(fieldCat); rsr.setField(field); rsr.setParameters(new String[]{dbTbl, dbCol}); rs = rssbs.remoteAdministrationCall(rsr); if ("SUCCESS".equals(rs.getStatusCode())) { out.write("Success"); } else { out.write("Failure"); } } %> <br><br> <form action="<%=self%>" method="post"> <input type="hidden" name="cmd" value="publishView" /> <h3>Publish View</h3> <input type="text" name="publishViewId" /> <input type="submit" /> </form> <% cmd = request.getParameter("cmd"); viewID = ""; /* *After all changes have been made, publish the view. */ if ("publishView".equals(cmd)) { viewID = request.getParameter("publishViewId"); rsr = new AdministrationServiceRequest(); rsr.setLoginId(userId); rsr.setPassword(password); rsr.setOrgId(new Integer(1)); rsr.setOrgRef(cliOrgRef); rsr.setFunction("PUBLISHVIEW"); if (viewID!=""){ rsr.setViewId(new Integer(viewID)); } rs = rssbs.remoteAdministrationCall(rsr); if ("SUCCESS".equals(rs.getStatusCode())) { out.write("Success"); } else { out.write("Failure"); } } %>
その他
こちらのwebサービスは、Yellowfin内のビューを削除するために使用します。ID、またはUUIDを提供することで、ビューを指定することができます。
リクエストパラメーター
以下の要素は、こちらのリクエストとともに渡されます。
リクエスト要素 | データ型 | 説明 |
LoginId | String | Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。 このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。 |
Password | String | 上記アカウントのパスワードです。 |
OrgId | Integer | Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。 |
Function | String | Webサービス関数です。こちらは、「DELETEVIEW」に設定します。 |
Parameters | String[] | 削除するビューのID、またはUUIDです。 |
応答パラメーター
返される応答には、これらのパラメーターが含まれます。
応答要素 | データ型 | 説明 |
StatusCode | String | Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。
|
手順
Javaの例を使用して、こちらの呼び出しを実行するための詳細な手順は、以下を参照してください。
管理ユーザーとしてのログインと、実行するwebサービスの呼び出しの指定を含む、こちらの関数の基礎的なリクエストから開始します。
AdministrationServiceRequest rsr = new AdministrationServiceRequest(); rsr.setLoginId("admin@yellowfin.com.au"); rsr.setPassword("test"); rsr.setOrgId(new Integer(1)); rsr.setFunction("DELETEVIEW");
ID、またはUUIDを提供することで、削除するビューを指定します。
rsr.setParameters(new String[] { "70103" });
リクエストを構成したら、呼び出しを実行します。
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
管理webサービスを初期化します。実行方法の詳細は、こちらを参照してください。
返される応答には、StatusCodeが含まれます。(より詳細な情報は、上記応答パラメーターの表を参照してください)
完成例
以下は、こちらのwebサービスの呼び出しの完成例です。こちらを使用するには、以下の手順に従います。
- コードをコピーして、「ws_deleteview.jsp」として保存します。
- root(Yellowfin/appserver/webapps/ROOT)フォルダーにファイルを配置します。
- 環境に応じて、ホスト、ポート番号、管理ユーザーの詳細を調整します。
- インターネットブラウザから、「http://<host>:<port>/ws_deleteview.jsp」を実行します。
<% /* ws_deleteview.jsp */ %> <%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ page import="com.hof.util.*, java.util.*, java.text.*" %> <%@ page import="com.hof.web.form.*" %> <%@ page import="com.hof.mi.web.service.*" %> AdministrationServiceResponse rs = null; AdministrationServiceRequest rsr = new AdministrationServiceRequest(); AdministrationServiceService ts = new AdministrationServiceServiceLocator("localhost", 8080, "/services/AdministrationService", false); AdministrationServiceSoapBindingStub rssbs = (AdministrationServiceSoapBindingStub) ts.getAdministrationService(); rsr.setLoginId("admin@yellowfin.com.au"); rsr.setPassword("test"); rsr.setOrgId(new Integer(1)); rsr.setFunction("DELETEVIEW"); //Specify the view to be deleted by providing its ID or UUID rsr.setParameters(new String[] { "70103" }); rs = rssbs.remoteAdministrationCall(rsr); if ("SUCCESS".equals(rs.getStatusCode())) { out.write("Success </br>"); } else { out.write(rs.getStatusCode()); out.write(rs.toString()); }