アットウィキロゴ

ouchi > Dustbox > LoginService的な

  1. package ppp.uc002;
  2.  
  3. import java.sql.Connection;
  4. import java.util.List;
  5.  
  6. import ppp.common.ConnectionManager;
  7. import ppp.dao.CustomerSelectDAO;
  8. import ppp.exception.AppRuntimeException;
  9. import ppp.exception.AppSQLException;
  10. import ppp.vo.CustomerVO;
  11.  
  12. public class LoginService {
  13.  
  14. boolean servicePerform(String customerId, String password) throws AppRuntimeException {
  15. Object[] params = {customerId, password};
  16. List<CustomerVO> list = null;
  17. ConnectionManager cm = new ConnectionManager();
  18. Connection conn = null;
  19. try {
  20. conn = cm.getConnection();
  21. CustomerSelectDAO dao = new CustomerSelectDAO(conn);
  22. list = dao.select(params);
  23. } catch (AppSQLException e) {
  24. throw new AppRuntimeException("ItemVOリストの取得に失敗しました", e);
  25. } finally {
  26. cm.closeConnection();
  27. }
  28. if (list != null) {
  29. System.out.println("抽出結果");
  30. for (CustomerVO customer : list) {
  31. System.out.println(customer.toString());
  32. }
  33. }
  34.  
  35. if (list.size() > 0) {
  36. return true;
  37. } else {
  38. return false;
  39. }
  40. }
  41.  
  42.  
  43. public static void main(String[] args) {
  44. LoginService service = new LoginService();
  45. service.servicePerform("000001", "a1a1a1a1");
  46. }
  47.  
  48. }
  49.  
最終更新:2013年06月08日 15:44