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