Coverage Report - org.mule.routing.ExpressionMessageInfoMapping
 
Classes in this File Line Coverage Branch Coverage Complexity
ExpressionMessageInfoMapping
0%
0/14
0%
0/2
1.143
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.routing;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.MuleMessage;
 11  
 import org.mule.api.context.MuleContextAware;
 12  
 import org.mule.api.routing.MessageInfoMapping;
 13  
 
 14  
 /**
 15  
  * TODO
 16  
  */
 17  0
 public class ExpressionMessageInfoMapping implements MessageInfoMapping, MuleContextAware
 18  
 {
 19  
     private String correlationIdExpression;
 20  
     private String messageIdExpression;
 21  
     private MuleContext muleContext;
 22  
 
 23  
     public void setMuleContext(MuleContext context)
 24  
     {
 25  0
         this.muleContext = context;
 26  0
     }
 27  
 
 28  
     public String getMessageId(MuleMessage message)
 29  
     {
 30  0
         return (String) muleContext.getExpressionManager().evaluate(getMessageIdExpression(), message, true);
 31  
     }
 32  
 
 33  
     public String getCorrelationId(MuleMessage message)
 34  
     {
 35  0
         String id = (String) muleContext.getExpressionManager().evaluate(getCorrelationIdExpression(), message, false);
 36  0
         if (id == null)
 37  
         {
 38  0
             id = getMessageId(message);
 39  
         }
 40  0
         return id;
 41  
     }
 42  
 
 43  
     public String getCorrelationIdExpression()
 44  
     {
 45  0
         return correlationIdExpression;
 46  
     }
 47  
 
 48  
     public void setCorrelationIdExpression(String correlationIdExpression)
 49  
     {
 50  0
         this.correlationIdExpression = correlationIdExpression;
 51  0
     }
 52  
 
 53  
     public String getMessageIdExpression()
 54  
     {
 55  0
         return messageIdExpression;
 56  
     }
 57  
 
 58  
     public void setMessageIdExpression(String messageIdExpression)
 59  
     {
 60  0
         this.messageIdExpression = messageIdExpression;
 61  0
     }
 62  
 }