From 00be822e1e3a5edd535f2f3166aa9657f45c227a Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Sun, 15 Sep 2019 20:34:42 +0200 Subject: [PATCH] Rename PlainTextExpression to Literal --- samples/Sample02/Program.cs | 4 +-- samples/Sample03/Program.cs | 4 +-- samples/Sample04/CalculatorWorkflow.cs | 12 ++++---- samples/Sample06/HelloWorldWorkflow.cs | 4 +-- samples/Sample07/DocumentApprovalWorkflow.cs | 14 ++++----- .../Sample08/Workflows/CreateOrderWorkflow.cs | 4 +-- samples/Sample10/HelloWorldWorkflow.cs | 2 +- samples/Sample11/CorrelationWorkflow.cs | 4 +-- samples/Sample12/UserTaskWorkflow.cs | 10 +++---- samples/Sample13/ActivityOutputWorkflow.cs | 2 +- samples/Sample14/HelloWorldWorkflow.cs | 2 +- samples/Sample15/HelloWorldWorkflow.cs | 2 +- .../Activities/CronEvent.cs | 2 +- .../Activities/Workflows/TriggerWorkflow.cs | 4 +-- .../{PlainTextExpression.cs => Literal.cs} | 30 +++++++++---------- 15 files changed, 50 insertions(+), 50 deletions(-) rename src/core/Elsa.Core/Expressions/{PlainTextExpression.cs => Literal.cs} (62%) diff --git a/samples/Sample02/Program.cs b/samples/Sample02/Program.cs index aa9a0c398..4df2a0cff 100644 --- a/samples/Sample02/Program.cs +++ b/samples/Sample02/Program.cs @@ -27,8 +27,8 @@ namespace Sample02 // Define a workflow. var workflowBuilder = services.GetRequiredService(); var workflowDefinition = workflowBuilder - .StartWith(x => x.TextExpression = new PlainTextExpression("Hello world!")) - .Then(x => x.TextExpression = new PlainTextExpression("Goodbye cruel world...")) + .StartWith(x => x.TextExpression = new Literal("Hello world!")) + .Then(x => x.TextExpression = new Literal("Goodbye cruel world...")) .Build(); // Run the workflow. diff --git a/samples/Sample03/Program.cs b/samples/Sample03/Program.cs index 18c58f546..7e4b9d1d1 100644 --- a/samples/Sample03/Program.cs +++ b/samples/Sample03/Program.cs @@ -31,8 +31,8 @@ namespace Sample03 { Activities = new[] { - new ActivityDefinition("activity-1", new { TextExpression = new PlainTextExpression("Hello world!")}), - new ActivityDefinition("activity-2", new { TextExpression = new PlainTextExpression("Goodbye cruel world...")}) + new ActivityDefinition("activity-1", new { TextExpression = new Literal("Hello world!")}), + new ActivityDefinition("activity-2", new { TextExpression = new Literal("Goodbye cruel world...")}) }, Connections = new [] { diff --git a/samples/Sample04/CalculatorWorkflow.cs b/samples/Sample04/CalculatorWorkflow.cs index a04ff643c..c10465676 100644 --- a/samples/Sample04/CalculatorWorkflow.cs +++ b/samples/Sample04/CalculatorWorkflow.cs @@ -14,12 +14,12 @@ namespace Sample04 public void Build(IWorkflowBuilder builder) { builder - .StartWith(x => x.TextExpression = new PlainTextExpression("Welcome to Calculator Workflow!")) - .Then(x => x.TextExpression = new PlainTextExpression("Enter number 1:"), id: "start") + .StartWith(x => x.TextExpression = new Literal("Welcome to Calculator Workflow!")) + .Then(x => x.TextExpression = new Literal("Enter number 1:"), id: "start") .Then(x => x.VariableName = "number1") - .Then(x => x.TextExpression = new PlainTextExpression("Enter number 2:")) + .Then(x => x.TextExpression = new Literal("Enter number 2:")) .Then(x => x.VariableName = "number2") - .Then(x => x.TextExpression = new PlainTextExpression("Now enter the operation you wish to apply. Options are: add, subtract, multiply or divide:")) + .Then(x => x.TextExpression = new Literal("Now enter the operation you wish to apply. Options are: add, subtract, multiply or divide:")) .Then(x => x.VariableName = "operation") .Then(@switch => { @@ -50,7 +50,7 @@ namespace Sample04 } ) .Add(x => x.TextExpression = new JavaScriptExpression("`Result: ${result}`"), "showResult") - .Then(x => x.TextExpression = new PlainTextExpression("Try again? (y/n)")) + .Then(x => x.TextExpression = new Literal("Try again? (y/n)")) .Then(x => x.VariableName = "retry") .Then( x => x.Expression = new JavaScriptExpression("retry.toLowerCase() === 'y'"), @@ -62,7 +62,7 @@ namespace Sample04 ifElse .When(OutcomeNames.False) - .Then(x => x.TextExpression = new PlainTextExpression("Bye!")); + .Then(x => x.TextExpression = new Literal("Bye!")); });; } diff --git a/samples/Sample06/HelloWorldWorkflow.cs b/samples/Sample06/HelloWorldWorkflow.cs index d9c97a58c..10942518e 100644 --- a/samples/Sample06/HelloWorldWorkflow.cs +++ b/samples/Sample06/HelloWorldWorkflow.cs @@ -16,10 +16,10 @@ namespace Sample06 .Then( activity => { - activity.Content = new PlainTextExpression("

Hello World!

Elsa says hi :)

"); + activity.Content = new Literal("

Hello World!

Elsa says hi :)

"); activity.ContentType = "text/html"; activity.StatusCode = HttpStatusCode.OK; - activity.ResponseHeaders = new PlainTextExpression("X-Powered-By=Elsa Workflows"); + activity.ResponseHeaders = new Literal("X-Powered-By=Elsa Workflows"); } ); } diff --git a/samples/Sample07/DocumentApprovalWorkflow.cs b/samples/Sample07/DocumentApprovalWorkflow.cs index 4133f3683..9370b5816 100644 --- a/samples/Sample07/DocumentApprovalWorkflow.cs +++ b/samples/Sample07/DocumentApprovalWorkflow.cs @@ -36,7 +36,7 @@ namespace Sample07 .Then( activity => { - activity.From = new PlainTextExpression("approval@acme.com"); + activity.From = new Literal("approval@acme.com"); activity.To = new JavaScriptExpression("document.author.email"); activity.Subject = new JavaScriptExpression("`Document received from ${document.author.name}`"); activity.Body = new JavaScriptExpression( @@ -48,10 +48,10 @@ namespace Sample07 .Then( activity => { - activity.Content = new PlainTextExpression("

Request for Approval Sent

Your document has been received and will be reviewed shortly.

"); + activity.Content = new Literal("

Request for Approval Sent

Your document has been received and will be reviewed shortly.

"); activity.ContentType = "text/html"; activity.StatusCode = HttpStatusCode.OK; - activity.ResponseHeaders = new PlainTextExpression("X-Powered-By=Elsa Workflows"); + activity.ResponseHeaders = new Literal("X-Powered-By=Elsa Workflows"); } ) .Then( @@ -60,12 +60,12 @@ namespace Sample07 { fork .When("Approve") - .Then(activity => activity.Signal = new PlainTextExpression("approve")) + .Then(activity => activity.Signal = new Literal("approve")) .Then("join-signals"); fork .When("Reject") - .Then(activity => activity.Signal = new PlainTextExpression("reject")) + .Then(activity => activity.Signal = new Literal("reject")) .Then("join-signals"); } ) @@ -78,7 +78,7 @@ namespace Sample07 .Then( activity => { - activity.From = new PlainTextExpression("approval@acme.com"); + activity.From = new Literal("approval@acme.com"); activity.To = new JavaScriptExpression("document.author.email"); activity.Subject = new JavaScriptExpression("`Document ${document.id} approved!`"); activity.Body = new JavaScriptExpression("`Great job ${document.author.name}, that document is perfect! Keep it up.`"); @@ -89,7 +89,7 @@ namespace Sample07 .Then( activity => { - activity.From = new PlainTextExpression("approval@acme.com"); + activity.From = new Literal("approval@acme.com"); activity.To = new JavaScriptExpression("document.author.email"); activity.Subject = new JavaScriptExpression("`Document ${document.id} rejected`"); activity.Body = new JavaScriptExpression("`Sorry ${document.author.name}, that document isn't good enough. Please try again.`"); diff --git a/samples/Sample08/Workflows/CreateOrderWorkflow.cs b/samples/Sample08/Workflows/CreateOrderWorkflow.cs index bd88bb523..106fc5e6e 100644 --- a/samples/Sample08/Workflows/CreateOrderWorkflow.cs +++ b/samples/Sample08/Workflows/CreateOrderWorkflow.cs @@ -48,7 +48,7 @@ namespace Sample08.Workflows .Then( activity => { - activity.Content = new PlainTextExpression("

Order Received

Your order has been received. Waiting for shipment.

"); + activity.Content = new Literal("

Order Received

Your order has been received. Waiting for shipment.

"); activity.ContentType = "text/html"; activity.StatusCode = HttpStatusCode.Accepted; } @@ -60,7 +60,7 @@ namespace Sample08.Workflows .Then( activity => { - activity.From = new PlainTextExpression("shipment@acme.com"); + activity.From = new Literal("shipment@acme.com"); activity.To = new JavaScriptExpression("order.customer.email"); activity.Subject = new JavaScriptExpression("`Your order with ID #${order.id} has been shipped!`"); activity.Body = new JavaScriptExpression( diff --git a/samples/Sample10/HelloWorldWorkflow.cs b/samples/Sample10/HelloWorldWorkflow.cs index 44094aed3..4fe20a229 100644 --- a/samples/Sample10/HelloWorldWorkflow.cs +++ b/samples/Sample10/HelloWorldWorkflow.cs @@ -10,7 +10,7 @@ namespace Sample10 public void Build(IWorkflowBuilder builder) { builder - .StartWith(activity => activity.TextExpression = new PlainTextExpression("Hello World!")); + .StartWith(activity => activity.TextExpression = new Literal("Hello World!")); } } } \ No newline at end of file diff --git a/samples/Sample11/CorrelationWorkflow.cs b/samples/Sample11/CorrelationWorkflow.cs index 3ac3d7c67..fc702a4b4 100644 --- a/samples/Sample11/CorrelationWorkflow.cs +++ b/samples/Sample11/CorrelationWorkflow.cs @@ -13,9 +13,9 @@ namespace Sample11 { builder .StartWith(activity => activity.TextExpression = new JavaScriptExpression("`Workflow started with correlation ID \"${correlationId()}\".`")) - .Then(activity => activity.Signal = new PlainTextExpression("Proceed")) + .Then(activity => activity.Signal = new Literal("Proceed")) .Then(activity => activity.TextExpression = new JavaScriptExpression("`Signal received for workflow with correlation ID: \"${correlationId()}\"`")) - .Then(activity => activity.TextExpression = new PlainTextExpression("Workflow finished.")); + .Then(activity => activity.TextExpression = new Literal("Workflow finished.")); } } } \ No newline at end of file diff --git a/samples/Sample12/UserTaskWorkflow.cs b/samples/Sample12/UserTaskWorkflow.cs index 5792ca25a..00075fa90 100644 --- a/samples/Sample12/UserTaskWorkflow.cs +++ b/samples/Sample12/UserTaskWorkflow.cs @@ -12,27 +12,27 @@ namespace Sample12 public void Build(IWorkflowBuilder builder) { builder - .StartWith(activity => activity.TextExpression = new PlainTextExpression("Workflow started. Waiting for user action.")) + .StartWith(activity => activity.TextExpression = new Literal("Workflow started. Waiting for user action.")) .Then( activity => activity.Actions = new[] { "Accept", "Reject", "Needs Work" }, userTask => { userTask .When("Accept") - .Then(activity => activity.TextExpression = new PlainTextExpression("Great! Your work has been accepted.")) + .Then(activity => activity.TextExpression = new Literal("Great! Your work has been accepted.")) .Then("Exit"); userTask.When("Reject") - .Then(activity => activity.TextExpression = new PlainTextExpression("Sorry! Your work has been rejected.")) + .Then(activity => activity.TextExpression = new Literal("Sorry! Your work has been rejected.")) .Then("Exit"); userTask.When("Needs Work") - .Then(activity => activity.TextExpression = new PlainTextExpression("So close! Your work needs a little bit more work.")) + .Then(activity => activity.TextExpression = new Literal("So close! Your work needs a little bit more work.")) .Then("WaitUser"); }, "WaitUser" ) - .Add(activity => activity.TextExpression = new PlainTextExpression("Workflow finished."), "Exit"); + .Add(activity => activity.TextExpression = new Literal("Workflow finished."), "Exit"); } } } \ No newline at end of file diff --git a/samples/Sample13/ActivityOutputWorkflow.cs b/samples/Sample13/ActivityOutputWorkflow.cs index c44f9ef6c..1a17149e0 100644 --- a/samples/Sample13/ActivityOutputWorkflow.cs +++ b/samples/Sample13/ActivityOutputWorkflow.cs @@ -10,7 +10,7 @@ namespace Sample13 public void Build(IWorkflowBuilder builder) { builder - .StartWith(x => x.TextExpression = new PlainTextExpression("Hi! What's your name?")) + .StartWith(x => x.TextExpression = new Literal("Hi! What's your name?")) .Then(id: "name") .Then(x => x.TextExpression = new JavaScriptExpression("`${name.output.text}, that's a great name! Now, what's your age?`")) .Then(id: "age") diff --git a/samples/Sample14/HelloWorldWorkflow.cs b/samples/Sample14/HelloWorldWorkflow.cs index 64a931113..026fde7c0 100644 --- a/samples/Sample14/HelloWorldWorkflow.cs +++ b/samples/Sample14/HelloWorldWorkflow.cs @@ -10,7 +10,7 @@ namespace Sample14 public void Build(IWorkflowBuilder builder) { builder - .StartWith(activity => activity.TextExpression = new PlainTextExpression("Hello World!")); + .StartWith(activity => activity.TextExpression = new Literal("Hello World!")); } } } \ No newline at end of file diff --git a/samples/Sample15/HelloWorldWorkflow.cs b/samples/Sample15/HelloWorldWorkflow.cs index bd020c67d..940675e76 100644 --- a/samples/Sample15/HelloWorldWorkflow.cs +++ b/samples/Sample15/HelloWorldWorkflow.cs @@ -10,7 +10,7 @@ namespace Sample15 public void Build(IWorkflowBuilder builder) { builder - .StartWith(activity => activity.TextExpression = new PlainTextExpression("Hello World!")); + .StartWith(activity => activity.TextExpression = new Literal("Hello World!")); } } } \ No newline at end of file diff --git a/src/activities/Elsa.Activities.Timers/Activities/CronEvent.cs b/src/activities/Elsa.Activities.Timers/Activities/CronEvent.cs index 3f766f77a..8163722d9 100644 --- a/src/activities/Elsa.Activities.Timers/Activities/CronEvent.cs +++ b/src/activities/Elsa.Activities.Timers/Activities/CronEvent.cs @@ -23,7 +23,7 @@ namespace Elsa.Activities.Timers.Activities public WorkflowExpression CronExpression { - get => GetState(() => new PlainTextExpression("* * * * *")); + get => GetState(() => new Literal("* * * * *")); set => SetState(value); } diff --git a/src/core/Elsa.Core/Activities/Workflows/TriggerWorkflow.cs b/src/core/Elsa.Core/Activities/Workflows/TriggerWorkflow.cs index 9bdb99fb8..6e53e8228 100644 --- a/src/core/Elsa.Core/Activities/Workflows/TriggerWorkflow.cs +++ b/src/core/Elsa.Core/Activities/Workflows/TriggerWorkflow.cs @@ -23,7 +23,7 @@ namespace Elsa.Activities.Workflows public WorkflowExpression ActivityType { - get => GetState(() => new PlainTextExpression("")); + get => GetState(() => new Literal("")); set => SetState(value); } @@ -35,7 +35,7 @@ namespace Elsa.Activities.Workflows public WorkflowExpression CorrelationId { - get => GetState(() => new PlainTextExpression(Guid.NewGuid().ToString())); + get => GetState(() => new Literal(Guid.NewGuid().ToString())); set => SetState(value); } diff --git a/src/core/Elsa.Core/Expressions/PlainTextExpression.cs b/src/core/Elsa.Core/Expressions/Literal.cs similarity index 62% rename from src/core/Elsa.Core/Expressions/PlainTextExpression.cs rename to src/core/Elsa.Core/Expressions/Literal.cs index 781854c15..1a67de48c 100644 --- a/src/core/Elsa.Core/Expressions/PlainTextExpression.cs +++ b/src/core/Elsa.Core/Expressions/Literal.cs @@ -1,16 +1,16 @@ -namespace Elsa.Expressions -{ - public class PlainTextExpression : WorkflowExpression - { - public PlainTextExpression(string expression) : base(PlainTextEvaluator.SyntaxName, expression) - { - } - } - - public class PlainTextExpression : PlainTextExpression - { - public PlainTextExpression(string expression) : base(expression) - { - } - } +namespace Elsa.Expressions +{ + public class PlainTextExpression : WorkflowExpression + { + public PlainTextExpression(string expression) : base(PlainTextEvaluator.SyntaxName, expression) + { + } + } + + public class Literal : PlainTextExpression + { + public Literal(string expression) : base(expression) + { + } + } } \ No newline at end of file