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.Contact; 023 import com.liferay.portal.service.ServiceContext; 024 025 import java.util.List; 026 027 /** 028 * The persistence utility for the contact service. This utility wraps {@link ContactPersistenceImpl} 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 ContactPersistence 036 * @see ContactPersistenceImpl 037 * @generated 038 */ 039 public class ContactUtil { 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(Contact contact) { 057 getPersistence().clearCache(contact); 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<Contact> 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<Contact> 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<Contact> 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 Contact remove(Contact contact) throws SystemException { 100 return getPersistence().remove(contact); 101 } 102 103 /** 104 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean) 105 */ 106 public static Contact update(Contact contact, boolean merge) 107 throws SystemException { 108 return getPersistence().update(contact, merge); 109 } 110 111 /** 112 * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext) 113 */ 114 public static Contact update(Contact contact, boolean merge, 115 ServiceContext serviceContext) throws SystemException { 116 return getPersistence().update(contact, merge, serviceContext); 117 } 118 119 /** 120 * Caches the contact in the entity cache if it is enabled. 121 * 122 * @param contact the contact 123 */ 124 public static void cacheResult(com.liferay.portal.model.Contact contact) { 125 getPersistence().cacheResult(contact); 126 } 127 128 /** 129 * Caches the contacts in the entity cache if it is enabled. 130 * 131 * @param contacts the contacts 132 */ 133 public static void cacheResult( 134 java.util.List<com.liferay.portal.model.Contact> contacts) { 135 getPersistence().cacheResult(contacts); 136 } 137 138 /** 139 * Creates a new contact with the primary key. Does not add the contact to the database. 140 * 141 * @param contactId the primary key for the new contact 142 * @return the new contact 143 */ 144 public static com.liferay.portal.model.Contact create(long contactId) { 145 return getPersistence().create(contactId); 146 } 147 148 /** 149 * Removes the contact with the primary key from the database. Also notifies the appropriate model listeners. 150 * 151 * @param contactId the primary key of the contact 152 * @return the contact that was removed 153 * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found 154 * @throws SystemException if a system exception occurred 155 */ 156 public static com.liferay.portal.model.Contact remove(long contactId) 157 throws com.liferay.portal.NoSuchContactException, 158 com.liferay.portal.kernel.exception.SystemException { 159 return getPersistence().remove(contactId); 160 } 161 162 public static com.liferay.portal.model.Contact updateImpl( 163 com.liferay.portal.model.Contact contact, boolean merge) 164 throws com.liferay.portal.kernel.exception.SystemException { 165 return getPersistence().updateImpl(contact, merge); 166 } 167 168 /** 169 * Returns the contact with the primary key or throws a {@link com.liferay.portal.NoSuchContactException} if it could not be found. 170 * 171 * @param contactId the primary key of the contact 172 * @return the contact 173 * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found 174 * @throws SystemException if a system exception occurred 175 */ 176 public static com.liferay.portal.model.Contact findByPrimaryKey( 177 long contactId) 178 throws com.liferay.portal.NoSuchContactException, 179 com.liferay.portal.kernel.exception.SystemException { 180 return getPersistence().findByPrimaryKey(contactId); 181 } 182 183 /** 184 * Returns the contact with the primary key or returns <code>null</code> if it could not be found. 185 * 186 * @param contactId the primary key of the contact 187 * @return the contact, or <code>null</code> if a contact with the primary key could not be found 188 * @throws SystemException if a system exception occurred 189 */ 190 public static com.liferay.portal.model.Contact fetchByPrimaryKey( 191 long contactId) 192 throws com.liferay.portal.kernel.exception.SystemException { 193 return getPersistence().fetchByPrimaryKey(contactId); 194 } 195 196 /** 197 * Returns all the contacts where companyId = ?. 198 * 199 * @param companyId the company ID 200 * @return the matching contacts 201 * @throws SystemException if a system exception occurred 202 */ 203 public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId( 204 long companyId) 205 throws com.liferay.portal.kernel.exception.SystemException { 206 return getPersistence().findByCompanyId(companyId); 207 } 208 209 /** 210 * Returns a range of all the contacts where companyId = ?. 211 * 212 * <p> 213 * 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. 214 * </p> 215 * 216 * @param companyId the company ID 217 * @param start the lower bound of the range of contacts 218 * @param end the upper bound of the range of contacts (not inclusive) 219 * @return the range of matching contacts 220 * @throws SystemException if a system exception occurred 221 */ 222 public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId( 223 long companyId, int start, int end) 224 throws com.liferay.portal.kernel.exception.SystemException { 225 return getPersistence().findByCompanyId(companyId, start, end); 226 } 227 228 /** 229 * Returns an ordered range of all the contacts where companyId = ?. 230 * 231 * <p> 232 * 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. 233 * </p> 234 * 235 * @param companyId the company ID 236 * @param start the lower bound of the range of contacts 237 * @param end the upper bound of the range of contacts (not inclusive) 238 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 239 * @return the ordered range of matching contacts 240 * @throws SystemException if a system exception occurred 241 */ 242 public static java.util.List<com.liferay.portal.model.Contact> findByCompanyId( 243 long companyId, int start, int end, 244 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 245 throws com.liferay.portal.kernel.exception.SystemException { 246 return getPersistence() 247 .findByCompanyId(companyId, start, end, orderByComparator); 248 } 249 250 /** 251 * Returns the first contact in the ordered set where companyId = ?. 252 * 253 * <p> 254 * 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. 255 * </p> 256 * 257 * @param companyId the company ID 258 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 259 * @return the first matching contact 260 * @throws com.liferay.portal.NoSuchContactException if a matching contact could not be found 261 * @throws SystemException if a system exception occurred 262 */ 263 public static com.liferay.portal.model.Contact findByCompanyId_First( 264 long companyId, 265 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 266 throws com.liferay.portal.NoSuchContactException, 267 com.liferay.portal.kernel.exception.SystemException { 268 return getPersistence() 269 .findByCompanyId_First(companyId, orderByComparator); 270 } 271 272 /** 273 * Returns the last contact in the ordered set where companyId = ?. 274 * 275 * <p> 276 * 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. 277 * </p> 278 * 279 * @param companyId the company ID 280 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 281 * @return the last matching contact 282 * @throws com.liferay.portal.NoSuchContactException if a matching contact could not be found 283 * @throws SystemException if a system exception occurred 284 */ 285 public static com.liferay.portal.model.Contact findByCompanyId_Last( 286 long companyId, 287 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 288 throws com.liferay.portal.NoSuchContactException, 289 com.liferay.portal.kernel.exception.SystemException { 290 return getPersistence() 291 .findByCompanyId_Last(companyId, orderByComparator); 292 } 293 294 /** 295 * Returns the contacts before and after the current contact in the ordered set where companyId = ?. 296 * 297 * <p> 298 * 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. 299 * </p> 300 * 301 * @param contactId the primary key of the current contact 302 * @param companyId the company ID 303 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) 304 * @return the previous, current, and next contact 305 * @throws com.liferay.portal.NoSuchContactException if a contact with the primary key could not be found 306 * @throws SystemException if a system exception occurred 307 */ 308 public static com.liferay.portal.model.Contact[] findByCompanyId_PrevAndNext( 309 long contactId, long companyId, 310 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 311 throws com.liferay.portal.NoSuchContactException, 312 com.liferay.portal.kernel.exception.SystemException { 313 return getPersistence() 314 .findByCompanyId_PrevAndNext(contactId, companyId, 315 orderByComparator); 316 } 317 318 /** 319 * Returns all the contacts. 320 * 321 * @return the contacts 322 * @throws SystemException if a system exception occurred 323 */ 324 public static java.util.List<com.liferay.portal.model.Contact> findAll() 325 throws com.liferay.portal.kernel.exception.SystemException { 326 return getPersistence().findAll(); 327 } 328 329 /** 330 * Returns a range of all the contacts. 331 * 332 * <p> 333 * 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. 334 * </p> 335 * 336 * @param start the lower bound of the range of contacts 337 * @param end the upper bound of the range of contacts (not inclusive) 338 * @return the range of contacts 339 * @throws SystemException if a system exception occurred 340 */ 341 public static java.util.List<com.liferay.portal.model.Contact> findAll( 342 int start, int end) 343 throws com.liferay.portal.kernel.exception.SystemException { 344 return getPersistence().findAll(start, end); 345 } 346 347 /** 348 * Returns an ordered range of all the contacts. 349 * 350 * <p> 351 * 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. 352 * </p> 353 * 354 * @param start the lower bound of the range of contacts 355 * @param end the upper bound of the range of contacts (not inclusive) 356 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 357 * @return the ordered range of contacts 358 * @throws SystemException if a system exception occurred 359 */ 360 public static java.util.List<com.liferay.portal.model.Contact> findAll( 361 int start, int end, 362 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 363 throws com.liferay.portal.kernel.exception.SystemException { 364 return getPersistence().findAll(start, end, orderByComparator); 365 } 366 367 /** 368 * Removes all the contacts where companyId = ? from the database. 369 * 370 * @param companyId the company ID 371 * @throws SystemException if a system exception occurred 372 */ 373 public static void removeByCompanyId(long companyId) 374 throws com.liferay.portal.kernel.exception.SystemException { 375 getPersistence().removeByCompanyId(companyId); 376 } 377 378 /** 379 * Removes all the contacts from the database. 380 * 381 * @throws SystemException if a system exception occurred 382 */ 383 public static void removeAll() 384 throws com.liferay.portal.kernel.exception.SystemException { 385 getPersistence().removeAll(); 386 } 387 388 /** 389 * Returns the number of contacts where companyId = ?. 390 * 391 * @param companyId the company ID 392 * @return the number of matching contacts 393 * @throws SystemException if a system exception occurred 394 */ 395 public static int countByCompanyId(long companyId) 396 throws com.liferay.portal.kernel.exception.SystemException { 397 return getPersistence().countByCompanyId(companyId); 398 } 399 400 /** 401 * Returns the number of contacts. 402 * 403 * @return the number of contacts 404 * @throws SystemException if a system exception occurred 405 */ 406 public static int countAll() 407 throws com.liferay.portal.kernel.exception.SystemException { 408 return getPersistence().countAll(); 409 } 410 411 public static ContactPersistence getPersistence() { 412 if (_persistence == null) { 413 _persistence = (ContactPersistence)PortalBeanLocatorUtil.locate(ContactPersistence.class.getName()); 414 415 ReferenceRegistry.registerReference(ContactUtil.class, 416 "_persistence"); 417 } 418 419 return _persistence; 420 } 421 422 public void setPersistence(ContactPersistence persistence) { 423 _persistence = persistence; 424 425 ReferenceRegistry.registerReference(ContactUtil.class, "_persistence"); 426 } 427 428 private static ContactPersistence _persistence; 429 }