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