001 /** 002 * Copyright (c) 2000-2011 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.kernel.exception.SystemException; 018 import com.liferay.portal.model.Resource; 019 020 /** 021 * The persistence interface for the resource service. 022 * 023 * <p> 024 * Caching information and settings can be found in <code>portal.properties</code> 025 * </p> 026 * 027 * @author Brian Wing Shun Chan 028 * @see ResourcePersistenceImpl 029 * @see ResourceUtil 030 * @generated 031 */ 032 public interface ResourcePersistence extends BasePersistence<Resource> { 033 /* 034 * NOTE FOR DEVELOPERS: 035 * 036 * Never modify or reference this interface directly. Always use {@link ResourceUtil} to access the resource persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this interface. 037 */ 038 039 /** 040 * Caches the resource in the entity cache if it is enabled. 041 * 042 * @param resource the resource 043 */ 044 public void cacheResult(com.liferay.portal.model.Resource resource); 045 046 /** 047 * Caches the resources in the entity cache if it is enabled. 048 * 049 * @param resources the resources 050 */ 051 public void cacheResult( 052 java.util.List<com.liferay.portal.model.Resource> resources); 053 054 /** 055 * Creates a new resource with the primary key. Does not add the resource to the database. 056 * 057 * @param resourceId the primary key for the new resource 058 * @return the new resource 059 */ 060 public com.liferay.portal.model.Resource create(long resourceId); 061 062 /** 063 * Removes the resource with the primary key from the database. Also notifies the appropriate model listeners. 064 * 065 * @param resourceId the primary key of the resource 066 * @return the resource that was removed 067 * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found 068 * @throws SystemException if a system exception occurred 069 */ 070 public com.liferay.portal.model.Resource remove(long resourceId) 071 throws com.liferay.portal.NoSuchResourceException, 072 com.liferay.portal.kernel.exception.SystemException; 073 074 public com.liferay.portal.model.Resource updateImpl( 075 com.liferay.portal.model.Resource resource, boolean merge) 076 throws com.liferay.portal.kernel.exception.SystemException; 077 078 /** 079 * Returns the resource with the primary key or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found. 080 * 081 * @param resourceId the primary key of the resource 082 * @return the resource 083 * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found 084 * @throws SystemException if a system exception occurred 085 */ 086 public com.liferay.portal.model.Resource findByPrimaryKey(long resourceId) 087 throws com.liferay.portal.NoSuchResourceException, 088 com.liferay.portal.kernel.exception.SystemException; 089 090 /** 091 * Returns the resource with the primary key or returns <code>null</code> if it could not be found. 092 * 093 * @param resourceId the primary key of the resource 094 * @return the resource, or <code>null</code> if a resource with the primary key could not be found 095 * @throws SystemException if a system exception occurred 096 */ 097 public com.liferay.portal.model.Resource fetchByPrimaryKey(long resourceId) 098 throws com.liferay.portal.kernel.exception.SystemException; 099 100 /** 101 * Returns all the resources where codeId = ?. 102 * 103 * @param codeId the code ID 104 * @return the matching resources 105 * @throws SystemException if a system exception occurred 106 */ 107 public java.util.List<com.liferay.portal.model.Resource> findByCodeId( 108 long codeId) throws com.liferay.portal.kernel.exception.SystemException; 109 110 /** 111 * Returns a range of all the resources where codeId = ?. 112 * 113 * <p> 114 * 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. 115 * </p> 116 * 117 * @param codeId the code ID 118 * @param start the lower bound of the range of resources 119 * @param end the upper bound of the range of resources (not inclusive) 120 * @return the range of matching resources 121 * @throws SystemException if a system exception occurred 122 */ 123 public java.util.List<com.liferay.portal.model.Resource> findByCodeId( 124 long codeId, int start, int end) 125 throws com.liferay.portal.kernel.exception.SystemException; 126 127 /** 128 * Returns an ordered range of all the resources where codeId = ?. 129 * 130 * <p> 131 * 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. 132 * </p> 133 * 134 * @param codeId the code ID 135 * @param start the lower bound of the range of resources 136 * @param end the upper bound of the range of resources (not inclusive) 137 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 138 * @return the ordered range of matching resources 139 * @throws SystemException if a system exception occurred 140 */ 141 public java.util.List<com.liferay.portal.model.Resource> findByCodeId( 142 long codeId, int start, int end, 143 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 144 throws com.liferay.portal.kernel.exception.SystemException; 145 146 /** 147 * Returns the first resource in the ordered set where codeId = ?. 148 * 149 * <p> 150 * 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. 151 * </p> 152 * 153 * @param codeId the code ID 154 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 155 * @return the first matching resource 156 * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found 157 * @throws SystemException if a system exception occurred 158 */ 159 public com.liferay.portal.model.Resource findByCodeId_First(long codeId, 160 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 161 throws com.liferay.portal.NoSuchResourceException, 162 com.liferay.portal.kernel.exception.SystemException; 163 164 /** 165 * Returns the last resource in the ordered set where codeId = ?. 166 * 167 * <p> 168 * 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. 169 * </p> 170 * 171 * @param codeId the code ID 172 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 173 * @return the last matching resource 174 * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found 175 * @throws SystemException if a system exception occurred 176 */ 177 public com.liferay.portal.model.Resource findByCodeId_Last(long codeId, 178 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 179 throws com.liferay.portal.NoSuchResourceException, 180 com.liferay.portal.kernel.exception.SystemException; 181 182 /** 183 * Returns the resources before and after the current resource in the ordered set where codeId = ?. 184 * 185 * <p> 186 * 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. 187 * </p> 188 * 189 * @param resourceId the primary key of the current resource 190 * @param codeId the code ID 191 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 192 * @return the previous, current, and next resource 193 * @throws com.liferay.portal.NoSuchResourceException if a resource with the primary key could not be found 194 * @throws SystemException if a system exception occurred 195 */ 196 public com.liferay.portal.model.Resource[] findByCodeId_PrevAndNext( 197 long resourceId, long codeId, 198 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 199 throws com.liferay.portal.NoSuchResourceException, 200 com.liferay.portal.kernel.exception.SystemException; 201 202 /** 203 * Returns the resource where codeId = ? and primKey = ? or throws a {@link com.liferay.portal.NoSuchResourceException} if it could not be found. 204 * 205 * @param codeId the code ID 206 * @param primKey the prim key 207 * @return the matching resource 208 * @throws com.liferay.portal.NoSuchResourceException if a matching resource could not be found 209 * @throws SystemException if a system exception occurred 210 */ 211 public com.liferay.portal.model.Resource findByC_P(long codeId, 212 java.lang.String primKey) 213 throws com.liferay.portal.NoSuchResourceException, 214 com.liferay.portal.kernel.exception.SystemException; 215 216 /** 217 * Returns the resource where codeId = ? and primKey = ? or returns <code>null</code> if it could not be found. Uses the finder cache. 218 * 219 * @param codeId the code ID 220 * @param primKey the prim key 221 * @return the matching resource, or <code>null</code> if a matching resource could not be found 222 * @throws SystemException if a system exception occurred 223 */ 224 public com.liferay.portal.model.Resource fetchByC_P(long codeId, 225 java.lang.String primKey) 226 throws com.liferay.portal.kernel.exception.SystemException; 227 228 /** 229 * Returns the resource where codeId = ? and primKey = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. 230 * 231 * @param codeId the code ID 232 * @param primKey the prim key 233 * @param retrieveFromCache whether to use the finder cache 234 * @return the matching resource, or <code>null</code> if a matching resource could not be found 235 * @throws SystemException if a system exception occurred 236 */ 237 public com.liferay.portal.model.Resource fetchByC_P(long codeId, 238 java.lang.String primKey, boolean retrieveFromCache) 239 throws com.liferay.portal.kernel.exception.SystemException; 240 241 /** 242 * Returns all the resources. 243 * 244 * @return the resources 245 * @throws SystemException if a system exception occurred 246 */ 247 public java.util.List<com.liferay.portal.model.Resource> findAll() 248 throws com.liferay.portal.kernel.exception.SystemException; 249 250 /** 251 * Returns a range of all the resources. 252 * 253 * <p> 254 * 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. 255 * </p> 256 * 257 * @param start the lower bound of the range of resources 258 * @param end the upper bound of the range of resources (not inclusive) 259 * @return the range of resources 260 * @throws SystemException if a system exception occurred 261 */ 262 public java.util.List<com.liferay.portal.model.Resource> findAll( 263 int start, int end) 264 throws com.liferay.portal.kernel.exception.SystemException; 265 266 /** 267 * Returns an ordered range of all the resources. 268 * 269 * <p> 270 * 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. 271 * </p> 272 * 273 * @param start the lower bound of the range of resources 274 * @param end the upper bound of the range of resources (not inclusive) 275 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 276 * @return the ordered range of resources 277 * @throws SystemException if a system exception occurred 278 */ 279 public java.util.List<com.liferay.portal.model.Resource> findAll( 280 int start, int end, 281 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 282 throws com.liferay.portal.kernel.exception.SystemException; 283 284 /** 285 * Removes all the resources where codeId = ? from the database. 286 * 287 * @param codeId the code ID 288 * @throws SystemException if a system exception occurred 289 */ 290 public void removeByCodeId(long codeId) 291 throws com.liferay.portal.kernel.exception.SystemException; 292 293 /** 294 * Removes the resource where codeId = ? and primKey = ? from the database. 295 * 296 * @param codeId the code ID 297 * @param primKey the prim key 298 * @throws SystemException if a system exception occurred 299 */ 300 public void removeByC_P(long codeId, java.lang.String primKey) 301 throws com.liferay.portal.NoSuchResourceException, 302 com.liferay.portal.kernel.exception.SystemException; 303 304 /** 305 * Removes all the resources from the database. 306 * 307 * @throws SystemException if a system exception occurred 308 */ 309 public void removeAll() 310 throws com.liferay.portal.kernel.exception.SystemException; 311 312 /** 313 * Returns the number of resources where codeId = ?. 314 * 315 * @param codeId the code ID 316 * @return the number of matching resources 317 * @throws SystemException if a system exception occurred 318 */ 319 public int countByCodeId(long codeId) 320 throws com.liferay.portal.kernel.exception.SystemException; 321 322 /** 323 * Returns the number of resources where codeId = ? and primKey = ?. 324 * 325 * @param codeId the code ID 326 * @param primKey the prim key 327 * @return the number of matching resources 328 * @throws SystemException if a system exception occurred 329 */ 330 public int countByC_P(long codeId, java.lang.String primKey) 331 throws com.liferay.portal.kernel.exception.SystemException; 332 333 /** 334 * Returns the number of resources. 335 * 336 * @return the number of resources 337 * @throws SystemException if a system exception occurred 338 */ 339 public int countAll() 340 throws com.liferay.portal.kernel.exception.SystemException; 341 342 public Resource remove(Resource resource) throws SystemException; 343 }