001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.example.gae;
018
019 import java.io.Serializable;
020
021 import org.w3c.dom.Document;
022
023 import org.apache.camel.Exchange;
024 import org.apache.camel.Expression;
025
026 public class ReportData implements Serializable {
027
028 private static final long serialVersionUID = -468314239950430108L;
029
030 private String city;
031 private String recipient;
032 private String requestor;
033 private Document weather;
034
035 public ReportData(String city, String recipient, String requestor) {
036 this.city = city;
037 this.recipient = recipient;
038 this.requestor = requestor;
039 }
040
041 public String getCity() {
042 return city;
043 }
044
045 public String getRecipient() {
046 return recipient;
047 }
048
049 public String getRequestor() {
050 return requestor;
051 }
052
053 public Document getWeather() {
054 return weather;
055 }
056
057 public void setWeather(Document weather) {
058 this.weather = weather;
059 }
060
061 public static Expression city() {
062 return new Expression() {
063 public <T> T evaluate(Exchange exchange, Class<T> type) {
064 return type.cast(exchange.getIn().getBody(ReportData.class).getCity());
065 }
066 };
067 }
068
069 public static Expression recipient() {
070 return new Expression() {
071 public <T> T evaluate(Exchange exchange, Class<T> type) {
072 return type.cast(exchange.getIn().getBody(ReportData.class).getRecipient());
073 }
074 };
075 }
076
077 public static Expression requestor() {
078 return new Expression() {
079 public <T> T evaluate(Exchange exchange, Class<T> type) {
080 return type.cast(exchange.getIn().getBody(ReportData.class).getRequestor());
081 }
082 };
083 }
084
085 }