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