@burgan-tech/morph-touch-runtime 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/burgan-tech-morph-touch-runtime-0.0.2.tgz +0 -0
- package/package.json +21 -0
- package/touch/Extensions/.gitkeep +0 -0
- package/touch/Functions/.gitkeep +0 -0
- package/touch/Functions/check-livekit-room-access.1.0.0.json +28 -0
- package/touch/Functions/check-livekit-room-access.http +44 -0
- package/touch/Functions/get-absence-entry.1.0.0.json +28 -0
- package/touch/Functions/get-advisor-stats.1.0.0.json +27 -0
- package/touch/Functions/get-available-slots.1.0.0.json +30 -0
- package/touch/Functions/get-available-slots.http +29 -0
- package/touch/Functions/get-chat-rooms.1.0.0.json +28 -0
- package/touch/Functions/get-chat-rooms.http +62 -0
- package/touch/Functions/get-customer-info.1.0.0.json +27 -0
- package/touch/Functions/get-matrix-sync.1.0.0.json +28 -0
- package/touch/Functions/get-rezervations.1.0.0.json +26 -0
- package/touch/Functions/get-rezervations.http +59 -0
- package/touch/Functions/get-room-messages.1.0.0.json +29 -0
- package/touch/Functions/get-room-messages.http +45 -0
- package/touch/Functions/rezervation-transfer.http +118 -0
- package/touch/Functions/send-room-message.1.0.0.json +29 -0
- package/touch/Functions/src/CheckLivekitRoomAccessMapping.csx +238 -0
- package/touch/Functions/src/GetAbsenceEntryMapping.csx +225 -0
- package/touch/Functions/src/GetAdvisorStatsMapping.csx +190 -0
- package/touch/Functions/src/GetAvailableSlotsMapping.csx +468 -0
- package/touch/Functions/src/GetChatRoomsMapping.csx +202 -0
- package/touch/Functions/src/GetCustomerInfoMapping.csx +140 -0
- package/touch/Functions/src/GetMatrixSyncMapping.csx +197 -0
- package/touch/Functions/src/GetRezervationsMapping.csx +162 -0
- package/touch/Functions/src/GetRoomMessagesMapping.csx +165 -0
- package/touch/Functions/src/SendCancelNotificationMapping.csx +63 -0
- package/touch/Functions/src/SendRoomMessageMapping.csx +131 -0
- package/touch/Schemas/.gitkeep +0 -0
- package/touch/Schemas/absence-entry.1.0.0.json +232 -0
- package/touch/Schemas/advisor-chat-rooms.1.0.0.json +62 -0
- package/touch/Schemas/chat-room.1.0.0.json +110 -0
- package/touch/Schemas/notification-sender.1.0.0.json +159 -0
- package/touch/Schemas/portfolio-manager.1.0.0.json +63 -0
- package/touch/Schemas/rezervation.1.0.0.json +102 -0
- package/touch/Tasks/.gitkeep +0 -0
- package/touch/Tasks/cancel-absence-entry-for-rezervation.1.0.0.json +21 -0
- package/touch/Tasks/check-already-completed-chat-room.1.0.0.json +24 -0
- package/touch/Tasks/check-duplicate-portfolio-manager.1.0.0.json +23 -0
- package/touch/Tasks/check-duplicate-rezervation.1.0.0.json +23 -0
- package/touch/Tasks/check-existing-permanent-chat-room.1.0.0.json +21 -0
- package/touch/Tasks/check-randevu-time.1.0.0.json +17 -0
- package/touch/Tasks/create-permanent-chat-room.1.0.0.json +28 -0
- package/touch/Tasks/determine-transfer-type.1.0.0.json +16 -0
- package/touch/Tasks/enrich-rezervations-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/execute-permanent-chatroom-update.1.0.0.json +21 -0
- package/touch/Tasks/execute-rez-chatroom-transfer.1.0.0.json +21 -0
- package/touch/Tasks/execute-rezervation-transfer.1.0.0.json +19 -0
- package/touch/Tasks/fetch-absence-entries-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-advisors-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-permanent-chatrooms-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-rez-chatrooms-for-transfer.1.0.0.json +23 -0
- package/touch/Tasks/fetch-rezervations-for-transfer.1.0.0.json +22 -0
- package/touch/Tasks/get-absence-entry-task.1.0.0.json +23 -0
- package/touch/Tasks/get-available-slots-http.1.0.0.json +27 -0
- package/touch/Tasks/get-available-slots.1.0.0.json +24 -0
- package/touch/Tasks/get-chat-room-data-for-rezervation.1.0.0.json +23 -0
- package/touch/Tasks/get-chat-token.1.0.0.json +27 -0
- package/touch/Tasks/get-matrix-room-messages.1.0.0.json +25 -0
- package/touch/Tasks/get-matrix-sync.1.0.0.json +25 -0
- package/touch/Tasks/get-rezervation-data-task.1.0.0.json +22 -0
- package/touch/Tasks/get-rezervation-state-task.1.0.0.json +22 -0
- package/touch/Tasks/get-rezervations-task.1.0.0.json +21 -0
- package/touch/Tasks/get-user-info-for-rezervation.1.0.0.json +24 -0
- package/touch/Tasks/get-video-call-url.1.0.0.json +17 -0
- package/touch/Tasks/invite-user-to-rezervation-room.1.0.0.json +27 -0
- package/touch/Tasks/join-chat-room-for-rezervation.1.0.0.json +28 -0
- package/touch/Tasks/join-matrix-room.1.0.0.json +27 -0
- package/touch/Tasks/join-user-to-room.1.0.0.json +27 -0
- package/touch/Tasks/merge-invited-user.1.0.0.json +17 -0
- package/touch/Tasks/merge-rezervation-update.1.0.0.json +16 -0
- package/touch/Tasks/merge-target-advisor-for-transfer.1.0.0.json +17 -0
- package/touch/Tasks/merge-update-body-for-randevu-update.1.0.0.json +16 -0
- package/touch/Tasks/merge-video-call-urls.1.0.0.json +17 -0
- package/touch/Tasks/query-chat-room-instances.1.0.0.json +23 -0
- package/touch/Tasks/remove-member-from-room.1.0.0.json +28 -0
- package/touch/Tasks/send-matrix-room-message.1.0.0.json +26 -0
- package/touch/Tasks/send-push-notification.1.0.0.json +26 -0
- package/touch/Tasks/send-sms-notification.1.0.0.json +26 -0
- package/touch/Tasks/set-chat-room-status-active.1.0.0.json +16 -0
- package/touch/Tasks/set-chat-room-status-deactive.1.0.0.json +16 -0
- package/touch/Tasks/set-previous-advisor.1.0.0.json +16 -0
- package/touch/Tasks/set-user-from-headers-for-rezervation.1.0.0.json +17 -0
- package/touch/Tasks/start-absence-entry-for-rezervation.1.0.0.json +21 -0
- package/touch/Tasks/start-chat-room-for-rezervation.1.0.0.json +20 -0
- package/touch/Tasks/start-notification-sender.1.0.0.json +20 -0
- package/touch/Tasks/start-permanent-chat-room.1.0.0.json +21 -0
- package/touch/Tasks/start-transfer-from-absence-entry.1.0.0.json +19 -0
- package/touch/Tasks/start-video-call.1.0.0.json +22 -0
- package/touch/Tasks/trigger-chat-room-deactivate.1.0.0.json +21 -0
- package/touch/Tasks/trigger-chat-room-transfer.1.0.0.json +21 -0
- package/touch/Tasks/trigger-chat-room-update.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-add-invited-participant.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-apply-update.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-to-in-meet.1.0.0.json +20 -0
- package/touch/Tasks/trigger-rezervation-video-call-update.1.0.0.json +21 -0
- package/touch/Tasks/validate-date-for-rezervation.1.0.0.json +18 -0
- package/touch/Tasks/validate-slot-for-rezervation.1.0.0.json +24 -0
- package/touch/Tasks/validate-transfer-availability.1.0.0.json +23 -0
- package/touch/Views/.gitkeep +0 -0
- package/touch/Workflows/.gitkeep +0 -0
- package/touch/Workflows/absence-entry.http +458 -0
- package/touch/Workflows/absence-entry.json +179 -0
- package/touch/Workflows/add-participant-to-rezervation.http +47 -0
- package/touch/Workflows/add-participant-to-rezervation.json +340 -0
- package/touch/Workflows/chat-room.http +207 -0
- package/touch/Workflows/chat-room.json +452 -0
- package/touch/Workflows/investment-advisor.json +367 -0
- package/touch/Workflows/notification-sender.http +299 -0
- package/touch/Workflows/notification-sender.json +262 -0
- package/touch/Workflows/portfolio-manager.json +367 -0
- package/touch/Workflows/randevu-update.http +87 -0
- package/touch/Workflows/rezervation-start.json +467 -0
- package/touch/Workflows/rezervation-transfer.json +512 -0
- package/touch/Workflows/rezervation-update.http +87 -0
- package/touch/Workflows/rezervation-update.json +485 -0
- package/touch/Workflows/rezervation.http +214 -0
- package/touch/Workflows/rezervation.json +726 -0
- package/touch/Workflows/src/AllChatRoomsSuccessRule.csx +65 -0
- package/touch/Workflows/src/AlwaysTrueRule.csx +13 -0
- package/touch/Workflows/src/AnyChatRoomFailedRule.csx +64 -0
- package/touch/Workflows/src/AutoProcessRule.csx +38 -0
- package/touch/Workflows/src/BuildRezChatRoomPlanMapping.csx +160 -0
- package/touch/Workflows/src/CanStartRezervationTimerMapping.csx +48 -0
- package/touch/Workflows/src/CanStartTransferMapping.csx +14 -0
- package/touch/Workflows/src/CancelAbsenceEntryForRezervationMapping.csx +48 -0
- package/touch/Workflows/src/CancelAbsenceForRandevuUpdateMapping.csx +62 -0
- package/touch/Workflows/src/ChatRoomCreatedFailedRule.csx +54 -0
- package/touch/Workflows/src/ChatRoomCreatedSuccessRule.csx +54 -0
- package/touch/Workflows/src/ChatRoomRemoveMapping.csx +104 -0
- package/touch/Workflows/src/ChatRoomTransferInviteMapping.csx +109 -0
- package/touch/Workflows/src/ChatRoomTransferRemoveMapping.csx +71 -0
- package/touch/Workflows/src/ChatRoomUpdateMapping.csx +107 -0
- package/touch/Workflows/src/CheckAlreadyCompletedChatRoomMapping.csx +100 -0
- package/touch/Workflows/src/CheckDuplicatePortfolioManagerMapping.csx +119 -0
- package/touch/Workflows/src/CheckDuplicateRezervationMapping.csx +150 -0
- package/touch/Workflows/src/CheckExistingPermanentChatRoomMapping.csx +169 -0
- package/touch/Workflows/src/CheckRandevuTimeMapping.csx +67 -0
- package/touch/Workflows/src/CheckRezervationStateActiveOrInMeetRule.csx +14 -0
- package/touch/Workflows/src/CreateAbsenceEntryForRezervationMapping.csx +111 -0
- package/touch/Workflows/src/CreateAbsenceForRandevuUpdateMapping.csx +108 -0
- package/touch/Workflows/src/CreateChatRoomForRezervationMapping.csx +122 -0
- package/touch/Workflows/src/CreatePermanentChatRoomMapping.csx +140 -0
- package/touch/Workflows/src/CustomerControlToEndRule.csx +14 -0
- package/touch/Workflows/src/DetermineTransferTypeMapping.csx +92 -0
- package/touch/Workflows/src/EnrichRezervationsForTransferMapping.csx +495 -0
- package/touch/Workflows/src/ExecutePermanentChatRoomUpdateMapping.csx +124 -0
- package/touch/Workflows/src/ExecuteRezChatRoomTransferMapping.csx +95 -0
- package/touch/Workflows/src/ExecuteTransferMapping.csx +152 -0
- package/touch/Workflows/src/FetchAbsenceEntriesForTransferMapping.csx +116 -0
- package/touch/Workflows/src/FetchAdvisorsForTransferMapping.csx +145 -0
- package/touch/Workflows/src/FetchPermanentChatRoomsMapping.csx +128 -0
- package/touch/Workflows/src/FetchRezervationsForTransferMapping.csx +124 -0
- package/touch/Workflows/src/GetChatRoomDataForRezervationMapping.csx +100 -0
- package/touch/Workflows/src/GetChatTokenMapping.csx +85 -0
- package/touch/Workflows/src/GetRezervationDataForAddParticipantMapping.csx +105 -0
- package/touch/Workflows/src/GetRezervationDataForRandevuUpdateMapping.csx +110 -0
- package/touch/Workflows/src/GetRezervationDataMapping.csx +111 -0
- package/touch/Workflows/src/GetRezervationStateForRandevuUpdateMapping.csx +80 -0
- package/touch/Workflows/src/GetRezervationStateMapping.csx +92 -0
- package/touch/Workflows/src/GetUserInfoForRezervationMapping.csx +63 -0
- package/touch/Workflows/src/GetVideoCallUrlMapping.csx +62 -0
- package/touch/Workflows/src/HasChangedAdvisorRule.csx +28 -0
- package/touch/Workflows/src/HasChatIntegrationRule.csx +41 -0
- package/touch/Workflows/src/HasExistingPermanentRoomRule.csx +28 -0
- package/touch/Workflows/src/InviteAdvisorForRandevuUpdateMapping.csx +86 -0
- package/touch/Workflows/src/InviteNewAdvisorToRezervationRoomMapping.csx +78 -0
- package/touch/Workflows/src/InviteNewParticipantToRandevuRoomMapping.csx +88 -0
- package/touch/Workflows/src/InvitedUserMergeMapping.csx +77 -0
- package/touch/Workflows/src/InvitedUserNotAllowedRule.csx +71 -0
- package/touch/Workflows/src/InvitedUserNotInMeetRule.csx +19 -0
- package/touch/Workflows/src/IsNotfSentRule.csx +36 -0
- package/touch/Workflows/src/JoinChatRoomForAddParticipantMapping.csx +118 -0
- package/touch/Workflows/src/JoinChatRoomForRandevuStartMapping.csx +119 -0
- package/touch/Workflows/src/JoinChatRoomForRezervationMapping.csx +118 -0
- package/touch/Workflows/src/JoinMatrixRoomMapping.csx +100 -0
- package/touch/Workflows/src/JoinUserToRoomMapping.csx +118 -0
- package/touch/Workflows/src/LoginForAddParticipantChatMapping.csx +102 -0
- package/touch/Workflows/src/LoginForRandevuStartChatMapping.csx +96 -0
- package/touch/Workflows/src/MergeRezervationUpdateMapping.csx +82 -0
- package/touch/Workflows/src/MergeTargetAdvisorForTransferMapping.csx +79 -0
- package/touch/Workflows/src/MergeUpdateBodyForRandevuUpdateMapping.csx +91 -0
- package/touch/Workflows/src/NoExistingPermanentRoomRule.csx +23 -0
- package/touch/Workflows/src/NotificationCompleteAlwaysRule.csx +14 -0
- package/touch/Workflows/src/NotificationCompleteFromPendingRule.csx +41 -0
- package/touch/Workflows/src/NotificationCompleteFromSmsRule.csx +36 -0
- package/touch/Workflows/src/NotificationPushFromPendingRule.csx +42 -0
- package/touch/Workflows/src/NotificationPushFromSmsRule.csx +36 -0
- package/touch/Workflows/src/NotificationSmsPendingRule.csx +32 -0
- package/touch/Workflows/src/PermanentDoneRule.csx +44 -0
- package/touch/Workflows/src/PermanentProcessNextRule.csx +44 -0
- package/touch/Workflows/src/RezChatRoomProcessNextRule.csx +44 -0
- package/touch/Workflows/src/RezChatRoomsDoneRule.csx +44 -0
- package/touch/Workflows/src/SendPushNotificationMapping.csx +146 -0
- package/touch/Workflows/src/SendSmsNotificationMapping.csx +138 -0
- package/touch/Workflows/src/SetChatRoomStatusActiveMapping.csx +22 -0
- package/touch/Workflows/src/SetChatRoomStatusDeactiveMapping.csx +22 -0
- package/touch/Workflows/src/SetPreviousAdvisorMapping.csx +28 -0
- package/touch/Workflows/src/SetUserFromHeadersForRezervationMapping.csx +24 -0
- package/touch/Workflows/src/SlotAvailableRule.csx +33 -0
- package/touch/Workflows/src/SlotUnavailableRule.csx +33 -0
- package/touch/Workflows/src/StartChatRoomForRezervationMapping.csx +100 -0
- package/touch/Workflows/src/StartGetChatTokenForRezervationMapping.csx +71 -0
- package/touch/Workflows/src/StartNotificationForAdvisorMapping.csx +117 -0
- package/touch/Workflows/src/StartNotificationForRezervationFromUserInfoMapping.csx +128 -0
- package/touch/Workflows/src/StartNotificationForUserMapping.csx +117 -0
- package/touch/Workflows/src/StartPermanentChatRoomMapping.csx +92 -0
- package/touch/Workflows/src/StartTransferFromAbsenceEntryMapping.csx +94 -0
- package/touch/Workflows/src/StartVideoCallCustomerSubFlowMapping.csx +37 -0
- package/touch/Workflows/src/StartVideoCallForInvitedParticipantMapping.csx +54 -0
- package/touch/Workflows/src/StartVideoCallForRandevuStartMapping.csx +70 -0
- package/touch/Workflows/src/StartVideoCallStaffSubFlowMapping.csx +37 -0
- package/touch/Workflows/src/StateActiveForUpdateRule.csx +14 -0
- package/touch/Workflows/src/StateActiveRule.csx +14 -0
- package/touch/Workflows/src/StateInMeetRule.csx +14 -0
- package/touch/Workflows/src/StateNotActiveForUpdateRule.csx +14 -0
- package/touch/Workflows/src/StateNotActiveOrInMeetRule.csx +14 -0
- package/touch/Workflows/src/StatusCustomerEnterRule.csx +25 -0
- package/touch/Workflows/src/StatusStaffEnterRule.csx +25 -0
- package/touch/Workflows/src/SyncWorkingHoursRule.csx +46 -0
- package/touch/Workflows/src/TokenSuccessRule.csx +24 -0
- package/touch/Workflows/src/TransferAllDoneRule.csx +50 -0
- package/touch/Workflows/src/TransferHasInvalidRule.csx +34 -0
- package/touch/Workflows/src/TransferProcessNextRule.csx +50 -0
- package/touch/Workflows/src/TriggerChatRoomDeactivateMapping.csx +77 -0
- package/touch/Workflows/src/TriggerChatRoomTransferMapping.csx +93 -0
- package/touch/Workflows/src/TriggerChatRoomUpdateMapping.csx +99 -0
- package/touch/Workflows/src/TriggerRezervationAddInvitedParticipantMapping.csx +77 -0
- package/touch/Workflows/src/TriggerRezervationApplyUpdateMapping.csx +66 -0
- package/touch/Workflows/src/TriggerRezervationToInMeetMapping.csx +69 -0
- package/touch/Workflows/src/TriggerRezervationVideoCallUpdateMapping.csx +67 -0
- package/touch/Workflows/src/ValidateDateForRezervationMapping.csx +60 -0
- package/touch/Workflows/src/ValidateSlotForRandevuUpdateMapping.csx +211 -0
- package/touch/Workflows/src/ValidateSlotForRezervationMapping.csx +246 -0
- package/touch/Workflows/src/ValidateTransferMapping.csx +243 -0
- package/touch/Workflows/src/VideoCallUrlUpdateMergeMapping.csx +141 -0
- package/touch/Workflows/start-chat.json +217 -0
- package/touch/Workflows/start-video-call.http +93 -0
- package/touch/Workflows/start-video-call.json +206 -0
- package/vnext.config.json +58 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
using BBT.Workflow.Definitions;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Mapping for start-transfer-from-absence-entry StartTask (Type 11).
|
|
8
|
+
/// Conditionally starts a rezervation-transfer subflow when absenceType is personal-leave.
|
|
9
|
+
/// Determines transfer type: annual-leave (endDateTime present) or termination (endDateTime null).
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class StartTransferFromAbsenceEntryMapping : ScriptBase, IMapping
|
|
12
|
+
{
|
|
13
|
+
public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
|
|
14
|
+
{
|
|
15
|
+
var startTask = task as StartTask;
|
|
16
|
+
if (startTask == null)
|
|
17
|
+
throw new InvalidOperationException("Task must be a StartTask");
|
|
18
|
+
|
|
19
|
+
var data = context.Instance?.Data;
|
|
20
|
+
if (data == null)
|
|
21
|
+
return Task.FromResult(new ScriptResponse { Data = new { skipped = true, reason = "no-instance-data" } });
|
|
22
|
+
|
|
23
|
+
var absenceType = GetString(data, "absenceType");
|
|
24
|
+
if (absenceType != "personal-leave")
|
|
25
|
+
return Task.FromResult(new ScriptResponse { Data = new { skipped = true, reason = "not-personal-leave" } });
|
|
26
|
+
|
|
27
|
+
var advisor = GetString(data, "advisor");
|
|
28
|
+
if (string.IsNullOrEmpty(advisor))
|
|
29
|
+
return Task.FromResult(new ScriptResponse { Data = new { skipped = true, reason = "no-advisor" } });
|
|
30
|
+
|
|
31
|
+
var startDateTime = GetString(data, "startDateTime");
|
|
32
|
+
if (string.IsNullOrEmpty(startDateTime))
|
|
33
|
+
return Task.FromResult(new ScriptResponse { Data = new { skipped = true, reason = "no-startDateTime" } });
|
|
34
|
+
|
|
35
|
+
var endDateTime = GetString(data, "endDateTime");
|
|
36
|
+
|
|
37
|
+
var advisorType = ExtractAdvisorType(advisor);
|
|
38
|
+
var transferType = string.IsNullOrEmpty(endDateTime) ? "termination" : "annual-leave";
|
|
39
|
+
|
|
40
|
+
var safeStart = startDateTime.Replace(":", "-");
|
|
41
|
+
var transferKey = $"transfer-leave-{advisor}-{safeStart}";
|
|
42
|
+
|
|
43
|
+
startTask.SetDomain("touch");
|
|
44
|
+
startTask.SetFlow("rezervation-transfer");
|
|
45
|
+
startTask.SetKey(transferKey);
|
|
46
|
+
|
|
47
|
+
var body = new System.Collections.Generic.Dictionary<string, object>
|
|
48
|
+
{
|
|
49
|
+
["sourceAdvisorId"] = advisor,
|
|
50
|
+
["advisorType"] = advisorType,
|
|
51
|
+
["startDate"] = startDateTime
|
|
52
|
+
};
|
|
53
|
+
if (!string.IsNullOrEmpty(endDateTime))
|
|
54
|
+
body["endDate"] = endDateTime;
|
|
55
|
+
|
|
56
|
+
startTask.SetBody(body);
|
|
57
|
+
|
|
58
|
+
return Task.FromResult(new ScriptResponse
|
|
59
|
+
{
|
|
60
|
+
Data = new { skipped = false, transferType, transferKey }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
65
|
+
{
|
|
66
|
+
return Task.FromResult(new ScriptResponse());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private string ExtractAdvisorType(string advisor)
|
|
70
|
+
{
|
|
71
|
+
if (string.IsNullOrEmpty(advisor)) return null;
|
|
72
|
+
var parts = advisor.Split('.');
|
|
73
|
+
if (parts.Length >= 3)
|
|
74
|
+
return parts[1];
|
|
75
|
+
if (parts.Length == 2)
|
|
76
|
+
return parts[0];
|
|
77
|
+
return advisor;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private string GetString(dynamic obj, string name)
|
|
81
|
+
{
|
|
82
|
+
if (obj == null) return null;
|
|
83
|
+
try
|
|
84
|
+
{
|
|
85
|
+
if (HasProperty(obj, name))
|
|
86
|
+
{
|
|
87
|
+
var v = GetPropertyValue(obj, name);
|
|
88
|
+
return v?.ToString();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch { }
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using BBT.Workflow.Scripting;
|
|
5
|
+
using BBT.Workflow.Definitions;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// ISubFlowMapping for start-video-call subflow in accept-terms state.
|
|
9
|
+
/// Input: roomName, status=customer-enter, user, advisor.
|
|
10
|
+
/// Output: Full InstanceData from subflow (videoCallUrl, getTokenSuccess, etc.).
|
|
11
|
+
/// </summary>
|
|
12
|
+
public class StartVideoCallCustomerSubFlowMapping : ScriptBase, ISubFlowMapping
|
|
13
|
+
{
|
|
14
|
+
public Task<ScriptResponse> InputHandler(ScriptContext context)
|
|
15
|
+
{
|
|
16
|
+
var data = context.Instance?.Data;
|
|
17
|
+
var instanceKey = context.Instance?.Key ?? (string)null;
|
|
18
|
+
var user = data?.user?.ToString()?.Trim();
|
|
19
|
+
var advisor = data?.advisor?.ToString()?.Trim();
|
|
20
|
+
|
|
21
|
+
var input = new Dictionary<string, object>
|
|
22
|
+
{
|
|
23
|
+
{ "roomName", instanceKey },
|
|
24
|
+
{ "status", "customer-enter" },
|
|
25
|
+
{ "user", user ?? (object)string.Empty },
|
|
26
|
+
{ "advisor", advisor ?? (object)string.Empty }
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return Task.FromResult(new ScriptResponse { Data = input });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
33
|
+
{
|
|
34
|
+
var instanceData = context.Body?.data ?? context.Body?.attributes ?? context.Body?.Data ?? context.Body;
|
|
35
|
+
return Task.FromResult(new ScriptResponse { Data = instanceData });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using BBT.Workflow.Scripting;
|
|
5
|
+
using BBT.Workflow.Definitions;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// ISubFlowMapping for start-video-call when invoked from add-participant-to-rezervation flow.
|
|
9
|
+
/// Input: roomName=randevuKey, status=customer-enter, user=newUserId. Invited participant joins as customer.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class StartVideoCallForInvitedParticipantMapping : ScriptBase, ISubFlowMapping
|
|
12
|
+
{
|
|
13
|
+
public Task<ScriptResponse> InputHandler(ScriptContext context)
|
|
14
|
+
{
|
|
15
|
+
var data = context.Instance?.Data;
|
|
16
|
+
var randevuKey = GetString(data, "randevuKey");
|
|
17
|
+
var newUserId = GetString(data, "newUserId");
|
|
18
|
+
var advisor = data?.advisor ?? (object)string.Empty;
|
|
19
|
+
|
|
20
|
+
if (string.IsNullOrWhiteSpace(randevuKey) || string.IsNullOrWhiteSpace(newUserId))
|
|
21
|
+
return Task.FromResult(new ScriptResponse());
|
|
22
|
+
|
|
23
|
+
var input = new Dictionary<string, object>
|
|
24
|
+
{
|
|
25
|
+
{ "roomName", randevuKey ?? string.Empty },
|
|
26
|
+
{ "status", "customer-enter" },
|
|
27
|
+
{ "user", newUserId.Trim() },
|
|
28
|
+
{ "advisor", advisor }
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return Task.FromResult(new ScriptResponse { Data = input });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
35
|
+
{
|
|
36
|
+
var instanceData = context.Body?.data ?? context.Body?.attributes ?? context.Body?.Data ?? context.Body;
|
|
37
|
+
return Task.FromResult(new ScriptResponse { Data = instanceData });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private string GetString(dynamic obj, string name)
|
|
41
|
+
{
|
|
42
|
+
if (obj == null) return null;
|
|
43
|
+
try
|
|
44
|
+
{
|
|
45
|
+
if (HasProperty(obj, name))
|
|
46
|
+
{
|
|
47
|
+
var v = GetPropertyValue(obj, name);
|
|
48
|
+
return v?.ToString();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch { }
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using BBT.Workflow.Scripting;
|
|
5
|
+
using BBT.Workflow.Definitions;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// ISubFlowMapping for start-video-call when invoked from rezervation-start flow end state.
|
|
9
|
+
/// Input: roomName=randevuKey, status=staff-enter or customer-enter based on participantType, user, advisor, invitedUserId.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class StartVideoCallForRandevuStartMapping : ScriptBase, ISubFlowMapping
|
|
12
|
+
{
|
|
13
|
+
public Task<ScriptResponse> InputHandler(ScriptContext context)
|
|
14
|
+
{
|
|
15
|
+
var data = context.Instance?.Data;
|
|
16
|
+
var randevuKey = GetString(data, "randevuKey");
|
|
17
|
+
var participantType = GetString(data, "participantType");
|
|
18
|
+
var user = data?.user ?? (object)string.Empty;
|
|
19
|
+
var advisor = data?.advisor ?? (object)string.Empty;
|
|
20
|
+
|
|
21
|
+
string status;
|
|
22
|
+
object userVal;
|
|
23
|
+
if (participantType == "advisor")
|
|
24
|
+
{
|
|
25
|
+
status = "staff-enter";
|
|
26
|
+
userVal = advisor;
|
|
27
|
+
}
|
|
28
|
+
else if (participantType == "invited")
|
|
29
|
+
{
|
|
30
|
+
status = "customer-enter";
|
|
31
|
+
userVal = GetString(data, "invitedUserId") ?? string.Empty;
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
{
|
|
35
|
+
status = "customer-enter";
|
|
36
|
+
userVal = user;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var input = new Dictionary<string, object>
|
|
40
|
+
{
|
|
41
|
+
{ "roomName", randevuKey ?? string.Empty },
|
|
42
|
+
{ "status", status },
|
|
43
|
+
{ "user", userVal },
|
|
44
|
+
{ "advisor", advisor }
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return Task.FromResult(new ScriptResponse { Data = input });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
51
|
+
{
|
|
52
|
+
var instanceData = context.Body?.data ?? context.Body?.attributes ?? context.Body?.Data ?? context.Body;
|
|
53
|
+
return Task.FromResult(new ScriptResponse { Data = instanceData });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private string GetString(dynamic obj, string name)
|
|
57
|
+
{
|
|
58
|
+
if (obj == null) return null;
|
|
59
|
+
try
|
|
60
|
+
{
|
|
61
|
+
if (HasProperty(obj, name))
|
|
62
|
+
{
|
|
63
|
+
var v = GetPropertyValue(obj, name);
|
|
64
|
+
return v?.ToString();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch { }
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using BBT.Workflow.Scripting;
|
|
5
|
+
using BBT.Workflow.Definitions;
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// ISubFlowMapping for start-video-call subflow in customer-waiting-enter state.
|
|
9
|
+
/// Input: roomName, status=staff-enter, user, advisor.
|
|
10
|
+
/// Output: Full InstanceData from subflow (videoCallUrl, getTokenSuccess, etc.).
|
|
11
|
+
/// </summary>
|
|
12
|
+
public class StartVideoCallStaffSubFlowMapping : ScriptBase, ISubFlowMapping
|
|
13
|
+
{
|
|
14
|
+
public Task<ScriptResponse> InputHandler(ScriptContext context)
|
|
15
|
+
{
|
|
16
|
+
var data = context.Instance?.Data;
|
|
17
|
+
var instanceKey = context.Instance?.Key ?? (string)null;
|
|
18
|
+
var user = data?.user?.ToString()?.Trim();
|
|
19
|
+
var advisor = data?.advisor?.ToString()?.Trim();
|
|
20
|
+
|
|
21
|
+
var input = new Dictionary<string, object>
|
|
22
|
+
{
|
|
23
|
+
{ "roomName", instanceKey },
|
|
24
|
+
{ "status", "staff-enter" },
|
|
25
|
+
{ "user", user ?? (object)string.Empty },
|
|
26
|
+
{ "advisor", advisor ?? (object)string.Empty }
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return Task.FromResult(new ScriptResponse { Data = input });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
33
|
+
{
|
|
34
|
+
var instanceData = context.Body?.data ?? context.Body?.attributes ?? context.Body?.Data ?? context.Body;
|
|
35
|
+
return Task.FromResult(new ScriptResponse { Data = instanceData });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// Rule for randevu-update flow: only continue when rezervation state is active.
|
|
6
|
+
/// </summary>
|
|
7
|
+
public class StateActiveForUpdateRule : ScriptBase, IConditionMapping
|
|
8
|
+
{
|
|
9
|
+
public Task<bool> Handler(ScriptContext context)
|
|
10
|
+
{
|
|
11
|
+
var state = context.Instance?.Data?.state?.ToString()?.Trim();
|
|
12
|
+
return Task.FromResult(state == "active");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// Condition for check-time: state=active -> create-room-and-trigger.
|
|
6
|
+
/// </summary>
|
|
7
|
+
public class StateActiveRule : ScriptBase, IConditionMapping
|
|
8
|
+
{
|
|
9
|
+
public Task<bool> Handler(ScriptContext context)
|
|
10
|
+
{
|
|
11
|
+
var state = context.Instance?.Data?.state?.ToString()?.Trim();
|
|
12
|
+
return Task.FromResult(state == "active");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// Condition for check-time: state=in-meet -> join-room.
|
|
6
|
+
/// </summary>
|
|
7
|
+
public class StateInMeetRule : ScriptBase, IConditionMapping
|
|
8
|
+
{
|
|
9
|
+
public Task<bool> Handler(ScriptContext context)
|
|
10
|
+
{
|
|
11
|
+
var state = context.Instance?.Data?.state?.ToString()?.Trim();
|
|
12
|
+
return Task.FromResult(state == "in-meet");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// Rule for randevu-update flow: go to not-active-error when rezervation state is not active.
|
|
6
|
+
/// </summary>
|
|
7
|
+
public class StateNotActiveForUpdateRule : ScriptBase, IConditionMapping
|
|
8
|
+
{
|
|
9
|
+
public Task<bool> Handler(ScriptContext context)
|
|
10
|
+
{
|
|
11
|
+
var state = context.Instance?.Data?.state?.ToString()?.Trim();
|
|
12
|
+
return Task.FromResult(state != "active");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// Condition for check-rezervation-state: state not in (active, in-meet) -> meet-not-active.
|
|
6
|
+
/// </summary>
|
|
7
|
+
public class StateNotActiveOrInMeetRule : ScriptBase, IConditionMapping
|
|
8
|
+
{
|
|
9
|
+
public Task<bool> Handler(ScriptContext context)
|
|
10
|
+
{
|
|
11
|
+
var state = context.Instance?.Data?.state?.ToString()?.Trim();
|
|
12
|
+
return Task.FromResult(state != "active" && state != "in-meet");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for to-creating-token auto transition when status is customer-enter.
|
|
7
|
+
/// Rule: status == "customer-enter"
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class StatusCustomerEnterRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
try
|
|
14
|
+
{
|
|
15
|
+
if (context?.Instance?.Data == null)
|
|
16
|
+
return Task.FromResult(false);
|
|
17
|
+
var status = context.Instance.Data.status?.ToString()?.Trim();
|
|
18
|
+
return Task.FromResult(status == "customer-enter");
|
|
19
|
+
}
|
|
20
|
+
catch (Exception)
|
|
21
|
+
{
|
|
22
|
+
return Task.FromResult(false);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for to-creating-token auto transition when status is staff-enter.
|
|
7
|
+
/// Rule: status == "staff-enter"
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class StatusStaffEnterRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
try
|
|
14
|
+
{
|
|
15
|
+
if (context?.Instance?.Data == null)
|
|
16
|
+
return Task.FromResult(false);
|
|
17
|
+
var status = context.Instance.Data.status?.ToString()?.Trim();
|
|
18
|
+
return Task.FromResult(status == "staff-enter");
|
|
19
|
+
}
|
|
20
|
+
catch (Exception)
|
|
21
|
+
{
|
|
22
|
+
return Task.FromResult(false);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition mapping for sync-working-hours auto transition.
|
|
7
|
+
/// Checks if custom working hours need to be synced to absence-entry.
|
|
8
|
+
///
|
|
9
|
+
/// Rule: useDefaultWorkingHours == false AND workingHoursSynced != true
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class SyncWorkingHoursRule : ScriptBase, IConditionMapping
|
|
12
|
+
{
|
|
13
|
+
public Task<bool> Handler(ScriptContext context)
|
|
14
|
+
{
|
|
15
|
+
try
|
|
16
|
+
{
|
|
17
|
+
if (context?.Instance?.Data == null)
|
|
18
|
+
{
|
|
19
|
+
return Task.FromResult(false);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var data = context.Instance.Data;
|
|
23
|
+
|
|
24
|
+
// Check useDefaultWorkingHours - must be false
|
|
25
|
+
bool useDefaultWorkingHours = true; // default
|
|
26
|
+
if (HasProperty(data, "useDefaultWorkingHours") && data.useDefaultWorkingHours != null)
|
|
27
|
+
{
|
|
28
|
+
useDefaultWorkingHours = data.useDefaultWorkingHours == true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Check workingHoursSynced - must not be true
|
|
32
|
+
bool workingHoursSynced = false; // default
|
|
33
|
+
if (HasProperty(data, "workingHoursSynced") && data.workingHoursSynced != null)
|
|
34
|
+
{
|
|
35
|
+
workingHoursSynced = data.workingHoursSynced == true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Rule: useDefaultWorkingHours == false AND workingHoursSynced != true
|
|
39
|
+
return Task.FromResult(useDefaultWorkingHours == false && workingHoursSynced != true);
|
|
40
|
+
}
|
|
41
|
+
catch (Exception)
|
|
42
|
+
{
|
|
43
|
+
return Task.FromResult(false);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition for token-success auto transition in start-video-call flow.
|
|
7
|
+
/// Rule: getTokenSuccess == true (set by GetVideoCallUrlMapping InputHandler)
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class TokenSuccessRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
try
|
|
14
|
+
{
|
|
15
|
+
if (context?.Instance?.Data == null)
|
|
16
|
+
return Task.FromResult(false);
|
|
17
|
+
return Task.FromResult(context.Instance.Data.getTokenSuccess == true);
|
|
18
|
+
}
|
|
19
|
+
catch (Exception)
|
|
20
|
+
{
|
|
21
|
+
return Task.FromResult(false);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Linq;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using BBT.Workflow.Scripting;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Condition mapping for all-done auto transition in validating state.
|
|
8
|
+
/// Rule: validationResult.allValid == true AND processedIndex >= transferPlan.Count
|
|
9
|
+
/// When true, all transfers have been executed and the workflow moves to completed.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class TransferAllDoneRule : ScriptBase, IConditionMapping
|
|
12
|
+
{
|
|
13
|
+
public Task<bool> Handler(ScriptContext context)
|
|
14
|
+
{
|
|
15
|
+
try
|
|
16
|
+
{
|
|
17
|
+
if (context?.Instance?.Data == null)
|
|
18
|
+
return Task.FromResult(false);
|
|
19
|
+
|
|
20
|
+
var data = context.Instance.Data;
|
|
21
|
+
|
|
22
|
+
if (!HasProperty(data, "validationResult") || data.validationResult == null)
|
|
23
|
+
return Task.FromResult(false);
|
|
24
|
+
if (!HasProperty(data.validationResult, "allValid") || data.validationResult.allValid != true)
|
|
25
|
+
return Task.FromResult(false);
|
|
26
|
+
|
|
27
|
+
if (!HasProperty(data, "transferPlan") || data.transferPlan == null)
|
|
28
|
+
return Task.FromResult(true);
|
|
29
|
+
|
|
30
|
+
var transferPlan = data.transferPlan as System.Collections.IEnumerable;
|
|
31
|
+
if (transferPlan == null)
|
|
32
|
+
return Task.FromResult(true);
|
|
33
|
+
|
|
34
|
+
int totalCount = 0;
|
|
35
|
+
foreach (var item in transferPlan) totalCount++;
|
|
36
|
+
|
|
37
|
+
int processedIndex = 0;
|
|
38
|
+
if (HasProperty(data, "processedIndex"))
|
|
39
|
+
{
|
|
40
|
+
int.TryParse(data.processedIndex?.ToString() ?? "0", out processedIndex);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return Task.FromResult(processedIndex >= totalCount);
|
|
44
|
+
}
|
|
45
|
+
catch (Exception)
|
|
46
|
+
{
|
|
47
|
+
return Task.FromResult(false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Threading.Tasks;
|
|
3
|
+
using BBT.Workflow.Scripting;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Condition mapping for has-invalid auto transition in rezervation-transfer validating state.
|
|
7
|
+
/// Rule: validationResult == null OR validationResult.allValid != true
|
|
8
|
+
/// Returns the user to awaiting-assignment to re-plan the transfer.
|
|
9
|
+
/// </summary>
|
|
10
|
+
public class TransferHasInvalidRule : ScriptBase, IConditionMapping
|
|
11
|
+
{
|
|
12
|
+
public Task<bool> Handler(ScriptContext context)
|
|
13
|
+
{
|
|
14
|
+
try
|
|
15
|
+
{
|
|
16
|
+
if (context?.Instance?.Data == null)
|
|
17
|
+
return Task.FromResult(true);
|
|
18
|
+
|
|
19
|
+
var data = context.Instance.Data;
|
|
20
|
+
if (!HasProperty(data, "validationResult") || data.validationResult == null)
|
|
21
|
+
return Task.FromResult(true);
|
|
22
|
+
|
|
23
|
+
var validationResult = data.validationResult;
|
|
24
|
+
if (!HasProperty(validationResult, "allValid"))
|
|
25
|
+
return Task.FromResult(true);
|
|
26
|
+
|
|
27
|
+
return Task.FromResult(validationResult.allValid != true);
|
|
28
|
+
}
|
|
29
|
+
catch (Exception)
|
|
30
|
+
{
|
|
31
|
+
return Task.FromResult(true);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Linq;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
using BBT.Workflow.Scripting;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Condition mapping for process-next auto transition in validating state.
|
|
8
|
+
/// Rule: validationResult.allValid == true AND processedIndex less than transferPlan.Count
|
|
9
|
+
/// When true, the self-loop fires to process the next transfer item.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public class TransferProcessNextRule : ScriptBase, IConditionMapping
|
|
12
|
+
{
|
|
13
|
+
public Task<bool> Handler(ScriptContext context)
|
|
14
|
+
{
|
|
15
|
+
try
|
|
16
|
+
{
|
|
17
|
+
if (context?.Instance?.Data == null)
|
|
18
|
+
return Task.FromResult(false);
|
|
19
|
+
|
|
20
|
+
var data = context.Instance.Data;
|
|
21
|
+
|
|
22
|
+
if (!HasProperty(data, "validationResult") || data.validationResult == null)
|
|
23
|
+
return Task.FromResult(false);
|
|
24
|
+
if (!HasProperty(data.validationResult, "allValid") || data.validationResult.allValid != true)
|
|
25
|
+
return Task.FromResult(false);
|
|
26
|
+
|
|
27
|
+
if (!HasProperty(data, "transferPlan") || data.transferPlan == null)
|
|
28
|
+
return Task.FromResult(false);
|
|
29
|
+
|
|
30
|
+
var transferPlan = data.transferPlan as System.Collections.IEnumerable;
|
|
31
|
+
if (transferPlan == null)
|
|
32
|
+
return Task.FromResult(false);
|
|
33
|
+
|
|
34
|
+
int totalCount = 0;
|
|
35
|
+
foreach (var item in transferPlan) totalCount++;
|
|
36
|
+
|
|
37
|
+
int processedIndex = 0;
|
|
38
|
+
if (HasProperty(data, "processedIndex"))
|
|
39
|
+
{
|
|
40
|
+
int.TryParse(data.processedIndex?.ToString() ?? "0", out processedIndex);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return Task.FromResult(processedIndex < totalCount);
|
|
44
|
+
}
|
|
45
|
+
catch (Exception)
|
|
46
|
+
{
|
|
47
|
+
return Task.FromResult(false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|