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.portlet.expando.service.base;
24  
25  import com.liferay.counter.service.CounterLocalService;
26  import com.liferay.counter.service.CounterService;
27  
28  import com.liferay.portal.PortalException;
29  import com.liferay.portal.SystemException;
30  import com.liferay.portal.kernel.bean.InitializingBean;
31  import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
32  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
33  
34  import com.liferay.portlet.expando.model.ExpandoRow;
35  import com.liferay.portlet.expando.service.ExpandoColumnLocalService;
36  import com.liferay.portlet.expando.service.ExpandoRowLocalService;
37  import com.liferay.portlet.expando.service.ExpandoTableLocalService;
38  import com.liferay.portlet.expando.service.ExpandoValueLocalService;
39  import com.liferay.portlet.expando.service.persistence.ExpandoColumnFinder;
40  import com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence;
41  import com.liferay.portlet.expando.service.persistence.ExpandoRowFinder;
42  import com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence;
43  import com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence;
44  import com.liferay.portlet.expando.service.persistence.ExpandoValueFinder;
45  import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
46  
47  import java.util.List;
48  
49  /**
50   * <a href="ExpandoRowLocalServiceBaseImpl.java.html"><b><i>View Source</i></b></a>
51   *
52   * @author Brian Wing Shun Chan
53   *
54   */
55  public abstract class ExpandoRowLocalServiceBaseImpl
56      implements ExpandoRowLocalService, InitializingBean {
57      public ExpandoRow addExpandoRow(ExpandoRow expandoRow)
58          throws SystemException {
59          expandoRow.setNew(true);
60  
61          return expandoRowPersistence.update(expandoRow, false);
62      }
63  
64      public void deleteExpandoRow(long rowId)
65          throws PortalException, SystemException {
66          expandoRowPersistence.remove(rowId);
67      }
68  
69      public void deleteExpandoRow(ExpandoRow expandoRow)
70          throws SystemException {
71          expandoRowPersistence.remove(expandoRow);
72      }
73  
74      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
75          throws SystemException {
76          return expandoRowPersistence.findWithDynamicQuery(dynamicQuery);
77      }
78  
79      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
80          int end) throws SystemException {
81          return expandoRowPersistence.findWithDynamicQuery(dynamicQuery, start,
82              end);
83      }
84  
85      public ExpandoRow getExpandoRow(long rowId)
86          throws PortalException, SystemException {
87          return expandoRowPersistence.findByPrimaryKey(rowId);
88      }
89  
90      public List<ExpandoRow> getExpandoRows(int start, int end)
91          throws SystemException {
92          return expandoRowPersistence.findAll(start, end);
93      }
94  
95      public int getExpandoRowsCount() throws SystemException {
96          return expandoRowPersistence.countAll();
97      }
98  
99      public ExpandoRow updateExpandoRow(ExpandoRow expandoRow)
100         throws SystemException {
101         expandoRow.setNew(false);
102 
103         return expandoRowPersistence.update(expandoRow, true);
104     }
105 
106     public ExpandoColumnLocalService getExpandoColumnLocalService() {
107         return expandoColumnLocalService;
108     }
109 
110     public void setExpandoColumnLocalService(
111         ExpandoColumnLocalService expandoColumnLocalService) {
112         this.expandoColumnLocalService = expandoColumnLocalService;
113     }
114 
115     public ExpandoColumnPersistence getExpandoColumnPersistence() {
116         return expandoColumnPersistence;
117     }
118 
119     public void setExpandoColumnPersistence(
120         ExpandoColumnPersistence expandoColumnPersistence) {
121         this.expandoColumnPersistence = expandoColumnPersistence;
122     }
123 
124     public ExpandoColumnFinder getExpandoColumnFinder() {
125         return expandoColumnFinder;
126     }
127 
128     public void setExpandoColumnFinder(ExpandoColumnFinder expandoColumnFinder) {
129         this.expandoColumnFinder = expandoColumnFinder;
130     }
131 
132     public ExpandoRowPersistence getExpandoRowPersistence() {
133         return expandoRowPersistence;
134     }
135 
136     public void setExpandoRowPersistence(
137         ExpandoRowPersistence expandoRowPersistence) {
138         this.expandoRowPersistence = expandoRowPersistence;
139     }
140 
141     public ExpandoRowFinder getExpandoRowFinder() {
142         return expandoRowFinder;
143     }
144 
145     public void setExpandoRowFinder(ExpandoRowFinder expandoRowFinder) {
146         this.expandoRowFinder = expandoRowFinder;
147     }
148 
149     public ExpandoTableLocalService getExpandoTableLocalService() {
150         return expandoTableLocalService;
151     }
152 
153     public void setExpandoTableLocalService(
154         ExpandoTableLocalService expandoTableLocalService) {
155         this.expandoTableLocalService = expandoTableLocalService;
156     }
157 
158     public ExpandoTablePersistence getExpandoTablePersistence() {
159         return expandoTablePersistence;
160     }
161 
162     public void setExpandoTablePersistence(
163         ExpandoTablePersistence expandoTablePersistence) {
164         this.expandoTablePersistence = expandoTablePersistence;
165     }
166 
167     public ExpandoValueLocalService getExpandoValueLocalService() {
168         return expandoValueLocalService;
169     }
170 
171     public void setExpandoValueLocalService(
172         ExpandoValueLocalService expandoValueLocalService) {
173         this.expandoValueLocalService = expandoValueLocalService;
174     }
175 
176     public ExpandoValuePersistence getExpandoValuePersistence() {
177         return expandoValuePersistence;
178     }
179 
180     public void setExpandoValuePersistence(
181         ExpandoValuePersistence expandoValuePersistence) {
182         this.expandoValuePersistence = expandoValuePersistence;
183     }
184 
185     public ExpandoValueFinder getExpandoValueFinder() {
186         return expandoValueFinder;
187     }
188 
189     public void setExpandoValueFinder(ExpandoValueFinder expandoValueFinder) {
190         this.expandoValueFinder = expandoValueFinder;
191     }
192 
193     public CounterLocalService getCounterLocalService() {
194         return counterLocalService;
195     }
196 
197     public void setCounterLocalService(CounterLocalService counterLocalService) {
198         this.counterLocalService = counterLocalService;
199     }
200 
201     public CounterService getCounterService() {
202         return counterService;
203     }
204 
205     public void setCounterService(CounterService counterService) {
206         this.counterService = counterService;
207     }
208 
209     public void afterPropertiesSet() {
210         if (expandoColumnLocalService == null) {
211             expandoColumnLocalService = (ExpandoColumnLocalService)PortalBeanLocatorUtil.locate(ExpandoColumnLocalService.class.getName() +
212                     ".impl");
213         }
214 
215         if (expandoColumnPersistence == null) {
216             expandoColumnPersistence = (ExpandoColumnPersistence)PortalBeanLocatorUtil.locate(ExpandoColumnPersistence.class.getName() +
217                     ".impl");
218         }
219 
220         if (expandoColumnFinder == null) {
221             expandoColumnFinder = (ExpandoColumnFinder)PortalBeanLocatorUtil.locate(ExpandoColumnFinder.class.getName() +
222                     ".impl");
223         }
224 
225         if (expandoRowPersistence == null) {
226             expandoRowPersistence = (ExpandoRowPersistence)PortalBeanLocatorUtil.locate(ExpandoRowPersistence.class.getName() +
227                     ".impl");
228         }
229 
230         if (expandoRowFinder == null) {
231             expandoRowFinder = (ExpandoRowFinder)PortalBeanLocatorUtil.locate(ExpandoRowFinder.class.getName() +
232                     ".impl");
233         }
234 
235         if (expandoTableLocalService == null) {
236             expandoTableLocalService = (ExpandoTableLocalService)PortalBeanLocatorUtil.locate(ExpandoTableLocalService.class.getName() +
237                     ".impl");
238         }
239 
240         if (expandoTablePersistence == null) {
241             expandoTablePersistence = (ExpandoTablePersistence)PortalBeanLocatorUtil.locate(ExpandoTablePersistence.class.getName() +
242                     ".impl");
243         }
244 
245         if (expandoValueLocalService == null) {
246             expandoValueLocalService = (ExpandoValueLocalService)PortalBeanLocatorUtil.locate(ExpandoValueLocalService.class.getName() +
247                     ".impl");
248         }
249 
250         if (expandoValuePersistence == null) {
251             expandoValuePersistence = (ExpandoValuePersistence)PortalBeanLocatorUtil.locate(ExpandoValuePersistence.class.getName() +
252                     ".impl");
253         }
254 
255         if (expandoValueFinder == null) {
256             expandoValueFinder = (ExpandoValueFinder)PortalBeanLocatorUtil.locate(ExpandoValueFinder.class.getName() +
257                     ".impl");
258         }
259 
260         if (counterLocalService == null) {
261             counterLocalService = (CounterLocalService)PortalBeanLocatorUtil.locate(CounterLocalService.class.getName() +
262                     ".impl");
263         }
264 
265         if (counterService == null) {
266             counterService = (CounterService)PortalBeanLocatorUtil.locate(CounterService.class.getName() +
267                     ".impl");
268         }
269     }
270 
271     protected ExpandoColumnLocalService expandoColumnLocalService;
272     protected ExpandoColumnPersistence expandoColumnPersistence;
273     protected ExpandoColumnFinder expandoColumnFinder;
274     protected ExpandoRowPersistence expandoRowPersistence;
275     protected ExpandoRowFinder expandoRowFinder;
276     protected ExpandoTableLocalService expandoTableLocalService;
277     protected ExpandoTablePersistence expandoTablePersistence;
278     protected ExpandoValueLocalService expandoValueLocalService;
279     protected ExpandoValuePersistence expandoValuePersistence;
280     protected ExpandoValueFinder expandoValueFinder;
281     protected CounterLocalService counterLocalService;
282     protected CounterService counterService;
283 }