KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javabb > infra > PMHelper


1 package org.javabb.infra;
2
3 import org.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.javabb.transaction.PrivMsgTransaction;
6
7
8 /*
9  * Copyright 2004 JavaFree.org
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */

23 public class PMHelper {
24
25     private static final Log LOG = LogFactory.getLog(UserContext.class);
26     
27     private PrivMsgTransaction pmTrans = null;
28     public void setPmTransaction(PrivMsgTransaction pmTrans) {
29         this.pmTrans = pmTrans;
30     }
31     
32     public int getCountMessages() throws Exception JavaDoc{
33         try {
34             return pmTrans.countMsgByUser(UserContext.getContext().getUser());
35         } catch (Exception JavaDoc e) {
36             LOG.debug("Error at getCountMessages " + e.getMessage());
37             return 0;
38         }
39     }
40 }
41
Popular Tags