|
|
Parameter Map and complex types
Hi,
How do we specificy complex types in the ParameterMap. For instance:
public class A implements Serializable { private B b;
public B getB() { return b; } public void setB (B b) { this.b = b; }
}
public class B implements Serializable { private String id public String getId() { return id; } public void setId (String id) { this.id = id; }
}
Now if we are in a FlowExecutionTest and A is the form backing object, how do we set B in the parameter map?
public void testSubmitARegistration () {
startFlow();
MockParameterMap parameters = new MockParameterMap(); parameters (quot;bquot;, ????); }
Is this invalid usage? Do we need to use custom types or tell the ParameterMap how to map the value to a data type?
Thanks in advance for any help,
John Brinnand
ParameterMaps are String/String's.
AttributeMaps are String/Objects.
ParameterMap is used to provide an abstraction for external context parameters, e.g. from or Portlet request parameters.
AttributeMap is used both for external context attributes, but moreso for internal attributes -- including all the scopes, as well as flow execution input attributes. When you launch a flow execution in a tesr environment you can actually pass that execution input in a attribute map. That map may have entries whose values are strongly typed.
In a production environment, an AttributeMapper can be set on the FlowExecutor to map between generic request parameters and a flow execution nput attrbute map. This mapper could apply a type conversion if necessary during the mapping process. See RequestParameterInputMapper in executor package for more info.
In your case, the parameters are coming into the flow as external context request parameters. If you'd like to bind those paramters to form backing objects, you can use a FormAction to do that which can apply a type conversion during the data binding operation. See sellitem for an example.
Keith
Many thanks for the info. Naturally I have a few questions but will do some testing first.
Best,
John |
|