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