1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.persistence;
16  
17  import com.liferay.portal.NoSuchModelException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
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 int 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("rawtypes")
50      public List findWithDynamicQuery(DynamicQuery dynamicQuery)
51          throws SystemException;
52  
53      @SuppressWarnings("rawtypes")
54      public List findWithDynamicQuery(
55              DynamicQuery dynamicQuery, int start, int end)
56          throws SystemException;
57  
58      @SuppressWarnings("rawtypes")
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  }