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 MProjectType extends X_C_ProjectType 28 { 29 public MProjectType (Properties ctx, int C_ProjectType_ID) 30 { 31 super (ctx, C_ProjectType_ID); 32 39 } 41 public MProjectType (Properties ctx, ResultSet rs) 42 { 43 super (ctx, rs); 44 } 46 50 public String toString() 51 { 52 StringBuffer sb = new StringBuffer ("MProjectType[").append(getID()) 53 .append("-").append(getName()) 54 .append("]"); 55 return sb.toString(); 56 } 58 59 60 64 public MProjectTypePhase[] getPhases() 65 { 66 ArrayList list = new ArrayList(); 67 String sql = "SELECT * FROM C_Phase WHERE C_ProjectType_ID=? ORDER BY SeqNo"; 68 PreparedStatement pstmt = null; 69 try 70 { 71 pstmt = DB.prepareStatement(sql); 72 pstmt.setInt(1, getC_ProjectType_ID()); 73 ResultSet rs = pstmt.executeQuery(); 74 while (rs.next()) 75 list.add(new MProjectTypePhase (getCtx(), rs)); 76 rs.close(); 77 pstmt.close(); 78 pstmt = null; 79 } 80 catch (SQLException ex) 81 { 82 log.error("getPhases", ex); 83 } 84 try 85 { 86 if (pstmt != null) 87 pstmt.close(); 88 } 89 catch (SQLException ex1) 90 { 91 } 92 pstmt = null; 93 MProjectTypePhase[] retValue = new MProjectTypePhase[list.size()]; 95 list.toArray(retValue); 96 return retValue; 97 } 99 100 } | Popular Tags |