1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
19  import com.liferay.portal.kernel.exception.SystemException;
20  import com.liferay.portal.kernel.util.OrderByComparator;
21  import com.liferay.portal.model.BaseModel;
22  import com.liferay.portal.model.ModelListener;
23  
24  import java.io.Serializable;
25  
26  import java.util.List;
27  
28  import javax.sql.DataSource;
29  
30  /**
31   * <a href="BasePersistence.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author Brian Wing Shun Chan
34   */
35  public interface BasePersistence<T extends BaseModel<T>> {
36  
37      public void clearCache();
38  
39      public void clearCache(T model);
40  
41      public long countWithDynamicQuery(DynamicQuery dynamicQuery)
42          throws SystemException;
43  
44      public T fetchByPrimaryKey(Serializable primaryKey) throws SystemException;
45  
46      public T findByPrimaryKey(Serializable primaryKey)
47          throws NoSuchModelException, SystemException;
48  
49      @SuppressWarnings("unchecked")
50      public List findWithDynamicQuery(DynamicQuery dynamicQuery)
51          throws SystemException;
52  
53      @SuppressWarnings("unchecked")
54      public List findWithDynamicQuery(
55              DynamicQuery dynamicQuery, int start, int end)
56          throws SystemException;
57  
58      @SuppressWarnings("unchecked")
59      public List findWithDynamicQuery(
60              DynamicQuery dynamicQuery, int start, int end,
61              OrderByComparator orderByComparator)
62          throws SystemException;
63  
64      public DataSource getDataSource();
65  
66      public ModelListener<T>[] getListeners();
67  
68      public void registerListener(ModelListener<T> listener);
69  
70      public T remove(Serializable primaryKey)
71          throws NoSuchModelException, SystemException;
72  
73      public T remove(T model) throws SystemException;
74  
75      public void setDataSource(DataSource dataSource);
76  
77      public void unregisterListener(ModelListener<T> listener);
78  
79      public T update(T model, boolean merge) throws SystemException;
80  
81  }