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  /**
29   * <a href="BasePersistence.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Brian Wing Shun Chan
32   */
33  public interface BasePersistence<T extends BaseModel<T>> {
34  
35      public void clearCache();
36  
37      public int countWithDynamicQuery(DynamicQuery dynamicQuery)
38          throws SystemException;
39  
40      public T fetchByPrimaryKey(Serializable primaryKey) throws SystemException;
41  
42      public T findByPrimaryKey(Serializable primaryKey)
43          throws NoSuchModelException, SystemException;
44  
45      public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
46          throws SystemException;
47  
48      public List<Object> findWithDynamicQuery(
49              DynamicQuery dynamicQuery, int start, int end)
50          throws SystemException;
51  
52      public List<Object> findWithDynamicQuery(
53              DynamicQuery dynamicQuery, int start, int end,
54              OrderByComparator orderByComparator)
55          throws SystemException;
56  
57      public ModelListener<T>[] getListeners();
58  
59      public void registerListener(ModelListener<T> listener);
60  
61      public T remove(Serializable primaryKey)
62          throws NoSuchModelException, SystemException;
63  
64      public T remove(T model) throws SystemException;
65  
66      public void unregisterListener(ModelListener<T> listener);
67  
68      public T update(T model, boolean merge) throws SystemException;
69  
70  }