こちらのwebサービスは、単一のスケジュールを保存します。AdministrationScheduleオブジェクトを使用して、保存するスケジュールの詳細を渡します。応答は、新しい詳細とともにこちらのオブジェクトを返します。これは、新規スケジュールの作成は行いませんが、既存のスケジュールの詳細を更新する点に注意してください。
リクエストパラメーター以下の要素は、こちらのリクエストとともに渡されます。 リクエスト要素 | データ型 | 説明 | LoginId | String | Yellowfin Webサービスの管理者ユーザーIDです。これは、ログインIDの方法に応じて、ユーザーID、または電子メールアドレスになります。 このYellowfinアカウントは、「Yellowfin Webサービス使用権」が有効化されたロールを持ち、デフォルト(プライマリー)組織に所属していなくてはいけません。 | Password | String | 上記アカウントのパスワードです。 | OrgId | Integer | Yellowfin内のデフォルト(プライマリー)組織IDです。常に、「1」に設定します。 | Function | String | Webサービス関数です。こちらは、「SAVESCHEDULE」に設定します。 | Schedules | AdministrationSchedule | 保存するスケジュールの詳細を含むオブジェクトです。以下の表を参照してください。 |
以下のパラメーターは、こちらの関数のAdministrationScheduleオブジェクトに含める必要があります。 AdministrationSchedule要素 | データ型 | 説明 | ScheduleUUID | String | 追加するスケジュールのUUIDです。 | Frequency | ScheduleFrequency | こちらのスケジュールの編集可能な頻度オプションを定義するScheduleFrequencyオブジェクトです。以下の表を参照してください。 |
頻度オブジェクトでは、各ScheduleFrequencyタイプに応じて、必要な値は異なりますが、すべて頻度タイプが以下のフィールドを含みます。 パラメーター | データ型 | 説明 | FrequencyTypeCode | String | 頻度情報の解釈方法を説明します。 | FrequencyCode | String | 頻度タイプコードに応じて、異なる意味合いを持ちます。 | FrequencyUnit | Integer | 頻度タイプコードに応じて、異なる意味合いを持ちます。 | LocalRunTime | Integer | このスケジュールを指定された日に実行する午前0時からの秒数です。 | LocalTimezoneCode | String | 実行するスケジュールのJavaタイムゾーンオフセットコードです。 |
応答パラメーター返される応答には、これらのパラメーターが含まれます。 応答要素 | データ型 | 説明 | StatusCode | String | Webサービス呼び出しのステータスです。値の選択肢は、以下の通りです。 | Schedules | AdministrationSchedule | こちらのオブジェクトは、スケジュールの更新詳細を含みます。 |
手順Javaの例を使用して、こちらの呼び出しを実行するための詳細な手順は、以下を参照してください。 管理ユーザーとしてのログインと、実行するwebサービスの呼び出しの指定を含む、こちらの関数の基礎的なリクエストから開始します。
AdministrationServiceRequest rsr = new AdministrationServiceRequest();
rsr.setLoginId(this.username);
rsr.setPassword(this.password);
// This is the primary organisation
rsr.setOrgId(new Integer(1));
rsr.setFunction("SAVESCHEDULE"); |
スケジュールを更新する場合、通常はまずスケジュールを読み込んでから更新をしますが、書き込み可能なアイテムは、FrequencyとisActiveパラメーターのみのため、スケジュールのUUIDが既に明確な場合は、最初に読み込みをしなくても構いません。
// This is the AdministrationSchedule which should be saved
AdministrationSchedule s = new AdministrationSchedule();
s.setScheduleUUID("SOME_KNOWN_EXISTING_UUID");
s.setActive(true);
// define the frequency information
ScheduleFrequency f = new MinutesFrequency();
f.setMinutes(5);
s.setFrequency(f);
// set the schedule in the request
rsr.setSchedule(s); |
リクエストを構成したら、呼び出しを実行します。
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr); |
管理webサービスを初期化します。実行方法の詳細は、こちらを参照してください。
|
完成例以下は、こちらのwebサービスの呼び出しの完成例です。こちらを使用するには、以下の手順に従います。 - コードをコピーして、「ws_saveschedule.jsp」として保存します。
- root(Yellowfin/appserver/webapps/ROOT)フォルダーにファイルを配置します。
- 環境に応じて、ホスト、ポート番号、管理ユーザーの詳細を調整します。
- インターネットブラウザから、「http://<host>:<port>/ws_ saveschedule.jsp」を実行します。
<%
/*
* SAVESCHEDULE Example. ws_saveschedule.jsp.
* A more complete example can be found in ws_admin_schedule_management.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.web.form.*" %>
<%
AdministrationServiceService s_adm = new AdministrationServiceServiceLocator("localhost",8080, "/services/AdministrationService", false); // adjust host and port number
AdministrationServiceSoapBindingStub adminService = (AdministrationServiceSoapBindingStub) s_adm.getAdministrationService();
AdministrationServiceRequest rsr = new AdministrationServiceRequest();
rsr.setLoginId("admin@yellowfin.com.au"); // provide your Yellowfin web services admin account
rsr.setPassword("test"); // change to the password of the above account
rsr.setOrgId(1);
// normally you would load a schedule first and do some sort of modification
rsr.setFunction("LOADSCHEDULE");
// existing Schedule UUID to load. Adjust this value
String[] parameters = {
"SOME_UUID"
};
rsr.setParameters(parameters);
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
AdministrationSchedule editingSchedule = null;
if ("SUCCESS".equals(rs.getStatusCode()) ) {
editingSchedule = rs.getSchedule();
} else {
out.write("LOADSCHEDULE Failure");
out.write(" Code: " + rs.getErrorCode() );
return;
}
editingSchedule.setScheduleActive(true);
WeeklyFrequency newFreq = new WeeklyFrequency();
newFreq.setDayOfWeek(ScheduleFrequency.MONDAY);
newFreq.setLocalRunTime(3 * 60 * 60); // 9am
newFreq.setLocalTimezoneCode("AUSTRALIA/SYDNEY");
editingSchedule.setFrequency(newFreq);
rsr.setSchedule(editingSchedule);
rsr.setParameters(null);
rsr.setFunction("SAVESCHEDULE");
rs = adminService.remoteAdministrationCall(rsr);
if ("SUCCESS".equals(rs.getStatusCode()) ) {
AdministrationSchedule updatedSchedule = rs.getSchedule();
out.write("Loaded schedule: " + updatedSchedule.getScheduleUUID() + "<br>");
out.write("Schedule Type: " + updatedSchedule.getScheduleTypeCode() + "<br>");
out.write("Description: " + updatedSchedule.getScheduleDescription() + "<br>");
out.write("Is Active: " + updatedSchedule.isScheduleActive() + "<br>");
out.write("Last Run Status: " + updatedSchedule.getLastRunStatus() + "<br>");
out.write("Last Run Error: " + updatedSchedule.getLastRunError() + "<br>");
out.write("Last Run Date: " + updatedSchedule.getLastRunDateTimeGMT() + "<br>");
out.write("Next Run Date: " + updatedSchedule.getNextRunDateTimeGMT() + "<br>");
// Some schedule types have extra information that you can access, see reference for details
if (updatedSchedule instanceof ReportRefreshSchedule) {
ReportRefreshSchedule rrs = (ReportRefreshSchedule)updatedSchedule;
out.write("Report To Refresh: " + rrs.getReportId() + "<br>");
}
// these values all have different meanings depending on FrequencyType, see reference for details
out.write("Frequency Type: " + updatedSchedule.getFrequency().getFrequencyTypeCode() + "<br>");
out.write("Frequency Code: " + updatedSchedule.getFrequency().getFrequencyCode() + "<br>");
out.write("Frequency Unit: " + updatedSchedule.getFrequency().getFrequencyUnit() + "<br>");
out.write("Frequency Local Time: " + updatedSchedule.getFrequency().getLocalRunTime() + "<br>");
out.write("Frequency Local Timezone: " + updatedSchedule.getFrequency().getLocalTimezoneCode() + "<br>");
} else {
out.write("Failure");
out.write(" Code: " + rs.getErrorCode() );
}
%> |
|