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.Ticket;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import java.util.List;
026    
027    /**
028     * The persistence utility for the ticket service. This utility wraps {@link TicketPersistenceImpl} 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 TicketPersistence
036     * @see TicketPersistenceImpl
037     * @generated
038     */
039    public class TicketUtil {
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(Ticket ticket) {
057                    getPersistence().clearCache(ticket);
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<Ticket> 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<Ticket> findWithDynamicQuery(DynamicQuery dynamicQuery,
080                    int start, int end) throws SystemException {
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<Ticket> findWithDynamicQuery(DynamicQuery dynamicQuery,
088                    int start, int end, OrderByComparator orderByComparator)
089                    throws SystemException {
090                    return getPersistence()
091                                       .findWithDynamicQuery(dynamicQuery, start, end,
092                            orderByComparator);
093            }
094    
095            /**
096             * @see com.liferay.portal.service.persistence.BasePersistence#remove(com.liferay.portal.model.BaseModel)
097             */
098            public static Ticket remove(Ticket ticket) throws SystemException {
099                    return getPersistence().remove(ticket);
100            }
101    
102            /**
103             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean)
104             */
105            public static Ticket update(Ticket ticket, boolean merge)
106                    throws SystemException {
107                    return getPersistence().update(ticket, merge);
108            }
109    
110            /**
111             * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
112             */
113            public static Ticket update(Ticket ticket, boolean merge,
114                    ServiceContext serviceContext) throws SystemException {
115                    return getPersistence().update(ticket, merge, serviceContext);
116            }
117    
118            /**
119            * Caches the ticket in the entity cache if it is enabled.
120            *
121            * @param ticket the ticket
122            */
123            public static void cacheResult(com.liferay.portal.model.Ticket ticket) {
124                    getPersistence().cacheResult(ticket);
125            }
126    
127            /**
128            * Caches the tickets in the entity cache if it is enabled.
129            *
130            * @param tickets the tickets
131            */
132            public static void cacheResult(
133                    java.util.List<com.liferay.portal.model.Ticket> tickets) {
134                    getPersistence().cacheResult(tickets);
135            }
136    
137            /**
138            * Creates a new ticket with the primary key. Does not add the ticket to the database.
139            *
140            * @param ticketId the primary key for the new ticket
141            * @return the new ticket
142            */
143            public static com.liferay.portal.model.Ticket create(long ticketId) {
144                    return getPersistence().create(ticketId);
145            }
146    
147            /**
148            * Removes the ticket with the primary key from the database. Also notifies the appropriate model listeners.
149            *
150            * @param ticketId the primary key of the ticket
151            * @return the ticket that was removed
152            * @throws com.liferay.portal.NoSuchTicketException if a ticket with the primary key could not be found
153            * @throws SystemException if a system exception occurred
154            */
155            public static com.liferay.portal.model.Ticket remove(long ticketId)
156                    throws com.liferay.portal.NoSuchTicketException,
157                            com.liferay.portal.kernel.exception.SystemException {
158                    return getPersistence().remove(ticketId);
159            }
160    
161            public static com.liferay.portal.model.Ticket updateImpl(
162                    com.liferay.portal.model.Ticket ticket, boolean merge)
163                    throws com.liferay.portal.kernel.exception.SystemException {
164                    return getPersistence().updateImpl(ticket, merge);
165            }
166    
167            /**
168            * Returns the ticket with the primary key or throws a {@link com.liferay.portal.NoSuchTicketException} if it could not be found.
169            *
170            * @param ticketId the primary key of the ticket
171            * @return the ticket
172            * @throws com.liferay.portal.NoSuchTicketException if a ticket with the primary key could not be found
173            * @throws SystemException if a system exception occurred
174            */
175            public static com.liferay.portal.model.Ticket findByPrimaryKey(
176                    long ticketId)
177                    throws com.liferay.portal.NoSuchTicketException,
178                            com.liferay.portal.kernel.exception.SystemException {
179                    return getPersistence().findByPrimaryKey(ticketId);
180            }
181    
182            /**
183            * Returns the ticket with the primary key or returns <code>null</code> if it could not be found.
184            *
185            * @param ticketId the primary key of the ticket
186            * @return the ticket, or <code>null</code> if a ticket with the primary key could not be found
187            * @throws SystemException if a system exception occurred
188            */
189            public static com.liferay.portal.model.Ticket fetchByPrimaryKey(
190                    long ticketId)
191                    throws com.liferay.portal.kernel.exception.SystemException {
192                    return getPersistence().fetchByPrimaryKey(ticketId);
193            }
194    
195            /**
196            * Returns the ticket where key = &#63; or throws a {@link com.liferay.portal.NoSuchTicketException} if it could not be found.
197            *
198            * @param key the key
199            * @return the matching ticket
200            * @throws com.liferay.portal.NoSuchTicketException if a matching ticket could not be found
201            * @throws SystemException if a system exception occurred
202            */
203            public static com.liferay.portal.model.Ticket findByKey(
204                    java.lang.String key)
205                    throws com.liferay.portal.NoSuchTicketException,
206                            com.liferay.portal.kernel.exception.SystemException {
207                    return getPersistence().findByKey(key);
208            }
209    
210            /**
211            * Returns the ticket where key = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
212            *
213            * @param key the key
214            * @return the matching ticket, or <code>null</code> if a matching ticket could not be found
215            * @throws SystemException if a system exception occurred
216            */
217            public static com.liferay.portal.model.Ticket fetchByKey(
218                    java.lang.String key)
219                    throws com.liferay.portal.kernel.exception.SystemException {
220                    return getPersistence().fetchByKey(key);
221            }
222    
223            /**
224            * Returns the ticket where key = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
225            *
226            * @param key the key
227            * @param retrieveFromCache whether to use the finder cache
228            * @return the matching ticket, or <code>null</code> if a matching ticket could not be found
229            * @throws SystemException if a system exception occurred
230            */
231            public static com.liferay.portal.model.Ticket fetchByKey(
232                    java.lang.String key, boolean retrieveFromCache)
233                    throws com.liferay.portal.kernel.exception.SystemException {
234                    return getPersistence().fetchByKey(key, retrieveFromCache);
235            }
236    
237            /**
238            * Returns all the tickets.
239            *
240            * @return the tickets
241            * @throws SystemException if a system exception occurred
242            */
243            public static java.util.List<com.liferay.portal.model.Ticket> findAll()
244                    throws com.liferay.portal.kernel.exception.SystemException {
245                    return getPersistence().findAll();
246            }
247    
248            /**
249            * Returns a range of all the tickets.
250            *
251            * <p>
252            * 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.
253            * </p>
254            *
255            * @param start the lower bound of the range of tickets
256            * @param end the upper bound of the range of tickets (not inclusive)
257            * @return the range of tickets
258            * @throws SystemException if a system exception occurred
259            */
260            public static java.util.List<com.liferay.portal.model.Ticket> findAll(
261                    int start, int end)
262                    throws com.liferay.portal.kernel.exception.SystemException {
263                    return getPersistence().findAll(start, end);
264            }
265    
266            /**
267            * Returns an ordered range of all the tickets.
268            *
269            * <p>
270            * 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.
271            * </p>
272            *
273            * @param start the lower bound of the range of tickets
274            * @param end the upper bound of the range of tickets (not inclusive)
275            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
276            * @return the ordered range of tickets
277            * @throws SystemException if a system exception occurred
278            */
279            public static java.util.List<com.liferay.portal.model.Ticket> findAll(
280                    int start, int end,
281                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
282                    throws com.liferay.portal.kernel.exception.SystemException {
283                    return getPersistence().findAll(start, end, orderByComparator);
284            }
285    
286            /**
287            * Removes the ticket where key = &#63; from the database.
288            *
289            * @param key the key
290            * @throws SystemException if a system exception occurred
291            */
292            public static void removeByKey(java.lang.String key)
293                    throws com.liferay.portal.NoSuchTicketException,
294                            com.liferay.portal.kernel.exception.SystemException {
295                    getPersistence().removeByKey(key);
296            }
297    
298            /**
299            * Removes all the tickets from the database.
300            *
301            * @throws SystemException if a system exception occurred
302            */
303            public static void removeAll()
304                    throws com.liferay.portal.kernel.exception.SystemException {
305                    getPersistence().removeAll();
306            }
307    
308            /**
309            * Returns the number of tickets where key = &#63;.
310            *
311            * @param key the key
312            * @return the number of matching tickets
313            * @throws SystemException if a system exception occurred
314            */
315            public static int countByKey(java.lang.String key)
316                    throws com.liferay.portal.kernel.exception.SystemException {
317                    return getPersistence().countByKey(key);
318            }
319    
320            /**
321            * Returns the number of tickets.
322            *
323            * @return the number of tickets
324            * @throws SystemException if a system exception occurred
325            */
326            public static int countAll()
327                    throws com.liferay.portal.kernel.exception.SystemException {
328                    return getPersistence().countAll();
329            }
330    
331            public static TicketPersistence getPersistence() {
332                    if (_persistence == null) {
333                            _persistence = (TicketPersistence)PortalBeanLocatorUtil.locate(TicketPersistence.class.getName());
334    
335                            ReferenceRegistry.registerReference(TicketUtil.class, "_persistence");
336                    }
337    
338                    return _persistence;
339            }
340    
341            public void setPersistence(TicketPersistence persistence) {
342                    _persistence = persistence;
343    
344                    ReferenceRegistry.registerReference(TicketUtil.class, "_persistence");
345            }
346    
347            private static TicketPersistence _persistence;
348    }