KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.math.*;
19 import java.io.*;
20
21 import org.compiere.util.*;
22
23 /**
24  * Advertisement Model
25  *
26  * @author Jorg Janke
27  * @version $Id: MAdvertisement.java,v 1.1 2003/08/31 06:48:59 jjanke Exp $
28  */

29 public class MAdvertisement extends X_W_Advertisement
30 {
31     /**
32      * Default Constructor
33      * @param ctx context
34      * @param W_Advertisement_ID id
35      */

36     public MAdvertisement (Properties ctx, int W_Advertisement_ID)
37     {
38         super (ctx, W_Advertisement_ID);
39         /** if (W_Advertisement_ID == 0)
40         {
41             setC_BPartner_ID (0);
42             setIsSelfService (false);
43             setName (null);
44             setW_Advertisement_ID (0);
45         }
46         **/

47     } // MAdvertisement
48

49     /**
50      * Load Constructor
51      * @param ctx context
52      * @param rs result set
53      */

54     public MAdvertisement (Properties ctx, ResultSet rs)
55     {
56         super (ctx, rs);
57     } // MAdvertisement
58

59     /** Click Count */
60     private MClickCount m_clickCount = null;
61     /** Counter Count */
62     private MCounterCount m_counterCount = null;
63     /** Sales Rep */
64     private int m_SalesRep_ID = 0;
65
66     /*************************************************************************/
67
68     /**
69      * Get ClickCount
70      * @return Click Count
71      */

72     public MClickCount getMClickCount()
73     {
74         if (getW_ClickCount_ID() == 0)
75             return null;
76         if (m_clickCount == null)
77             m_clickCount = new MClickCount (getCtx(), getW_ClickCount_ID());
78         return m_clickCount;
79     } // MClickCount
80

81     public String JavaDoc getClickTargetURL()
82     {
83         getMClickCount();
84         if (m_clickCount == null)
85             return "-";
86         return m_clickCount.getTargetURL();
87     } // getClickTargetURL
88

89     /**
90      * Get Weekly Count
91      * @return weekly count
92      */

93     public ValueNamePair[] getClickCountWeek ()
94     {
95         getMClickCount();
96         if (m_clickCount == null)
97             return new ValueNamePair[0];
98         return m_clickCount.getCountWeek();
99     } // getClickCountWeek
100

101
102     /**
103      * Get CounterCount
104      * @return Counter Count
105      */

106     public MCounterCount getMCounterCount()
107     {
108         if (getW_CounterCount_ID() == 0)
109             return null;
110         if (m_counterCount == null)
111             m_counterCount = new MCounterCount (getCtx(), getW_CounterCount_ID());
112         return m_counterCount;
113     } // MCounterCount
114

115     /**
116      * Get Sales Rep ID.
117      * (AD_User_ID of oldest BP user)
118      * @return Sales Rep ID
119      */

120     public int getSalesRep_ID()
121     {
122         if (m_SalesRep_ID == 0)
123             m_SalesRep_ID = DB.getSQLValue("SELECT AD_User_ID FROM AD_User "
124                 + "WHERE C_BPartner_ID=? AND IsActive='Y' ORDER BY 1", getC_BPartner_ID());
125         return m_SalesRep_ID;
126     } // getSalesRep_ID
127

128 } // MAdvertisement
129
Free Books   Free Magazines  
Popular Tags