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