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.counter.service; 016 017 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil; 018 import com.liferay.portal.kernel.util.MethodCache; 019 import com.liferay.portal.kernel.util.ReferenceRegistry; 020 021 /** 022 * The utility for the counter local service. This utility wraps {@link com.liferay.counter.service.impl.CounterLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server. 023 * 024 * <p> 025 * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM. 026 * </p> 027 * 028 * @author Brian Wing Shun Chan 029 * @see CounterLocalService 030 * @see com.liferay.counter.service.base.CounterLocalServiceBaseImpl 031 * @see com.liferay.counter.service.impl.CounterLocalServiceImpl 032 * @generated 033 */ 034 public class CounterLocalServiceUtil { 035 /* 036 * NOTE FOR DEVELOPERS: 037 * 038 * Never modify this class directly. Add custom service methods to {@link com.liferay.counter.service.impl.CounterLocalServiceImpl} and rerun ServiceBuilder to regenerate this class. 039 */ 040 041 /** 042 * Adds the counter to the database. Also notifies the appropriate model listeners. 043 * 044 * @param counter the counter 045 * @return the counter that was added 046 * @throws SystemException if a system exception occurred 047 */ 048 public static com.liferay.counter.model.Counter addCounter( 049 com.liferay.counter.model.Counter counter) 050 throws com.liferay.portal.kernel.exception.SystemException { 051 return getService().addCounter(counter); 052 } 053 054 /** 055 * Creates a new counter with the primary key. Does not add the counter to the database. 056 * 057 * @param name the primary key for the new counter 058 * @return the new counter 059 */ 060 public static com.liferay.counter.model.Counter createCounter( 061 java.lang.String name) { 062 return getService().createCounter(name); 063 } 064 065 /** 066 * Deletes the counter with the primary key from the database. Also notifies the appropriate model listeners. 067 * 068 * @param name the primary key of the counter 069 * @throws PortalException if a counter with the primary key could not be found 070 * @throws SystemException if a system exception occurred 071 */ 072 public static void deleteCounter(java.lang.String name) 073 throws com.liferay.portal.kernel.exception.PortalException, 074 com.liferay.portal.kernel.exception.SystemException { 075 getService().deleteCounter(name); 076 } 077 078 /** 079 * Deletes the counter from the database. Also notifies the appropriate model listeners. 080 * 081 * @param counter the counter 082 * @throws SystemException if a system exception occurred 083 */ 084 public static void deleteCounter(com.liferay.counter.model.Counter counter) 085 throws com.liferay.portal.kernel.exception.SystemException { 086 getService().deleteCounter(counter); 087 } 088 089 /** 090 * Performs a dynamic query on the database and returns the matching rows. 091 * 092 * @param dynamicQuery the dynamic query 093 * @return the matching rows 094 * @throws SystemException if a system exception occurred 095 */ 096 @SuppressWarnings("rawtypes") 097 public static java.util.List dynamicQuery( 098 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 099 throws com.liferay.portal.kernel.exception.SystemException { 100 return getService().dynamicQuery(dynamicQuery); 101 } 102 103 /** 104 * Performs a dynamic query on the database and returns a range of the matching rows. 105 * 106 * <p> 107 * 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. 108 * </p> 109 * 110 * @param dynamicQuery the dynamic query 111 * @param start the lower bound of the range of model instances 112 * @param end the upper bound of the range of model instances (not inclusive) 113 * @return the range of matching rows 114 * @throws SystemException if a system exception occurred 115 */ 116 @SuppressWarnings("rawtypes") 117 public static java.util.List dynamicQuery( 118 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 119 int end) throws com.liferay.portal.kernel.exception.SystemException { 120 return getService().dynamicQuery(dynamicQuery, start, end); 121 } 122 123 /** 124 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 125 * 126 * <p> 127 * 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. 128 * </p> 129 * 130 * @param dynamicQuery the dynamic query 131 * @param start the lower bound of the range of model instances 132 * @param end the upper bound of the range of model instances (not inclusive) 133 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 134 * @return the ordered range of matching rows 135 * @throws SystemException if a system exception occurred 136 */ 137 @SuppressWarnings("rawtypes") 138 public static java.util.List dynamicQuery( 139 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 140 int end, 141 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 142 throws com.liferay.portal.kernel.exception.SystemException { 143 return getService() 144 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 145 } 146 147 /** 148 * Returns the number of rows that match the dynamic query. 149 * 150 * @param dynamicQuery the dynamic query 151 * @return the number of rows that match the dynamic query 152 * @throws SystemException if a system exception occurred 153 */ 154 public static long dynamicQueryCount( 155 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 156 throws com.liferay.portal.kernel.exception.SystemException { 157 return getService().dynamicQueryCount(dynamicQuery); 158 } 159 160 /** 161 * Returns the counter with the primary key. 162 * 163 * @param name the primary key of the counter 164 * @return the counter 165 * @throws PortalException if a counter with the primary key could not be found 166 * @throws SystemException if a system exception occurred 167 */ 168 public static com.liferay.counter.model.Counter getCounter( 169 java.lang.String name) 170 throws com.liferay.portal.kernel.exception.PortalException, 171 com.liferay.portal.kernel.exception.SystemException { 172 return getService().getCounter(name); 173 } 174 175 public static com.liferay.portal.model.PersistedModel getPersistedModel( 176 java.io.Serializable primaryKeyObj) 177 throws com.liferay.portal.kernel.exception.PortalException, 178 com.liferay.portal.kernel.exception.SystemException { 179 return getService().getPersistedModel(primaryKeyObj); 180 } 181 182 /** 183 * Returns a range of all the counters. 184 * 185 * <p> 186 * 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. 187 * </p> 188 * 189 * @param start the lower bound of the range of counters 190 * @param end the upper bound of the range of counters (not inclusive) 191 * @return the range of counters 192 * @throws SystemException if a system exception occurred 193 */ 194 public static java.util.List<com.liferay.counter.model.Counter> getCounters( 195 int start, int end) 196 throws com.liferay.portal.kernel.exception.SystemException { 197 return getService().getCounters(start, end); 198 } 199 200 /** 201 * Returns the number of counters. 202 * 203 * @return the number of counters 204 * @throws SystemException if a system exception occurred 205 */ 206 public static int getCountersCount() 207 throws com.liferay.portal.kernel.exception.SystemException { 208 return getService().getCountersCount(); 209 } 210 211 /** 212 * Updates the counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 213 * 214 * @param counter the counter 215 * @return the counter that was updated 216 * @throws SystemException if a system exception occurred 217 */ 218 public static com.liferay.counter.model.Counter updateCounter( 219 com.liferay.counter.model.Counter counter) 220 throws com.liferay.portal.kernel.exception.SystemException { 221 return getService().updateCounter(counter); 222 } 223 224 /** 225 * Updates the counter in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 226 * 227 * @param counter the counter 228 * @param merge whether to merge the counter with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation. 229 * @return the counter that was updated 230 * @throws SystemException if a system exception occurred 231 */ 232 public static com.liferay.counter.model.Counter updateCounter( 233 com.liferay.counter.model.Counter counter, boolean merge) 234 throws com.liferay.portal.kernel.exception.SystemException { 235 return getService().updateCounter(counter, merge); 236 } 237 238 /** 239 * Returns the Spring bean ID for this bean. 240 * 241 * @return the Spring bean ID for this bean 242 */ 243 public static java.lang.String getBeanIdentifier() { 244 return getService().getBeanIdentifier(); 245 } 246 247 /** 248 * Sets the Spring bean ID for this bean. 249 * 250 * @param beanIdentifier the Spring bean ID for this bean 251 */ 252 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 253 getService().setBeanIdentifier(beanIdentifier); 254 } 255 256 public static java.util.List<java.lang.String> getNames() 257 throws com.liferay.portal.kernel.exception.SystemException { 258 return getService().getNames(); 259 } 260 261 public static long increment() 262 throws com.liferay.portal.kernel.exception.SystemException { 263 return getService().increment(); 264 } 265 266 public static long increment(java.lang.String name) 267 throws com.liferay.portal.kernel.exception.SystemException { 268 return getService().increment(name); 269 } 270 271 public static long increment(java.lang.String name, int size) 272 throws com.liferay.portal.kernel.exception.SystemException { 273 return getService().increment(name, size); 274 } 275 276 public static void rename(java.lang.String oldName, java.lang.String newName) 277 throws com.liferay.portal.kernel.exception.SystemException { 278 getService().rename(oldName, newName); 279 } 280 281 public static void reset(java.lang.String name) 282 throws com.liferay.portal.kernel.exception.SystemException { 283 getService().reset(name); 284 } 285 286 public static void reset(java.lang.String name, long size) 287 throws com.liferay.portal.kernel.exception.SystemException { 288 getService().reset(name, size); 289 } 290 291 public static CounterLocalService getService() { 292 if (_service == null) { 293 _service = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName()); 294 295 ReferenceRegistry.registerReference(CounterLocalServiceUtil.class, 296 "_service"); 297 MethodCache.remove(CounterLocalService.class); 298 } 299 300 return _service; 301 } 302 303 public void setService(CounterLocalService service) { 304 MethodCache.remove(CounterLocalService.class); 305 306 _service = service; 307 308 ReferenceRegistry.registerReference(CounterLocalServiceUtil.class, 309 "_service"); 310 MethodCache.remove(CounterLocalService.class); 311 } 312 313 private static CounterLocalService _service; 314 }