001 /** 002 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 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 to cache 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 to cache 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 to remove 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 * Finds 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 to find 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 * Finds 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 to find 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 * Finds all the resources where codeId = ?. 102 * 103 * @param codeId the code ID to search with 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 * Finds 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 to search with 118 * @param start the lower bound of the range of resources to return 119 * @param end the upper bound of the range of resources to return (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 * Finds 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 to search with 135 * @param start the lower bound of the range of resources to return 136 * @param end the upper bound of the range of resources to return (not inclusive) 137 * @param orderByComparator the comparator to order the results by 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 * Finds 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 to search with 154 * @param orderByComparator the comparator to order the set by 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 * Finds 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 to search with 172 * @param orderByComparator the comparator to order the set by 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 * Finds 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 to search with 191 * @param orderByComparator the comparator to order the set by 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 * Finds 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 to search with 206 * @param primKey the prim key to search with 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 * Finds 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 to search with 220 * @param primKey the prim key to search with 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 * Finds 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 to search with 232 * @param primKey the prim key to search with 233 * @return the matching resource, or <code>null</code> if a matching resource could not be found 234 * @throws SystemException if a system exception occurred 235 */ 236 public com.liferay.portal.model.Resource fetchByC_P(long codeId, 237 java.lang.String primKey, boolean retrieveFromCache) 238 throws com.liferay.portal.kernel.exception.SystemException; 239 240 /** 241 * Finds all the resources. 242 * 243 * @return the resources 244 * @throws SystemException if a system exception occurred 245 */ 246 public java.util.List<com.liferay.portal.model.Resource> findAll() 247 throws com.liferay.portal.kernel.exception.SystemException; 248 249 /** 250 * Finds a range of all the resources. 251 * 252 * <p> 253 * 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. 254 * </p> 255 * 256 * @param start the lower bound of the range of resources to return 257 * @param end the upper bound of the range of resources to return (not inclusive) 258 * @return the range of resources 259 * @throws SystemException if a system exception occurred 260 */ 261 public java.util.List<com.liferay.portal.model.Resource> findAll( 262 int start, int end) 263 throws com.liferay.portal.kernel.exception.SystemException; 264 265 /** 266 * Finds an ordered range of all the resources. 267 * 268 * <p> 269 * 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. 270 * </p> 271 * 272 * @param start the lower bound of the range of resources to return 273 * @param end the upper bound of the range of resources to return (not inclusive) 274 * @param orderByComparator the comparator to order the results by 275 * @return the ordered range of resources 276 * @throws SystemException if a system exception occurred 277 */ 278 public java.util.List<com.liferay.portal.model.Resource> findAll( 279 int start, int end, 280 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 281 throws com.liferay.portal.kernel.exception.SystemException; 282 283 /** 284 * Removes all the resources where codeId = ? from the database. 285 * 286 * @param codeId the code ID to search with 287 * @throws SystemException if a system exception occurred 288 */ 289 public void removeByCodeId(long codeId) 290 throws com.liferay.portal.kernel.exception.SystemException; 291 292 /** 293 * Removes the resource where codeId = ? and primKey = ? from the database. 294 * 295 * @param codeId the code ID to search with 296 * @param primKey the prim key to search with 297 * @throws SystemException if a system exception occurred 298 */ 299 public void removeByC_P(long codeId, java.lang.String primKey) 300 throws com.liferay.portal.NoSuchResourceException, 301 com.liferay.portal.kernel.exception.SystemException; 302 303 /** 304 * Removes all the resources from the database. 305 * 306 * @throws SystemException if a system exception occurred 307 */ 308 public void removeAll() 309 throws com.liferay.portal.kernel.exception.SystemException; 310 311 /** 312 * Counts all the resources where codeId = ?. 313 * 314 * @param codeId the code ID to search with 315 * @return the number of matching resources 316 * @throws SystemException if a system exception occurred 317 */ 318 public int countByCodeId(long codeId) 319 throws com.liferay.portal.kernel.exception.SystemException; 320 321 /** 322 * Counts all the resources where codeId = ? and primKey = ?. 323 * 324 * @param codeId the code ID to search with 325 * @param primKey the prim key to search with 326 * @return the number of matching resources 327 * @throws SystemException if a system exception occurred 328 */ 329 public int countByC_P(long codeId, java.lang.String primKey) 330 throws com.liferay.portal.kernel.exception.SystemException; 331 332 /** 333 * Counts all the resources. 334 * 335 * @return the number of resources 336 * @throws SystemException if a system exception occurred 337 */ 338 public int countAll() 339 throws com.liferay.portal.kernel.exception.SystemException; 340 341 public Resource remove(Resource resource) throws SystemException; 342 }