⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 facadebean.java

📁 数据库管理系统
💻 JAVA
字号:
package appgdzc.model;

import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import javax.rmi.PortableRemoteObject;
import appgdzc.tools.InitContext;
import java.sql.Date;
import java.util.Collection;
import javax.naming.Context;

public class facadeBean implements SessionBean {
    SessionContext sessionContext;
    public TZcxxRemoteHome zcxxRemotehome = null;
    public TZcxxRemote zcxxRemote = null;

    public TInoutRemoteHome inoutRemotehome = null;
    public TInoutRemote inoutRemote = null;

    public TZcwxRemoteHome zcwxRemotehome = null;
    public TZcwxRemote zcwxRemote = null;

    public TZczjRemoteHome zczjRemotehome = null;
    public TZczjRemote zczjRemote = null;

    private InitContext initContext = new InitContext();
    private Context context = null;
    public void ejbCreate() throws CreateException {
        try{
            context = initContext.getinitialContext();
            Object objectRef = context.lookup("TZcxxRemote");
            zcxxRemotehome = (TZcxxRemoteHome)PortableRemoteObject.narrow(objectRef,TZcxxRemoteHome.class);
            objectRef = context.lookup("TInoutRemote");
            inoutRemotehome = (TInoutRemoteHome)PortableRemoteObject.narrow(objectRef,TInoutRemoteHome.class);
            objectRef = context.lookup("TZcwxRemote");
            zcwxRemotehome = (TZcwxRemoteHome)PortableRemoteObject.narrow(objectRef,TZcwxRemoteHome.class);
            objectRef = context.lookup("TZczjRemote");
            zczjRemotehome = (TZczjRemoteHome)PortableRemoteObject.narrow(objectRef,TZczjRemoteHome.class);

        }catch(Exception e){
            e.printStackTrace();
        }
    }

    public void ejbRemove() {
    }

    public void ejbActivate() {
        try{
            context = initContext.getinitialContext();
            Object objectRef = context.lookup("TZcxxRemote");
            zcxxRemotehome = (TZcxxRemoteHome)PortableRemoteObject.narrow(objectRef,TZcxxRemoteHome.class);
            objectRef = context.lookup("TInoutRemote ");
            inoutRemotehome = (TInoutRemoteHome)PortableRemoteObject.narrow(objectRef,TInoutRemoteHome.class);
            objectRef = context.lookup("TZcwxRemote");
            zcwxRemotehome = (TZcwxRemoteHome)PortableRemoteObject.narrow(objectRef,TZcwxRemoteHome.class);
            objectRef = context.lookup("TZczjRemote");
            zczjRemotehome = (TZczjRemoteHome)PortableRemoteObject.narrow(objectRef,TZczjRemoteHome.class);

        }catch(Exception e){
            e.printStackTrace();
        }
    }

    public void ejbPassivate() {
    }


    public void setSessionContext(SessionContext sessionContext) {
        this.sessionContext = sessionContext;
    }
//通过调用实体bean进行数据库存盘操作.
    public String InsertTzcc(Obj_zcxx oz) {
        String zcbh;
        String zcmc;
        String zcxh;
        Integer zcsl;
        Double zcdj;
        Double zcje;
        String sccj;
        Date scrq;
        Date gmrq;
        String gmr;
        String sts;
        int kcsl;
        zcbh = oz.getzcBh();
        zcmc = oz.getZcmc();
        zcxh = oz.getZcxh();
        zcsl = oz.getZcsl();
        zcdj = oz.getZcdj();
        zcje = oz.getZcje();
        sccj = oz.getSccj();
        scrq = oz.getScrq();
        gmrq = oz.getGmrq();
        gmr = oz.getGmr();
        sts = oz.getSts();
        kcsl = oz.getKcsl();
        java.lang.Boolean flag;
        try{
            zcxxRemote = zcxxRemotehome.create(zcbh,zcmc,zcxh,zcsl,zcdj,zcje,sccj,scrq,gmrq,gmr,sts,kcsl);
            return zcxxRemote.getZcbh();
        }catch(CreateException ce){
            ce.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException re){
            return null;
        }

    }
//通过参数获得对应的数据数值
    public Obj_zcxx getZcxxInfo(String zcbh) {
        Obj_zcxx obj_zcxx = new Obj_zcxx();

        try{
//            zcxxRemote = zcxxRemotehome.findByPrimaryKey(zcbh);
            zcxxRemote = zcxxRemotehome.findByzcbh(zcbh);
            obj_zcxx.setzcBh(zcxxRemote.getZcbh());
            obj_zcxx.setZcmc(zcxxRemote.getZcmc());
            obj_zcxx.setZcxh(zcxxRemote.getZcxh());
            obj_zcxx.setZcsl(zcxxRemote.getZcsl());
            obj_zcxx.setZcdj(zcxxRemote.getZcdj());
            obj_zcxx.setZcje(zcxxRemote.getZcje());
            obj_zcxx.setSccj(zcxxRemote.getSccj());
            obj_zcxx.setScrq(zcxxRemote.getScrq());
            obj_zcxx.setGmr(zcxxRemote.getGmr());
            obj_zcxx.setGmrq(zcxxRemote.getGmrq());
            obj_zcxx.setSts(zcxxRemote.getSts());
            obj_zcxx.setKcsl(zcxxRemote.getKcsl());
            return obj_zcxx;
        }catch(javax.ejb.FinderException finder){
            finder.getMessage();
            finder.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException remote){
            remote.printStackTrace();
            return null;
        }
    }
// 通过参数Obj_zcxx 进行数据表更新
    public void UpdateTzcc(Obj_zcxx zcxx) {
        try{
            if (zcxxRemote instanceof TZcxxRemote){
                zcxxRemote.setZcmc(zcxx.getZcmc());
                zcxxRemote.setZcdj(zcxx.getZcdj());
                zcxxRemote.setZcje(zcxx.getZcje());
                zcxxRemote.setZcsl(zcxx.getZcsl());
                zcxxRemote.setSccj(zcxx.getSccj());
                zcxxRemote.setScrq(zcxx.getScrq());
                zcxxRemote.setGmr(zcxx.getGmr());
                zcxxRemote.setGmrq(zcxx.getGmrq());
                zcxxRemote.setSts(zcxx.getSts());
                zcxxRemote.setKcsl(zcxx.getKcsl());
            }else{
                System.out.println("没有找到对象:zcxxRemote");
            }


        }catch(java.rmi.RemoteException re){
            re.printStackTrace();
        }
    }
//获得所有的实体bean对象
    //String zcbh, String zcmc,String zcxh,Integer zcsl, Double zcdj, Double zcje,
//            String sccj, Date scrq, Date gmrq, String gmr
  public Collection getAllzcxx() {
    Collection result = new java.util.Vector();
    try{
      Collection c1 = zcxxRemotehome.findAllZcxx();
      Object o1[] = c1.toArray();
      for(int i = 0; i < o1.length; i++){
        zcxxRemote = (TZcxxRemote)o1[i];
        result.add(new Obj_zcxx(zcxxRemote.getZcbh(),zcxxRemote.getZcmc(),zcxxRemote.getZcxh(),
                                zcxxRemote.getZcsl(),zcxxRemote.getZcdj(),zcxxRemote.getZcje(),
                                zcxxRemote.getSccj(),zcxxRemote.getScrq(),zcxxRemote.getGmrq(),
                                zcxxRemote.getGmr(),zcxxRemote.getSts(),zcxxRemote.getKcsl()));

      }
    }catch(javax.ejb.FinderException find){
      return null;
    }catch(java.rmi.RemoteException remote){
      return null;
    }
    return result;
  }

    public String  InsertZcinout(Obj_inout objinout) {
        try{
            inoutRemote = inoutRemotehome.create(objinout);
            return inoutRemote.getLsh();
        }catch(CreateException ce){
            ce.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException re){
            return null;
        }
    }

    public Obj_inout  getZcinoutInfo(String lsh) {
        Obj_inout objinout = new Obj_inout();
        try{
            inoutRemote = inoutRemotehome.findByPrimaryKey(lsh);
            objinout.setZcbh(inoutRemote.getZcbh());
            objinout.setJcsl(inoutRemote.getJcsl());
            objinout.setJcbm(inoutRemote.getJcbm());
            objinout.setJyr(inoutRemote.getJyr());
            objinout.setJcrq(inoutRemote.getJcrq());
            objinout.setGhsl(inoutRemote.getGhsl());
            objinout.setGhrq(inoutRemote.getGhrq());
            objinout.setWhsl(inoutRemote.getWhsl());
            return objinout;
        }catch(javax.ejb.FinderException finder){
            finder.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException remote){
            remote.printStackTrace();
            return null;
        }
    }

    public void UpdateZcinout(Obj_inout objinout) {
        try{
            inoutRemote.setZcbh(objinout.getZcbh());
            inoutRemote.setJcsl(objinout.getJcsl());
            inoutRemote.setJcbm(objinout.getJcbm());
            inoutRemote.setJyr(objinout.getJyr());
            inoutRemote.setJcrq(objinout.getJcrq());
            inoutRemote.setGhsl(objinout.getGhsl());
            inoutRemote.setGhrq(objinout.getGhrq());
            inoutRemote.setWhsl(objinout.getWhsl());

        }catch(java.rmi.RemoteException remote){
            remote.printStackTrace();
        }
    }

    public Collection getAllinout() {
        Collection result = new java.util.Vector();
        try {
            Collection c1 = inoutRemotehome.findAllInout();
            Object o1[] = c1.toArray();
            for (int i = 0; i < o1.length; i++) {
                inoutRemote = (TInoutRemote) o1[i];
                result.add(new Obj_inout(inoutRemote.getLsh(),inoutRemote.getZcbh(),inoutRemote.getJcsl(),
                           inoutRemote.getJcbm(),inoutRemote.getJyr(),
                           inoutRemote.getJcrq(),inoutRemote.getGhsl(),
                           inoutRemote.getGhrq(),inoutRemote.getWhsl()));
            }
        } catch (javax.ejb.FinderException find) {
            return null;
        } catch (java.rmi.RemoteException remote) {
            return null;
        }
        return result;
    }

    public String InsertZcwx(Obj_zcwx objzcwx) {
        try{
            zcwxRemote = zcwxRemotehome.create(objzcwx);
            return zcwxRemote.getLsh();
        }catch(CreateException ce){
            ce.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException re){
            return null;
        }
    }

    public Obj_zcwx getZcwxInfo(String lsh) {
        Obj_zcwx objzcwx = new Obj_zcwx();
        try{
            zcwxRemote = zcwxRemotehome.findByPrimaryKey(lsh);
            objzcwx.setZcbh(zcwxRemote.getZcbh());
            objzcwx.setZcmc(zcwxRemote.getZcmc());
            objzcwx.setSxrq(zcwxRemote.getSxrq());
            objzcwx.setGzyy(zcwxRemote.getGzyy());
            objzcwx.setWxrq(zcwxRemote.getWxrq());
            objzcwx.setWxzk(zcwxRemote.getWxzk());
            objzcwx.setPjmc(zcwxRemote.getPjmc());
            objzcwx.setWxfy(zcwxRemote.getWxfy());

            return objzcwx;
        }catch(javax.ejb.FinderException finder){
            finder.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException remote){
            remote.printStackTrace();
            return null;
        }

    }

    public void UpdateZcwx(Obj_zcwx objzcwx) {
        try{
            zcwxRemote.setZcbh(objzcwx.getZcbh());
            zcwxRemote.setZcmc(objzcwx.getZcmc());
            zcwxRemote.setSxrq(objzcwx.getSxrq());
            zcwxRemote.setGzyy(objzcwx.getGzyy());
            zcwxRemote.setWxrq(objzcwx.getWxrq());
            zcwxRemote.setWxzk(objzcwx.getWxzk());
            zcwxRemote.setPjmc(objzcwx.getPjmc());
            zcwxRemote.setWxfy(objzcwx.getWxfy());


       }catch(java.rmi.RemoteException remote){
           remote.printStackTrace();
       }

    }

    public Collection  getAllzcwx() {
        Collection result = new java.util.Vector();
        try {
            Collection c1 = zcwxRemotehome.findAllzcwx();
            Object o1[] = c1.toArray();
            for (int i = 0; i < o1.length; i++) {
                zcwxRemote = (TZcwxRemote) o1[i];

                result.add(new Obj_zcwx(zcwxRemote.getLsh(),
                                        zcwxRemote.getZcbh(),zcwxRemote.getZcmc(),
                                        zcwxRemote.getSxrq(),zcwxRemote.getGzyy(),
                                        zcwxRemote.getWxrq(),zcwxRemote.getWxzk(),
                                        zcwxRemote.getPjmc(),zcwxRemote.getWxfy()));

            }
        } catch (javax.ejb.FinderException find) {
            return null;
        } catch (java.rmi.RemoteException remote) {
            return null;
        }
        return result;

    }
    public String InsertZczj(Obj_zczj objzczj) {
        try{
            zczjRemote = zczjRemotehome.create(objzczj);
            return zczjRemote.getZcbh();
        }catch(CreateException ce){
            ce.printStackTrace();
            return null;
        }catch(java.rmi.RemoteException re){
            return null;
        }
    }

    public Obj_zczj getZczjInfo(String zcbh) {
        Obj_zczj objzczj = new Obj_zczj();
         try{
             zczjRemote = zczjRemotehome.findByPrimaryKey(zcbh);
             objzczj.setZcbh(zczjRemote.getZcbh());
             objzczj.setZcmc(zczjRemote.getZcmc());
             objzczj.setZjff(zczjRemote.getZjff());
             objzczj.setZcyz(zczjRemote.getZcyz());
             objzczj.setJcl(zczjRemote.getJcl());
             objzczj.setZjnx(zczjRemote.getZjnx());
             objzczj.setZjl(zczjRemote.getZjl());
             objzczj.setZje(zczjRemote.getZje());

             return objzczj;
         }catch(javax.ejb.FinderException finder){
             finder.printStackTrace();
             return null;
         }catch(java.rmi.RemoteException remote){
             remote.printStackTrace();
             return null;
         }

    }

    public void UpdateZczj(Obj_zczj objzczj) {
        try{
            zczjRemote.setZcmc(objzczj.getZcmc());
            zczjRemote.setZjff(objzczj.getZjff());
            zczjRemote.setZcyz(objzczj.getZcyz());
            zczjRemote.setJcl(objzczj.getJcl());
            zczjRemote.setZjnx(objzczj.getZjnx());
            zczjRemote.setZjl(objzczj.getZjl());
            zczjRemote.setZje(objzczj.getZje());
       }catch(java.rmi.RemoteException remote){
           remote.printStackTrace();
       }
    }

    public Collection  getAllzczj() {
        Collection result = new java.util.Vector();
        try {
            Collection c1 = zczjRemotehome.findAllzczj();
            Object o1[] = c1.toArray();
            for (int i = 0; i < o1.length; i++) {
                zczjRemote = (TZczjRemote) o1[i];
                result.add(new Obj_zczj(zczjRemote.getZcbh(),zczjRemote.getZcmc(),
                                        zczjRemote.getZjff(),zczjRemote.getZcyz(),
                                        zczjRemote.getJcl(),zczjRemote.getZjnx(),
                                        zczjRemote.getZjl(),zczjRemote.getZje()));
            }
        } catch (javax.ejb.FinderException find) {
            return null;
        } catch (java.rmi.RemoteException remote) {
            return null;
        }
        return result;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -