001 /** 002 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portal.service.persistence; 016 017 import com.liferay.portal.model.Resource; 018 019 /** 020 * The persistence interface for the resource service. 021 * 022 * <p> 023 * Never modify this interface directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regnerate this interface. 024 * </p> 025 * 026 * @author Brian Wing Shun Chan 027 * @see ResourcePersistenceImpl 028 * @see ResourceUtil 029 * @generated 030 */ 031 public interface ResourcePersistence extends BasePersistence<Resource> { 032 /** 033 * Caches the resource in the entity cache if it is enabled. 034 * 035 * @param resource the resource to cache 036 */ 037 public void cacheResult(com.liferay.portal.model.Resource resource); 038 039 /** 040 * Caches the resources in the entity cache if it is enabled. 041 * 042 * @param resources the resources to cache 043 */ 044 public void cacheResult( 045 java.util.List<com.liferay.portal.model.Resource> resources); 046 047 /** 048 * Creates a new resource with the primary key. 049 * 050 * @param resourceId the primary key for the new resource 051 * @return the new resource 052 */ 053 public com.liferay.portal.model.Resource create(long resourceId); 054 055 /** 056 * Removes the resource with the primary key from the database. Also notifies the appropriate model listeners. 057 * 058 * @param resourceId the primary key of the resource to remove 059 * @return the resource that was removed 060 * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found 061 * @throws SystemException if a system exception occurred 062 */ 063 public com.liferay.portal.model.Resource remove(long resourceId) 064 throws com.liferay.portal.NoSuchResourceException, 065 com.liferay.portal.kernel.exception.SystemException; 066 067 public com.liferay.portal.model.Resource updateImpl( 068 com.liferay.portal.model.Resource resource, boolean merge) 069 throws com.liferay.portal.kernel.exception.SystemException; 070 071 /** 072 * Finds the resource with the primary key or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found. 073 * 074 * @param resourceId the primary key of the resource to find 075 * @return the resource 076 * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found 077 * @throws SystemException if a system exception occurred 078 */ 079 public com.liferay.portal.model.Resource findByPrimaryKey(long resourceId) 080 throws com.liferay.portal.NoSuchResourceException, 081 com.liferay.portal.kernel.exception.SystemException; 082 083 /** 084 * Finds the resource with the primary key or returns <code>null</code> if it could not be found. 085 * 086 * @param resourceId the primary key of the resource to find 087 * @return the resource, or <code>null</code> if a resource with the primary key could not be found 088 * @throws SystemException if a system exception occurred 089 */ 090 public com.liferay.portal.model.Resource fetchByPrimaryKey(long resourceId) 091 throws com.liferay.portal.kernel.exception.SystemException; 092 093 /** 094 * Finds all the resources where codeId = ?. 095 * 096 * @param codeId the code id to search with 097 * @return the matching resources 098 * @throws SystemException if a system exception occurred 099 */ 100 public java.util.List<com.liferay.portal.model.Resource> findByCodeId( 101 long codeId) throws com.liferay.portal.kernel.exception.SystemException; 102 103 /** 104 * Finds a range of all the resources where codeId = ?. 105 * 106 * <p> 107 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 108 * </p> 109 * 110 * @param codeId the code id to search with 111 * @param start the lower bound of the range of resources to return 112 * @param end the upper bound of the range of resources to return (not inclusive) 113 * @return the range of matching resources 114 * @throws SystemException if a system exception occurred 115 */ 116 public java.util.List<com.liferay.portal.model.Resource> findByCodeId( 117 long codeId, int start, int end) 118 throws com.liferay.portal.kernel.exception.SystemException; 119 120 /** 121 * Finds an ordered range of all the resources where codeId = ?. 122 * 123 * <p> 124 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 125 * </p> 126 * 127 * @param codeId the code id to search with 128 * @param start the lower bound of the range of resources to return 129 * @param end the upper bound of the range of resources to return (not inclusive) 130 * @param orderByComparator the comparator to order the results by 131 * @return the ordered range of matching resources 132 * @throws SystemException if a system exception occurred 133 */ 134 public java.util.List<com.liferay.portal.model.Resource> findByCodeId( 135 long codeId, int start, int end, 136 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 137 throws com.liferay.portal.kernel.exception.SystemException; 138 139 /** 140 * Finds the first resource in the ordered set where codeId = ?. 141 * 142 * <p> 143 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 144 * </p> 145 * 146 * @param codeId the code id to search with 147 * @param orderByComparator the comparator to order the set by 148 * @return the first matching resource 149 * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found 150 * @throws SystemException if a system exception occurred 151 */ 152 public com.liferay.portal.model.Resource findByCodeId_First(long codeId, 153 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 154 throws com.liferay.portal.NoSuchResourceException, 155 com.liferay.portal.kernel.exception.SystemException; 156 157 /** 158 * Finds the last resource in the ordered set where codeId = ?. 159 * 160 * <p> 161 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 162 * </p> 163 * 164 * @param codeId the code id to search with 165 * @param orderByComparator the comparator to order the set by 166 * @return the last matching resource 167 * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found 168 * @throws SystemException if a system exception occurred 169 */ 170 public com.liferay.portal.model.Resource findByCodeId_Last(long codeId, 171 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 172 throws com.liferay.portal.NoSuchResourceException, 173 com.liferay.portal.kernel.exception.SystemException; 174 175 /** 176 * Finds the resources before and after the current resource in the ordered set where codeId = ?. 177 * 178 * <p> 179 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 180 * </p> 181 * 182 * @param resourceId the primary key of the current resource 183 * @param codeId the code id to search with 184 * @param orderByComparator the comparator to order the set by 185 * @return the previous, current, and next resource 186 * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found 187 * @throws SystemException if a system exception occurred 188 */ 189 public com.liferay.portal.model.Resource[] findByCodeId_PrevAndNext( 190 long resourceId, long codeId, 191 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 192 throws com.liferay.portal.NoSuchResourceException, 193 com.liferay.portal.kernel.exception.SystemException; 194 195 /** 196 * Finds the resource where codeId = ? and primKey = ? or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found. 197 * 198 * @param codeId the code id to search with 199 * @param primKey the prim key to search with 200 * @return the matching resource 201 * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found 202 * @throws SystemException if a system exception occurred 203 */ 204 public com.liferay.portal.model.Resource findByC_P(long codeId, 205 java.lang.String primKey) 206 throws com.liferay.portal.NoSuchResourceException, 207 com.liferay.portal.kernel.exception.SystemException; 208 209 /** 210 * Finds the resource where codeId = ? and primKey = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 211 * 212 * @param codeId the code id to search with 213 * @param primKey the prim key to search with 214 * @return the matching resource, or <code>null</code> if a matching resource could not be found 215 * @throws SystemException if a system exception occurred 216 */ 217 public com.liferay.portal.model.Resource fetchByC_P(long codeId, 218 java.lang.String primKey) 219 throws com.liferay.portal.kernel.exception.SystemException; 220 221 /** 222 * Finds the resource where codeId = ? and primKey = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 223 * 224 * @param codeId the code id to search with 225 * @param primKey the prim key to search with 226 * @return the matching resource, or <code>null</code> if a matching resource could not be found 227 * @throws SystemException if a system exception occurred 228 */ 229 public com.liferay.portal.model.Resource fetchByC_P(long codeId, 230 java.lang.String primKey, boolean retrieveFromCache) 231 throws com.liferay.portal.kernel.exception.SystemException; 232 233 /** 234 * Finds all the resources. 235 * 236 * @return the resources 237 * @throws SystemException if a system exception occurred 238 */ 239 public java.util.List<com.liferay.portal.model.Resource> findAll() 240 throws com.liferay.portal.kernel.exception.SystemException; 241 242 /** 243 * Finds a range of all the resources. 244 * 245 * <p> 246 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 247 * </p> 248 * 249 * @param start the lower bound of the range of resources to return 250 * @param end the upper bound of the range of resources to return (not inclusive) 251 * @return the range of resources 252 * @throws SystemException if a system exception occurred 253 */ 254 public java.util.List<com.liferay.portal.model.Resource> findAll( 255 int start, int end) 256 throws com.liferay.portal.kernel.exception.SystemException; 257 258 /** 259 * Finds an ordered range of all the resources. 260 * 261 * <p> 262 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. 263 * </p> 264 * 265 * @param start the lower bound of the range of resources to return 266 * @param end the upper bound of the range of resources to return (not inclusive) 267 * @param orderByComparator the comparator to order the results by 268 * @return the ordered range of resources 269 * @throws SystemException if a system exception occurred 270 */ 271 public java.util.List<com.liferay.portal.model.Resource> findAll( 272 int start, int end, 273 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 274 throws com.liferay.portal.kernel.exception.SystemException; 275 276 /** 277 * Removes all the resources where codeId = ? from the database. 278 * 279 * @param codeId the code id to search with 280 * @throws SystemException if a system exception occurred 281 */ 282 public void removeByCodeId(long codeId) 283 throws com.liferay.portal.kernel.exception.SystemException; 284 285 /** 286 * Removes the resource where codeId = ? and primKey = ? from the database. 287 * 288 * @param codeId the code id to search with 289 * @param primKey the prim key to search with 290 * @throws SystemException if a system exception occurred 291 */ 292 public void removeByC_P(long codeId, java.lang.String primKey) 293 throws com.liferay.portal.NoSuchResourceException, 294 com.liferay.portal.kernel.exception.SystemException; 295 296 /** 297 * Removes all the resources from the database. 298 * 299 * @throws SystemException if a system exception occurred 300 */ 301 public void removeAll() 302 throws com.liferay.portal.kernel.exception.SystemException; 303 304 /** 305 * Counts all the resources where codeId = ?. 306 * 307 * @param codeId the code id to search with 308 * @return the number of matching resources 309 * @throws SystemException if a system exception occurred 310 */ 311 public int countByCodeId(long codeId) 312 throws com.liferay.portal.kernel.exception.SystemException; 313 314 /** 315 * Counts all the resources where codeId = ? and primKey = ?. 316 * 317 * @param codeId the code id to search with 318 * @param primKey the prim key to search with 319 * @return the number of matching resources 320 * @throws SystemException if a system exception occurred 321 */ 322 public int countByC_P(long codeId, java.lang.String primKey) 323 throws com.liferay.portal.kernel.exception.SystemException; 324 325 /** 326 * Counts all the resources. 327 * 328 * @return the number of resources 329 * @throws SystemException if a system exception occurred 330 */ 331 public int countAll() 332 throws com.liferay.portal.kernel.exception.SystemException; 333 }