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.bean.PortalBeanLocatorUtil; 018 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 019 import com.liferay.portal.kernel.exception.SystemException; 020 import com.liferay.portal.kernel.util.OrderByComparator; 021 import com.liferay.portal.kernel.util.ReferenceRegistry; 022 import com.liferay.portal.model.Account; 023 import com.liferay.portal.service.ServiceContext; 024 025 import java.util.List; 026 027 /** 028 * The persistence utility for the account service. This utility wraps {@link AccountPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class. 029 * 030 * <p> 031 * Caching information and settings can be found in <code>portal.properties</code> 032 * </p> 033 * 034 * @author Brian Wing Shun Chan 035 * @see AccountPersistence 036 * @see AccountPersistenceImpl 037 * @generated 038 */ 039 public class AccountUtil { 040 /* 041 * NOTE FOR DEVELOPERS: 042 * 043 * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class. 044 */ 045 046 /** 047 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache() 048 */ 049 public static void clearCache() { 050 getPersistence().clearCache(); 051 } 052 053 /** 054 * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel) 055 */ 056 public static void clearCache(Account account) { 057 getPersistence().clearCache(account); 058 } 059 060 /** 061 * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery) 062 */ 063 public long countWithDynamicQuery(DynamicQuery dynamicQuery) 064 throws SystemException { 065 return getPersistence().countWithDynamicQuery(dynamicQuery); 066 } 067 068 /** 069 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery) 070 */ 071 public static List<Account> findWithDynamicQuery(DynamicQuery dynamicQuery) 072 throws SystemException { 073 return getPersistence().findWithDynamicQuery(dynamicQuery); 074 } 075 076 /** 077 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int) 078 */ 079 public static List<Account> findWithDynamicQuery( 080 DynamicQuery dynamicQuery, int start, int end) 081 throws SystemException { 082 return getPersistence().findWithDynamicQuery(dynamicQuery, start, end); 083 } 084 085 /** 086 * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator) 087 */ 088 public static List<Account> findWithDynamicQuery( 089 DynamicQuery dynamicQuery, int start, int end, 090 OrderByComparator orderByComparator) throws SystemException { 091 return getPersistence() 092 .findWithDynamicQuery(dynamicQuery, start, end, 093 orderByComparator); 094 } 095 096 /** 097 * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel) 098 */ 099 public static Account remove(Account account) throws SystemException { 100 return getPersistence().remove(account); 101 } 102 103 /** 104 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean) 105 */ 106 public static Account update(Account account, boolean merge) 107 throws SystemException { 108 return getPersistence().update(account, merge); 109 } 110 111 /** 112 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext) 113 */ 114 public static Account update(Account account, boolean merge, 115 ServiceContext serviceContext) throws SystemException { 116 return getPersistence().update(account, merge, serviceContext); 117 } 118 119 /** 120 * Caches the account in the entity cache if it is enabled. 121 * 122 * @param account the account 123 */ 124 public static void cacheResult(com.liferay.portal.model.Account account) { 125 getPersistence().cacheResult(account); 126 } 127 128 /** 129 * Caches the accounts in the entity cache if it is enabled. 130 * 131 * @param accounts the accounts 132 */ 133 public static void cacheResult( 134 java.util.List<com.liferay.portal.model.Account> accounts) { 135 getPersistence().cacheResult(accounts); 136 } 137 138 /** 139 * Creates a new account with the primary key. Does not add the account to the database. 140 * 141 * @param accountId the primary key for the new account 142 * @return the new account 143 */ 144 public static com.liferay.portal.model.Account create(long accountId) { 145 return getPersistence().create(accountId); 146 } 147 148 /** 149 * Removes the account with the primary key from the database. Also notifies the appropriate model listeners. 150 * 151 * @param accountId the primary key of the account 152 * @return the account that was removed 153 * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found 154 * @throws SystemException if a system exception occurred 155 */ 156 public static com.liferay.portal.model.Account remove(long accountId) 157 throws com.liferay.portal.NoSuchAccountException, 158 com.liferay.portal.kernel.exception.SystemException { 159 return getPersistence().remove(accountId); 160 } 161 162 public static com.liferay.portal.model.Account updateImpl( 163 com.liferay.portal.model.Account account, boolean merge) 164 throws com.liferay.portal.kernel.exception.SystemException { 165 return getPersistence().updateImpl(account, merge); 166 } 167 168 /** 169 * Returns the account with the primary key or throws a {@link com.liferay.portal.NoSuchAccountException} if it could not be found. 170 * 171 * @param accountId the primary key of the account 172 * @return the account 173 * @throws com.liferay.portal.NoSuchAccountException if a account with the primary key could not be found 174 * @throws SystemException if a system exception occurred 175 */ 176 public static com.liferay.portal.model.Account findByPrimaryKey( 177 long accountId) 178 throws com.liferay.portal.NoSuchAccountException, 179 com.liferay.portal.kernel.exception.SystemException { 180 return getPersistence().findByPrimaryKey(accountId); 181 } 182 183 /** 184 * Returns the account with the primary key or returns <code>null</code> if it could not be found. 185 * 186 * @param accountId the primary key of the account 187 * @return the account, or <code>null</code> if a account with the primary key could not be found 188 * @throws SystemException if a system exception occurred 189 */ 190 public static com.liferay.portal.model.Account fetchByPrimaryKey( 191 long accountId) 192 throws com.liferay.portal.kernel.exception.SystemException { 193 return getPersistence().fetchByPrimaryKey(accountId); 194 } 195 196 /** 197 * Returns all the accounts. 198 * 199 * @return the accounts 200 * @throws SystemException if a system exception occurred 201 */ 202 public static java.util.List<com.liferay.portal.model.Account> findAll() 203 throws com.liferay.portal.kernel.exception.SystemException { 204 return getPersistence().findAll(); 205 } 206 207 /** 208 * Returns a range of all the accounts. 209 * 210 * <p> 211 * 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. 212 * </p> 213 * 214 * @param start the lower bound of the range of accounts 215 * @param end the upper bound of the range of accounts (not inclusive) 216 * @return the range of accounts 217 * @throws SystemException if a system exception occurred 218 */ 219 public static java.util.List<com.liferay.portal.model.Account> findAll( 220 int start, int end) 221 throws com.liferay.portal.kernel.exception.SystemException { 222 return getPersistence().findAll(start, end); 223 } 224 225 /** 226 * Returns an ordered range of all the accounts. 227 * 228 * <p> 229 * 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. 230 * </p> 231 * 232 * @param start the lower bound of the range of accounts 233 * @param end the upper bound of the range of accounts (not inclusive) 234 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 235 * @return the ordered range of accounts 236 * @throws SystemException if a system exception occurred 237 */ 238 public static java.util.List<com.liferay.portal.model.Account> findAll( 239 int start, int end, 240 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 241 throws com.liferay.portal.kernel.exception.SystemException { 242 return getPersistence().findAll(start, end, orderByComparator); 243 } 244 245 /** 246 * Removes all the accounts from the database. 247 * 248 * @throws SystemException if a system exception occurred 249 */ 250 public static void removeAll() 251 throws com.liferay.portal.kernel.exception.SystemException { 252 getPersistence().removeAll(); 253 } 254 255 /** 256 * Returns the number of accounts. 257 * 258 * @return the number of accounts 259 * @throws SystemException if a system exception occurred 260 */ 261 public static int countAll() 262 throws com.liferay.portal.kernel.exception.SystemException { 263 return getPersistence().countAll(); 264 } 265 266 public static AccountPersistence getPersistence() { 267 if (_persistence == null) { 268 _persistence = (AccountPersistence)PortalBeanLocatorUtil.locate(AccountPersistence.class.getName()); 269 270 ReferenceRegistry.registerReference(AccountUtil.class, 271 "_persistence"); 272 } 273 274 return _persistence; 275 } 276 277 public void setPersistence(AccountPersistence persistence) { 278 _persistence = persistence; 279 280 ReferenceRegistry.registerReference(AccountUtil.class, "_persistence"); 281 } 282 283 private static AccountPersistence _persistence; 284 }