001    /**
002     * Copyright (c) 2000-2011 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                    if (!_setOriginalGroupId) {
115                            _setOriginalGroupId = true;
116    
117                            _originalGroupId = _groupId;
118                    }
119    
120                    _groupId = groupId;
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                    if (!_setOriginalCompanyId) {
133                            _setOriginalCompanyId = true;
134    
135                            _originalCompanyId = _companyId;
136                    }
137    
138                    _companyId = companyId;
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                    if (!_setOriginalClassNameId) {
204                            _setOriginalClassNameId = true;
205    
206                            _originalClassNameId = _classNameId;
207                    }
208    
209                    _classNameId = classNameId;
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 workflowDefinitionLinkImpl = new WorkflowDefinitionLinkImpl();
263    
264                    workflowDefinitionLinkImpl.setWorkflowDefinitionLinkId(getWorkflowDefinitionLinkId());
265    
266                    workflowDefinitionLinkImpl.setGroupId(getGroupId());
267    
268                    WorkflowDefinitionLinkModelImpl workflowDefinitionLinkModelImpl = workflowDefinitionLinkImpl;
269    
270                    workflowDefinitionLinkModelImpl._originalGroupId = workflowDefinitionLinkModelImpl._groupId;
271    
272                    workflowDefinitionLinkModelImpl._setOriginalGroupId = false;
273                    workflowDefinitionLinkImpl.setCompanyId(getCompanyId());
274    
275                    workflowDefinitionLinkModelImpl._originalCompanyId = workflowDefinitionLinkModelImpl._companyId;
276    
277                    workflowDefinitionLinkModelImpl._setOriginalCompanyId = false;
278                    workflowDefinitionLinkImpl.setUserId(getUserId());
279    
280                    workflowDefinitionLinkImpl.setUserName(getUserName());
281    
282                    workflowDefinitionLinkImpl.setCreateDate(getCreateDate());
283    
284                    workflowDefinitionLinkImpl.setModifiedDate(getModifiedDate());
285    
286                    workflowDefinitionLinkImpl.setClassNameId(getClassNameId());
287    
288                    workflowDefinitionLinkModelImpl._originalClassNameId = workflowDefinitionLinkModelImpl._classNameId;
289    
290                    workflowDefinitionLinkModelImpl._setOriginalClassNameId = false;
291                    workflowDefinitionLinkImpl.setWorkflowDefinitionName(getWorkflowDefinitionName());
292    
293                    workflowDefinitionLinkImpl.setWorkflowDefinitionVersion(getWorkflowDefinitionVersion());
294    
295                    return workflowDefinitionLinkImpl;
296            }
297    
298            public int compareTo(WorkflowDefinitionLink workflowDefinitionLink) {
299                    int value = 0;
300    
301                    value = getWorkflowDefinitionName()
302                                            .compareTo(workflowDefinitionLink.getWorkflowDefinitionName());
303    
304                    if (value != 0) {
305                            return value;
306                    }
307    
308                    return 0;
309            }
310    
311            public boolean equals(Object obj) {
312                    if (obj == null) {
313                            return false;
314                    }
315    
316                    WorkflowDefinitionLink workflowDefinitionLink = null;
317    
318                    try {
319                            workflowDefinitionLink = (WorkflowDefinitionLink)obj;
320                    }
321                    catch (ClassCastException cce) {
322                            return false;
323                    }
324    
325                    long pk = workflowDefinitionLink.getPrimaryKey();
326    
327                    if (getPrimaryKey() == pk) {
328                            return true;
329                    }
330                    else {
331                            return false;
332                    }
333            }
334    
335            public int hashCode() {
336                    return (int)getPrimaryKey();
337            }
338    
339            public String toString() {
340                    StringBundler sb = new StringBundler(21);
341    
342                    sb.append("{workflowDefinitionLinkId=");
343                    sb.append(getWorkflowDefinitionLinkId());
344                    sb.append(", groupId=");
345                    sb.append(getGroupId());
346                    sb.append(", companyId=");
347                    sb.append(getCompanyId());
348                    sb.append(", userId=");
349                    sb.append(getUserId());
350                    sb.append(", userName=");
351                    sb.append(getUserName());
352                    sb.append(", createDate=");
353                    sb.append(getCreateDate());
354                    sb.append(", modifiedDate=");
355                    sb.append(getModifiedDate());
356                    sb.append(", classNameId=");
357                    sb.append(getClassNameId());
358                    sb.append(", workflowDefinitionName=");
359                    sb.append(getWorkflowDefinitionName());
360                    sb.append(", workflowDefinitionVersion=");
361                    sb.append(getWorkflowDefinitionVersion());
362                    sb.append("}");
363    
364                    return sb.toString();
365            }
366    
367            public String toXmlString() {
368                    StringBundler sb = new StringBundler(34);
369    
370                    sb.append("<model><model-name>");
371                    sb.append("com.liferay.portal.model.WorkflowDefinitionLink");
372                    sb.append("</model-name>");
373    
374                    sb.append(
375                            "<column><column-name>workflowDefinitionLinkId</column-name><column-value><![CDATA[");
376                    sb.append(getWorkflowDefinitionLinkId());
377                    sb.append("]]></column-value></column>");
378                    sb.append(
379                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
380                    sb.append(getGroupId());
381                    sb.append("]]></column-value></column>");
382                    sb.append(
383                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
384                    sb.append(getCompanyId());
385                    sb.append("]]></column-value></column>");
386                    sb.append(
387                            "<column><column-name>userId</column-name><column-value><![CDATA[");
388                    sb.append(getUserId());
389                    sb.append("]]></column-value></column>");
390                    sb.append(
391                            "<column><column-name>userName</column-name><column-value><![CDATA[");
392                    sb.append(getUserName());
393                    sb.append("]]></column-value></column>");
394                    sb.append(
395                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
396                    sb.append(getCreateDate());
397                    sb.append("]]></column-value></column>");
398                    sb.append(
399                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
400                    sb.append(getModifiedDate());
401                    sb.append("]]></column-value></column>");
402                    sb.append(
403                            "<column><column-name>classNameId</column-name><column-value><![CDATA[");
404                    sb.append(getClassNameId());
405                    sb.append("]]></column-value></column>");
406                    sb.append(
407                            "<column><column-name>workflowDefinitionName</column-name><column-value><![CDATA[");
408                    sb.append(getWorkflowDefinitionName());
409                    sb.append("]]></column-value></column>");
410                    sb.append(
411                            "<column><column-name>workflowDefinitionVersion</column-name><column-value><![CDATA[");
412                    sb.append(getWorkflowDefinitionVersion());
413                    sb.append("]]></column-value></column>");
414    
415                    sb.append("</model>");
416    
417                    return sb.toString();
418            }
419    
420            private long _workflowDefinitionLinkId;
421            private long _groupId;
422            private long _originalGroupId;
423            private boolean _setOriginalGroupId;
424            private long _companyId;
425            private long _originalCompanyId;
426            private boolean _setOriginalCompanyId;
427            private long _userId;
428            private String _userUuid;
429            private String _userName;
430            private Date _createDate;
431            private Date _modifiedDate;
432            private long _classNameId;
433            private long _originalClassNameId;
434            private boolean _setOriginalClassNameId;
435            private String _workflowDefinitionName;
436            private int _workflowDefinitionVersion;
437            private transient ExpandoBridge _expandoBridge;
438    }