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 */
017package org.apache.camel.model.dataformat;
018
019import javax.xml.bind.annotation.XmlAccessType;
020import javax.xml.bind.annotation.XmlAccessorType;
021import javax.xml.bind.annotation.XmlAttribute;
022import javax.xml.bind.annotation.XmlRootElement;
023
024import org.apache.camel.CamelContext;
025import org.apache.camel.model.DataFormatDefinition;
026import org.apache.camel.spi.DataFormat;
027import org.apache.camel.spi.RouteContext;
028
029
030/**
031 * Represents a Barcode DataFormat {@link org.apache.camel.spi.DataFormat}
032 *
033 * @version 
034 */
035@XmlRootElement(name = "barcode")
036@XmlAccessorType(XmlAccessType.FIELD)
037
038public class BarcodeDataFormat extends DataFormatDefinition {
039    @XmlAttribute
040    private Integer width;
041    @XmlAttribute
042    private Integer height;
043    @XmlAttribute
044    private String imageType;
045    @XmlAttribute
046    private String barcodeFormat;
047    
048    public BarcodeDataFormat() {
049        super("barcode");
050    }
051    
052    @Override
053    protected DataFormat createDataFormat(RouteContext routeContext) {
054        DataFormat barcodeFormat = super.createDataFormat(routeContext);
055
056        return barcodeFormat;
057    }
058
059    @Override
060    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
061        if (width != null) {
062            setProperty(camelContext, dataFormat, "width", width);
063        }
064
065        if (height != null) {
066            setProperty(camelContext, dataFormat, "height", height);
067        } 
068        
069        if (imageType != null) {
070            setProperty(camelContext, dataFormat, "barcodeImageType", imageType);
071        }
072
073        if (barcodeFormat != null) {
074            setProperty(camelContext, dataFormat, "barcodeFormat", barcodeFormat);
075        }
076       
077    }
078    
079    public Integer getWidth() {
080        return width;
081    }
082
083    public void setWidth(Integer width) {
084        this.width = width;
085    }
086
087    public Integer getHeight() {
088        return height;
089    }
090
091    public void setHeight(Integer height) {
092        this.height = height;
093    }
094
095    public String getImageType() {
096        return imageType;
097    }
098
099    public void setImageType(String imageType) {
100        this.imageType = imageType;
101    }
102
103    public String getBarcodeFormat() {
104        return barcodeFormat;
105    }
106
107    public void setBarcodeFormat(String barcodeFormat) {
108        this.barcodeFormat = barcodeFormat;
109    }
110
111}