Asankha,

Thanks a lot for your prompt reply.
sure, I can file a jira for it.

The reason why I like if we can also do a small script evaluation for the
condition (filter) is so that we can use  logic other than regex or xpath
expressions.
For example a script can pick up the system date easily.

Here is a rough example.

<if>
       <script language="js">.<![CDATA[
               var d=new Date();
               var time=d.getHours();
               if (time > 20 )
               {
                  return true ;
               }
        ]]><script>
     <send><endpoint address="" /></send>
</if>
 <else>
   <send><endpoint address="" /></send>
 </else>

regards,

Rajith

On 4/22/07, Asankha C. Perera <[EMAIL PROTECTED]> wrote:

Rajith

The answer to your question is yes, we can do this right now. However we
do not have a 'else if' or 'else' as the conditional mediator is a
'filter' that is able to evaluate a boolean Xpath expression over the
current message, or evaluate the result of an Xpath over the current
message against a regex match. But the inclusion of an 'else' and 'else
if' should not be a difficult task. I was also looking into the
possibility to read the system time as the Xpath 1.0 which we support
does not support it natively. Again this is a minor enhancement. Would
you be interested in filing an enhancement request for either of these?

asankha

Rajith Attapattu wrote:
> Hi folks,
>
> Can we achieve the following functionality (or simillar) using the
> current mediators?
>
> <conditional>
>    <if><script language="js">.........<script>
>       <send><endpoint address="" /></send>
>   </if>
>    <if><script language="js">.........<script>
>       <send><endpoint address="" /></send>
>   </if>
>   <else>
>     <send><endpoint address="" /></send>
>   </else>
> </conditional>
>
> If not, is there a value in having something like this? Here is my use
> case.
>
> <transaction>
>   <cardType>visa<cardType>
>   <cardNumber>12343466<cardNumber>
>   <amount>154.45<amount>
>   <date>.......<date>
> <transaction>
>
> The logic is.
>
> if (amount > 300)
> {
>    send to fraudScreeningService
> }
> else if (time > 21.00 or time < 8.00)
> {
>    send to fraudScreeningService
> }
> else
> {
>    send to my service.
> }
>
> Regards,
>
> Rajith

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to