-
Notifications
You must be signed in to change notification settings - Fork 9
InfoPlusSDK
marstone edited this page Jun 3, 2020
·
23 revisions
- InfoPlus SDK分为服务端SDK和客户端JS-SDK,后面如无特殊说明,均指服务端SDK。
- 本文皆在介绍InfoPlus SDK的所需的Messenger API的接口标准
- 对于Workflow开发人员来说,您一般无须关注此细节,使用我们提供的SDK即可
- 请参考开源的 InfoPlus .NET SDK 和 Java SDK 和 NodeJS StarterKit
- Java的SDK的源代码通过maven发布,以jar包形式提供。
- 如果我们的SDK无法满足您使用的语言或技术,您可以继续阅读此文档自行实现
- Messenger APIs are Event-Driven
- Transport: WebService or REST
- Security: HTTP Digest(WS), HTTP Basic(REST), OAuth2(API)
- Message Dispatching
- Dispatch by Enterprise/Workflow (e.step.domain/e.step.workflowCode)
- Dispatch by EventType (event)
- Dispatch by Step/Action (e.step.stepCode/e.actionCode)
- Dispatch by CodeTable (e.suggestion)
- Dispatch by Field (e.field/e.fieldPath)
- Security
- Inbound: HTTP Digest (WS), HTTP Basic (REST)
- Inbound: Anti-Replay
- Outbound: OAuth2 for API invocation (Workflow code@domain/secret/scope)
- FormData-Entity Mapping
- FormData to Entity
- Entity to FormData
- Field Changing: Locate Changed Object from UI
- Field Changing: Send Changing Content to UI
- Dynamic parallel: Locate object for current branch
- Miscellaneous
- API Encapsulation
- Search by Pinyin
- Configuration
- EndPoint Publishing/Interception
public enum EventTypes {
INSTANCE_STARTING(0x01 << 0),
INSTANCE_STARTED(0x01 << 1),
INSTANCE_COMPLETING(0x01 << 2), // 暂未使用
INSTANCE_COMPLETED(0x01 << 3),
ACTION_DOING(0x01 << 4),
ACTION_DONE(0x01 << 5),
ACTION_SAVING(0x01 << 6),
ACTION_SAVED(0x01 << 7),
STEP_EXPIRING(0x01 << 8),
STEP_EXPIRED(0x01 << 9),
FIELD_CHANGING(0x01 << 10),
ECHO(0x01 << 11), // 用于Engine测试Messenger状态
STUB_12(0x01 << 12), // 保留
FIELD_SUGGESTING(0x01 << 13), // 外部代码表
STEP_RENDERING(0x01 << 14),
STEP_RENDERED(0x01 << 15), // 暂未使用
ACTION_CLICKING(0x01 << 16),
STEP_PRINTING(0x01 << 17),
INSTANCE_EXPIRING(0x01 << 18),
INSTANCE_EXPIRED(0x01 << 19),
INSTANCE_KILLING(0x01 << 20),
INSTANCE_KILLED(0x01 << 21),
INSTANCE_COMPENSATION(0x01 << 22); // 手工触发
}- 更多信息,请参见Messenger的相关章节
- 尚待完善
- Request: 参见 InfoPlusEvent类源代码
public class InfoPlusEvent
{
// *who*, sometimes can also be found in Step.AssignUser
public InfoPlusUser User { get; set; }
// *who* actually made this move. in other words, the *Entruster*
public InfoPlusUser ActualUser { get; set; }
// *when*, unix timestamp
public long When { get; set; }
// *what* data it is,
// especially, ON_FIELD_CHANGING will assign value here to indicate:
// which field changed, changed to what.
public IDictionary<string, object> FormData { get; set; }
// *where* the data located.
// public string Path { get; set; }
// Field Events
public string Field { get; set; }
public string FieldPath { get; set; }
// suggestion data, only valid for FIELD_CHANGING
public CodeSuggestion Suggestion { get; set; }
// *how* could the data be?
public IList<FormField> Fields { get; set; }
// which step/instance/definition/form/application
public FormStep Step { get; set; }
// which action & users are chosen
public string ActionCode { get; set; }
public string ActionName { get; set; }
public IList<FormStep> NextSteps { get; set; }
public FormStep EndStep { get; set; }
// result, only available for DONE/STARTED...
public ResponseEntity<object> Result { get; set; }
/// <summary>
/// Whether release/beta instance
/// </summary>
public bool Release { get; set; }
/// <summary>
/// AccessTokens for resources that: defined in workflow resources, granted by user, fetched by engine GUI
/// only available in Events that after user interact
/// </summary>
public IDictionary<string, string> Tokens { get; set; }
}- Response: 参见 InfoPlusResponse类源代码
public class InfoPlusResponse
{
/// <summary>
/// cancel the current doing if Cancel == True
/// </summary>
public bool Cancel { get; set; }
/// <summary>
/// when you cancel the event, give the user a prompt.
/// </summary>
public string Prompt { get; set; }
/// <summary>
/// for Expiration.
/// 0: do nothing
/// -1: kill
/// positive: seconds to extend.
/// </summary>
public long Then { get; set; }
/// <summary>
/// Then, after Expiration, submit an Action
/// </summary>
public long ThenAction { get; set; }
/// <summary>
/// Detail will contain exception infomation
/// </summary>
public string Detail { get; set; }
/// <summary>
/// Response form data, when:
/// WorkflowStarting as Initialization data
/// FieldChanging as auto fills.
/// </summary>
public IDictionary<string, object> FormData { get; set; }
/// <summary>
/// Codes. Maybe a list of CodeList, which used when:
/// 1.ON_FIELD_SUGGESTING return only one CodeList suggested,
/// 2.ON_STEP_RENDERING/ED, return CodeLists should be initialized.
/// 3.ON_FIELD_CHANGING, as above.
/// </summary>
public IList<CodeList> Codes { get; set; }
}<script src="http://example.com/infoplus/static/js/sdk/infoplus.sdk.js"></script>- 注意 http://example.com/infoplus 是流程平台的部署位置,请根据您的实际情况替换。
- 跨站通讯(开发IFrame控件)
- 长连接订阅