// 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:   AdLinkAction.java

package com.keyshop.shop.content.controller;

import com.keyshop.pub.controller.PubAction;
import com.keyshop.pub.model.PubBean;
import com.keyshop.pub.util.*;
import com.keyshop.shop.channel.util.ChannelConst;
import com.keyshop.shop.content.model.AdLink;
import java.io.File;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
import org.apache.struts.upload.FormFile;

// Referenced classes of package com.keyshop.shop.content.controller:
//            AdLinkForm

public class AdLinkAction extends PubAction
{

    public AdLinkAction()
    {
    }

    public void initClassName()
    {
        boClass = "com.keyshop.shop.content.bo.AdLinkBO";
        beanClass = "com.keyshop.shop.content.model.AdLink";
        formBeanClass = "com.keyshop.shop.content.controller.AdLinkForm";
    }

    protected String getSelectSQL()
    {
        String sql = " from AdLink as AdLink where 1=1";
      
        return sql;
    }

    private String updateAdElement(FormFile file, String oldFileName, String type)
    {
        shopResource = ResourceBundle.getBundle("resources.shopapplication", new Locale("", ""));
        String fileRoot = shopResource.getString(ChannelConst.ADFILE_PATH_ROOT);
        try
        {
            if(file != null && file.getFileData() != null && file.getFileSize() > 0)
            {
                String currentPath = fileRoot + DateUtil.getNoSpSysDateString() + "/" + type + "/";
                String currentRoot = httpRequest.getRealPath(currentPath);
                String oldFilePath = "";
                if(!StringUtil.isEmpty(oldFileName))
                    oldFilePath = httpRequest.getRealPath(oldFileName);
                File currentFolder = new File(currentRoot);
                if(!currentFolder.exists())
                    currentFolder.mkdirs();
                if(file != null && file.getFileSize() > 0)
                {
                    String fileName = FileUtil.updateImageFileByRelPath(currentRoot + "/", oldFilePath, file);
                    return currentPath + fileName;
                }
            }
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        return "";
    }

    protected boolean isObjectExisted(PubBean bean)
    {
        return false;
    }
}
