View Javadoc
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.module.ibeans.spi;
8   
9   import org.mule.routing.filters.ExpressionFilter;
10  
11  import org.ibeans.api.IBeansException;
12  import org.ibeans.spi.ErrorFilter;
13  
14  /**
15   * An implementation of a {@link org.ibeans.spi.ErrorFilter} that allows for error filter expressions to be configured on
16   * an iBean
17   */
18  public class ErrorExpressionFilter extends ExpressionFilter implements ErrorFilter<MuleResponseMessage>
19  {
20      private String errorCodeExpression;
21  
22      public ErrorExpressionFilter(String evaluator, String customEvaluator, String expression, String errorCodeExpr)
23      {
24          super(evaluator, customEvaluator, expression);
25          if (errorCodeExpr != null && errorCodeExpr.length() > 0)
26          {
27              this.errorCodeExpression = errorCodeExpr;
28          }
29      }
30  
31      public ErrorExpressionFilter(String evaluator, String expression, String errorCodeExpr)
32      {
33          super(evaluator, expression);
34          if (errorCodeExpr != null && errorCodeExpr.length() > 0)
35          {
36              this.errorCodeExpression = errorCodeExpr;
37          }
38      }
39  
40      public ErrorExpressionFilter(String expression)
41      {
42          super(expression);
43      }
44  
45      public ErrorExpressionFilter()
46      {
47          super();
48      }
49  
50      public String getErrorCodeExpression()
51      {
52          return errorCodeExpression;
53      }
54  
55      public String getErrorExpression()
56      {
57          return getExpression();
58      }
59  
60      public String getType()
61      {
62          return getEvaluator();
63      }
64  
65      public boolean accept(MuleResponseMessage object) throws IBeansException
66      {
67          return accept(object.getMessage());
68      }
69  }