-
Notifications
You must be signed in to change notification settings - Fork 2
WFS-468 Vacation request sample #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Callback API Sample | ||
|
||
This is a sample of a Web Api server for working with the WorkflowServer Callback API. | ||
Callback API allows hosting your code of Actions, Conditions or Rules on third-party servers. | ||
Callback server should be connected in the admin panel on the Callback API page. | ||
More details on the [workflowserver.io](https://workflowserver.io/documentation/callback-api). | ||
|
||
## What's inside | ||
|
||
- **ApiController** – controller that implements all possible requests from Callback API of WFS 3.0.0. | ||
- **ActionProvider, ConditionProvider, IdentityProvider** – a sample of the implementation of API functions. | ||
- **VacationRequest** is a schema that implements this API. | ||
|
||
## How to start | ||
|
||
- Download, deploy and start WorkflowServer. More details on the [workflowserver.io](https://workflowserver.io/documentation/how-to-launch) | ||
- Deploy and start this Web Api Server. | ||
- Go to the WorkflowServer, in the sidebar go to "Api" -> "Callback API". Set up a connection properties to this API. | ||
More details on the [workflowserver.io](https://workflowserver.io/documentation/callback-api) | ||
- In the sidebar, go to "Workflow" -> "Scheme Management" -> "Create". | ||
Create a scheme, name it "VacationRequest" and upload the `Schemes/VacationRequest.xml` file from API project to the Scheme. | ||
- You can now test this sample with the WorkflowApi. | ||
Just create an instance, you can change the initial parameters if you like. Use the Workflow API to execute commands. | ||
Learn more about [workflowserver.io](https://workflowserver.io/documentation/workflow-api) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
<Process Name="VacationRequest" CanBeInlined="false" Tags="" LogEnabled="true"> | ||
<Designer X="-110" Y="-60" /> | ||
<Actors> | ||
<Actor Name="Manager" Rule="isUser" Value="@Manager" /> | ||
<Actor Name="Author" Rule="isUser" Value="@Author" /> | ||
<Actor Name="BigBoss" Rule="InRole" Value="Big Boss" /> | ||
<Actor Name="Accountant" Rule="InRole" Value="Accountant" /> | ||
</Actors> | ||
<Parameters> | ||
<Parameter Name="Comment" Type="String" Purpose="Temporary" /> | ||
<Parameter Name="Author" Type="String" Purpose="Persistence" InitialValue="John" /> | ||
<Parameter Name="Manager" Type="String" Purpose="Persistence" InitialValue="Margo" /> | ||
<Parameter Name="Sum" Type="Int32" Purpose="Persistence" InitialValue="100" /> | ||
</Parameters> | ||
<Commands> | ||
<Command Name="StartSigning"> | ||
<InputParameters> | ||
<ParameterRef Name="Comment" IsRequired="false" DefaultValue="" NameRef="Comment" /> | ||
</InputParameters> | ||
</Command> | ||
<Command Name="Approve"> | ||
<InputParameters> | ||
<ParameterRef Name="Comment" IsRequired="false" DefaultValue="" NameRef="Comment" /> | ||
</InputParameters> | ||
</Command> | ||
<Command Name="Reject"> | ||
<InputParameters> | ||
<ParameterRef Name="Comment" IsRequired="false" DefaultValue="" NameRef="Comment" /> | ||
</InputParameters> | ||
</Command> | ||
<Command Name="Paid"> | ||
<InputParameters> | ||
<ParameterRef Name="Comment" IsRequired="false" DefaultValue="" NameRef="Comment" /> | ||
</InputParameters> | ||
</Command> | ||
</Commands> | ||
<Timers> | ||
<Timer Name="SendToBigBoss" Type="Interval" Value="10minutes" NotOverrideIfExists="false" /> | ||
</Timers> | ||
<Activities> | ||
<Activity Name="VacationRequestCreated" State="VacationRequestCreated" IsInitial="true" IsFinal="false" IsForSetState="true" IsAutoSchemeUpdate="true"> | ||
<Implementation> | ||
<ActionRef Order="1" NameRef="JsonBackup"> | ||
<ActionParameter><![CDATA[StartBackup]]></ActionParameter> | ||
</ActionRef> | ||
</Implementation> | ||
<Designer X="20" Y="160" Hidden="false" /> | ||
</Activity> | ||
<Activity Name="ManagerSigning" State="ManagerSigning" IsInitial="false" IsFinal="false" IsForSetState="true" IsAutoSchemeUpdate="true"> | ||
<Designer X="360" Y="160" Hidden="false" /> | ||
</Activity> | ||
<Activity Name="BigBossSigning" State="BigBossSigning" IsInitial="false" IsFinal="false" IsForSetState="true" IsAutoSchemeUpdate="true"> | ||
<Designer X="640" Y="160" Hidden="false" /> | ||
</Activity> | ||
<Activity Name="AccountingReview" State="AccountingReview" IsInitial="false" IsFinal="false" IsForSetState="true" IsAutoSchemeUpdate="true"> | ||
<Designer X="630" Y="320" Hidden="false" /> | ||
</Activity> | ||
<Activity Name="RequestApproved" State="RequestApproved" IsInitial="false" IsFinal="true" IsForSetState="true" IsAutoSchemeUpdate="true"> | ||
<Implementation> | ||
<ActionRef Order="1" NameRef="JsonBackup"> | ||
<ActionParameter><![CDATA[FinalBackup]]></ActionParameter> | ||
</ActionRef> | ||
</Implementation> | ||
<Designer X="900" Y="320" Hidden="false" /> | ||
</Activity> | ||
</Activities> | ||
<Transitions> | ||
<Transition Name="ManagerSigning_Draft_1" To="VacationRequestCreated" From="ManagerSigning" Classifier="Reverse" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="Manager" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Reject" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer X="269" Y="205" Hidden="false" /> | ||
</Transition> | ||
<Transition Name="BigBossSigning_Activity_1_1" To="AccountingReview" From="BigBossSigning" Classifier="Direct" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="BigBoss" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Approve" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer Hidden="false" /> | ||
</Transition> | ||
<Transition Name="ManagerSigning_Approved_1" To="AccountingReview" From="ManagerSigning" Classifier="Direct" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="Manager" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Approve" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Otherwise" /> | ||
</Conditions> | ||
<Designer X="453" Y="271" Hidden="false" /> | ||
</Transition> | ||
<Transition Name="ManagerSigning_BigBossSigning_1" To="BigBossSigning" From="ManagerSigning" Classifier="Direct" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="Manager" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Approve" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Expression" ConditionInversion="false"> | ||
<Expression><![CDATA[@Sum > 100]]></Expression> | ||
</Condition> | ||
</Conditions> | ||
<Designer X="562" Y="177" Hidden="false" /> | ||
</Transition> | ||
<Transition Name="Draft_ManagerSigning_1" To="ManagerSigning" From="VacationRequestCreated" Classifier="Direct" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="Author" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="StartSigning" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer X="269" Y="170" Hidden="false" /> | ||
</Transition> | ||
<Transition Name="BigBossSigning_ManagerSigning_1" To="ManagerSigning" From="BigBossSigning" Classifier="Reverse" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="BigBoss" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Reject" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer X="563" Y="204" Hidden="false" /> | ||
</Transition> | ||
<Transition Name="ManagerSigning_BigBossSigning_2" To="BigBossSigning" From="ManagerSigning" Classifier="NotSpecified" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Triggers> | ||
<Trigger Type="Timer" NameRef="SendToBigBoss" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer X="557" Y="120" Hidden="false" /> | ||
</Transition> | ||
<Transition Name="Accountant_Activity_1_1" To="RequestApproved" From="AccountingReview" Classifier="Direct" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="Accountant" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Paid" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer Hidden="false" /> | ||
</Transition> | ||
<Transition Name="Accountant_ManagerSigning_1" To="ManagerSigning" From="AccountingReview" Classifier="Reverse" AllowConcatenationType="And" RestrictConcatenationType="And" ConditionsConcatenationType="And" DisableParentStateControl="false"> | ||
<Restrictions> | ||
<Restriction Type="Allow" NameRef="Accountant" /> | ||
</Restrictions> | ||
<Triggers> | ||
<Trigger Type="Command" NameRef="Reject" /> | ||
</Triggers> | ||
<Conditions> | ||
<Condition Type="Always" /> | ||
</Conditions> | ||
<Designer X="395" Y="343" Hidden="false" /> | ||
</Transition> | ||
</Transitions> | ||
<Localization> | ||
<Localize Type="State" IsDefault="True" Culture="en-US" ObjectName="ManagerSigning" Value="Manager signing" /> | ||
<Localize Type="State" IsDefault="True" Culture="en-US" ObjectName="BigBossSigning" Value="BigBoss signing" /> | ||
<Localize Type="Command" IsDefault="True" Culture="en-US" ObjectName="StartSigning" Value="Start signing" /> | ||
<Localize Type="State" IsDefault="True" Culture="en-US" ObjectName="AccountingReview" Value="Accounting review" /> | ||
<Localize Type="State" IsDefault="True" Culture="en-US" ObjectName="VacationRequestCreated" Value="Vacation request created" /> | ||
<Localize Type="State" IsDefault="True" Culture="en-US" ObjectName="RequestApproved" Value="Request approved" /> | ||
</Localization> | ||
</Process> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace WorkflowServer.CallbackApi.VacationRequest; | ||
|
||
public class User | ||
{ | ||
public User(string id, string name, params string[] roles) | ||
{ | ||
Id = id; | ||
Name = name; | ||
Roles = roles; | ||
} | ||
|
||
public string Id { get; } | ||
public string Name { get; } | ||
public string[] Roles { get; } | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.