View Javadoc
1   /*
2    * Copyright 2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.platform.camel.core.adapter.builder;
17  
18  import org.apache.camel.Processor;
19  import org.openehealth.ipf.platform.camel.core.support.builder.RouteBuilderSupport;
20  
21  
22  /**
23   * @author Martin Krasser
24   */
25  public class TransmogrifierRouteBuilder extends RouteBuilderSupport {
26  
27      @Override
28      public void configure() throws Exception {
29          from("direct:transmogrifier-test-1")
30          .process(transmogrifier1());
31  
32          from("direct:transmogrifier-test-2")
33          .process(transmogrifier2());
34  
35          from("direct:transmogrifier-test-3")
36          .process(transmogrifier3());
37      
38          from("direct:transmogrifier-test-4")
39          .process(transmogrifier1());
40      }
41  
42      private Processor transmogrifier1() {
43      	// take input from body (no params)
44          return helper.transmogrifier("testTransmogrifier");
45      }
46      
47      private Processor transmogrifier2() {
48      	// take input from body (static params)
49          return helper.transmogrifier("testTransmogrifier")
50              .staticParams(" eats", " mice");
51      }
52      
53      private Processor transmogrifier3() {
54      	// take input from foo header (static params)
55          return helper.transmogrifier("testTransmogrifier")
56              .staticParams(" likes", " fish")
57              .input(header("foo"));
58      }
59      
60  }