001
014
015 package com.liferay.portlet.expando.service.base;
016
017 import com.liferay.counter.service.CounterLocalService;
018
019 import com.liferay.portal.kernel.bean.BeanReference;
020 import com.liferay.portal.kernel.bean.IdentifiableBean;
021 import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
022 import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
023 import com.liferay.portal.kernel.dao.orm.DynamicQuery;
024 import com.liferay.portal.kernel.exception.PortalException;
025 import com.liferay.portal.kernel.exception.SystemException;
026 import com.liferay.portal.kernel.log.Log;
027 import com.liferay.portal.kernel.log.LogFactoryUtil;
028 import com.liferay.portal.kernel.search.Indexer;
029 import com.liferay.portal.kernel.search.IndexerRegistryUtil;
030 import com.liferay.portal.kernel.search.SearchException;
031 import com.liferay.portal.kernel.util.OrderByComparator;
032 import com.liferay.portal.model.PersistedModel;
033 import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
034 import com.liferay.portal.service.ResourceLocalService;
035 import com.liferay.portal.service.ResourceService;
036 import com.liferay.portal.service.UserLocalService;
037 import com.liferay.portal.service.UserService;
038 import com.liferay.portal.service.persistence.ResourceFinder;
039 import com.liferay.portal.service.persistence.ResourcePersistence;
040 import com.liferay.portal.service.persistence.UserFinder;
041 import com.liferay.portal.service.persistence.UserPersistence;
042
043 import com.liferay.portlet.expando.model.ExpandoValue;
044 import com.liferay.portlet.expando.service.ExpandoColumnLocalService;
045 import com.liferay.portlet.expando.service.ExpandoColumnService;
046 import com.liferay.portlet.expando.service.ExpandoRowLocalService;
047 import com.liferay.portlet.expando.service.ExpandoTableLocalService;
048 import com.liferay.portlet.expando.service.ExpandoValueLocalService;
049 import com.liferay.portlet.expando.service.ExpandoValueService;
050 import com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence;
051 import com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence;
052 import com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence;
053 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
054
055 import java.io.Serializable;
056
057 import java.util.List;
058
059 import javax.sql.DataSource;
060
061
073 public abstract class ExpandoValueLocalServiceBaseImpl
074 implements ExpandoValueLocalService, IdentifiableBean {
075
080
081
088 public ExpandoValue addExpandoValue(ExpandoValue expandoValue)
089 throws SystemException {
090 expandoValue.setNew(true);
091
092 expandoValue = expandoValuePersistence.update(expandoValue, false);
093
094 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
095
096 if (indexer != null) {
097 try {
098 indexer.reindex(expandoValue);
099 }
100 catch (SearchException se) {
101 if (_log.isWarnEnabled()) {
102 _log.warn(se, se);
103 }
104 }
105 }
106
107 return expandoValue;
108 }
109
110
116 public ExpandoValue createExpandoValue(long valueId) {
117 return expandoValuePersistence.create(valueId);
118 }
119
120
127 public void deleteExpandoValue(long valueId)
128 throws PortalException, SystemException {
129 ExpandoValue expandoValue = expandoValuePersistence.remove(valueId);
130
131 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
132
133 if (indexer != null) {
134 try {
135 indexer.delete(expandoValue);
136 }
137 catch (SearchException se) {
138 if (_log.isWarnEnabled()) {
139 _log.warn(se, se);
140 }
141 }
142 }
143 }
144
145
151 public void deleteExpandoValue(ExpandoValue expandoValue)
152 throws SystemException {
153 expandoValuePersistence.remove(expandoValue);
154
155 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
156
157 if (indexer != null) {
158 try {
159 indexer.delete(expandoValue);
160 }
161 catch (SearchException se) {
162 if (_log.isWarnEnabled()) {
163 _log.warn(se, se);
164 }
165 }
166 }
167 }
168
169
176 @SuppressWarnings("rawtypes")
177 public List dynamicQuery(DynamicQuery dynamicQuery)
178 throws SystemException {
179 return expandoValuePersistence.findWithDynamicQuery(dynamicQuery);
180 }
181
182
195 @SuppressWarnings("rawtypes")
196 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
197 throws SystemException {
198 return expandoValuePersistence.findWithDynamicQuery(dynamicQuery,
199 start, end);
200 }
201
202
216 @SuppressWarnings("rawtypes")
217 public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
218 OrderByComparator orderByComparator) throws SystemException {
219 return expandoValuePersistence.findWithDynamicQuery(dynamicQuery,
220 start, end, orderByComparator);
221 }
222
223
230 public long dynamicQueryCount(DynamicQuery dynamicQuery)
231 throws SystemException {
232 return expandoValuePersistence.countWithDynamicQuery(dynamicQuery);
233 }
234
235 public ExpandoValue fetchExpandoValue(long valueId)
236 throws SystemException {
237 return expandoValuePersistence.fetchByPrimaryKey(valueId);
238 }
239
240
248 public ExpandoValue getExpandoValue(long valueId)
249 throws PortalException, SystemException {
250 return expandoValuePersistence.findByPrimaryKey(valueId);
251 }
252
253 public PersistedModel getPersistedModel(Serializable primaryKeyObj)
254 throws PortalException, SystemException {
255 return expandoValuePersistence.findByPrimaryKey(primaryKeyObj);
256 }
257
258
270 public List<ExpandoValue> getExpandoValues(int start, int end)
271 throws SystemException {
272 return expandoValuePersistence.findAll(start, end);
273 }
274
275
281 public int getExpandoValuesCount() throws SystemException {
282 return expandoValuePersistence.countAll();
283 }
284
285
292 public ExpandoValue updateExpandoValue(ExpandoValue expandoValue)
293 throws SystemException {
294 return updateExpandoValue(expandoValue, true);
295 }
296
297
305 public ExpandoValue updateExpandoValue(ExpandoValue expandoValue,
306 boolean merge) throws SystemException {
307 expandoValue.setNew(false);
308
309 expandoValue = expandoValuePersistence.update(expandoValue, merge);
310
311 Indexer indexer = IndexerRegistryUtil.getIndexer(getModelClassName());
312
313 if (indexer != null) {
314 try {
315 indexer.reindex(expandoValue);
316 }
317 catch (SearchException se) {
318 if (_log.isWarnEnabled()) {
319 _log.warn(se, se);
320 }
321 }
322 }
323
324 return expandoValue;
325 }
326
327
332 public ExpandoColumnLocalService getExpandoColumnLocalService() {
333 return expandoColumnLocalService;
334 }
335
336
341 public void setExpandoColumnLocalService(
342 ExpandoColumnLocalService expandoColumnLocalService) {
343 this.expandoColumnLocalService = expandoColumnLocalService;
344 }
345
346
351 public ExpandoColumnService getExpandoColumnService() {
352 return expandoColumnService;
353 }
354
355
360 public void setExpandoColumnService(
361 ExpandoColumnService expandoColumnService) {
362 this.expandoColumnService = expandoColumnService;
363 }
364
365
370 public ExpandoColumnPersistence getExpandoColumnPersistence() {
371 return expandoColumnPersistence;
372 }
373
374
379 public void setExpandoColumnPersistence(
380 ExpandoColumnPersistence expandoColumnPersistence) {
381 this.expandoColumnPersistence = expandoColumnPersistence;
382 }
383
384
389 public ExpandoRowLocalService getExpandoRowLocalService() {
390 return expandoRowLocalService;
391 }
392
393
398 public void setExpandoRowLocalService(
399 ExpandoRowLocalService expandoRowLocalService) {
400 this.expandoRowLocalService = expandoRowLocalService;
401 }
402
403
408 public ExpandoRowPersistence getExpandoRowPersistence() {
409 return expandoRowPersistence;
410 }
411
412
417 public void setExpandoRowPersistence(
418 ExpandoRowPersistence expandoRowPersistence) {
419 this.expandoRowPersistence = expandoRowPersistence;
420 }
421
422
427 public ExpandoTableLocalService getExpandoTableLocalService() {
428 return expandoTableLocalService;
429 }
430
431
436 public void setExpandoTableLocalService(
437 ExpandoTableLocalService expandoTableLocalService) {
438 this.expandoTableLocalService = expandoTableLocalService;
439 }
440
441
446 public ExpandoTablePersistence getExpandoTablePersistence() {
447 return expandoTablePersistence;
448 }
449
450
455 public void setExpandoTablePersistence(
456 ExpandoTablePersistence expandoTablePersistence) {
457 this.expandoTablePersistence = expandoTablePersistence;
458 }
459
460
465 public ExpandoValueLocalService getExpandoValueLocalService() {
466 return expandoValueLocalService;
467 }
468
469
474 public void setExpandoValueLocalService(
475 ExpandoValueLocalService expandoValueLocalService) {
476 this.expandoValueLocalService = expandoValueLocalService;
477 }
478
479
484 public ExpandoValueService getExpandoValueService() {
485 return expandoValueService;
486 }
487
488
493 public void setExpandoValueService(ExpandoValueService expandoValueService) {
494 this.expandoValueService = expandoValueService;
495 }
496
497
502 public ExpandoValuePersistence getExpandoValuePersistence() {
503 return expandoValuePersistence;
504 }
505
506
511 public void setExpandoValuePersistence(
512 ExpandoValuePersistence expandoValuePersistence) {
513 this.expandoValuePersistence = expandoValuePersistence;
514 }
515
516
521 public CounterLocalService getCounterLocalService() {
522 return counterLocalService;
523 }
524
525
530 public void setCounterLocalService(CounterLocalService counterLocalService) {
531 this.counterLocalService = counterLocalService;
532 }
533
534
539 public ResourceLocalService getResourceLocalService() {
540 return resourceLocalService;
541 }
542
543
548 public void setResourceLocalService(
549 ResourceLocalService resourceLocalService) {
550 this.resourceLocalService = resourceLocalService;
551 }
552
553
558 public ResourceService getResourceService() {
559 return resourceService;
560 }
561
562
567 public void setResourceService(ResourceService resourceService) {
568 this.resourceService = resourceService;
569 }
570
571
576 public ResourcePersistence getResourcePersistence() {
577 return resourcePersistence;
578 }
579
580
585 public void setResourcePersistence(ResourcePersistence resourcePersistence) {
586 this.resourcePersistence = resourcePersistence;
587 }
588
589
594 public ResourceFinder getResourceFinder() {
595 return resourceFinder;
596 }
597
598
603 public void setResourceFinder(ResourceFinder resourceFinder) {
604 this.resourceFinder = resourceFinder;
605 }
606
607
612 public UserLocalService getUserLocalService() {
613 return userLocalService;
614 }
615
616
621 public void setUserLocalService(UserLocalService userLocalService) {
622 this.userLocalService = userLocalService;
623 }
624
625
630 public UserService getUserService() {
631 return userService;
632 }
633
634
639 public void setUserService(UserService userService) {
640 this.userService = userService;
641 }
642
643
648 public UserPersistence getUserPersistence() {
649 return userPersistence;
650 }
651
652
657 public void setUserPersistence(UserPersistence userPersistence) {
658 this.userPersistence = userPersistence;
659 }
660
661
666 public UserFinder getUserFinder() {
667 return userFinder;
668 }
669
670
675 public void setUserFinder(UserFinder userFinder) {
676 this.userFinder = userFinder;
677 }
678
679 public void afterPropertiesSet() {
680 persistedModelLocalServiceRegistry.register("com.liferay.portlet.expando.model.ExpandoValue",
681 expandoValueLocalService);
682 }
683
684 public void destroy() {
685 persistedModelLocalServiceRegistry.unregister(
686 "com.liferay.portlet.expando.model.ExpandoValue");
687 }
688
689
694 public String getBeanIdentifier() {
695 return _beanIdentifier;
696 }
697
698
703 public void setBeanIdentifier(String beanIdentifier) {
704 _beanIdentifier = beanIdentifier;
705 }
706
707 protected ClassLoader getClassLoader() {
708 Class<?> clazz = getClass();
709
710 return clazz.getClassLoader();
711 }
712
713 protected Class<?> getModelClass() {
714 return ExpandoValue.class;
715 }
716
717 protected String getModelClassName() {
718 return ExpandoValue.class.getName();
719 }
720
721
726 protected void runSQL(String sql) throws SystemException {
727 try {
728 DataSource dataSource = expandoValuePersistence.getDataSource();
729
730 SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
731 sql, new int[0]);
732
733 sqlUpdate.update();
734 }
735 catch (Exception e) {
736 throw new SystemException(e);
737 }
738 }
739
740 @BeanReference(type = ExpandoColumnLocalService.class)
741 protected ExpandoColumnLocalService expandoColumnLocalService;
742 @BeanReference(type = ExpandoColumnService.class)
743 protected ExpandoColumnService expandoColumnService;
744 @BeanReference(type = ExpandoColumnPersistence.class)
745 protected ExpandoColumnPersistence expandoColumnPersistence;
746 @BeanReference(type = ExpandoRowLocalService.class)
747 protected ExpandoRowLocalService expandoRowLocalService;
748 @BeanReference(type = ExpandoRowPersistence.class)
749 protected ExpandoRowPersistence expandoRowPersistence;
750 @BeanReference(type = ExpandoTableLocalService.class)
751 protected ExpandoTableLocalService expandoTableLocalService;
752 @BeanReference(type = ExpandoTablePersistence.class)
753 protected ExpandoTablePersistence expandoTablePersistence;
754 @BeanReference(type = ExpandoValueLocalService.class)
755 protected ExpandoValueLocalService expandoValueLocalService;
756 @BeanReference(type = ExpandoValueService.class)
757 protected ExpandoValueService expandoValueService;
758 @BeanReference(type = ExpandoValuePersistence.class)
759 protected ExpandoValuePersistence expandoValuePersistence;
760 @BeanReference(type = CounterLocalService.class)
761 protected CounterLocalService counterLocalService;
762 @BeanReference(type = ResourceLocalService.class)
763 protected ResourceLocalService resourceLocalService;
764 @BeanReference(type = ResourceService.class)
765 protected ResourceService resourceService;
766 @BeanReference(type = ResourcePersistence.class)
767 protected ResourcePersistence resourcePersistence;
768 @BeanReference(type = ResourceFinder.class)
769 protected ResourceFinder resourceFinder;
770 @BeanReference(type = UserLocalService.class)
771 protected UserLocalService userLocalService;
772 @BeanReference(type = UserService.class)
773 protected UserService userService;
774 @BeanReference(type = UserPersistence.class)
775 protected UserPersistence userPersistence;
776 @BeanReference(type = UserFinder.class)
777 protected UserFinder userFinder;
778 @BeanReference(type = PersistedModelLocalServiceRegistry.class)
779 protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
780 private static Log _log = LogFactoryUtil.getLog(ExpandoValueLocalServiceBaseImpl.class);
781 private String _beanIdentifier;
782 }