You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leszek Gawron <ou...@vip.net.pl> on 2003/04/06 19:51:10 UTC

Nested actions in action-sets

Has anyone tried lately to use action set with nested action? This is a piece
of code I use: 
<map:action-sets>
    <map:action-set name="process-route">
        <map:act type="form-validator" action="show-route"/>
        <map:act type="form-validator" action="route-change">
	        <map:act type="serverpages" src="action/route-change.xsp"/>
        </map:act>
        <map:act type="form-validator" action="route-add-contractor">
            <map:act type="serverpages" src="action/route-add-contractor.xsp"/>
        </map:act>
        <map:act type="form-validator" action="route-close">
            <map:act type="serverpages" src="action/route-close.xsp"/>
        </map:act>
    </map:action-set>
</map:action-sets>

<!-- later on -->
<map:match pattern="content/*">
    <map:select type="request-parameter">
        <map:parameter name="parameter-name" value="visited"/>
        <map:when test="1">
            <map:act set="process-route">
                <map:parameter name="descriptor" value="data/{1}-form-descriptor.xml"/>
                <map:parameter name="validate-set" value="main"/>
                <map:aggregate element="content">
                    <map:part src="cocoon:/form/{../1}"/>
                    <map:part src="cocoon:/data/{../1}"/>
                </map:aggregate>
                <map:serialize/>
            </map:act>
        </map:when>
    </map:select>
    <map:aggregate element="content">
        <map:part src="cocoon:/form/{1}"/>
    </map:aggregate>
    <map:serialize/>
</map:match>

The problem is that when request is being made the user receives the page that
denotes that the particular action from action set is being executed and
action succeeds but little investigation shows that nested action does not get
executed ( for example action/route-add-contractor.xsp )
When I prepare the action set like this:

<map:action-sets>
    <map:action-set name="process-route">
        <map:act type="form-validator" action="show-route"/>
        <map:act type="serverpages" src="action/route-change.xsp" action="route-change"/>
        <map:act type="serverpages" src="action/route-add-contractor.xsp" action="route-add-contractor"/>
        <map:act type="serverpages" src="action/route-close.xsp" action="route-close"/>
    </map:action-set>
</map:action-sets>

all actions execute properly so this must be the case with nesting actions in
action sets.

Best regards
	LG
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Re: Nested actions in action-sets

Posted by Leszek Gawron <ou...@vip.net.pl>.
On wto, kwi 08, 2003 at 03:51:17 +0200, Sylvain Wallez wrote:
> Vadim Gritsenko wrote:
> 
> >Leszek Gawron wrote:
> >
> >>On pon, kwi 07, 2003 at 09:56:19 -0400, Vadim Gritsenko wrote:
> >>
> >>>Related bug:
> >>>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9835
> >>>  
> >>
> >>Sorry for reposting the known issue. What does your comment mean?:
> >>------- Additional Comments From Vadim Gritsenko 2002-09-21 04:16 
> >>-------
> >>Blocking 2.1 release
> >
> >It means that no 2.1 release should be made without fixing the issue.
> >
> >>The problem is almost 10 months old. Is there a chance for a fix?
> >
> >Send in a patch. Attach it to the mentioned bug.
> >
> >>I'd like to look into myself but have no idea where to start.
> >
> >
> >Somewhere in the treeprocessor. 
> 
> Dig, and dig, and dig ;-)
> 
> Seriously, I wasn't aware of this behaviour to be correct in the 
> compiled sitemap engine. I'll take care of fixing this for the release...
I have already started digging but the problem is too big for me. The
ActionsetNodeBuilder and ActionSetNode have to be completely rewritten as
action set configuration is a set of flat arrays and not a tree. I do not know
cocoon from the inside well enough to produce valuable code.
	LG
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Re: Nested actions in action-sets

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Vadim Gritsenko wrote:

> Leszek Gawron wrote:
>
>> On pon, kwi 07, 2003 at 09:56:19 -0400, Vadim Gritsenko wrote:
>>
>>> Related bug:
>>> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9835
>>>   
>>
>> Sorry for reposting the known issue. What does your comment mean?:
>> ------- Additional Comments From Vadim Gritsenko 2002-09-21 04:16 
>> -------
>> Blocking 2.1 release
>
> It means that no 2.1 release should be made without fixing the issue.
>
>> The problem is almost 10 months old. Is there a chance for a fix?
>
> Send in a patch. Attach it to the mentioned bug.
>
>> I'd like to look into myself but have no idea where to start.
>
>
> Somewhere in the treeprocessor. 

Dig, and dig, and dig ;-)

Seriously, I wasn't aware of this behaviour to be correct in the 
compiled sitemap engine. I'll take care of fixing this for the release...

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Re: Nested actions in action-sets

Posted by Vadim Gritsenko <va...@verizon.net>.
Leszek Gawron wrote:

>On pon, kwi 07, 2003 at 09:56:19 -0400, Vadim Gritsenko wrote:
>  
>
>>Related bug:
>>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9835
>>    
>>
>Sorry for reposting the known issue. What does your comment mean?: 
>
>------- Additional Comments From Vadim Gritsenko 2002-09-21 04:16 -------
>
>Blocking 2.1 release
>

It means that no 2.1 release should be made without fixing the issue.


>The problem is almost 10 months old. Is there a chance for a fix?
>

Send in a patch. Attach it to the mentioned bug.


>I'd like to look into myself but have no idea where to start.
>

Somewhere in the treeprocessor.

Vadim



Re: Nested actions in action-sets

Posted by Leszek Gawron <ou...@vip.net.pl>.
On pon, kwi 07, 2003 at 09:56:19 -0400, Vadim Gritsenko wrote:
> Related bug:
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9835
Sorry for reposting the known issue. What does your comment mean?: 

------- Additional Comments From Vadim Gritsenko 2002-09-21 04:16 -------

Blocking 2.1 release

The problem is almost 10 months old. Is there a chance for a fix?
I'd like to look into myself but have no idea where to start.
	LG
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Re: Nested actions in action-sets

Posted by Vadim Gritsenko <va...@verizon.net>.
Leszek Gawron wrote:

>On nie, kwi 06, 2003 at 10:46:45 +0200, Sylvain Wallez wrote:
>  
>
>>Leszek Gawron wrote:
>>
>>    
>>
>>>Has anyone tried lately to use action set with nested action? This is a 
>>>piece
>>>of code I use: 
>>><map:action-sets>
>>>  <map:action-set name="process-route">
>>>      <map:act type="form-validator" action="show-route"/>
>>>      <map:act type="form-validator" action="route-change">
>>>	        <map:act type="serverpages" src="action/route-change.xsp"/>
>>>      </map:act>
>>>      <map:act type="form-validator" action="route-add-contractor">
>>>          <map:act type="serverpages" 
>>>          src="action/route-add-contractor.xsp"/>
>>>      </map:act>
>>>      <map:act type="form-validator" action="route-close">
>>>          <map:act type="serverpages" src="action/route-close.xsp"/>
>>>      </map:act>
>>>  </map:action-set>
>>></map:action-sets>
>>>
>>>
>>>      
>>>
>>Nested actions in action-sets aren't allowed, and I'm suprised the 
>>sitemap engine accepted the above. I'll take a look at it so that it 
>>refuses this kind of construct.
>>    
>>
>Not to look far: 
>cocoon-home/src/blocks/databases/samples/tutorial/sitemap.xmap:
>

Related bug:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9835

Vadim



Re: Nested actions in action-sets

Posted by Leszek Gawron <ou...@vip.net.pl>.
On nie, kwi 06, 2003 at 10:46:45 +0200, Sylvain Wallez wrote:
> Leszek Gawron wrote:
> 
> >Has anyone tried lately to use action set with nested action? This is a 
> >piece
> >of code I use: 
> ><map:action-sets>
> >   <map:action-set name="process-route">
> >       <map:act type="form-validator" action="show-route"/>
> >       <map:act type="form-validator" action="route-change">
> >	        <map:act type="serverpages" src="action/route-change.xsp"/>
> >       </map:act>
> >       <map:act type="form-validator" action="route-add-contractor">
> >           <map:act type="serverpages" 
> >           src="action/route-add-contractor.xsp"/>
> >       </map:act>
> >       <map:act type="form-validator" action="route-close">
> >           <map:act type="serverpages" src="action/route-close.xsp"/>
> >       </map:act>
> >   </map:action-set>
> ></map:action-sets>
> > 
> >
> 
> Nested actions in action-sets aren't allowed, and I'm suprised the 
> sitemap engine accepted the above. I'll take a look at it so that it 
> refuses this kind of construct.
Not to look far: 
cocoon-home/src/blocks/databases/samples/tutorial/sitemap.xmap:
 <map:action-sets>
  <map:action-set name="process">
   <map:act type="form" action="Create Department">
     <map:parameter name="validate-set" value="add"/>
     <map:act type="dbAdd"/>
   </map:act>
   <map:act type="form" action="Update Department">
     <map:parameter name="validate-set" value="update"/>
     <map:act type="dbUpd"/>
   </map:act>
   <map:act type="dbDel" action="Delete Department"/>
   <map:act type="form" action="Create Employee">
     <map:parameter name="validate-set" value="add"/>
     <map:act type="dbAdd"/>
   </map:act>
   <map:act type="form" action="Update Employee">
     <map:parameter name="validate-set" value="update"/>
     <map:act type="dbUpd"/>
   </map:act>
   <map:act type="dbDel" action="Delete Employee"/>
  </map:action-set>
 </map:action-sets>

In my case the solution wouldn't be nice but is quite simple: 
I make 2 action sets. One is just a form validator with different rules for
each action. The second is the actual action (route change, route add, route
close). I call the first action set and then nest in the second call to the
second action set. Every action in my case contains of validation and actual
action but the problem is: just a little more complicated thing and this wouldn't
work. So either I create unmaintainable mess in the sitemap with
request-parameter selectors and a lot of code duplication or I wait till flow
gets stabilized. One worse than another.

Wouldn't it be possible to allow nested actions in action sets? Of course the
problem is passing parameters but having no such opportunity is worse than
having all nested actions sharing the same parameters.

	LG
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Re: Nested actions in action-sets

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Leszek Gawron wrote:

>Has anyone tried lately to use action set with nested action? This is a piece
>of code I use: 
><map:action-sets>
>    <map:action-set name="process-route">
>        <map:act type="form-validator" action="show-route"/>
>        <map:act type="form-validator" action="route-change">
>	        <map:act type="serverpages" src="action/route-change.xsp"/>
>        </map:act>
>        <map:act type="form-validator" action="route-add-contractor">
>            <map:act type="serverpages" src="action/route-add-contractor.xsp"/>
>        </map:act>
>        <map:act type="form-validator" action="route-close">
>            <map:act type="serverpages" src="action/route-close.xsp"/>
>        </map:act>
>    </map:action-set>
></map:action-sets>
>  
>

Nested actions in action-sets aren't allowed, and I'm suprised the 
sitemap engine accepted the above. I'll take a look at it so that it 
refuses this kind of construct.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }