KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > model > MProjectTypePhase


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Smart Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.model;
15
16 import java.sql.*;
17 import java.util.*;
18
19 import org.compiere.util.*;
20
21 /**
22  * Project Type Phase Model
23  *
24  * @author Jorg Janke
25  * @version $Id: MProjectTypePhase.java,v 1.2 2003/08/11 05:55:37 jjanke Exp $
26  */

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         // setC_Phase_ID (0); // PK
35
// setC_ProjectType_ID (0); // Parent
36
// setName (null);
37
setSeqNo (0);
38             setStandardQty (Env.ZERO);
39         }
40     } // MProjectTypePhase
41

42     public MProjectTypePhase (Properties ctx, ResultSet rs)
43     {
44         super (ctx, rs);
45     } // MProjectTypePhase
46

47     /**
48      * Get Project Type Phases
49      * @return Array of phases
50      */

51     public MProjectTypeTask[] getTasks()
52     {
53         ArrayList list = new ArrayList();
54         String JavaDoc 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         //
81
MProjectTypeTask[] retValue = new MProjectTypeTask[list.size()];
82         list.toArray(retValue);
83         return retValue;
84     } // getPhases
85

86 } // MProjectTypePhase
87
Popular Tags