Routing to a different channels based on condition - spring-integration

I would like to route the message to different channels based on the condition of the property.
Let's say I have score property. If the score is <100 then it goes to "perfectchannel" else it goes to "normalchannel"
Where do I specify the spel expression or condition
<si:router id="serviceRouter" input-channel="serviceRoutingChannel"
expression="payload.score" default-output-channel="badchannel"
resolution-required="false">
<si:mapping value="100" channel="perfectchannel" />
<si:mapping value="<100 ??" channel="normalchannel" />
</si:router>
Appreciate your help on this.

We have a JIRA ticket on the matter, but haven't come up with the solution yet.
Right now you can achieve this behaviour with condition from the expression and providing mapping for true and false and with cascad of the routers:
<si:router id="serviceRouter" input-channel="serviceRoutingChannel"
expression="payload.score == 100">
<si:mapping value="true" channel="perfectChannel" />
<si:mapping value="false" channel="nestedRouterChannel" />
</si:router>
<si:router input-channel="nestedRouterChannel"
expression="payload.score lt 100">
<si:mapping value="true" channel="normalChannel" />
<si:mapping value="false" channel="badChannel" />
</si:router>
UPDATE
Another option to use <recipient-list-router>:
<recipient-list-router id="serviceRouter" input-channel="serviceRoutingChannel">
<recipient selector-expression="payload.score == 100" channel="perfectchannel"/>
<recipient selector-expression="payload.score lt 100" channel="normalchannel"/>
<recipient selector-expression="payload.score gt 100" channel="badchannel"/>
</recipient-list-router>

Related

find xml-nodes by tag with wildcard

I am trying to find any nodes in a xml whos tags start with a certain pattern.
<data>
<general>
<va value="400" /> <!--looking for this "v-tag"-->
<vb value="42" /> <!-- and this one-->
<y value="43" />
</general>
<special>
<va value="100" />
</special>
</data>
I cannot put together the xpath expression. Something like this
xyz = lxml.etree.parse( ... )
vees = xyz.xpath("general/[tag='v*']")
I would like to have vees beeing
vees
Out[64]: [<Element va at 0x....>, <Element vb at 0x...>]
Try changing:
vees = xyz.xpath("general/[tag='v*']")
to
doc.xpath('//general//*[starts-with(name(),"v")]')
and see if it works.

SCXML notation of a target set

How can I define a "legal state configuration" according to https://www.w3.org/TR/scxml/#LegalStateConfigurations. I want to specify a target set (!), not a single target. Target sets can be defined inside the initial attribute of the <scxml> and <state> elements, as well as a target attribute of <transition> elements. But I can't seem to find any example of the notation of more than one state inside the above-mentioned attributes. Do they have to be space-separated? Or array notation according to JavaScript? Or object notation? Or comma-separated?
Thanks for any hints.
But anyway I'd like to know, what I have missed in the standard, to be sure to be interpreter-independent.
Here's a little testcode:
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
<initial>
<transition target="State_3_2 State_4_2" />
</initial>
<parallel id="Parallel_1">
<history id="hist" type="deep">
<transition target="State_1_2 State_2_2" />
</history>
<state id="State_1">
<state id="State_1_1" />
<state id="State_1_2" />
</state>
<state id="State_2">
<state id="State_2_1" />
<state id="State_2_2" />
</state>
</parallel>
<parallel id="Parallel_2">
<transition target="hist" event="switch_hist" />
<state id="State_3">
<state id="State_3_1" />
<state id="State_3_2" />
</state>
<state id="State_4">
<state id="State_4_1" />
<state id="State_4_2" />
</state>
</parallel>
</scxml>
To test: on entry, the states State_3_2 and State_4_2 must be active (initial element executed correctly), after event switch_hist, states State_1_2 and State_2_2 must be active (transitionattribute executed correctly).
If somebody has an interpreter all set other than SCION, could You test this there?
Also the alternative syntax with the first 4 lines replaced by
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="State_3_2 State_4_2">
Thank You.
It is space-separated. You can see an example of this in the SCXML test test suite. For example line 9 of test364.
Hope this helps. Thanks.

with vimgrep - or other vim possibility - how can i get groups of data out of a file?

I'm trying to do a vimgrep on a file in order to get only two attributs with their values out of the xml file.
so far i can get the complete lines and i'd like with the help of groups to have a better display.
:vimgrep key= % | copen
^ I'd like to add to this command the grouping possibility with "( )" ....but without success for the moment.
i'd appreciate your help in order to have a result as explained in the "result expected"
part of the file that I'm working with :
<policy name="Menu_Controls" class="User" displayName="$(string.Menu_Controls)" explainText="$(string.IE_ExplainMenu_Controls)" presentation="$(presentation.Menu_Controls)" key="Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\AllowedControls">
<parentCategory ref="AdminApproved" />
<supportedOn ref="SUPPORTED_IE5" />
<elements>
<boolean id="MCSiMenu" valueName="{275E2FE0-7486-11D0-89D6-00A0C90C9B67}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
<boolean id="PopupMenu_Object" valueName="{7823A620-9DD9-11CF-A662-00AA00C066D2}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
<boolean id="Ikonic_Control" valueName="{F5131C24-E56D-11CF-B78A-444553540000}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
</elements>
</policy>
<policy name="Microsoft_Agent" class="User" displayName="$(string.Microsoft_Agent)" explainText="$(string.IE_Explain_Microsoft_Agent)" presentation="$(presentation.Microsoft_Agent)" key="Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\AllowedControls">
<parentCategory ref="AdminApproved" />
<supportedOn ref="SUPPORTED_IE5" />
<elements>
<boolean id="Microsoft_Agent_Control" valueName="{D45FD31B-5C6E-11D1-9EC1-00C04FD7081F}">
<trueValue>
<decimal value="0" />
</trueValue>
<falseValue>
<decimal value="1" />
</falseValue>
</boolean>
</elements>
</policy>
my expected result :
name="Menu_Controls" key="Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\AllowedControls"
name="Microsoft_Agent" key="Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\AllowedControls"
thanks in advance for your help.
toshi
two cmds could do it:
v/<policy /d
then
%s/.* \(name="[^"]*"\).*\(key="[^"]*"\).*/\1 \2/g
My ExtractMatches plugin provides a :YankMatches command, with which you can extract the matches and put them into a scratch buffer. As a one-liner:
:execute 'YankMatches \<\%(name\|key\)="[^"]*"' | new | put!
Result:
name="Menu_Controls"
key="Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\AllowedControls"
name="Microsoft_Agent"
key="Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\AllowedControls"
If you find :vimgrep and the quickfix list really helpful, you can use the editqf.vim plugin to make the quickfix list of your grep results editable, and then use e.g. a variation of the :%s command given in #Kent's answer to strip off the extraneous stuff.

Ext:BooleanColumn,when editing ,it shows true or false value

I have a grid and there is ext:BooleanColumn inside it,and I put a combobox for editing boolen colum.everything works fine ,except of this one .when I click boolen colum to edit,it shows false or true inside it,
I added a image what I trying to say.
how I can avoid this .thank you
and here is the my code :
<ext:BooleanColumn ID="BooleanColumn1" runat="server" DataIndex="BorcOdendimi" TrueText="odendi" Text="ödenme durumu"
FalseText="odenmedi" >
<Editor>
<ext:ComboBox runat="server" Text="odendi durumu" Editable="false">
<Items>
<ext:ListItem Text="Odendi" Value="1" />
<ext:ListItem Text="Odenmedi" Value="0" />
</Items>
</ext:ComboBox>
</Editor>
</ext:BooleanColumn>
To get it working the Values of the ComboBox's Items should match the values of a BooleanColumn. Currently, true/false (BooleanColumn's values) doesn't match 1/0 (ComboBox Items' values).
You can replace the existing ComboBox's Items with:
<ext:ListItem Text="Odendi" Value="true" Mode="Raw" />
<ext:ListItem Text="Odenmedi" Value="false" Mode="Raw" />
Answered in the Ext.NET forums thread.

Ribbon button should be hidden based on lead status - CRM 2011

I have custom button in lead ribbon. The custom button should be hidden when lead is qualified. How can I do that? Can any one please explain. I appreciate.
You can actually accomplish this entirely with built-in DisplayRule functionality. When a Lead is qualified, the StatusCode property is set to "Qualified", which translates into an OptionSet value of "3". You can check for the value of this property in a ValueRule and display/hide the control appropriately. I can think of two ways to achieve this:
Erik Pool's Visual Ribbon Editor
RibbonXml
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="CompanyName.Form.lead.MainTab.Actions.Sample.CustomAction" Location="Mscrm.Form.lead.MainTab.Actions.Controls._children" Sequence="41">
<CommandUIDefinition>
<Button Id="CompanyName.Form.lead.MainTab.Actions.Sample" Command="CompanyName.Form.lead.MainTab.Actions.Sample.Command" Sequence="29" ToolTipTitle="$LocLabels:CompanyName.Form.lead.MainTab.Actions.Sample.LabelText" LabelText="$LocLabels:CompanyName.Form.lead.MainTab.Actions.Sample.LabelText" ToolTipDescription="$LocLabels:CompanyName.Form.lead.MainTab.Actions.Sample.Description" TemplateAlias="isv" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="CompanyName.Form.lead.MainTab.Actions.Sample.Command">
<EnableRules />
<DisplayRules>
<DisplayRule Id="CompanyName.Form.lead.MainTab.Actions.Sample.Command.DisplayRule.ValueRule" />
</DisplayRules>
<Actions>
<Url Address="http://www.bing.com" />
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="CompanyName.Form.lead.MainTab.Actions.Sample.Command.DisplayRule.ValueRule">
<ValueRule Field="statuscode" Value="3" />
</DisplayRule>
</DisplayRules>
<EnableRules />
</RuleDefinitions>
<LocLabels>
<LocLabel Id="CompanyName.Form.lead.MainTab.Actions.Sample.LabelText">
<Titles>
<Title languagecode="1033" description="Sample" />
</Titles>
</LocLabel>
<LocLabel Id="CompanyName.Form.lead.MainTab.Actions.Sample.Description">
<Titles>
<Title languagecode="1033" description="Sample Description" />
</Titles>
</LocLabel>
</LocLabels>
</RibbonDiffXml>

Resources