001 /** 002 * Copyright (c) 2000-present 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.base; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.bean.BeanReference; 020 import com.liferay.portal.kernel.bean.IdentifiableBean; 021 import com.liferay.portal.kernel.dao.db.DB; 022 import com.liferay.portal.kernel.dao.db.DBFactoryUtil; 023 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate; 024 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil; 025 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 026 import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery; 027 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 028 import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; 029 import com.liferay.portal.kernel.dao.orm.Projection; 030 import com.liferay.portal.kernel.exception.PortalException; 031 import com.liferay.portal.kernel.exception.SystemException; 032 import com.liferay.portal.kernel.search.Indexable; 033 import com.liferay.portal.kernel.search.IndexableType; 034 import com.liferay.portal.kernel.util.OrderByComparator; 035 import com.liferay.portal.model.PersistedModel; 036 import com.liferay.portal.model.UserTrackerPath; 037 import com.liferay.portal.service.BaseLocalServiceImpl; 038 import com.liferay.portal.service.PersistedModelLocalServiceRegistry; 039 import com.liferay.portal.service.UserTrackerPathLocalService; 040 import com.liferay.portal.service.persistence.UserTrackerPathPersistence; 041 import com.liferay.portal.util.PortalUtil; 042 043 import java.io.Serializable; 044 045 import java.util.List; 046 047 import javax.sql.DataSource; 048 049 /** 050 * Provides the base implementation for the user tracker path local service. 051 * 052 * <p> 053 * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portal.service.impl.UserTrackerPathLocalServiceImpl}. 054 * </p> 055 * 056 * @author Brian Wing Shun Chan 057 * @see com.liferay.portal.service.impl.UserTrackerPathLocalServiceImpl 058 * @see com.liferay.portal.service.UserTrackerPathLocalServiceUtil 059 * @generated 060 */ 061 @ProviderType 062 public abstract class UserTrackerPathLocalServiceBaseImpl 063 extends BaseLocalServiceImpl implements UserTrackerPathLocalService, 064 IdentifiableBean { 065 /* 066 * NOTE FOR DEVELOPERS: 067 * 068 * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.UserTrackerPathLocalServiceUtil} to access the user tracker path local service. 069 */ 070 071 /** 072 * Adds the user tracker path to the database. Also notifies the appropriate model listeners. 073 * 074 * @param userTrackerPath the user tracker path 075 * @return the user tracker path that was added 076 */ 077 @Indexable(type = IndexableType.REINDEX) 078 @Override 079 public UserTrackerPath addUserTrackerPath(UserTrackerPath userTrackerPath) { 080 userTrackerPath.setNew(true); 081 082 return userTrackerPathPersistence.update(userTrackerPath); 083 } 084 085 /** 086 * Creates a new user tracker path with the primary key. Does not add the user tracker path to the database. 087 * 088 * @param userTrackerPathId the primary key for the new user tracker path 089 * @return the new user tracker path 090 */ 091 @Override 092 public UserTrackerPath createUserTrackerPath(long userTrackerPathId) { 093 return userTrackerPathPersistence.create(userTrackerPathId); 094 } 095 096 /** 097 * Deletes the user tracker path with the primary key from the database. Also notifies the appropriate model listeners. 098 * 099 * @param userTrackerPathId the primary key of the user tracker path 100 * @return the user tracker path that was removed 101 * @throws PortalException if a user tracker path with the primary key could not be found 102 */ 103 @Indexable(type = IndexableType.DELETE) 104 @Override 105 public UserTrackerPath deleteUserTrackerPath(long userTrackerPathId) 106 throws PortalException { 107 return userTrackerPathPersistence.remove(userTrackerPathId); 108 } 109 110 /** 111 * Deletes the user tracker path from the database. Also notifies the appropriate model listeners. 112 * 113 * @param userTrackerPath the user tracker path 114 * @return the user tracker path that was removed 115 */ 116 @Indexable(type = IndexableType.DELETE) 117 @Override 118 public UserTrackerPath deleteUserTrackerPath( 119 UserTrackerPath userTrackerPath) { 120 return userTrackerPathPersistence.remove(userTrackerPath); 121 } 122 123 @Override 124 public DynamicQuery dynamicQuery() { 125 Class<?> clazz = getClass(); 126 127 return DynamicQueryFactoryUtil.forClass(UserTrackerPath.class, 128 clazz.getClassLoader()); 129 } 130 131 /** 132 * Performs a dynamic query on the database and returns the matching rows. 133 * 134 * @param dynamicQuery the dynamic query 135 * @return the matching rows 136 */ 137 @Override 138 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) { 139 return userTrackerPathPersistence.findWithDynamicQuery(dynamicQuery); 140 } 141 142 /** 143 * Performs a dynamic query on the database and returns a range of the matching rows. 144 * 145 * <p> 146 * 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.UserTrackerPathModelImpl}. 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. 147 * </p> 148 * 149 * @param dynamicQuery the dynamic query 150 * @param start the lower bound of the range of model instances 151 * @param end the upper bound of the range of model instances (not inclusive) 152 * @return the range of matching rows 153 */ 154 @Override 155 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 156 int end) { 157 return userTrackerPathPersistence.findWithDynamicQuery(dynamicQuery, 158 start, end); 159 } 160 161 /** 162 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 163 * 164 * <p> 165 * 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.UserTrackerPathModelImpl}. 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. 166 * </p> 167 * 168 * @param dynamicQuery the dynamic query 169 * @param start the lower bound of the range of model instances 170 * @param end the upper bound of the range of model instances (not inclusive) 171 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 172 * @return the ordered range of matching rows 173 */ 174 @Override 175 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 176 int end, OrderByComparator<T> orderByComparator) { 177 return userTrackerPathPersistence.findWithDynamicQuery(dynamicQuery, 178 start, end, orderByComparator); 179 } 180 181 /** 182 * Returns the number of rows matching the dynamic query. 183 * 184 * @param dynamicQuery the dynamic query 185 * @return the number of rows matching the dynamic query 186 */ 187 @Override 188 public long dynamicQueryCount(DynamicQuery dynamicQuery) { 189 return userTrackerPathPersistence.countWithDynamicQuery(dynamicQuery); 190 } 191 192 /** 193 * Returns the number of rows matching the dynamic query. 194 * 195 * @param dynamicQuery the dynamic query 196 * @param projection the projection to apply to the query 197 * @return the number of rows matching the dynamic query 198 */ 199 @Override 200 public long dynamicQueryCount(DynamicQuery dynamicQuery, 201 Projection projection) { 202 return userTrackerPathPersistence.countWithDynamicQuery(dynamicQuery, 203 projection); 204 } 205 206 @Override 207 public UserTrackerPath fetchUserTrackerPath(long userTrackerPathId) { 208 return userTrackerPathPersistence.fetchByPrimaryKey(userTrackerPathId); 209 } 210 211 /** 212 * Returns the user tracker path with the primary key. 213 * 214 * @param userTrackerPathId the primary key of the user tracker path 215 * @return the user tracker path 216 * @throws PortalException if a user tracker path with the primary key could not be found 217 */ 218 @Override 219 public UserTrackerPath getUserTrackerPath(long userTrackerPathId) 220 throws PortalException { 221 return userTrackerPathPersistence.findByPrimaryKey(userTrackerPathId); 222 } 223 224 @Override 225 public ActionableDynamicQuery getActionableDynamicQuery() { 226 ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery(); 227 228 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserTrackerPathLocalServiceUtil.getService()); 229 actionableDynamicQuery.setClass(UserTrackerPath.class); 230 actionableDynamicQuery.setClassLoader(getClassLoader()); 231 232 actionableDynamicQuery.setPrimaryKeyPropertyName("userTrackerPathId"); 233 234 return actionableDynamicQuery; 235 } 236 237 protected void initActionableDynamicQuery( 238 ActionableDynamicQuery actionableDynamicQuery) { 239 actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserTrackerPathLocalServiceUtil.getService()); 240 actionableDynamicQuery.setClass(UserTrackerPath.class); 241 actionableDynamicQuery.setClassLoader(getClassLoader()); 242 243 actionableDynamicQuery.setPrimaryKeyPropertyName("userTrackerPathId"); 244 } 245 246 /** 247 * @throws PortalException 248 */ 249 @Override 250 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 251 throws PortalException { 252 return userTrackerPathLocalService.deleteUserTrackerPath((UserTrackerPath)persistedModel); 253 } 254 255 @Override 256 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 257 throws PortalException { 258 return userTrackerPathPersistence.findByPrimaryKey(primaryKeyObj); 259 } 260 261 /** 262 * Returns a range of all the user tracker paths. 263 * 264 * <p> 265 * 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.UserTrackerPathModelImpl}. 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. 266 * </p> 267 * 268 * @param start the lower bound of the range of user tracker paths 269 * @param end the upper bound of the range of user tracker paths (not inclusive) 270 * @return the range of user tracker paths 271 */ 272 @Override 273 public List<UserTrackerPath> getUserTrackerPaths(int start, int end) { 274 return userTrackerPathPersistence.findAll(start, end); 275 } 276 277 /** 278 * Returns the number of user tracker paths. 279 * 280 * @return the number of user tracker paths 281 */ 282 @Override 283 public int getUserTrackerPathsCount() { 284 return userTrackerPathPersistence.countAll(); 285 } 286 287 /** 288 * Updates the user tracker path in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 289 * 290 * @param userTrackerPath the user tracker path 291 * @return the user tracker path that was updated 292 */ 293 @Indexable(type = IndexableType.REINDEX) 294 @Override 295 public UserTrackerPath updateUserTrackerPath( 296 UserTrackerPath userTrackerPath) { 297 return userTrackerPathPersistence.update(userTrackerPath); 298 } 299 300 /** 301 * Returns the user tracker path local service. 302 * 303 * @return the user tracker path local service 304 */ 305 public UserTrackerPathLocalService getUserTrackerPathLocalService() { 306 return userTrackerPathLocalService; 307 } 308 309 /** 310 * Sets the user tracker path local service. 311 * 312 * @param userTrackerPathLocalService the user tracker path local service 313 */ 314 public void setUserTrackerPathLocalService( 315 UserTrackerPathLocalService userTrackerPathLocalService) { 316 this.userTrackerPathLocalService = userTrackerPathLocalService; 317 } 318 319 /** 320 * Returns the user tracker path persistence. 321 * 322 * @return the user tracker path persistence 323 */ 324 public UserTrackerPathPersistence getUserTrackerPathPersistence() { 325 return userTrackerPathPersistence; 326 } 327 328 /** 329 * Sets the user tracker path persistence. 330 * 331 * @param userTrackerPathPersistence the user tracker path persistence 332 */ 333 public void setUserTrackerPathPersistence( 334 UserTrackerPathPersistence userTrackerPathPersistence) { 335 this.userTrackerPathPersistence = userTrackerPathPersistence; 336 } 337 338 /** 339 * Returns the counter local service. 340 * 341 * @return the counter local service 342 */ 343 public com.liferay.counter.service.CounterLocalService getCounterLocalService() { 344 return counterLocalService; 345 } 346 347 /** 348 * Sets the counter local service. 349 * 350 * @param counterLocalService the counter local service 351 */ 352 public void setCounterLocalService( 353 com.liferay.counter.service.CounterLocalService counterLocalService) { 354 this.counterLocalService = counterLocalService; 355 } 356 357 public void afterPropertiesSet() { 358 persistedModelLocalServiceRegistry.register("com.liferay.portal.model.UserTrackerPath", 359 userTrackerPathLocalService); 360 } 361 362 public void destroy() { 363 persistedModelLocalServiceRegistry.unregister( 364 "com.liferay.portal.model.UserTrackerPath"); 365 } 366 367 /** 368 * Returns the Spring bean ID for this bean. 369 * 370 * @return the Spring bean ID for this bean 371 */ 372 @Override 373 public String getBeanIdentifier() { 374 return _beanIdentifier; 375 } 376 377 /** 378 * Sets the Spring bean ID for this bean. 379 * 380 * @param beanIdentifier the Spring bean ID for this bean 381 */ 382 @Override 383 public void setBeanIdentifier(String beanIdentifier) { 384 _beanIdentifier = beanIdentifier; 385 } 386 387 protected Class<?> getModelClass() { 388 return UserTrackerPath.class; 389 } 390 391 protected String getModelClassName() { 392 return UserTrackerPath.class.getName(); 393 } 394 395 /** 396 * Performs a SQL query. 397 * 398 * @param sql the sql query 399 */ 400 protected void runSQL(String sql) { 401 try { 402 DataSource dataSource = userTrackerPathPersistence.getDataSource(); 403 404 DB db = DBFactoryUtil.getDB(); 405 406 sql = db.buildSQL(sql); 407 sql = PortalUtil.transformSQL(sql); 408 409 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource, 410 sql, new int[0]); 411 412 sqlUpdate.update(); 413 } 414 catch (Exception e) { 415 throw new SystemException(e); 416 } 417 } 418 419 @BeanReference(type = com.liferay.portal.service.UserTrackerPathLocalService.class) 420 protected UserTrackerPathLocalService userTrackerPathLocalService; 421 @BeanReference(type = UserTrackerPathPersistence.class) 422 protected UserTrackerPathPersistence userTrackerPathPersistence; 423 @BeanReference(type = com.liferay.counter.service.CounterLocalService.class) 424 protected com.liferay.counter.service.CounterLocalService counterLocalService; 425 @BeanReference(type = PersistedModelLocalServiceRegistry.class) 426 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry; 427 private String _beanIdentifier; 428 }