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