// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   ChannelAd.java

package com.keyshop.shop.channel.model;

import com.keyshop.pub.model.PubBean;
import com.keyshop.pub.util.StringUtil;
import com.keyshop.shop.channel.bo.AdContentBO;
import com.keyshop.shop.channel.bo.ChannelJspModelConfigBO;

// Referenced classes of package com.keyshop.shop.channel.model:
//            AdContent, ChannelJspModelConfig

public class ChannelAd extends PubBean
{

    String channelId;
    String configId;
    String adId;
    String category;
    int position;
    boolean display;
    String pageSearchKey;
    AdContent ad;
    ChannelJspModelConfig config;

    public ChannelAd()
    {
        channelId = "";
        configId = "";
        adId = "";
        category = "";
        position = 0;
        display = true;
        pageSearchKey = "";
        ad = null;
        config = null;
    }

    public void clear()
    {
        channelId = "";
        configId = "";
        adId = "";
        category = "";
        position = 0;
        display = true;
        pageSearchKey = "";
        ad = null;
    }

    public ChannelAd copy()
    {
        ChannelAd ad = new ChannelAd();
        ad.setChannelId(channelId);
        ad.setConfigId(configId);
        ad.setAdId(adId);
        ad.setCategory(category);
        ad.setPosition(position);
        ad.setDisplay(display);
        ad.setPageSearchKey(pageSearchKey);
        return ad;
    }

    public String getCategory()
    {
        return category;
    }

    public String getAdId()
    {
        return adId;
    }

    public String getChannelId()
    {
        return channelId;
    }

    public boolean getDisplay()
    {
        return display;
    }

    public int getPosition()
    {
        return position;
    }

    public void setPosition(int position)
    {
        this.position = position;
    }

    public void setDisplay(boolean display)
    {
        this.display = display;
    }

    public void setChannelId(String channelId)
    {
        this.channelId = channelId;
    }

    public void setCategory(String category)
    {
        this.category = category;
    }

    public void setAdId(String adId)
    {
        this.adId = adId;
    }

    public String getPageSearchKey()
    {
        return pageSearchKey;
    }

    public void setPageSearchKey(String pageSearchKey)
    {
        this.pageSearchKey = pageSearchKey;
    }

    public AdContent getAd()
    {
        if(StringUtil.isEmpty(adId))
        {
            ad = null;
            return null;
        }
        if(ad != null)
            return ad;
        try
        {
            AdContentBO bo = new AdContentBO();
            ad = (AdContent)bo.get(adId);
            return ad;
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        return ad;
    }

    public String getConfigId()
    {
        return configId;
    }

    public void setConfigId(String configId)
    {
        this.configId = configId;
    }

    public ChannelJspModelConfig getConfig()
    {
        if(StringUtil.isEmpty(configId))
        {
            config = null;
            return null;
        }
        if(config != null && config.getId().equals(configId))
            return config;
        try
        {
            ChannelJspModelConfigBO bo = new ChannelJspModelConfigBO();
            config = (ChannelJspModelConfig)bo.get(configId);
            return config;
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        return config;
    }
}
