View Javadoc

1   /*
2    * $Id: CopyInboundToOutboundPropertiesTransformerCallback.java 21821 2011-05-06 01:45:34Z ddossot $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.pattern.core.support;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.api.config.MuleProperties;
15  import org.mule.transformer.TransformerTemplate.TransformerCallback;
16  import org.mule.util.StringUtils;
17  
18  public final class CopyInboundToOutboundPropertiesTransformerCallback implements TransformerCallback
19  {
20      public Object doTransform(final MuleMessage message) throws Exception
21      {
22          for (final String inboundPropertyName : message.getInboundPropertyNames())
23          {
24              if (StringUtils.startsWith(inboundPropertyName, MuleProperties.PROPERTY_PREFIX))
25              {
26                  continue;
27              }
28  
29              message.setOutboundProperty(inboundPropertyName, message.getInboundProperty(inboundPropertyName));
30          }
31  
32          return message;
33      }
34  }