You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jeffrey ai <jf...@gmail.com> on 2007/12/20 19:21:52 UTC

T5: A web flow idea on T5

Hi All,

As you may know or not, T5 doesn't have a web flow framework like the Spring
one yet. Howard mentioned he may add it in the next release. However, our
project cannot wait for that, therefore I have created a simple one on T5.
Here is the general idea, your comments are **GREATLY APPRECIATED**.

* A WEBFLOW, which is a normal T5 page,  injects and contains PAGEs that
will used in this web flow.

* A PAGE can be used in multiple web flows. A PAGE doesn't have any
knowledge of where to go for next page, previous page or cancel link. All
these knowledge are dynamically populated from a WEBFLOW. 

* A WEBFLOW has some data objects, which are annotated as @ApplicationState.
PAGEs can pick up whatever data they are interested, display them or
populate them.

* A typical request flow is like below:
=> An action request is post back to a PAGE
=> A PAGE will do some validation and populate the data 
=> In onSuccess() method in PAGE, it returns the next page link, which is
populated by WEBFLOW and pointing to an action in WEBFLOW
=> A redirection action request is sent to WEBFLOW
=> Some onPage() method in WEBFLOW is triggered. It could review the data ,
decide the next page and return it.
=> A page render request is sent to the next page

Here are some code snippets :
============
public class WebFlow
{
	@InjectPage
	private WebFlowPage1 page1;

	@InjectPage
	private WebFlowPage2 page2;

	@InjectPage
	private WebFlowPage3 page3;

	@SuppressWarnings("unused")
	@ApplicationState
	private SomeObject data;
	...

	private Object onStartPage()
	{
		page1.setNextPage( componentResources.createActionLink( "page1", false )
);
		page1.setCancelLink( componentResources.createActionLink( "cancel", false
) );

		return page1;
	}

	@SuppressWarnings("unused")
	private Object onPage1()
	{
		page2.setNextPage( componentResources.createActionLink( "page2", false )
);
		page2.setPreviousPage( componentResources.createActionLink( "startPage",
false ) );
		page2.setCancelLink( componentResources.createActionLink( "cancel", false
) );

		return this.page2;
	}

	@SuppressWarnings("unused")
	private Object onCancel()
	{
		this.clean();
		return this;
	}
	....
}

public class WebFlowPage1 {
	@Persist
	private Link nextPage;

	@Persist
	private Link previousPage;

	@Persist
	private Link cancelLink;

	@ApplicationState
	private SomeObject data;

	@SuppressWarnings("unused")
	private Link onSuccess()
	{
		....
		return nextPage;
	}

	@SuppressWarnings("unused")
	private Object onActionFromPreviousPage()
	{
		...
		return previousPage;
	}

	@SuppressWarnings("unused")
	private Object onActionFromCancel()
	{
		return cancelLink;
	}

	...
}

--------------------

Cheers,
Jeffrey Ai
-- 
View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14442158.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by jeffrey ai <jf...@gmail.com>.
I don't like xml configurations of web flow in Spring too.

Also another beauty to make a WEBFLOW  a normal T5 page is : multiple
WEBFLOWs can be easily composed together to create a new WEBFLOW,  just as
described in the Composite pattern of GOF.

Cheers,
Jeffrey Ai


Joshua Jackson-3 wrote:
> 
> I like the idea of web-flow like yours. It's not as complicated as
> Spring Webflow which involves a helluava xml. I hope tapestry5 would
> adopt your idea.
> 
> Cheers.
> 
> On 12/21/07, jeffrey ai <jf...@gmail.com> wrote:
>>
>> Hi All,
>>
>> As you may know or not, T5 doesn't have a web flow framework like the
>> Spring
>> one yet. Howard mentioned he may add it in the next release. However, our
>> project cannot wait for that, therefore I have created a simple one on
>> T5.
>> Here is the general idea, your comments are **GREATLY APPRECIATED**.
>>
>> * A WEBFLOW, which is a normal T5 page,  injects and contains PAGEs that
>> will used in this web flow.
>>
>> * A PAGE can be used in multiple web flows. A PAGE doesn't have any
>> knowledge of where to go for next page, previous page or cancel link. All
>> these knowledge are dynamically populated from a WEBFLOW.
>>
>> * A WEBFLOW has some data objects, which are annotated as
>> @ApplicationState.
>> PAGEs can pick up whatever data they are interested, display them or
>> populate them.
>>
>> * A typical request flow is like below:
>> => An action request is post back to a PAGE
>> => A PAGE will do some validation and populate the data
>> => In onSuccess() method in PAGE, it returns the next page link, which is
>> populated by WEBFLOW and pointing to an action in WEBFLOW
>> => A redirection action request is sent to WEBFLOW
>> => Some onPage() method in WEBFLOW is triggered. It could review the data
>> ,
>> decide the next page and return it.
>> => A page render request is sent to the next page
> 
> -- 
> I'm a coder not a drag-n-dropper
> 
> Blog: http://joshuajava.wordpress.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14459192.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by jeffrey ai <jf...@gmail.com>.
Thanks for you comments!

>>in the step 3 if the specific page would to render the next link, what 
>>is the purpose of the WEBFLOW?
The next link in that page is populated by the WEBFLOW, so it's still the
WEBFLOW controlling the navigation.

>>isn't the WEBFLOW'S responsibility to take care of the page navigation?? 
>>well i guess the purpose of having such a concept of WEBFLOW is to 
>>decouple the Page presentation from the page navigation
Exactly!

>>so upon the action, say delete from MyCRUD, MyCRUD::onDelete() was first 
>>invoked , then the return value (business specific, could be an Object 
>>to be deleted) will be pass to DeleteConfirmationPage, and invoke the 
>>@EntryPoint confirmationEntry
The point is: in some case, the next page needs to by dynamically decided by
the WEBFLOW based on the data user inputed so far. Therefore, the next page
might not be DeleteConfirmationPage, but some other page. Spring framework
webflow supports this by configuring conditions in XML. But I think using
Java is much simpler and testable to developers.

Cheers,
Jeffrey Ai


-- 
View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14459461.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by Dapeng <da...@spiralcomms.com>.
in the step 3 if the specific page would to render the next link, what 
is the purpose of the WEBFLOW?

isn't the WEBFLOW'S responsibility to take care of the page navigation?? 
well i guess the purpose of having such a concept of WEBFLOW is to 
decouple the Page presentation from the page navigation

it would be better to refine current framework as

each page there are some Entry Points and Exit Points, all are normal 
methods, (perhaps using annotation to give a name)

class MyCRUD{
   
    @EntryPoint(name='myEntry')
    void onEnter(long objectID){
       // do some setup
    }

    @ExitPoint(name='delete')
    Object onDelete(long objectID){
       // .........
    }

    @ExitPoint(name='update')
    Object onUpdate(long objectID){
       //...........
    }
}


then

the WEBFLOW looks like


class WebFlow{

    public static void contributePageFlow(PageFlowConfig config){

       config.getPage(MyCRUD.class).setExit('delete', 
DeleteConfirmationPage.class, 'confirmationEntry');
       config.getPage(MyCRUD.class).setExit('update', 
UpdateConfirmationPage.class, 'confirmationEntry');
    }

}



so upon the action, say delete from MyCRUD, MyCRUD::onDelete() was first 
invoked , then the return value (business specific, could be an Object 
to be deleted) will be pass to DeleteConfirmationPage, and invoke the 
@EntryPoint confirmationEntry

so the actual work flow is taken care of by the WebFlow

and for the actionMethods, there are no more page navigation related 
objects to be returned





Joshua Jackson wrote:
> I like the idea of web-flow like yours. It's not as complicated as
> Spring Webflow which involves a helluava xml. I hope tapestry5 would
> adopt your idea.
>
> Cheers.
>
> On 12/21/07, jeffrey ai <jf...@gmail.com> wrote:
>   
>> Hi All,
>>
>> As you may know or not, T5 doesn't have a web flow framework like the Spring
>> one yet. Howard mentioned he may add it in the next release. However, our
>> project cannot wait for that, therefore I have created a simple one on T5.
>> Here is the general idea, your comments are **GREATLY APPRECIATED**.
>>
>> * A WEBFLOW, which is a normal T5 page,  injects and contains PAGEs that
>> will used in this web flow.
>>
>> * A PAGE can be used in multiple web flows. A PAGE doesn't have any
>> knowledge of where to go for next page, previous page or cancel link. All
>> these knowledge are dynamically populated from a WEBFLOW.
>>
>> * A WEBFLOW has some data objects, which are annotated as @ApplicationState.
>> PAGEs can pick up whatever data they are interested, display them or
>> populate them.
>>
>> * A typical request flow is like below:
>> => An action request is post back to a PAGE
>> => A PAGE will do some validation and populate the data
>> => In onSuccess() method in PAGE, it returns the next page link, which is
>> populated by WEBFLOW and pointing to an action in WEBFLOW
>> => A redirection action request is sent to WEBFLOW
>> => Some onPage() method in WEBFLOW is triggered. It could review the data ,
>> decide the next page and return it.
>> => A page render request is sent to the next page
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by Joshua Jackson <jo...@gmail.com>.
I like the idea of web-flow like yours. It's not as complicated as
Spring Webflow which involves a helluava xml. I hope tapestry5 would
adopt your idea.

Cheers.

On 12/21/07, jeffrey ai <jf...@gmail.com> wrote:
>
> Hi All,
>
> As you may know or not, T5 doesn't have a web flow framework like the Spring
> one yet. Howard mentioned he may add it in the next release. However, our
> project cannot wait for that, therefore I have created a simple one on T5.
> Here is the general idea, your comments are **GREATLY APPRECIATED**.
>
> * A WEBFLOW, which is a normal T5 page,  injects and contains PAGEs that
> will used in this web flow.
>
> * A PAGE can be used in multiple web flows. A PAGE doesn't have any
> knowledge of where to go for next page, previous page or cancel link. All
> these knowledge are dynamically populated from a WEBFLOW.
>
> * A WEBFLOW has some data objects, which are annotated as @ApplicationState.
> PAGEs can pick up whatever data they are interested, display them or
> populate them.
>
> * A typical request flow is like below:
> => An action request is post back to a PAGE
> => A PAGE will do some validation and populate the data
> => In onSuccess() method in PAGE, it returns the next page link, which is
> populated by WEBFLOW and pointing to an action in WEBFLOW
> => A redirection action request is sent to WEBFLOW
> => Some onPage() method in WEBFLOW is triggered. It could review the data ,
> decide the next page and return it.
> => A page render request is sent to the next page

-- 
I'm a coder not a drag-n-dropper

Blog: http://joshuajava.wordpress.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by jeffrey ai <jf...@gmail.com>.
> Be careful that the problem might not just be having 2 flows at a time for
the
> same session but also managing interrupted flows.
I think allowing one flow interrupted by another will introduce lots of
complexity and consume more resources. I don't think our users need it, so I
don't want to overkill.  If a new flow starts, we will just simply clear the
existing flow.

> I don't know much of T5 internals: is the persistence strategy system
> so different from T4?
I start to use Tapestry since T5, so I don't know the difference. 
But I guess it's similar. Basically you could choose the session strategy,
flash strategy or client strategy.
Also fields annotated as ApplicationState are shared by all pages. 
You could find more information in the T5 guide.

Cheers,
Jeffrey Ai



Martino Piccinato wrote:
> 
> This is exactly what I'm trying to do for T4, it should be quite
> inobstrusive so that conversational persistence could be added without
> much effort and be easily used with your pattern if needed. Be careful
> that the problem might not just be having 2 flows at a time for the
> same session but also managing interrupted flows.
> I don't know much of T5 internals: is the persistence strategy system
> so different from T4?
> 
> As far as I can see (am I wrong?) there's nothing in your webflow
> pattern that couldn't be also done in a T4 application as it does not
> imply any new feature so I think I could test everything in T4
> 
> Martino
> 
> On Dec 24, 2007 8:25 PM, jeffrey ai <jf...@gmail.com> wrote:
>>
>> You are right.
>> So far, I think our system will only support one flow at a time. This
>> will
>> not only make design simpler, but also save some server resource. If a
>> system needs to support multiple flows, it needs a way to identify
>> different
>> flows in one session.
>>
>> Cheers,
>> Jeffrey Ai
>>
>>
>>
>> Martino Piccinato wrote:
>> >
>> > Hi,
>> >
>> > I think the only thing missing is a "conversational" type of
>> > persistence. That is that the application state object and persisted
>> > link shouldn't be simply session persisted but at least session
>> > persisted with some kind of "flowkey" prefix so to separate different
>> > flows. This would imply also some flow/conversation control mechanism
>> > (start/restart/reset/getFlowKey) I was planning to do a similar thing
>> > for T4.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14490669.html
>>
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14516419.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by Martino Piccinato <ma...@gmail.com>.
This is exactly what I'm trying to do for T4, it should be quite
inobstrusive so that conversational persistence could be added without
much effort and be easily used with your pattern if needed. Be careful
that the problem might not just be having 2 flows at a time for the
same session but also managing interrupted flows.
I don't know much of T5 internals: is the persistence strategy system
so different from T4?

As far as I can see (am I wrong?) there's nothing in your webflow
pattern that couldn't be also done in a T4 application as it does not
imply any new feature so I think I could test everything in T4

Martino

On Dec 24, 2007 8:25 PM, jeffrey ai <jf...@gmail.com> wrote:
>
> You are right.
> So far, I think our system will only support one flow at a time. This will
> not only make design simpler, but also save some server resource. If a
> system needs to support multiple flows, it needs a way to identify different
> flows in one session.
>
> Cheers,
> Jeffrey Ai
>
>
>
> Martino Piccinato wrote:
> >
> > Hi,
> >
> > I think the only thing missing is a "conversational" type of
> > persistence. That is that the application state object and persisted
> > link shouldn't be simply session persisted but at least session
> > persisted with some kind of "flowkey" prefix so to separate different
> > flows. This would imply also some flow/conversation control mechanism
> > (start/restart/reset/getFlowKey) I was planning to do a similar thing
> > for T4.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14490669.html
>
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by jeffrey ai <jf...@gmail.com>.
You are right. 
So far, I think our system will only support one flow at a time. This will
not only make design simpler, but also save some server resource. If a
system needs to support multiple flows, it needs a way to identify different
flows in one session.

Cheers,
Jeffrey Ai


Martino Piccinato wrote:
> 
> Hi,
> 
> I think the only thing missing is a "conversational" type of
> persistence. That is that the application state object and persisted
> link shouldn't be simply session persisted but at least session
> persisted with some kind of "flowkey" prefix so to separate different
> flows. This would imply also some flow/conversation control mechanism
> (start/restart/reset/getFlowKey) I was planning to do a similar thing
> for T4.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14490669.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: A web flow idea on T5

Posted by Martino Piccinato <ma...@gmail.com>.
Hi,

I think the only thing missing is a "conversational" type of
persistence. That is that the application state object and persisted
link shouldn't be simply session persisted but at least session
persisted with some kind of "flowkey" prefix so to separate different
flows. This would imply also some flow/conversation control mechanism
(start/restart/reset/getFlowKey) I was planning to do a similar thing
for T4.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org