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.portal.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.OrgLabor;
28  import com.liferay.portal.model.OrgLaborSoap;
29  import com.liferay.portal.util.PropsUtil;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.List;
39  
40  /**
41   * <a href="OrgLaborModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>OrgLabor</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portal.service.model.OrgLabor
56   * @see com.liferay.portal.service.model.OrgLaborModel
57   * @see com.liferay.portal.service.model.impl.OrgLaborImpl
58   *
59   */
60  public class OrgLaborModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "OrgLabor";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "orgLaborId", new Integer(Types.BIGINT) },
64              
65  
66              { "organizationId", new Integer(Types.BIGINT) },
67              
68  
69              { "typeId", new Integer(Types.INTEGER) },
70              
71  
72              { "sunOpen", new Integer(Types.INTEGER) },
73              
74  
75              { "sunClose", new Integer(Types.INTEGER) },
76              
77  
78              { "monOpen", new Integer(Types.INTEGER) },
79              
80  
81              { "monClose", new Integer(Types.INTEGER) },
82              
83  
84              { "tueOpen", new Integer(Types.INTEGER) },
85              
86  
87              { "tueClose", new Integer(Types.INTEGER) },
88              
89  
90              { "wedOpen", new Integer(Types.INTEGER) },
91              
92  
93              { "wedClose", new Integer(Types.INTEGER) },
94              
95  
96              { "thuOpen", new Integer(Types.INTEGER) },
97              
98  
99              { "thuClose", new Integer(Types.INTEGER) },
100             
101 
102             { "friOpen", new Integer(Types.INTEGER) },
103             
104 
105             { "friClose", new Integer(Types.INTEGER) },
106             
107 
108             { "satOpen", new Integer(Types.INTEGER) },
109             
110 
111             { "satClose", new Integer(Types.INTEGER) }
112         };
113     public static final String TABLE_SQL_CREATE = "create table OrgLabor (orgLaborId LONG not null primary key,organizationId LONG,typeId INTEGER,sunOpen INTEGER,sunClose INTEGER,monOpen INTEGER,monClose INTEGER,tueOpen INTEGER,tueClose INTEGER,wedOpen INTEGER,wedClose INTEGER,thuOpen INTEGER,thuClose INTEGER,friOpen INTEGER,friClose INTEGER,satOpen INTEGER,satClose INTEGER)";
114     public static final String TABLE_SQL_DROP = "drop table OrgLabor";
115     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
116                 "value.object.finder.cache.enabled.com.liferay.portal.model.OrgLabor"),
117             true);
118 
119     public static OrgLabor toModel(OrgLaborSoap soapModel) {
120         OrgLabor model = new OrgLaborImpl();
121 
122         model.setOrgLaborId(soapModel.getOrgLaborId());
123         model.setOrganizationId(soapModel.getOrganizationId());
124         model.setTypeId(soapModel.getTypeId());
125         model.setSunOpen(soapModel.getSunOpen());
126         model.setSunClose(soapModel.getSunClose());
127         model.setMonOpen(soapModel.getMonOpen());
128         model.setMonClose(soapModel.getMonClose());
129         model.setTueOpen(soapModel.getTueOpen());
130         model.setTueClose(soapModel.getTueClose());
131         model.setWedOpen(soapModel.getWedOpen());
132         model.setWedClose(soapModel.getWedClose());
133         model.setThuOpen(soapModel.getThuOpen());
134         model.setThuClose(soapModel.getThuClose());
135         model.setFriOpen(soapModel.getFriOpen());
136         model.setFriClose(soapModel.getFriClose());
137         model.setSatOpen(soapModel.getSatOpen());
138         model.setSatClose(soapModel.getSatClose());
139 
140         return model;
141     }
142 
143     public static List<OrgLabor> toModels(OrgLaborSoap[] soapModels) {
144         List<OrgLabor> models = new ArrayList<OrgLabor>(soapModels.length);
145 
146         for (OrgLaborSoap soapModel : soapModels) {
147             models.add(toModel(soapModel));
148         }
149 
150         return models;
151     }
152 
153     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
154                 "lock.expiration.time.com.liferay.portal.model.OrgLabor"));
155 
156     public OrgLaborModelImpl() {
157     }
158 
159     public long getPrimaryKey() {
160         return _orgLaborId;
161     }
162 
163     public void setPrimaryKey(long pk) {
164         setOrgLaborId(pk);
165     }
166 
167     public Serializable getPrimaryKeyObj() {
168         return new Long(_orgLaborId);
169     }
170 
171     public long getOrgLaborId() {
172         return _orgLaborId;
173     }
174 
175     public void setOrgLaborId(long orgLaborId) {
176         if (orgLaborId != _orgLaborId) {
177             _orgLaborId = orgLaborId;
178         }
179     }
180 
181     public long getOrganizationId() {
182         return _organizationId;
183     }
184 
185     public void setOrganizationId(long organizationId) {
186         if (organizationId != _organizationId) {
187             _organizationId = organizationId;
188         }
189     }
190 
191     public int getTypeId() {
192         return _typeId;
193     }
194 
195     public void setTypeId(int typeId) {
196         if (typeId != _typeId) {
197             _typeId = typeId;
198         }
199     }
200 
201     public int getSunOpen() {
202         return _sunOpen;
203     }
204 
205     public void setSunOpen(int sunOpen) {
206         if (sunOpen != _sunOpen) {
207             _sunOpen = sunOpen;
208         }
209     }
210 
211     public int getSunClose() {
212         return _sunClose;
213     }
214 
215     public void setSunClose(int sunClose) {
216         if (sunClose != _sunClose) {
217             _sunClose = sunClose;
218         }
219     }
220 
221     public int getMonOpen() {
222         return _monOpen;
223     }
224 
225     public void setMonOpen(int monOpen) {
226         if (monOpen != _monOpen) {
227             _monOpen = monOpen;
228         }
229     }
230 
231     public int getMonClose() {
232         return _monClose;
233     }
234 
235     public void setMonClose(int monClose) {
236         if (monClose != _monClose) {
237             _monClose = monClose;
238         }
239     }
240 
241     public int getTueOpen() {
242         return _tueOpen;
243     }
244 
245     public void setTueOpen(int tueOpen) {
246         if (tueOpen != _tueOpen) {
247             _tueOpen = tueOpen;
248         }
249     }
250 
251     public int getTueClose() {
252         return _tueClose;
253     }
254 
255     public void setTueClose(int tueClose) {
256         if (tueClose != _tueClose) {
257             _tueClose = tueClose;
258         }
259     }
260 
261     public int getWedOpen() {
262         return _wedOpen;
263     }
264 
265     public void setWedOpen(int wedOpen) {
266         if (wedOpen != _wedOpen) {
267             _wedOpen = wedOpen;
268         }
269     }
270 
271     public int getWedClose() {
272         return _wedClose;
273     }
274 
275     public void setWedClose(int wedClose) {
276         if (wedClose != _wedClose) {
277             _wedClose = wedClose;
278         }
279     }
280 
281     public int getThuOpen() {
282         return _thuOpen;
283     }
284 
285     public void setThuOpen(int thuOpen) {
286         if (thuOpen != _thuOpen) {
287             _thuOpen = thuOpen;
288         }
289     }
290 
291     public int getThuClose() {
292         return _thuClose;
293     }
294 
295     public void setThuClose(int thuClose) {
296         if (thuClose != _thuClose) {
297             _thuClose = thuClose;
298         }
299     }
300 
301     public int getFriOpen() {
302         return _friOpen;
303     }
304 
305     public void setFriOpen(int friOpen) {
306         if (friOpen != _friOpen) {
307             _friOpen = friOpen;
308         }
309     }
310 
311     public int getFriClose() {
312         return _friClose;
313     }
314 
315     public void setFriClose(int friClose) {
316         if (friClose != _friClose) {
317             _friClose = friClose;
318         }
319     }
320 
321     public int getSatOpen() {
322         return _satOpen;
323     }
324 
325     public void setSatOpen(int satOpen) {
326         if (satOpen != _satOpen) {
327             _satOpen = satOpen;
328         }
329     }
330 
331     public int getSatClose() {
332         return _satClose;
333     }
334 
335     public void setSatClose(int satClose) {
336         if (satClose != _satClose) {
337             _satClose = satClose;
338         }
339     }
340 
341     public OrgLabor toEscapedModel() {
342         if (isEscapedModel()) {
343             return (OrgLabor)this;
344         }
345         else {
346             OrgLabor model = new OrgLaborImpl();
347 
348             model.setEscapedModel(true);
349 
350             model.setOrgLaborId(getOrgLaborId());
351             model.setOrganizationId(getOrganizationId());
352             model.setTypeId(getTypeId());
353             model.setSunOpen(getSunOpen());
354             model.setSunClose(getSunClose());
355             model.setMonOpen(getMonOpen());
356             model.setMonClose(getMonClose());
357             model.setTueOpen(getTueOpen());
358             model.setTueClose(getTueClose());
359             model.setWedOpen(getWedOpen());
360             model.setWedClose(getWedClose());
361             model.setThuOpen(getThuOpen());
362             model.setThuClose(getThuClose());
363             model.setFriOpen(getFriOpen());
364             model.setFriClose(getFriClose());
365             model.setSatOpen(getSatOpen());
366             model.setSatClose(getSatClose());
367 
368             model = (OrgLabor)Proxy.newProxyInstance(OrgLabor.class.getClassLoader(),
369                     new Class[] { OrgLabor.class },
370                     new ReadOnlyBeanHandler(model));
371 
372             return model;
373         }
374     }
375 
376     public Object clone() {
377         OrgLaborImpl clone = new OrgLaborImpl();
378 
379         clone.setOrgLaborId(getOrgLaborId());
380         clone.setOrganizationId(getOrganizationId());
381         clone.setTypeId(getTypeId());
382         clone.setSunOpen(getSunOpen());
383         clone.setSunClose(getSunClose());
384         clone.setMonOpen(getMonOpen());
385         clone.setMonClose(getMonClose());
386         clone.setTueOpen(getTueOpen());
387         clone.setTueClose(getTueClose());
388         clone.setWedOpen(getWedOpen());
389         clone.setWedClose(getWedClose());
390         clone.setThuOpen(getThuOpen());
391         clone.setThuClose(getThuClose());
392         clone.setFriOpen(getFriOpen());
393         clone.setFriClose(getFriClose());
394         clone.setSatOpen(getSatOpen());
395         clone.setSatClose(getSatClose());
396 
397         return clone;
398     }
399 
400     public int compareTo(Object obj) {
401         if (obj == null) {
402             return -1;
403         }
404 
405         OrgLaborImpl orgLabor = (OrgLaborImpl)obj;
406 
407         int value = 0;
408 
409         if (getOrganizationId() < orgLabor.getOrganizationId()) {
410             value = -1;
411         }
412         else if (getOrganizationId() > orgLabor.getOrganizationId()) {
413             value = 1;
414         }
415         else {
416             value = 0;
417         }
418 
419         if (value != 0) {
420             return value;
421         }
422 
423         if (getTypeId() < orgLabor.getTypeId()) {
424             value = -1;
425         }
426         else if (getTypeId() > orgLabor.getTypeId()) {
427             value = 1;
428         }
429         else {
430             value = 0;
431         }
432 
433         if (value != 0) {
434             return value;
435         }
436 
437         return 0;
438     }
439 
440     public boolean equals(Object obj) {
441         if (obj == null) {
442             return false;
443         }
444 
445         OrgLaborImpl orgLabor = null;
446 
447         try {
448             orgLabor = (OrgLaborImpl)obj;
449         }
450         catch (ClassCastException cce) {
451             return false;
452         }
453 
454         long pk = orgLabor.getPrimaryKey();
455 
456         if (getPrimaryKey() == pk) {
457             return true;
458         }
459         else {
460             return false;
461         }
462     }
463 
464     public int hashCode() {
465         return (int)getPrimaryKey();
466     }
467 
468     private long _orgLaborId;
469     private long _organizationId;
470     private int _typeId;
471     private int _sunOpen;
472     private int _sunClose;
473     private int _monOpen;
474     private int _monClose;
475     private int _tueOpen;
476     private int _tueClose;
477     private int _wedOpen;
478     private int _wedClose;
479     private int _thuOpen;
480     private int _thuClose;
481     private int _friOpen;
482     private int _friClose;
483     private int _satOpen;
484     private int _satClose;
485 }