1 14 package org.compiere.model; 15 16 import java.sql.*; 17 import java.util.*; 18 19 import org.compiere.util.*; 20 21 27 public class MProjectTypePhase extends X_C_Phase 28 { 29 public MProjectTypePhase (Properties ctx, int C_Phase_ID) 30 { 31 super (ctx, C_Phase_ID); 32 if (C_Phase_ID == 0) 33 { 34 setSeqNo (0); 38 setStandardQty (Env.ZERO); 39 } 40 } 42 public MProjectTypePhase (Properties ctx, ResultSet rs) 43 { 44 super (ctx, rs); 45 } 47 51 public MProjectTypeTask[] getTasks() 52 { 53 ArrayList list = new ArrayList(); 54 String sql = "SELECT * FROM C_Task WHERE C_Phase_ID=? ORDER BY SeqNo"; 55 PreparedStatement pstmt = null; 56 try 57 { 58 pstmt = DB.prepareStatement(sql); 59 pstmt.setInt(1, getC_ProjectType_ID()); 60 ResultSet rs = pstmt.executeQuery(); 61 while (rs.next()) 62 list.add(new MProjectTypeTask (getCtx(), rs)); 63 rs.close(); 64 pstmt.close(); 65 pstmt = null; 66 } 67 catch (SQLException ex) 68 { 69 log.error("getTasks", ex); 70 } 71 try 72 { 73 if (pstmt != null) 74 pstmt.close(); 75 } 76 catch (SQLException ex1) 77 { 78 } 79 pstmt = null; 80 MProjectTypeTask[] retValue = new MProjectTypeTask[list.size()]; 82 list.toArray(retValue); 83 return retValue; 84 } 86 } | Popular Tags |