Set Spring Webflow attribute dynamically - spring-webflow

I would like to set an attribute dynamically on a view-state like:
<view-state id="any" view="/some.view.xml">
<attribute name="attr" value="#{true ? 'a' : 'b'}"/>
</view-state>
but the value is just taken as plain text. What ways do I have to change 'attr' based on a value in my model.

Explanation
The tag will not work since it only supports plain strings, not EL expressions.
I found a solution by adding info to the variable temp in an action call and evaluating it in the flow with
<on-entry><set name="viewScope.attr" value="flowScope.temp eq 'X' ? 'aaaa' : 'bbbb'" /></on-entry>

Related

how to read variable in assign message policy in APIGee

In Apigee
given a variable in javascript policy, example: var value = 123;
how to get this variable in the assign message policy?
by using {a} in the payload message is not reachable
For the variable to be available for use in any Apigee policy, you first have to make it a flow variable. You can use Apigee's JavaScript Object Model method called context to to this (see ref here). In your JS policy, you have var {some-value} = 123;. To make this available as a flow variable,introduce this line in your JS policy after the variable assignment: context.setVariable("preferred-variable-name", some-value);
You can now access this preferred-variable-name in your AM policy as show below:
<AssignVariable>
<Name>preferred-variable-name</Name>
<Ref>preferred-variable-name</Ref>
</AssignVariable>
Just to mention it is possible to pass the value directly in the policy as well as shown below
<AssignVariable>
<Name>variable_name</Name>
<Value>123</Value>
</AssignVariable>
Read more here.
The <Name> tag can be set to any name.
You have to set the variable in the context object using context.setVariable("variable-name", value);
Refer to this variable in the assign_message policy using {variable-name}.
You can just set the context variable in jsPolicy like this:
context.setVariable("a","123");
You can use it after in any of the policies.
Ex :-
<QueryParams>
<QueryParam name="a">{a}</QueryParam>
</QueryParams>

Sterling Map Editor : Conditional Null Value

I have a XML to XML map on IBM Sterling B2B Integrator map.
I am trying to set an empty tag on a conditional variable as follows:
empty($my_var[counter][1].#my_var);
The result is that on output the empty tag does not show up.
Expected result:
<my_var/>
Is there any way to achieve this?
The XML element should be declared as mandatory in the map.
The PCDATA property should not have Mandatory checked if it is not required, but the element level should be mandatory.
Note also this known problem:
http://www-01.ibm.com/support/docview.wss?uid=swg21701246

Binding multiple value sets to a single extension element

I'm wondering if there is a way to bind multiple value sets to a single extension element in fhir.
Here's an example of what I'm trying to achieve:
<StructureDefinition xmlns="http://hl7.org/fhir">
...
<snapshot>
...
<element>
<path value="Extension.valueCode"/>
...
<type>
<code value="code"/>
</type>
<binding>
<strength value="required"/>
<valueSetUri value="http://stelar.org/valueSet/const-yesNo"/>
</binding>
<binding>
<strength value="required"/>
<valueSetUri value="http://stelar.org/valueSet/missingData"/>
</binding>
</element>
...
</snapshot>
...
</StructureDefinition>
My reason for wanting to bind multiple is that I'm porting data over from a legacy system in which coded values can either come from a value set which represents collected data, or a separate value set which represents missing data. The reason for the split is that sometimes more is known about why the data is missing.
I don't really want to go an create a composite value set for every combination of the missing value set, and the various other value sets if possible, as this will really minimise the reuseability of the value domains.
I'm not sure if I'm just getting my syntax wrong, but I can't find any mention of multiple bindings in the documentation, and which I upload the file in the above (or below format) to simplifier, it only renders one bound domain, which makes me think it is just accepting the last child.
<binding>
<strength value="required"/>
<valueSetUri value="http://stelar.org/valueSet/const-yesNo"/>
<valueSetUri value="http://stelar.org/valueSet/missingData"/>
</binding>
Is there a way to bind multiple value sets? Is there a better way of handling missing data in fhir?
See http://build.fhir.org/elementdefinition-definitions.html#ElementDefinition.binding - binding can only appear once. Creating multiple bindings has a number of practical consequences, so the expectation is that you'll define a single value set that imports the other 2 value sets you might include. Note that you could create a contained value set in the structure definition that imports the two actual value sets, since it has no real existence or meaning outside the structure definition
We are discussing use cases for multiple bindings right now - but it's complicated. If there's more than one binding, is that 'and' or 'or'?

Binding Null Placeholder not translated in view based NSTableView

I have a view based NSTableView whose content is bound to an array controller. I bind one specific text field using objectValue.title. This works fine. I also have set a null placeholder for that binding which is indeed displayed when the value is null. However, it does NOT use translated values of the null placeholder.
The identifier for the placeholder is je1-iU-XEu.ibShadowedIsNilPlaceholder and the corresponding translation is je1-iU-XEu.ibShadowedIsNilPlaceholder" = "Stationsname";.
If I do the same with a cell based table view, it works. Any idea why this is not working?
I'm having this bug today. Seems that Apple didn't care about fixing it.
If you use localized strings, then you might have to dive in the storyboard code and ensure the object ids are matching.
In your storyboard, you will see an element with key "NSNullPlaceholder", wrapped into another one with id "Ds1-Gj-yzu". (See the code below)
Go to your string file and ensure you have something like
"Ds1-Gj-yzu.ibShadowedIsNilPlaceholder" = "Your translation";
WARNING: each time you will change the placeholder value in the storyboard, a new ID is generated, breaking at the same time the localization.
<connections>
<binding destination="TyA-Z9-mxH" id="Ds1-Gj-yzu" keyPath="objectValue.group" name="value">
<dictionary key="options">
<string key="NSNullPlaceholder">Group</string>
</dictionary>
</binding>
</connections>

How can I prevent a client-side data rule workflow from being executed the first time the screen loads?

The problem I have is this: I have a data rule which validates a field against a regex. I've provided both server- and client-side versions of the data rule, and bound them to appropriate dataset events.
The problem is, when I load the screen which contains the record creation form, the field is marked as invalid before the user gets any opportunity to even enter a value. I assume it's something to do with the dataset field being initially bound to the text-edit widget. I only want the validity to be test after the user enters a value, or when the screen is submitted.
How can I prevent the data rule from running when the screen is first loaded?
Update
Here's is my data rule definition:
<data-rule name="{#name}"
factory-class="com.aviarc.framework.datarule.xml.DefaultXMLDataRuleProviderFactoryImpl"
datarule-class="com.aviarc.framework.datarule.workflow.WorkflowDataRule">
<attributes>
<attribute name="field" mandatory="y" type="field"/>
<attribute name="valid-membership-number-regex" default="\d{8}[a-zA-Z\d]" mandatory="n" type="string">
Valid membership number regex:
- \d{8} : match 8 digits
- [a-zA-Z\d] : match any alphanumeric character
</attribute>
</attributes>
<event name="onRowFieldChanged" workflow="workflows/set-membership-number-valid"/>
<event name="onCurrentRowFieldChanged" client-action="actions/set-membership-number-valid"/>
</data-rule>
For field-change events like the ones I'm using, you need explicitly pass through the field that the dataset is bound to, like so:
<event name="onRowFieldChanged" field="{#field}" .../>
<event name="onCurrentRowFieldChanged" field="{#field}" .../>
I think my data rule must have been executing on any field change event, rather than just the field it was bound to.

Resources