KickJava   Java API By Example, From Geeks To Geeks.

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


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 Model
23  *
24  * @author Jorg Janke
25  * @version $Id: MProjectType.java,v 1.2 2003/08/11 05:55:37 jjanke Exp $
26  */

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         /**
33         if (C_ProjectType_ID == 0)
34         {
35             setC_ProjectType_ID (0);
36             setName (null);
37         }
38         **/

39     } // MProjectType
40

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

46     /**
47      * String Representation
48      * @return info
49      */

50     public String JavaDoc toString()
51     {
52         StringBuffer JavaDoc sb = new StringBuffer JavaDoc ("MProjectType[").append(getID())
53             .append("-").append(getName())
54             .append("]");
55         return sb.toString();
56     } // toString
57

58     /*************************************************************************/
59
60     /**
61      * Get Project Type Phases
62      * @return Array of phases
63      */

64     public MProjectTypePhase[] getPhases()
65     {
66         ArrayList list = new ArrayList();
67         String JavaDoc 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         //
94
MProjectTypePhase[] retValue = new MProjectTypePhase[list.size()];
95         list.toArray(retValue);
96         return retValue;
97     } // getPhases
98

99
100 } // MProjectType
101
Popular Tags