KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.*;
17 import java.sql.*;
18
19 import org.compiere.util.*;
20
21 /**
22  * Client Info Model
23  *
24  * @author Jorg Janke
25  * @version $Id: MClientInfo.java,v 1.1 2003/10/21 05:35:16 jjanke Exp $
26  */

27 public class MClientInfo extends X_AD_ClientInfo
28 {
29     /**
30      * Get Client Info
31      * @param ctx context
32      * @param AD_Client_ID id
33      * @return Client Info
34      */

35     public static MClientInfo get (Properties ctx, int AD_Client_ID)
36     {
37         MClientInfo retValue = null;
38         String JavaDoc sql = "SELECT * FROM AD_ClientInfo WHERE AD_Client_ID=?";
39         PreparedStatement pstmt = null;
40         try
41         {
42             pstmt = DB.prepareStatement (sql);
43             pstmt.setInt (1, AD_Client_ID);
44             ResultSet rs = pstmt.executeQuery ();
45             if (rs.next ())
46                 retValue = new MClientInfo (ctx, rs);
47             rs.close ();
48             pstmt.close ();
49             pstmt = null;
50         }
51         catch (SQLException ex)
52         {
53             s_log.error ("get", ex);
54         }
55         try
56         {
57             if (pstmt != null)
58                 pstmt.close ();
59         }
60         catch (SQLException ex1)
61         {
62         }
63         pstmt = null;
64         //
65
return retValue;
66     } // get
67

68     /** Logger */
69     private static Logger s_log = Logger.getCLogger (MClientInfo.class);
70
71     /**
72      * Load Constructor
73      * @param ctx context
74      * @param rs result set
75      */

76     public MClientInfo (Properties ctx, ResultSet rs)
77     {
78         super (ctx, rs);
79     } // MClientInfo
80

81     private MAcctSchema m_acctSchema = null;
82
83     /**
84      * Get primary Acct Schema
85      * @return acct schema
86      */

87     public MAcctSchema getMAcctSchema1()
88     {
89         if (m_acctSchema == null && getC_AcctSchema1_ID() != 0)
90             m_acctSchema = new MAcctSchema (getCtx(), getC_AcctSchema1_ID());
91         return m_acctSchema;
92     } // getMAcctSchema1
93

94     /**
95      * Get Default Accounting Currency
96      * @return currency or 0
97      */

98     public int getC_Currency_ID()
99     {
100         if (m_acctSchema == null)
101             getMAcctSchema1();
102         if (m_acctSchema != null)
103             return m_acctSchema.getC_Currency_ID();
104         return 0;
105     } // getC_Currency_ID
106

107 } // MClientInfo
108
Popular Tags