source: contrib/funambol/trunk/modules/psync/src/main/java/br/com/prognus/psync/items/manager/PIMEntityManager.java @ 2082

Revision 2082, 3.2 KB checked in by emersonfaria, 14 years ago (diff)

Ticket #927 - Reestruturacao dos diretorios do Funambol

Line 
1/**
2 *
3 * @author Diorgenes Felipe Grzesiuk <diorgenes@prognus.com.br>
4 * @copyright Copyright 2007-2008 Prognus
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Foobar; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19package br.com.prognus.psync.items.manager;
20
21import java.sql.Timestamp;
22import java.util.List;
23
24import br.com.prognus.psync.exception.EntityException;
25import br.com.prognus.psync.exception.PIMDBAccessException;
26import br.com.prognus.psync.items.dao.PIMEntityDAO;
27import br.com.prognus.psync.util.Def;
28
29import com.funambol.framework.logging.FunambolLogger;
30import com.funambol.framework.logging.FunambolLoggerFactory;
31
32public abstract class PIMEntityManager {
33
34        // ------------------------------------------------------------ Private data
35
36        protected static final FunambolLogger log = FunambolLoggerFactory
37                        .getLogger(Def.LOGGER_NAME);
38
39        protected PIMEntityDAO dao;
40
41        // ---------------------------------------------------------- Public methods
42
43        public char getItemState(String id, Timestamp t) throws EntityException {
44                try {
45                        return dao.getItemState(id, t);
46                } catch (PIMDBAccessException dbae) {
47                        throw new EntityException("Error while getting item state.", dbae);
48                }
49        }
50
51        public List getAllItems() throws EntityException {
52
53                try {
54                        return dao.getAllItems();
55                } catch (PIMDBAccessException dbae) {
56                        throw new EntityException("Error while getting all items.", dbae);
57                }
58        }
59
60        public List getNewItems(Timestamp since, Timestamp to)
61                        throws EntityException {
62
63                try {
64                        return dao.getNewItems(since, to);
65                } catch (PIMDBAccessException dbae) {
66                        throw new EntityException("Error while getting new items.", dbae);
67                }
68        }
69
70        public List getUpdatedItems(Timestamp since, Timestamp to)
71                        throws EntityException {
72
73                try {
74                        return dao.getUpdatedItems(since, to);
75                } catch (PIMDBAccessException dbae) {
76                        throw new EntityException("Error while getting updated items.",
77                                        dbae);
78                }
79        }
80
81// Correcao - Incluido parametro sourceURI - emerson-faria.nobre@serpro.gov.br - 17/set/2009
82        public List getDeletedItems(Timestamp since, Timestamp to, String sourceURI)
83                        throws EntityException {
84
85                try {
86                        return dao.getDeletedItems(since, to, sourceURI);
87                } catch (PIMDBAccessException dbae) {
88                        throw new EntityException("Error while getting deleted items.",
89                                        dbae);
90                }
91        }
92
93        public void removeItem(String uid) throws EntityException {
94
95                try {
96                        dao.removeItem(uid);
97                } catch (PIMDBAccessException dbae) {
98                        throw new EntityException("Error while deleting item.", dbae);
99                }
100        }
101
102        public void removeAllItems() throws EntityException {
103
104                try {
105                        dao.removeAllItems();
106                } catch (PIMDBAccessException dbae) {
107                        throw new EntityException("Error while removing all items.", dbae);
108                }
109        }
110}
Note: See TracBrowser for help on using the repository browser.