Java tutorial
/* * THIS PROGRAM IS GENERATED UNDER LICENSE FROM NEC CORPORATION. * * * $Date: 2011/12/19$ * $Revision: 1.1$ * $Author: hnnc$ * */ package com.jp.systemdirector.projectzero.zab01.ap.logicbean; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.springframework.transaction.annotation.Transactional; import com.jp.systemdirector.projectzero.zab01.ap.data.ContextData; import com.jp.systemdirector.projectzero.zab01.ap.data.SZAB011CSelectInputData; import com.jp.systemdirector.projectzero.zab01.ap.data.SZAB011CSelectResultData; import com.jp.systemdirector.projectzero.zab01.db.dao.ISZAB011CSelectDAO; import com.jp.systemdirector.projectzero.zab01.db.dao.SZAB011CSelectDTO; import com.jp.systemdirector.projectzero.zab01.ap.logicbean.ISZAB011CSelectLogicBean; public class SZAB011CSelectLogicBean implements ISZAB011CSelectLogicBean { private ISZAB011CSelectDAO dao; public ISZAB011CSelectDAO getDao() { return dao; } public void setDao(ISZAB011CSelectDAO dao) { this.dao = dao; } @Transactional public SZAB011CSelectResultData execute(ContextData context, SZAB011CSelectInputData inputData) { // ????List List<SZAB011CSelectDTO> resultList = new ArrayList<SZAB011CSelectDTO>(); if (context != null) { SZAB011CSelectDTO zDto = new SZAB011CSelectDTO(); zDto.setIN1(context.getProductCd()); // try { resultList = dao.findById(zDto); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } } // DTO?ContextData????PR??? List<ContextData> contextDataList = new ArrayList<ContextData>(); for (SZAB011CSelectDTO zSelectDTO : resultList) { if (zSelectDTO == null) { break; } ContextData contextData = new ContextData(); try { contextData.setProductCd(zSelectDTO.getIN1()); contextData.setQuantity(zSelectDTO.getQUANTITY().toString()); contextData.setModifyCount(zSelectDTO.getMODIFY_COUNT()); contextData.setUpdatedDate(zSelectDTO.getUPDATED_DATE()); contextDataList.add(contextData); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } // ?ListMemberResultData?memberList?? SZAB011CSelectResultData resultData = new SZAB011CSelectResultData(); resultData.setResultList(contextDataList); return resultData; } public SZAB011CSelectResultData getStoringId(ContextData context, SZAB011CSelectInputData inputData) { // ????List List<SZAB011CSelectDTO> resultList = new ArrayList<SZAB011CSelectDTO>(); if (context != null) { SZAB011CSelectDTO zDto = new SZAB011CSelectDTO(); // try { resultList = dao.selectStoringId(zDto); } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } } // DTO?ContextData????PR??? List<ContextData> contextDataList = new ArrayList<ContextData>(); for (SZAB011CSelectDTO zSelectDTO : resultList) { if (zSelectDTO == null) { break; } ContextData contextData = new ContextData(); try { contextData.setStoringId(zSelectDTO.getSTORING_ID()); contextDataList.add(contextData); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } // ?ListMemberResultData?memberList?? SZAB011CSelectResultData resultData = new SZAB011CSelectResultData(); resultData.setResultList(contextDataList); return resultData; } }