public void Parse_Parameter() { // ARRANGE var message = "Please update the password by clicking on the website {{configuration.Get('humanTaskUrl')}}/humantasks/{{messages.Get('humanTaskCreated', 'humanTaskInstance.fileId')}}/instances/{{messages.Get('humanTaskCreated', 'humanTaskInstance.id')}}?auth=email"; var incomingTokens = new List <MessageToken> { MessageToken.NewMessage(Guid.NewGuid().ToString(), "humanTaskCreated", new JObject { { "humanTaskInstance", new JObject { { "id", "id" }, { "fileId", "fileId" } } } }.ToString()) }; var configuration = new DelegateConfigurationAggregate(); configuration.AddRecord("humanTaskUrl", "http://localhost:4200"); // ACT var result = DelegateHelper.Parse(configuration, incomingTokens, message); // ASSERT Assert.Equal("Please update the password by clicking on the website http://localhost:4200/humantasks/fileId/instances/id?auth=email", result); }
private void SendActivateMail(UserInfo user) { var dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString); MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString); var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID); foreach (var messageTemplate in messageTemplates) { var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID); CommonFunction comm = new CommonFunction(); DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues); try { MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } catch (Exception) { ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert); return; } } }
protected override Task <ICollection <MessageToken> > Process(BPMNExecutionContext context, EmptyTask elt, CancellationToken cancellationToken) { ICollection <MessageToken> result = new List <MessageToken> { MessageToken.EmptyMessage(context.Pointer.InstanceFlowNodeId, elt.EltId) }; return(Task.FromResult(result)); }
public static MessageTokenModel ToModel(this MessageToken messageToken, MessageTokenDirections direction) { var msg = messageToken as MessageToken; return(new MessageTokenModel { SerializedContent = msg.MessageContent == null ? null : msg.MessageContent.ToString(), Name = messageToken.Name, Direction = direction }); }
public Task <ICollection <MessageToken> > Execute(ICollection <MessageToken> incoming, CancellationToken cancellationToken) { ICollection <MessageToken> result = new List <MessageToken>(); result.Add(MessageToken.NewMessage("weatherInformation", new JObject { { "city", "Bruxelles" }, { "degree", "31" } }.ToString())); return(Task.FromResult(result)); }
public void Execute(ISiqiServer server) { MessageToken token = null; lock (this) { if (mQueue.Count > 0) { token = mQueue.Dequeue(); } } if (token != null) { OnExecute(token, server); } }
static bool paramMatches(ActionParameter actionParam, MessageToken messageParam) { // If a name has been explicitly specified for this param, check it. if (messageParam.TokenType == MessageTokenType.Double) { if (!isMatch(messageParam.ItemOne, actionParam.Name)) { return(false); } } var messageParamValue = messageParam.TokenType == MessageTokenType.Single ? messageParam.ItemOne : messageParam.ItemTwo; return(StringToType.ConvertsToType(actionParam.Type, messageParamValue)); }
public Task <ICollection <MessageToken> > Execute(BPMNExecutionContext context, ICollection <MessageToken> incoming, DelegateConfigurationAggregate delegateConfiguration, CancellationToken cancellationToken) { var user = incoming.FirstOrDefault(i => i.Name == "user"); if (user == null) { throw new BPMNProcessorException("user must be passed in the request"); } var email = user.GetProperty("email"); if (string.IsNullOrWhiteSpace(email)) { throw new BPMNProcessorException("email is not passed in the request"); } var parameter = SendDelegateParameter.Build(delegateConfiguration); using (var smtpClient = new SmtpClient()) { smtpClient.EnableSsl = parameter.SmtpEnableSsl; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new NetworkCredential(parameter.SmtpUserName, parameter.SmtpPassword); smtpClient.Host = parameter.SmtpHost; smtpClient.Port = parameter.SmtpPort; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; var mailMessage = new MailMessage { From = new MailAddress(parameter.FromEmail), Subject = parameter.Subject, Body = DelegateHelper.Parse(delegateConfiguration, incoming, parameter.HttpBody), IsBodyHtml = true }; mailMessage.To.Add(email.ToString()); smtpClient.Send(mailMessage); } ICollection <MessageToken> result = new List <MessageToken> { MessageToken.EmptyMessage(context.Pointer.InstanceFlowNodeId, "sendEmail") }; return(Task.FromResult(result)); }
public async Task <ICollection <MessageToken> > Execute(BPMNExecutionContext context, ICollection <MessageToken> incoming, DelegateConfigurationAggregate delegateConfiguration, CancellationToken cancellationToken) { var user = incoming.FirstOrDefault(i => i.Name == "user"); if (user == null) { throw new BPMNProcessorException("user must be passed in the request"); } var userId = user.GetProperty("userId"); if (string.IsNullOrWhiteSpace(userId)) { throw new BPMNProcessorException("userId is not passed in the request"); } var humanTaskInstanceId = incoming.First(i => i.Name == "humanTaskCreated").JObjMessageContent.SelectToken("humanTaskInstance.id").ToString(); using (var httpClient = new HttpClient()) { var parameter = AssignHumanTaskInstanceParameter.Create(delegateConfiguration); var tokenResponse = await httpClient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest { Address = parameter.TokenUrl, ClientId = parameter.ClientId, ClientSecret = parameter.ClientSecret, Scope = "manage_humantaskinstance" }, cancellationToken); await Claim(httpClient, parameter, humanTaskInstanceId, userId, tokenResponse.AccessToken, cancellationToken); await Start(httpClient, parameter, humanTaskInstanceId, userId, tokenResponse.AccessToken, cancellationToken); } ICollection <MessageToken> result = new List <MessageToken> { MessageToken.EmptyMessage(context.Pointer.InstanceFlowNodeId, "assignHumanTaskInstance") }; return(result); }
public void CreateMessageToken(MessageToken token) { PartSequencingDataContext db = new PartSequencingDataContext(); db.MessageTokens.InsertOnSubmit(token); db.SubmitChanges(); MessageTokensCacheManager.RefreshMessageTokens(); }
public void UpdateMessageToken(MessageToken token) { PartSequencingDataContext db = new PartSequencingDataContext(); db.MessageTokens.Attach(token); db.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, token); db.SubmitChanges(); MessageTokensCacheManager.RefreshMessageTokens(); }
/// <summary> /// /// </summary> /// <returns></returns> public string Decompile() { StringBuilder sb = new StringBuilder(); Cursor = 0; while (Cursor < ByteCode.Length) { Console.Write("[0x{0:X4}]: ", Cursor + 2); byte opcode = ReadByte(); ScriptToken token = null; #region Decode switch (opcode) { case 0xff: token = new SetWallToken(this); break; case 0xfe: token = new ChangeWallToken(this); break; case 0xfd: token = new OpenDoorToken(this); break; case 0xfc: token = new CloseDoorToken(this); break; case 0xfb: token = new CreateMonsterToken(this); break; case 0xfa: token = new TeleportToken(this); break; case 0xf9: token = new StealSmallItemToken(this); break; case 0xf8: token = new MessageToken(this); break; case 0xf7: token = new SetFlagToken(this); break; case 0xf6: token = new SoundToken(this); break; case 0xf5: token = new ClearFlagToken(this); break; case 0xf4: token = new HealToken(this); break; case 0xf3: token = new DamageToken(this); break; case 0xf2: token = new JumpToken(this); break; case 0xf1: token = new EndToken(this); break; case 0xf0: token = new ReturnToken(this); break; case 0xef: token = new CallToken(this); break; case 0xee: token = new ConditionalToken(this); break; case 0xed: token = new ConsumeItemToken(this); break; case 0xec: token = new ChangeLevelToken(this); break; case 0xeb: token = new GiveXPToken(this); break; case 0xea: token = new NewItemToken(this); break; case 0xe9: token = new LauncherToken(this); break; case 0xe8: token = new TurnToken(this); break; case 0xe7: token = new IdentifyItemToken(this); break; case 0xe6: token = new EncounterToken(this); break; case 0xe5: token = new WaitToken(this); break; case 0xe4: token = new UpdateScreenToken(this); break; case 0xe3: token = new TextMenuToken(this); break; case 0xe2: token = new SpecialWindowToken(this); break; // Special window picture //case 0xe1: token = null; break; //case 0xe0: token = new PushEventFlagToken(this); break; default: { Console.Write("############# opcode: 0x{0:X2}", opcode); } break; } Console.WriteLine(token); Tokens.Add(token); } #endregion return sb.ToString(); }