1   /**
2    * Copyright (c) 2000-2009 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   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.service.persistence;
21  
22  import com.liferay.portal.PortalException;
23  import com.liferay.portal.SystemException;
24  import com.liferay.portal.kernel.annotation.Propagation;
25  import com.liferay.portal.kernel.annotation.Transactional;
26  
27  /**
28   * <a href="ResourcePersistence.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   *
32   */
33  @Transactional(rollbackFor =  {
34      PortalException.class, SystemException.class})
35  public interface ResourcePersistence extends BasePersistence {
36      public com.liferay.portal.model.Resource create(long resourceId);
37  
38      public com.liferay.portal.model.Resource remove(long resourceId)
39          throws com.liferay.portal.NoSuchResourceException,
40              com.liferay.portal.SystemException;
41  
42      public com.liferay.portal.model.Resource remove(
43          com.liferay.portal.model.Resource resource)
44          throws com.liferay.portal.SystemException;
45  
46      /**
47       * @deprecated Use <code>update(Resource resource, boolean merge)</code>.
48       */
49      public com.liferay.portal.model.Resource update(
50          com.liferay.portal.model.Resource resource)
51          throws com.liferay.portal.SystemException;
52  
53      /**
54       * Add, update, or merge, the entity. This method also calls the model
55       * listeners to trigger the proper events associated with adding, deleting,
56       * or updating an entity.
57       *
58       * @param        resource the entity to add, update, or merge
59       * @param        merge boolean value for whether to merge the entity. The
60       *                default value is false. Setting merge to true is more
61       *                expensive and should only be true when resource is
62       *                transient. See LEP-5473 for a detailed discussion of this
63       *                method.
64       * @return        true if the portlet can be displayed via Ajax
65       */
66      public com.liferay.portal.model.Resource update(
67          com.liferay.portal.model.Resource resource, boolean merge)
68          throws com.liferay.portal.SystemException;
69  
70      public com.liferay.portal.model.Resource updateImpl(
71          com.liferay.portal.model.Resource resource, boolean merge)
72          throws com.liferay.portal.SystemException;
73  
74      @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
75      public com.liferay.portal.model.Resource findByPrimaryKey(long resourceId)
76          throws com.liferay.portal.NoSuchResourceException,
77              com.liferay.portal.SystemException;
78  
79      public com.liferay.portal.model.Resource fetchByPrimaryKey(long resourceId)
80          throws com.liferay.portal.SystemException;
81  
82      @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
83      public java.util.List<com.liferay.portal.model.Resource> findByCodeId(
84          long codeId) throws com.liferay.portal.SystemException;
85  
86      @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
87      public java.util.List<com.liferay.portal.model.Resource> findByCodeId(
88          long codeId, int start, int end)
89          throws com.liferay.portal.SystemException;
90  
91      @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
92      public java.util.List<com.liferay.portal.model.Resource> findByCodeId(
93          long codeId, int start, int end,
94          com.liferay.portal.kernel.util.OrderByComparator obc)
95          throws com.liferay.portal.SystemException;
96  
97      @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
98      public com.liferay.portal.model.Resource findByCodeId_First(long codeId,
99          com.liferay.portal.kernel.util.OrderByComparator obc)
100         throws com.liferay.portal.NoSuchResourceException,
101             com.liferay.portal.SystemException;
102 
103     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
104     public com.liferay.portal.model.Resource findByCodeId_Last(long codeId,
105         com.liferay.portal.kernel.util.OrderByComparator obc)
106         throws com.liferay.portal.NoSuchResourceException,
107             com.liferay.portal.SystemException;
108 
109     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
110     public com.liferay.portal.model.Resource[] findByCodeId_PrevAndNext(
111         long resourceId, long codeId,
112         com.liferay.portal.kernel.util.OrderByComparator obc)
113         throws com.liferay.portal.NoSuchResourceException,
114             com.liferay.portal.SystemException;
115 
116     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
117     public com.liferay.portal.model.Resource findByC_P(long codeId,
118         java.lang.String primKey)
119         throws com.liferay.portal.NoSuchResourceException,
120             com.liferay.portal.SystemException;
121 
122     public com.liferay.portal.model.Resource fetchByC_P(long codeId,
123         java.lang.String primKey) throws com.liferay.portal.SystemException;
124 
125     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
126     public java.util.List<Object> findWithDynamicQuery(
127         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
128         throws com.liferay.portal.SystemException;
129 
130     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
131     public java.util.List<Object> findWithDynamicQuery(
132         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
133         int end) throws com.liferay.portal.SystemException;
134 
135     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
136     public java.util.List<com.liferay.portal.model.Resource> findAll()
137         throws com.liferay.portal.SystemException;
138 
139     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
140     public java.util.List<com.liferay.portal.model.Resource> findAll(
141         int start, int end) throws com.liferay.portal.SystemException;
142 
143     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
144     public java.util.List<com.liferay.portal.model.Resource> findAll(
145         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
146         throws com.liferay.portal.SystemException;
147 
148     public void removeByCodeId(long codeId)
149         throws com.liferay.portal.SystemException;
150 
151     public void removeByC_P(long codeId, java.lang.String primKey)
152         throws com.liferay.portal.NoSuchResourceException,
153             com.liferay.portal.SystemException;
154 
155     public void removeAll() throws com.liferay.portal.SystemException;
156 
157     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
158     public int countByCodeId(long codeId)
159         throws com.liferay.portal.SystemException;
160 
161     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
162     public int countByC_P(long codeId, java.lang.String primKey)
163         throws com.liferay.portal.SystemException;
164 
165     @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
166     public int countAll() throws com.liferay.portal.SystemException;
167 }