001    /**
002     * Copyright (c) 2000-2010 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.portlet.journal.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.impl.BaseModelImpl;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.expando.model.ExpandoBridge;
027    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028    import com.liferay.portlet.journal.model.JournalStructure;
029    import com.liferay.portlet.journal.model.JournalStructureModel;
030    import com.liferay.portlet.journal.model.JournalStructureSoap;
031    
032    import java.io.Serializable;
033    
034    import java.lang.reflect.Proxy;
035    
036    import java.sql.Types;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.List;
041    
042    /**
043     * The base model implementation for the JournalStructure service. Represents a row in the "JournalStructure" database table, with each column mapped to a property of this class.
044     *
045     * <p>
046     * This implementation and its corresponding interface {@link com.liferay.portlet.journal.model.JournalStructureModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link JournalStructureImpl}.
047     * </p>
048     *
049     * <p>
050     * Never modify or reference this class directly. All methods that expect a journal structure model instance should use the {@link com.liferay.portlet.journal.model.JournalStructure} interface instead.
051     * </p>
052     *
053     * @author Brian Wing Shun Chan
054     * @see JournalStructureImpl
055     * @see com.liferay.portlet.journal.model.JournalStructure
056     * @see com.liferay.portlet.journal.model.JournalStructureModel
057     * @generated
058     */
059    public class JournalStructureModelImpl extends BaseModelImpl<JournalStructure>
060            implements JournalStructureModel {
061            public static final String TABLE_NAME = "JournalStructure";
062            public static final Object[][] TABLE_COLUMNS = {
063                            { "uuid_", new Integer(Types.VARCHAR) },
064                            { "id_", new Integer(Types.BIGINT) },
065                            { "groupId", new Integer(Types.BIGINT) },
066                            { "companyId", new Integer(Types.BIGINT) },
067                            { "userId", new Integer(Types.BIGINT) },
068                            { "userName", new Integer(Types.VARCHAR) },
069                            { "createDate", new Integer(Types.TIMESTAMP) },
070                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
071                            { "structureId", new Integer(Types.VARCHAR) },
072                            { "parentStructureId", new Integer(Types.VARCHAR) },
073                            { "name", new Integer(Types.VARCHAR) },
074                            { "description", new Integer(Types.VARCHAR) },
075                            { "xsd", new Integer(Types.CLOB) }
076                    };
077            public static final String TABLE_SQL_CREATE = "create table JournalStructure (uuid_ VARCHAR(75) null,id_ LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,structureId VARCHAR(75) null,parentStructureId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,xsd TEXT null)";
078            public static final String TABLE_SQL_DROP = "drop table JournalStructure";
079            public static final String ORDER_BY_JPQL = " ORDER BY journalStructure.structureId ASC";
080            public static final String ORDER_BY_SQL = " ORDER BY JournalStructure.structureId ASC";
081            public static final String DATA_SOURCE = "liferayDataSource";
082            public static final String SESSION_FACTORY = "liferaySessionFactory";
083            public static final String TX_MANAGER = "liferayTransactionManager";
084            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
085                                    "value.object.entity.cache.enabled.com.liferay.portlet.journal.model.JournalStructure"),
086                            true);
087            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
088                                    "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalStructure"),
089                            true);
090    
091            /**
092             * Converts the soap model instance into a normal model instance.
093             *
094             * @param soapModel the soap model instance to convert
095             * @return the normal model instance
096             */
097            public static JournalStructure toModel(JournalStructureSoap soapModel) {
098                    JournalStructure model = new JournalStructureImpl();
099    
100                    model.setUuid(soapModel.getUuid());
101                    model.setId(soapModel.getId());
102                    model.setGroupId(soapModel.getGroupId());
103                    model.setCompanyId(soapModel.getCompanyId());
104                    model.setUserId(soapModel.getUserId());
105                    model.setUserName(soapModel.getUserName());
106                    model.setCreateDate(soapModel.getCreateDate());
107                    model.setModifiedDate(soapModel.getModifiedDate());
108                    model.setStructureId(soapModel.getStructureId());
109                    model.setParentStructureId(soapModel.getParentStructureId());
110                    model.setName(soapModel.getName());
111                    model.setDescription(soapModel.getDescription());
112                    model.setXsd(soapModel.getXsd());
113    
114                    return model;
115            }
116    
117            /**
118             * Converts the soap model instances into normal model instances.
119             *
120             * @param soapModels the soap model instances to convert
121             * @return the normal model instances
122             */
123            public static List<JournalStructure> toModels(
124                    JournalStructureSoap[] soapModels) {
125                    List<JournalStructure> models = new ArrayList<JournalStructure>(soapModels.length);
126    
127                    for (JournalStructureSoap soapModel : soapModels) {
128                            models.add(toModel(soapModel));
129                    }
130    
131                    return models;
132            }
133    
134            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
135                                    "lock.expiration.time.com.liferay.portlet.journal.model.JournalStructure"));
136    
137            public JournalStructureModelImpl() {
138            }
139    
140            public long getPrimaryKey() {
141                    return _id;
142            }
143    
144            public void setPrimaryKey(long pk) {
145                    setId(pk);
146            }
147    
148            public Serializable getPrimaryKeyObj() {
149                    return new Long(_id);
150            }
151    
152            public String getUuid() {
153                    if (_uuid == null) {
154                            return StringPool.BLANK;
155                    }
156                    else {
157                            return _uuid;
158                    }
159            }
160    
161            public void setUuid(String uuid) {
162                    _uuid = uuid;
163    
164                    if (_originalUuid == null) {
165                            _originalUuid = uuid;
166                    }
167            }
168    
169            public String getOriginalUuid() {
170                    return GetterUtil.getString(_originalUuid);
171            }
172    
173            public long getId() {
174                    return _id;
175            }
176    
177            public void setId(long id) {
178                    _id = id;
179            }
180    
181            public long getGroupId() {
182                    return _groupId;
183            }
184    
185            public void setGroupId(long groupId) {
186                    _groupId = groupId;
187    
188                    if (!_setOriginalGroupId) {
189                            _setOriginalGroupId = true;
190    
191                            _originalGroupId = groupId;
192                    }
193            }
194    
195            public long getOriginalGroupId() {
196                    return _originalGroupId;
197            }
198    
199            public long getCompanyId() {
200                    return _companyId;
201            }
202    
203            public void setCompanyId(long companyId) {
204                    _companyId = companyId;
205            }
206    
207            public long getUserId() {
208                    return _userId;
209            }
210    
211            public void setUserId(long userId) {
212                    _userId = userId;
213            }
214    
215            public String getUserUuid() throws SystemException {
216                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
217            }
218    
219            public void setUserUuid(String userUuid) {
220                    _userUuid = userUuid;
221            }
222    
223            public String getUserName() {
224                    if (_userName == null) {
225                            return StringPool.BLANK;
226                    }
227                    else {
228                            return _userName;
229                    }
230            }
231    
232            public void setUserName(String userName) {
233                    _userName = userName;
234            }
235    
236            public Date getCreateDate() {
237                    return _createDate;
238            }
239    
240            public void setCreateDate(Date createDate) {
241                    _createDate = createDate;
242            }
243    
244            public Date getModifiedDate() {
245                    return _modifiedDate;
246            }
247    
248            public void setModifiedDate(Date modifiedDate) {
249                    _modifiedDate = modifiedDate;
250            }
251    
252            public String getStructureId() {
253                    if (_structureId == null) {
254                            return StringPool.BLANK;
255                    }
256                    else {
257                            return _structureId;
258                    }
259            }
260    
261            public void setStructureId(String structureId) {
262                    _structureId = structureId;
263    
264                    if (_originalStructureId == null) {
265                            _originalStructureId = structureId;
266                    }
267            }
268    
269            public String getOriginalStructureId() {
270                    return GetterUtil.getString(_originalStructureId);
271            }
272    
273            public String getParentStructureId() {
274                    if (_parentStructureId == null) {
275                            return StringPool.BLANK;
276                    }
277                    else {
278                            return _parentStructureId;
279                    }
280            }
281    
282            public void setParentStructureId(String parentStructureId) {
283                    _parentStructureId = parentStructureId;
284            }
285    
286            public String getName() {
287                    if (_name == null) {
288                            return StringPool.BLANK;
289                    }
290                    else {
291                            return _name;
292                    }
293            }
294    
295            public void setName(String name) {
296                    _name = name;
297            }
298    
299            public String getDescription() {
300                    if (_description == null) {
301                            return StringPool.BLANK;
302                    }
303                    else {
304                            return _description;
305                    }
306            }
307    
308            public void setDescription(String description) {
309                    _description = description;
310            }
311    
312            public String getXsd() {
313                    if (_xsd == null) {
314                            return StringPool.BLANK;
315                    }
316                    else {
317                            return _xsd;
318                    }
319            }
320    
321            public void setXsd(String xsd) {
322                    _xsd = xsd;
323            }
324    
325            public JournalStructure toEscapedModel() {
326                    if (isEscapedModel()) {
327                            return (JournalStructure)this;
328                    }
329                    else {
330                            return (JournalStructure)Proxy.newProxyInstance(JournalStructure.class.getClassLoader(),
331                                    new Class[] { JournalStructure.class },
332                                    new AutoEscapeBeanHandler(this));
333                    }
334            }
335    
336            public ExpandoBridge getExpandoBridge() {
337                    if (_expandoBridge == null) {
338                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
339                                            JournalStructure.class.getName(), getPrimaryKey());
340                    }
341    
342                    return _expandoBridge;
343            }
344    
345            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
346                    getExpandoBridge().setAttributes(serviceContext);
347            }
348    
349            public Object clone() {
350                    JournalStructureImpl clone = new JournalStructureImpl();
351    
352                    clone.setUuid(getUuid());
353                    clone.setId(getId());
354                    clone.setGroupId(getGroupId());
355                    clone.setCompanyId(getCompanyId());
356                    clone.setUserId(getUserId());
357                    clone.setUserName(getUserName());
358                    clone.setCreateDate(getCreateDate());
359                    clone.setModifiedDate(getModifiedDate());
360                    clone.setStructureId(getStructureId());
361                    clone.setParentStructureId(getParentStructureId());
362                    clone.setName(getName());
363                    clone.setDescription(getDescription());
364                    clone.setXsd(getXsd());
365    
366                    return clone;
367            }
368    
369            public int compareTo(JournalStructure journalStructure) {
370                    int value = 0;
371    
372                    value = getStructureId().compareTo(journalStructure.getStructureId());
373    
374                    if (value != 0) {
375                            return value;
376                    }
377    
378                    return 0;
379            }
380    
381            public boolean equals(Object obj) {
382                    if (obj == null) {
383                            return false;
384                    }
385    
386                    JournalStructure journalStructure = null;
387    
388                    try {
389                            journalStructure = (JournalStructure)obj;
390                    }
391                    catch (ClassCastException cce) {
392                            return false;
393                    }
394    
395                    long pk = journalStructure.getPrimaryKey();
396    
397                    if (getPrimaryKey() == pk) {
398                            return true;
399                    }
400                    else {
401                            return false;
402                    }
403            }
404    
405            public int hashCode() {
406                    return (int)getPrimaryKey();
407            }
408    
409            public String toString() {
410                    StringBundler sb = new StringBundler(27);
411    
412                    sb.append("{uuid=");
413                    sb.append(getUuid());
414                    sb.append(", id=");
415                    sb.append(getId());
416                    sb.append(", groupId=");
417                    sb.append(getGroupId());
418                    sb.append(", companyId=");
419                    sb.append(getCompanyId());
420                    sb.append(", userId=");
421                    sb.append(getUserId());
422                    sb.append(", userName=");
423                    sb.append(getUserName());
424                    sb.append(", createDate=");
425                    sb.append(getCreateDate());
426                    sb.append(", modifiedDate=");
427                    sb.append(getModifiedDate());
428                    sb.append(", structureId=");
429                    sb.append(getStructureId());
430                    sb.append(", parentStructureId=");
431                    sb.append(getParentStructureId());
432                    sb.append(", name=");
433                    sb.append(getName());
434                    sb.append(", description=");
435                    sb.append(getDescription());
436                    sb.append(", xsd=");
437                    sb.append(getXsd());
438                    sb.append("}");
439    
440                    return sb.toString();
441            }
442    
443            public String toXmlString() {
444                    StringBundler sb = new StringBundler(43);
445    
446                    sb.append("<model><model-name>");
447                    sb.append("com.liferay.portlet.journal.model.JournalStructure");
448                    sb.append("</model-name>");
449    
450                    sb.append(
451                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
452                    sb.append(getUuid());
453                    sb.append("]]></column-value></column>");
454                    sb.append(
455                            "<column><column-name>id</column-name><column-value><![CDATA[");
456                    sb.append(getId());
457                    sb.append("]]></column-value></column>");
458                    sb.append(
459                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
460                    sb.append(getGroupId());
461                    sb.append("]]></column-value></column>");
462                    sb.append(
463                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
464                    sb.append(getCompanyId());
465                    sb.append("]]></column-value></column>");
466                    sb.append(
467                            "<column><column-name>userId</column-name><column-value><![CDATA[");
468                    sb.append(getUserId());
469                    sb.append("]]></column-value></column>");
470                    sb.append(
471                            "<column><column-name>userName</column-name><column-value><![CDATA[");
472                    sb.append(getUserName());
473                    sb.append("]]></column-value></column>");
474                    sb.append(
475                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
476                    sb.append(getCreateDate());
477                    sb.append("]]></column-value></column>");
478                    sb.append(
479                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
480                    sb.append(getModifiedDate());
481                    sb.append("]]></column-value></column>");
482                    sb.append(
483                            "<column><column-name>structureId</column-name><column-value><![CDATA[");
484                    sb.append(getStructureId());
485                    sb.append("]]></column-value></column>");
486                    sb.append(
487                            "<column><column-name>parentStructureId</column-name><column-value><![CDATA[");
488                    sb.append(getParentStructureId());
489                    sb.append("]]></column-value></column>");
490                    sb.append(
491                            "<column><column-name>name</column-name><column-value><![CDATA[");
492                    sb.append(getName());
493                    sb.append("]]></column-value></column>");
494                    sb.append(
495                            "<column><column-name>description</column-name><column-value><![CDATA[");
496                    sb.append(getDescription());
497                    sb.append("]]></column-value></column>");
498                    sb.append(
499                            "<column><column-name>xsd</column-name><column-value><![CDATA[");
500                    sb.append(getXsd());
501                    sb.append("]]></column-value></column>");
502    
503                    sb.append("</model>");
504    
505                    return sb.toString();
506            }
507    
508            private String _uuid;
509            private String _originalUuid;
510            private long _id;
511            private long _groupId;
512            private long _originalGroupId;
513            private boolean _setOriginalGroupId;
514            private long _companyId;
515            private long _userId;
516            private String _userUuid;
517            private String _userName;
518            private Date _createDate;
519            private Date _modifiedDate;
520            private String _structureId;
521            private String _originalStructureId;
522            private String _parentStructureId;
523            private String _name;
524            private String _description;
525            private String _xsd;
526            private transient ExpandoBridge _expandoBridge;
527    }