This project is read-only.

Stateful many end in my flow

Apr 11, 2012 at 7:10 PM
I have this situation:

My workflow state:

Protocollato
Assegnato
Accettato
Respinto
Chiuso

var assegnato = Declare.Step();
var accettato = Declare.Step();
var respinto = Declare.Step();
var chiuso = Declare.Step();

var wf = new StatefulWorkflow<Assegnazione>("Assegnazione WorkFlow");
wf.Yield(Protocollato);
wf.Define(assegnato)
	.Yield(Assegnato)
        .When(x => true).BranchTo(accettato)
        .When(x => true).BranchTo(respinto);
wf.Define(accettato)
        .Yield(Accettato);
wf.Define(chiuso)
        .Yield(Chiuso);
wf.Define(respinto)
	.Yield(Respinto);
Possible Transitions:
From: null, To: Protocollato
From: Protocollato, To: Assegnato
From: Assegnato, To: Accettato
From: Assegnato, To: Respinto
From: Accettato, To: Chiuso
From: Chiuso, To: Respinto
From: Chiuso, To: null
My workflow has two end, possible transactions are:

From: null, To: Protocollato
From: Protocollato, To: Assegnato
From: Assegnato, To: Accettato
From: Assegnato, To: Respinto
From: Respinto To: null
From: Accettato, To: Chiuso
From: Chiuso, To: null

Can i get this?
It's possible stop the flow at several points?
Best Regards Domenico.

Apr 12, 2012 at 1:11 AM
Domenico,

From what I can tell you're workflow is set up correctly. I'm not sure what you're asking, but I think you want to know how to make something useful out of
wf.Define(assegnato)
	.Yield(Assegnato)
        .When(x => true).BranchTo(accettato)
        .When(x => true).BranchTo(respinto);
You'll want to use the overload of .When() that takes two parameters. The second is a dictionary containing information parameters passed in through .Start(). Instead, your workflow step might look like:

wf.Define(assegnato) .Yield(Assegnato) .When(x => x.IsValid).BranchTo(accettato) .When((x, opts) => x.IsValidGiven((bool)opts["featureX"]).BranchTo(respinto);

// then
wf.Start(new X(), new { featureX = true });

I'm not confident that I answered your question, so I'm sorry if I'm way off.

--Tim



On Wed, Apr 11, 2012 at 12:10 PM, domenicopedicini <notifications@codeplex.com> wrote:

From: domenicopedicini

I have this situation:

My workflow state:

Protocollato
Assegnato
Accettato
Respinto
Chiuso

var assegnato = Declare.Step();
var accettato = Declare.Step();
var respinto = Declare.Step();
var chiuso = Declare.Step();

var wf = new StatefulWorkflow<Assegnazione>("Assegnazione WorkFlow");
wf.Yield(Protocollato);
wf.Define(assegnato)
	.Yield(Assegnato)
        .When(x => true).BranchTo(accettato)
        .When(x => true).BranchTo(respinto);
wf.Define(accettato)
        .Yield(Accettato);
wf.Define(chiuso)
        .Yield(Chiuso);
wf.Define(respinto)
	.Yield(Respinto);
Possible Transitions:
From: null, To: Protocollato
From: Protocollato, To: Assegnato
From: Assegnato, To: Accettato
From: Assegnato, To: Respinto
From: Accettato, To: Chiuso
From: Chiuso, To: Respinto
From: Chiuso, To: null
My workflow has two end, possible transactions are:

From: null, To: Protocollato
From: Protocollato, To: Assegnato
From: Assegnato, To: Accettato
From: Assegnato, To: Respinto
From: Respinto To: null
From: Accettato, To: Chiuso
From: Chiuso, To: null

Can i get this?
It's possible stop the flow at several points?
Best Regards Domenico.

Read the full discussion online.

To add a post to this discussion, reply to this email (objectflow@discussions.codeplex.com)

To start a new discussion for this project, email objectflow@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Apr 13, 2012 at 8:56 AM

Hi Tim,

tanks for thi answer

wf.Define(assegnato) .Yield(Assegnato) .When(x => x.IsValid).BranchTo(accettato) .When((x, opts) => x.IsValidGiven((bool)opts["featureX"]).BranchTo(respinto);

Are IsValid() and IsValidGiven(bool x) attribute of object Assegnazione?

This is my statechart

The states are:

Protocollato
Assegnato
Accettato
Respinto
Chiuso

Possible transitions are:

Protocollato 
             --> Assegnato

Assegnato
             --> Respinto
             --> Accettato

Acettato
           --> Assegnato
           --> Chiuso

Respinto
           --> Assegnato
           --> End

Chiuso
          --> End

Possible transitions in objectflow are:

1 - From: null, To: Protocollato
2 - From: Protocollato, To: Assegnato
3 - From: Assegnato, To: Accettato
4 - From: Assegnato, To: Respinto
5 - From: Accettato, To: Chiuso
6 - From: Chiuso, To: Respinto (DELETE)
7 - From: Chiuso, To: null

It's possible to delete transaction 6 (From: Chiuso, To: Respinto) in objectflow?

Thank you in advance

Best regards Domenico.

Apr 13, 2012 at 10:56 PM
Yeah,

It looks like Transition(Chiuso -> Respinto) is already defined correctly, but there appears to be no Transition(Chiuso -> null). For that I would recommend

var assegnato = Declare.Step();
var accettato = Declare.Step();
var respinto = Declare.Step();
var chiuso = Declare.Step();
var end = Declare.Step();

var wf = new StatefulWorkflow<Assegnazione>("Assegnazione WorkFlow");
wf.Yield(Protocollato);
wf.Define(assegnato)
	.Yield(Assegnato)
        .When(x => true).BranchTo(accettato)
        .When(x => true).BranchTo(respinto);
wf.Define(accettato)
        .Yield(Accettato);
wf.Define(chiuso)
        .Yield(Chiuso);
wf.When(x => ...).BranchTo(end);
wf.Define(respinto)
	.Yield(Respinto);
wf.Define(end);

--Tim



On Fri, Apr 13, 2012 at 1:56 AM, domenicopedicini <notifications@codeplex.com> wrote:

From: domenicopedicini

Hi Tim,

tanks for thi answer

wf.Define(assegnato) .Yield(Assegnato) .When(x => x.IsValid).BranchTo(accettato) .When((x, opts) => x.IsValidGiven((bool)opts["featureX"]).BranchTo(respinto);

Are IsValid() and IsValidGiven(bool x) attribute of object Assegnazione?

This is my statechart

The states are:

Protocollato
Assegnato
Accettato
Respinto
Chiuso

Possible transitions are:

Protocollato
--> Assegnato

Assegnato
--> Respinto
--> Accettato

Acettato
--> Assegnato
--> Chiuso

Respinto
--> Assegnato
--> End

Chiuso
--> End

Possible transitions in objectflow are:

1 - From: null, To: Protocollato
2 - From: Protocollato, To: Assegnato
3 - From: Assegnato, To: Accettato
4 - From: Assegnato, To: Respinto
5 - From: Accettato, To: Chiuso
6 - From: Chiuso, To: Respinto (DELETE)
7 - From: Chiuso, To: null

It's possible to delete transaction 6 (From: Chiuso, To: Respinto) in objectflow?

Thank you in advance

Best regards Domenico.

Read the full discussion online.

To add a post to this discussion, reply to this email (objectflow@discussions.codeplex.com)

To start a new discussion for this project, email objectflow@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com