KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > db > CompanyDAO


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/CompanyDAO.java,v 1.21 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.21 $
5  * $Date: 2006/04/14 17:05:26 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Tran Van Giang
39  * @author: Minh Nguyen
40  */

41 package com.mvnforum.db;
42
43 import java.sql.Timestamp JavaDoc;
44 import java.util.Collection JavaDoc;
45
46 import net.myvietnam.mvncore.exception.AssertionException;
47 import net.myvietnam.mvncore.exception.CreateException;
48 import net.myvietnam.mvncore.exception.DatabaseException;
49 import net.myvietnam.mvncore.exception.DuplicateKeyException;
50 import net.myvietnam.mvncore.exception.ObjectNotFoundException;
51 import net.myvietnam.mvncore.exception.ForeignKeyNotFoundException;
52
53 public interface CompanyDAO {
54
55     public static final String JavaDoc TABLE_NAME = DatabaseConfig.TABLE_PREFIX + "Company";
56
57     public void findByPrimaryKey(int companyID)
58         throws ObjectNotFoundException, DatabaseException;
59
60     public void findByAlternateKey_GroupID(int groupID)
61         throws ObjectNotFoundException, DatabaseException;
62
63     public void findByAlternateKey_CompanyName(String JavaDoc companyName)
64         throws ObjectNotFoundException, DatabaseException;
65
66     public void findByAlternateKey_CompanyEmail(String JavaDoc companyEmail)
67         throws ObjectNotFoundException, DatabaseException;
68
69     public void findByAlternateKey_CompanySpaceName(String JavaDoc companySpaceName)
70         throws ObjectNotFoundException, DatabaseException;
71
72     public void create(int groupID, String JavaDoc companyName, String JavaDoc companyAddress,
73                         String JavaDoc companyCity, String JavaDoc companyCAP, String JavaDoc companyProvince,
74                         String JavaDoc companyRegion, String JavaDoc companyPhone, String JavaDoc companyFax,
75                         String JavaDoc companyWebsite, String JavaDoc companyEmail, String JavaDoc companySpaceName,
76                         String JavaDoc companySpaceHeader, String JavaDoc companySpaceFooter, String JavaDoc companyVATNumber,
77                         String JavaDoc companyLogo, String JavaDoc companyCss, Timestamp JavaDoc companyCreationDate,
78                         Timestamp JavaDoc companyModifiedDate)
79         throws CreateException, DatabaseException, DuplicateKeyException, ForeignKeyNotFoundException;
80
81     public void delete(int companyID)
82         throws ObjectNotFoundException, DatabaseException;
83
84     public void updateCompanyInfo(int companyID, // primary key
85
String JavaDoc companyName, String JavaDoc companyAddress, String JavaDoc companyCity,
86                         String JavaDoc companyCAP, String JavaDoc companyProvince, String JavaDoc companyRegion,
87                         String JavaDoc companyPhone, String JavaDoc companyFax, String JavaDoc companyWebsite,
88                         String JavaDoc companyEmail, String JavaDoc companySpaceName, String JavaDoc companySpaceHeader,
89                         String JavaDoc companySpaceFooter, String JavaDoc companyVATNumber, Timestamp JavaDoc companyModifiedDate)
90         throws ObjectNotFoundException, DatabaseException, DuplicateKeyException;
91
92     public void updateCompanyLogo(int companyID, String JavaDoc virtualFile)
93         throws ObjectNotFoundException, DatabaseException;
94
95     public void updateCompanyCss(int companyID, String JavaDoc virtualFile)
96         throws ObjectNotFoundException, DatabaseException;
97
98     public int getCompanyIDFromGroupID(int groupID)
99         throws ObjectNotFoundException, DatabaseException;
100
101     /* @todo check if this method work with other DBMS other than MySql (check case-sensitive) */
102     public int getCompanyIDFromCompanyEmail(String JavaDoc companyEmail)
103         throws ObjectNotFoundException, DatabaseException;
104
105     public int getCompanyIDFromCompanySpaceName(String JavaDoc companySpaceName)
106         throws ObjectNotFoundException, DatabaseException;
107
108     // note: the implementation of this method is too slow
109
public int getCompanyIDFromCompanyCreationDate(java.util.Date JavaDoc companyCreationDate)
110         throws ObjectNotFoundException, DatabaseException;
111
112     public CompanyBean getCompany(int companyID)
113         throws ObjectNotFoundException, DatabaseException;
114
115     public Collection JavaDoc getCompanies_withSortSupport_limit(int offset, int rowsToReturn, String JavaDoc sort, String JavaDoc order)
116         throws IllegalArgumentException JavaDoc, DatabaseException;
117
118     public int getNumberOfCompanies()
119         throws AssertionException, DatabaseException;
120
121     /**
122      * This method could be used to get all company when rebuild lucene search index
123      *
124      * @throws DatabaseException
125      * @return Collection
126      */

127     public Collection JavaDoc getCompanies()
128         throws DatabaseException;
129
130 } //end of CompanyDAO class
131
Popular Tags