I've got a flow in mule, and part of it requires two "payload" objects to be passed - one payload is Customer, and the other is Store.
The current payload of the flow is set to the Store, and that works correctly being passed into my Java transformer class.
I've used Variable (set variable name to Customer) to save my customer payload and am using the property field of my Java Transformer to try and pass that through.
Currently it is passing it through to my Java class as a string - rather than the variable it's supposed to be referencing.
I've filled out the property field in the transformer as: Name: Customer Value: #[variable:Customer] Reference:
Any help would be much appreciated. I am using Mule Studio version 3.4
Code excerpts below
Mule xml
<flow name="query_dos_getStoreStatus" doc:name="query_dos_getStoreStatus">
<choice doc:name="Choice">
<when expression="#[payload.getCustomer()!=null]">
<set-variable variableName="Customer" value="#[payload]" doc:name="Save Customer"/>
<custom-transformer class="ServiceDetailsResponseToStores" doc:name="ServiceDetailsResponseStores"/>
<custom-transformer class="UpdateIdentifyCustomerResponseForStoreStatus" doc:name="Update Customer for Store status">
<spring:property name="Customer" ref="#[variable:Customer]"/>
</custom-transformer>
<remove-variable variableName="GetCustomerDetailsResponse" doc:name="Remove Customer variable"/>
</when>
</choice>
</flow>
Java class
import org.mule.transformer.AbstractTransformer;
import org.mule.transformer.types.DataTypeFactory;
public class UpdateIdentifyCustomerResponseForStoreStatus extends
AbstractTransformer{
public UpdateIdentifyCustomerResponseForStoreStatus()
{
super();
this.registerSourceType(DataTypeFactory.create(Store.class));
this.setReturnDataType(DataTypeFactory.create(IdentifyCustomerResponseEnvelope.class));
}
protected Object _customer;
public Object getCustomer()
{
return this._customer;
}
public void setCustomer(Object _customer)
{
this._customer = _customer;
}
public Object doTransform(Object payload, String outputEncoding)
{
if(payload instanceof Store && _customer instanceof IdentifyCustomerResponseEnvelope)
{
Store store = (Store)payload;
IdentifyCustomerResponseEnvelope customer = (IdentifyCustomerResponseEnvelope)_customer;
//changes to customer
return customer;
}
return this._customer;
}
}