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.portal.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.WorkflowDefinitionLink;
023    import com.liferay.portal.model.WorkflowDefinitionLinkModel;
024    import com.liferay.portal.service.ServiceContext;
025    import com.liferay.portal.util.PortalUtil;
026    
027    import com.liferay.portlet.expando.model.ExpandoBridge;
028    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029    
030    import java.io.Serializable;
031    
032    import java.lang.reflect.Proxy;
033    
034    import java.sql.Types;
035    
036    import java.util.Date;
037    
038    /**
039     * The base model implementation for the WorkflowDefinitionLink service. Represents a row in the "WorkflowDefinitionLink" database table, with each column mapped to a property of this class.
040     *
041     * <p>
042     * This implementation and its corresponding interface {@link com.liferay.portal.model.WorkflowDefinitionLinkModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link WorkflowDefinitionLinkImpl}.
043     * </p>
044     *
045     * <p>
046     * Never modify or reference this class directly. All methods that expect a workflow definition link model instance should use the {@link com.liferay.portal.model.WorkflowDefinitionLink} interface instead.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see WorkflowDefinitionLinkImpl
051     * @see com.liferay.portal.model.WorkflowDefinitionLink
052     * @see com.liferay.portal.model.WorkflowDefinitionLinkModel
053     * @generated
054     */
055    public class WorkflowDefinitionLinkModelImpl extends BaseModelImpl<WorkflowDefinitionLink>
056            implements WorkflowDefinitionLinkModel {
057            public static final String TABLE_NAME = "WorkflowDefinitionLink";
058            public static final Object[][] TABLE_COLUMNS = {
059                            { "workflowDefinitionLinkId", new Integer(Types.BIGINT) },
060                            { "groupId", new Integer(Types.BIGINT) },
061                            { "companyId", new Integer(Types.BIGINT) },
062                            { "userId", new Integer(Types.BIGINT) },
063                            { "userName", new Integer(Types.VARCHAR) },
064                            { "createDate", new Integer(Types.TIMESTAMP) },
065                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
066                            { "classNameId", new Integer(Types.BIGINT) },
067                            { "workflowDefinitionName", new Integer(Types.VARCHAR) },
068                            { "workflowDefinitionVersion", new Integer(Types.INTEGER) }
069                    };
070            public static final String TABLE_SQL_CREATE = "create table WorkflowDefinitionLink (workflowDefinitionLinkId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,workflowDefinitionName VARCHAR(75) null,workflowDefinitionVersion INTEGER)";
071            public static final String TABLE_SQL_DROP = "drop table WorkflowDefinitionLink";
072            public static final String ORDER_BY_JPQL = " ORDER BY workflowDefinitionLink.workflowDefinitionName ASC";
073            public static final String ORDER_BY_SQL = " ORDER BY WorkflowDefinitionLink.workflowDefinitionName ASC";
074            public static final String DATA_SOURCE = "liferayDataSource";
075            public static final String SESSION_FACTORY = "liferaySessionFactory";
076            public static final String TX_MANAGER = "liferayTransactionManager";
077            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078                                    "value.object.entity.cache.enabled.com.liferay.portal.model.WorkflowDefinitionLink"),
079                            true);
080            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081                                    "value.object.finder.cache.enabled.com.liferay.portal.model.WorkflowDefinitionLink"),
082                            true);
083            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
084                                    "lock.expiration.time.com.liferay.portal.model.WorkflowDefinitionLink"));
085    
086            public WorkflowDefinitionLinkModelImpl() {
087            }
088    
089            public long getPrimaryKey() {
090                    return _workflowDefinitionLinkId;
091            }
092    
093            public void setPrimaryKey(long pk) {
094                    setWorkflowDefinitionLinkId(pk);
095            }
096    
097            public Serializable getPrimaryKeyObj() {
098                    return new Long(_workflowDefinitionLinkId);
099            }
100    
101            public long getWorkflowDefinitionLinkId() {
102                    return _workflowDefinitionLinkId;
103            }
104    
105            public void setWorkflowDefinitionLinkId(long workflowDefinitionLinkId) {
106                    _workflowDefinitionLinkId = workflowDefinitionLinkId;
107            }
108    
109            public long getGroupId() {
110                    return _groupId;
111            }
112    
113            public void setGroupId(long groupId) {
114                    _groupId = groupId;
115    
116                    if (!_setOriginalGroupId) {
117                            _setOriginalGroupId = true;
118    
119                            _originalGroupId = groupId;
120                    }
121            }
122    
123            public long getOriginalGroupId() {
124                    return _originalGroupId;
125            }
126    
127            public long getCompanyId() {
128                    return _companyId;
129            }
130    
131            public void setCompanyId(long companyId) {
132                    _companyId = companyId;
133    
134                    if (!_setOriginalCompanyId) {
135                            _setOriginalCompanyId = true;
136    
137                            _originalCompanyId = companyId;
138                    }
139            }
140    
141            public long getOriginalCompanyId() {
142                    return _originalCompanyId;
143            }
144    
145            public long getUserId() {
146                    return _userId;
147            }
148    
149            public void setUserId(long userId) {
150                    _userId = userId;
151            }
152    
153            public String getUserUuid() throws SystemException {
154                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
155            }
156    
157            public void setUserUuid(String userUuid) {
158                    _userUuid = userUuid;
159            }
160    
161            public String getUserName() {
162                    if (_userName == null) {
163                            return StringPool.BLANK;
164                    }
165                    else {
166                            return _userName;
167                    }
168            }
169    
170            public void setUserName(String userName) {
171                    _userName = userName;
172            }
173    
174            public Date getCreateDate() {
175                    return _createDate;
176            }
177    
178            public void setCreateDate(Date createDate) {
179                    _createDate = createDate;
180            }
181    
182            public Date getModifiedDate() {
183                    return _modifiedDate;
184            }
185    
186            public void setModifiedDate(Date modifiedDate) {
187                    _modifiedDate = modifiedDate;
188            }
189    
190            public String getClassName() {
191                    if (getClassNameId() <= 0) {
192                            return StringPool.BLANK;
193                    }
194    
195                    return PortalUtil.getClassName(getClassNameId());
196            }
197    
198            public long getClassNameId() {
199                    return _classNameId;
200            }
201    
202            public void setClassNameId(long classNameId) {
203                    _classNameId = classNameId;
204    
205                    if (!_setOriginalClassNameId) {
206                            _setOriginalClassNameId = true;
207    
208                            _originalClassNameId = classNameId;
209                    }
210            }
211    
212            public long getOriginalClassNameId() {
213                    return _originalClassNameId;
214            }
215    
216            public String getWorkflowDefinitionName() {
217                    if (_workflowDefinitionName == null) {
218                            return StringPool.BLANK;
219                    }
220                    else {
221                            return _workflowDefinitionName;
222                    }
223            }
224    
225            public void setWorkflowDefinitionName(String workflowDefinitionName) {
226                    _workflowDefinitionName = workflowDefinitionName;
227            }
228    
229            public int getWorkflowDefinitionVersion() {
230                    return _workflowDefinitionVersion;
231            }
232    
233            public void setWorkflowDefinitionVersion(int workflowDefinitionVersion) {
234                    _workflowDefinitionVersion = workflowDefinitionVersion;
235            }
236    
237            public WorkflowDefinitionLink toEscapedModel() {
238                    if (isEscapedModel()) {
239                            return (WorkflowDefinitionLink)this;
240                    }
241                    else {
242                            return (WorkflowDefinitionLink)Proxy.newProxyInstance(WorkflowDefinitionLink.class.getClassLoader(),
243                                    new Class[] { WorkflowDefinitionLink.class },
244                                    new AutoEscapeBeanHandler(this));
245                    }
246            }
247    
248            public ExpandoBridge getExpandoBridge() {
249                    if (_expandoBridge == null) {
250                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
251                                            WorkflowDefinitionLink.class.getName(), getPrimaryKey());
252                    }
253    
254                    return _expandoBridge;
255            }
256    
257            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
258                    getExpandoBridge().setAttributes(serviceContext);
259            }
260    
261            public Object clone() {
262                    WorkflowDefinitionLinkImpl clone = new WorkflowDefinitionLinkImpl();
263    
264                    clone.setWorkflowDefinitionLinkId(getWorkflowDefinitionLinkId());
265                    clone.setGroupId(getGroupId());
266                    clone.setCompanyId(getCompanyId());
267                    clone.setUserId(getUserId());
268                    clone.setUserName(getUserName());
269                    clone.setCreateDate(getCreateDate());
270                    clone.setModifiedDate(getModifiedDate());
271                    clone.setClassNameId(getClassNameId());
272                    clone.setWorkflowDefinitionName(getWorkflowDefinitionName());
273                    clone.setWorkflowDefinitionVersion(getWorkflowDefinitionVersion());
274    
275                    return clone;
276            }
277    
278            public int compareTo(WorkflowDefinitionLink workflowDefinitionLink) {
279                    int value = 0;
280    
281                    value = getWorkflowDefinitionName()
282                                            .compareTo(workflowDefinitionLink.getWorkflowDefinitionName());
283    
284                    if (value != 0) {
285                            return value;
286                    }
287    
288                    return 0;
289            }
290    
291            public boolean equals(Object obj) {
292                    if (obj == null) {
293                            return false;
294                    }
295    
296                    WorkflowDefinitionLink workflowDefinitionLink = null;
297    
298                    try {
299                            workflowDefinitionLink = (WorkflowDefinitionLink)obj;
300                    }
301                    catch (ClassCastException cce) {
302                            return false;
303                    }
304    
305                    long pk = workflowDefinitionLink.getPrimaryKey();
306    
307                    if (getPrimaryKey() == pk) {
308                            return true;
309                    }
310                    else {
311                            return false;
312                    }
313            }
314    
315            public int hashCode() {
316                    return (int)getPrimaryKey();
317            }
318    
319            public String toString() {
320                    StringBundler sb = new StringBundler(21);
321    
322                    sb.append("{workflowDefinitionLinkId=");
323                    sb.append(getWorkflowDefinitionLinkId());
324                    sb.append(", groupId=");
325                    sb.append(getGroupId());
326                    sb.append(", companyId=");
327                    sb.append(getCompanyId());
328                    sb.append(", userId=");
329                    sb.append(getUserId());
330                    sb.append(", userName=");
331                    sb.append(getUserName());
332                    sb.append(", createDate=");
333                    sb.append(getCreateDate());
334                    sb.append(", modifiedDate=");
335                    sb.append(getModifiedDate());
336                    sb.append(", classNameId=");
337                    sb.append(getClassNameId());
338                    sb.append(", workflowDefinitionName=");
339                    sb.append(getWorkflowDefinitionName());
340                    sb.append(", workflowDefinitionVersion=");
341                    sb.append(getWorkflowDefinitionVersion());
342                    sb.append("}");
343    
344                    return sb.toString();
345            }
346    
347            public String toXmlString() {
348                    StringBundler sb = new StringBundler(34);
349    
350                    sb.append("<model><model-name>");
351                    sb.append("com.liferay.portal.model.WorkflowDefinitionLink");
352                    sb.append("</model-name>");
353    
354                    sb.append(
355                            "<column><column-name>workflowDefinitionLinkId</column-name><column-value><![CDATA[");
356                    sb.append(getWorkflowDefinitionLinkId());
357                    sb.append("]]></column-value></column>");
358                    sb.append(
359                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
360                    sb.append(getGroupId());
361                    sb.append("]]></column-value></column>");
362                    sb.append(
363                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
364                    sb.append(getCompanyId());
365                    sb.append("]]></column-value></column>");
366                    sb.append(
367                            "<column><column-name>userId</column-name><column-value><![CDATA[");
368                    sb.append(getUserId());
369                    sb.append("]]></column-value></column>");
370                    sb.append(
371                            "<column><column-name>userName</column-name><column-value><![CDATA[");
372                    sb.append(getUserName());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
376                    sb.append(getCreateDate());
377                    sb.append("]]></column-value></column>");
378                    sb.append(
379                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
380                    sb.append(getModifiedDate());
381                    sb.append("]]></column-value></column>");
382                    sb.append(
383                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
384                    sb.append(getClassNameId());
385                    sb.append("]]></column-value></column>");
386                    sb.append(
387                            "<column><column-name>workflowDefinitionName</column-name><column-value><![CDATA[");
388                    sb.append(getWorkflowDefinitionName());
389                    sb.append("]]></column-value></column>");
390                    sb.append(
391                            "<column><column-name>workflowDefinitionVersion</column-name><column-value><![CDATA[");
392                    sb.append(getWorkflowDefinitionVersion());
393                    sb.append("]]></column-value></column>");
394    
395                    sb.append("</model>");
396    
397                    return sb.toString();
398            }
399    
400            private long _workflowDefinitionLinkId;
401            private long _groupId;
402            private long _originalGroupId;
403            private boolean _setOriginalGroupId;
404            private long _companyId;
405            private long _originalCompanyId;
406            private boolean _setOriginalCompanyId;
407            private long _userId;
408            private String _userUuid;
409            private String _userName;
410            private Date _createDate;
411            private Date _modifiedDate;
412            private long _classNameId;
413            private long _originalClassNameId;
414            private boolean _setOriginalClassNameId;
415            private String _workflowDefinitionName;
416            private int _workflowDefinitionVersion;
417            private transient ExpandoBridge _expandoBridge;
418    }