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.model;
17  
18  import javax.xml.bind.annotation.XmlAccessType;
19  import javax.xml.bind.annotation.XmlAccessorType;
20  import javax.xml.bind.annotation.XmlElementRef;
21  
22  import static org.apache.camel.builder.ExpressionBuilder.headerExpression;
23  import static org.openehealth.ipf.platform.camel.core.util.Expressions.builderExpression;
24  import static org.openehealth.ipf.platform.camel.core.util.Expressions.headersAndBuilderExpression;
25  import static org.openehealth.ipf.platform.camel.core.util.Expressions.headersExpression;
26  
27  /**
28   * @author Martin Krasser
29   */
30  @XmlAccessorType(XmlAccessType.FIELD)
31  public class ParamsDefinition {
32  
33      @XmlElementRef
34      private final ProcessorAdapterDefinition processorAdapterDefinition;
35  
36      public ParamsDefinition() {
37          this(null);
38      }
39  
40      public ParamsDefinition(ProcessorAdapterDefinition processorAdapterDefinition) {
41          this.processorAdapterDefinition = processorAdapterDefinition;
42      }
43      
44      public ProcessorAdapterDefinition builder() {
45          return processorAdapterDefinition.params(builderExpression());
46      }
47  
48      public ProcessorAdapterDefinition headers() {
49          return processorAdapterDefinition.params(headersExpression());
50      }
51  
52      public ProcessorAdapterDefinition header(String name) {
53          return processorAdapterDefinition.params(headerExpression(name));
54      }
55  
56      public ProcessorAdapterDefinition headersAndBuilder() {
57          return processorAdapterDefinition.params(headersAndBuilderExpression());
58      }
59  
60  }