KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > snapper > business > IncrementQueryNumber


1 package org.enhydra.snapper.business;
2
3 /**
4  * @author Milin Radivoj
5  *
6  */

7
8 import org.enhydra.dods.DODS;
9 import org.enhydra.snapper.Log;
10 import org.enhydra.snapper.spec.*;
11 import com.lutris.appserver.server.sql.DBTransaction;
12 import java.sql.Timestamp JavaDoc;
13
14 public class IncrementQueryNumber{
15
16     
17   static synchronized void increment(String JavaDoc siteId)
18      {
19     try {
20        DBTransaction dbTransaction = DODS.getDatabaseManager().createTransaction();
21        
22        SiteList sl = SiteListFactory.getSiteList("org.enhydra.snapper.business.SiteListImpl");
23        Site site = sl.findSiteByID(siteId,dbTransaction);
24       
25        int no = site.getQUERYNR() + 1;
26        site.setQUERYNR(no);
27        site.setLASTQUERY(new Timestamp JavaDoc(System.currentTimeMillis()));
28        ((SiteImpl)site).save();
29          
30          dbTransaction.commit();
31          dbTransaction.release();
32     
33         }catch (Exception JavaDoc e){
34             Log.logException(e);
35         }
36      }
37     
38     
39 }
Popular Tags