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

📄 businesslogic.java

📁 Java实现的图书管理系统
💻 JAVA
字号:
/* * BusinessLogic.java * * Created on 2003年5月9日, 下午9:07 *//** * * @author  administrator */import java.util.*;import java.math.*;import javax.naming.Context;import javax.naming.InitialContext;import javax.rmi.PortableRemoteObject;class BusinessLogic {        private BookSessionHome bookSessionHome;    private BookSession bookSession;        /** Creates a new instance of BusinessLogic */    public BusinessLogic()     {        try {           Context initial = new InitialContext();           Object objref = initial.lookup("java:comp/env/ejb/SimpleBookSession");           bookSessionHome =                (BookSessionHome)PortableRemoteObject.narrow(objref,                                             BookSessionHome.class);                      bookSession = bookSessionHome.create();                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();        }                            }        public Vector getAllBook(String str)    {        Vector v=new Vector();        try {                                v=(Vector)bookSession.getAllBook(str);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }                return v;    }        public Vector getQueryBook(String bookName)    {        Vector v=new Vector();        try {                                v=bookSession.getQueryBook(bookName);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }                return v;            }        public Vector getBorrowedBook(String str)    {        Vector v=new Vector();        try {                                v=bookSession.getBorrowedBook(str);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }                return v;    }        public Vector getQueryBorrowedBook(String str)    {        Vector v=new Vector();        try {                                v=bookSession.getQueryBorrowedBook(str);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }                return v;    }        public int borrowBook(String bookId)    {        int result=0;        try {                                result=bookSession.borrowBook(bookId);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }               return result;    }        public int returnBook(String borrowId)    {        int result=0;        try {                                result=bookSession.returnBook(borrowId);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }               return result;            }        public int checkUser(String userName,String userPassword)    {        int result=0;        try {                                result=bookSession.checkUser(userName, userPassword);                   }catch (Exception ex) {           System.err.println("Caught an exception." );           ex.printStackTrace();       }               return result;    }    }

⌨️ 快捷键说明

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