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

package com.keyshop.shop.content.controller;

import com.keyshop.pub.controller.PubAction;
import com.keyshop.pub.controller.PubForm;
import com.keyshop.pub.model.PubBean;
import com.keyshop.pub.util.StringUtil;
import com.keyshop.shop.content.bo.InquisitionBO;
import com.keyshop.shop.content.model.Inquisition;
import com.keyshop.shop.content.model.InquisitionResult;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;

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

public class InquisitionAction extends PubAction
{

    public InquisitionAction()
    {
    }

    public String getSelectSQL()
    {
        String sql = " ";
        return sql;
    }

    public void initClassName()
    {
        boClass = "com.keyshop.shop.content.bo.InquisitionBO";
        beanClass = "com.keyshop.shop.content.model.Inquisition";
        formBeanClass = "com.keyshop.shop.content.controller.InquisitionForm";
    }

    public ActionForward performAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    {
        try
        {
            ((InquisitionForm)form).clear();
            PubForm _tmp = (PubForm)form;
            ((PubForm)form).setPageType("add");
        }
        catch(Exception e)
        {
            generalError(request, e);
            e.printStackTrace();
            return mapping.findForward("fail");
        }
        return mapping.findForward("add");
    }

    public ActionForward performSave(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    {
        try
        {
           
        }
        catch(Exception e)
        {
            generalError(request, e);
            e.printStackTrace();
            return mapping.findForward("fail");
        }
        return mapping.findForward("add");
    }

    public ActionForward performAddchild(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    {
        try
        {
           
        }
        catch(Exception e)
        {
            generalError(httpRequest, e);
            e.printStackTrace();
            return map.findForward("fail");
        }
        request.setAttribute("addChild", "true");
        return map.findForward("add");
    }

    public ActionForward performRemovechild(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    {
        try
        {
         

        }
        catch(Exception e)
        {
            generalError(httpRequest, e);
            e.printStackTrace();
            return map.findForward("fail");
        }
        return map.findForward("add");
    }

    public ActionForward performEditchild(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    {
        String childid = request.getParameter("childid");
        request.setAttribute("eidtChild", childid);
        return map.findForward("add");
    }

    public ActionForward performUpdatechild(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    {
        try
        {
            
        }
        catch(Exception e)
        {
            generalError(httpRequest, e);
            e.printStackTrace();
            return map.findForward("fail");
        }
        return map.findForward("add");
    }

    public boolean isInArray(String id, String idarray[])
    {
        if(idarray == null || idarray.length <= 0 || id == null || id.trim().length() <= 0)
            return false;
        for(int i = 0; i < idarray.length; i++)
            if(id.equals(idarray[i]))
                return true;

        return false;
    }

    protected boolean isObjectExisted(PubBean bean)
    {
        if(bean != null)
        {
            Inquisition Inquisition = (Inquisition)bean;
           
        }
        return false;
    }

    private boolean childExisted(InquisitionResult child)
    {
        InquisitionForm pform = (InquisitionForm)thisform;
        Inquisition bean = (Inquisition)pform.getBean();
        Collection childs = bean.getChildList();
        if(childs != null && childs.size() > 0)
        {
            for(Iterator it = childs.iterator(); it.hasNext();)
            {
                InquisitionResult tchild = (InquisitionResult)it.next();
                if(tchild.getName().equals(child.getName()))
                {
                    if(tchild.getTempId() != null && tchild.getTempId().length() > 0 && tchild.getTempId().equals(child.getTempId()))
                        return false;
                    return tchild.getId() == null || tchild.getId().length() <= 0 || !tchild.getId().equals(child.getId());
                }
            }

        }
        return false;
    }
}
