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.model.BaseModel;
21  import com.liferay.portal.model.ModelListener;
22  
23  import java.io.Serializable;
24  
25  import java.util.List;
26  
27  /**
28   * <a href="BasePersistence.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public interface BasePersistence<T extends BaseModel<T>> {
33  
34      public void clearCache();
35  
36      public T findByPrimaryKey(Serializable primaryKey)
37          throws NoSuchModelException, SystemException;
38  
39      public List<Object> findWithDynamicQuery(DynamicQuery dynamicQuery)
40          throws SystemException;
41  
42      public List<Object> findWithDynamicQuery(
43              DynamicQuery dynamicQuery, int start, int end)
44          throws SystemException;
45  
46      public T fetchByPrimaryKey(Serializable primaryKey) throws SystemException;
47  
48      public ModelListener<T>[] getListeners();
49  
50      public void registerListener(ModelListener<T> listener);
51  
52      public T remove(Serializable primaryKey)
53          throws NoSuchModelException, SystemException;
54  
55      public T remove(T model) throws SystemException;
56  
57      public void unregisterListener(ModelListener<T> listener);
58  
59      public T update(T model, boolean merge) throws SystemException;
60  
61  }