1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  /**
26   * <a href="ClassNameUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ClassNameUtil {
32      public static com.liferay.portal.model.ClassName create(long classNameId) {
33          return getPersistence().create(classNameId);
34      }
35  
36      public static com.liferay.portal.model.ClassName remove(long classNameId)
37          throws com.liferay.portal.SystemException,
38              com.liferay.portal.NoSuchClassNameException {
39          return getPersistence().remove(classNameId);
40      }
41  
42      public static com.liferay.portal.model.ClassName remove(
43          com.liferay.portal.model.ClassName className)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(className);
46      }
47  
48      /**
49       * @deprecated Use <code>update(ClassName className, boolean merge)</code>.
50       */
51      public static com.liferay.portal.model.ClassName update(
52          com.liferay.portal.model.ClassName className)
53          throws com.liferay.portal.SystemException {
54          return getPersistence().update(className);
55      }
56  
57      /**
58       * Add, update, or merge, the entity. This method also calls the model
59       * listeners to trigger the proper events associated with adding, deleting,
60       * or updating an entity.
61       *
62       * @param        className the entity to add, update, or merge
63       * @param        merge boolean value for whether to merge the entity. The
64       *                default value is false. Setting merge to true is more
65       *                expensive and should only be true when className is
66       *                transient. See LEP-5473 for a detailed discussion of this
67       *                method.
68       * @return        true if the portlet can be displayed via Ajax
69       */
70      public static com.liferay.portal.model.ClassName update(
71          com.liferay.portal.model.ClassName className, boolean merge)
72          throws com.liferay.portal.SystemException {
73          return getPersistence().update(className, merge);
74      }
75  
76      public static com.liferay.portal.model.ClassName updateImpl(
77          com.liferay.portal.model.ClassName className, boolean merge)
78          throws com.liferay.portal.SystemException {
79          return getPersistence().updateImpl(className, merge);
80      }
81  
82      public static com.liferay.portal.model.ClassName findByPrimaryKey(
83          long classNameId)
84          throws com.liferay.portal.SystemException,
85              com.liferay.portal.NoSuchClassNameException {
86          return getPersistence().findByPrimaryKey(classNameId);
87      }
88  
89      public static com.liferay.portal.model.ClassName fetchByPrimaryKey(
90          long classNameId) throws com.liferay.portal.SystemException {
91          return getPersistence().fetchByPrimaryKey(classNameId);
92      }
93  
94      public static com.liferay.portal.model.ClassName findByValue(
95          java.lang.String value)
96          throws com.liferay.portal.SystemException,
97              com.liferay.portal.NoSuchClassNameException {
98          return getPersistence().findByValue(value);
99      }
100 
101     public static com.liferay.portal.model.ClassName fetchByValue(
102         java.lang.String value) throws com.liferay.portal.SystemException {
103         return getPersistence().fetchByValue(value);
104     }
105 
106     public static java.util.List<com.liferay.portal.model.ClassName> findWithDynamicQuery(
107         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
108         throws com.liferay.portal.SystemException {
109         return getPersistence().findWithDynamicQuery(queryInitializer);
110     }
111 
112     public static java.util.List<com.liferay.portal.model.ClassName> findWithDynamicQuery(
113         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
114         int begin, int end) throws com.liferay.portal.SystemException {
115         return getPersistence()
116                    .findWithDynamicQuery(queryInitializer, begin, end);
117     }
118 
119     public static java.util.List<com.liferay.portal.model.ClassName> findAll()
120         throws com.liferay.portal.SystemException {
121         return getPersistence().findAll();
122     }
123 
124     public static java.util.List<com.liferay.portal.model.ClassName> findAll(
125         int begin, int end) throws com.liferay.portal.SystemException {
126         return getPersistence().findAll(begin, end);
127     }
128 
129     public static java.util.List<com.liferay.portal.model.ClassName> findAll(
130         int begin, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
131         throws com.liferay.portal.SystemException {
132         return getPersistence().findAll(begin, end, obc);
133     }
134 
135     public static void removeByValue(java.lang.String value)
136         throws com.liferay.portal.SystemException,
137             com.liferay.portal.NoSuchClassNameException {
138         getPersistence().removeByValue(value);
139     }
140 
141     public static void removeAll() throws com.liferay.portal.SystemException {
142         getPersistence().removeAll();
143     }
144 
145     public static int countByValue(java.lang.String value)
146         throws com.liferay.portal.SystemException {
147         return getPersistence().countByValue(value);
148     }
149 
150     public static int countAll() throws com.liferay.portal.SystemException {
151         return getPersistence().countAll();
152     }
153 
154     public static ClassNamePersistence getPersistence() {
155         return _getUtil()._persistence;
156     }
157 
158     public void setPersistence(ClassNamePersistence persistence) {
159         _persistence = persistence;
160     }
161 
162     private static ClassNameUtil _getUtil() {
163         if (_util == null) {
164             _util = (ClassNameUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
165         }
166 
167         return _util;
168     }
169 
170     private static final String _UTIL = ClassNameUtil.class.getName();
171     private static ClassNameUtil _util;
172     private ClassNamePersistence _persistence;
173 }