001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
020    import com.liferay.portal.kernel.exception.PortalException;
021    import com.liferay.portal.kernel.util.GetterUtil;
022    import com.liferay.portal.kernel.util.ProxyUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
025    import com.liferay.portal.model.CacheModel;
026    import com.liferay.portal.model.RecentLayoutSetBranch;
027    import com.liferay.portal.model.RecentLayoutSetBranchModel;
028    import com.liferay.portal.model.User;
029    import com.liferay.portal.service.ServiceContext;
030    import com.liferay.portal.service.UserLocalServiceUtil;
031    
032    import com.liferay.portlet.expando.model.ExpandoBridge;
033    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
034    
035    import java.io.Serializable;
036    
037    import java.sql.Types;
038    
039    import java.util.HashMap;
040    import java.util.Map;
041    
042    /**
043     * The base model implementation for the RecentLayoutSetBranch service. Represents a row in the "RecentLayoutSetBranch" database table, with each column mapped to a property of this class.
044     *
045     * <p>
046     * This implementation and its corresponding interface {@link RecentLayoutSetBranchModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link RecentLayoutSetBranchImpl}.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see RecentLayoutSetBranchImpl
051     * @see RecentLayoutSetBranch
052     * @see RecentLayoutSetBranchModel
053     * @generated
054     */
055    @ProviderType
056    public class RecentLayoutSetBranchModelImpl extends BaseModelImpl<RecentLayoutSetBranch>
057            implements RecentLayoutSetBranchModel {
058            /*
059             * NOTE FOR DEVELOPERS:
060             *
061             * Never modify or reference this class directly. All methods that expect a recent layout set branch model instance should use the {@link RecentLayoutSetBranch} interface instead.
062             */
063            public static final String TABLE_NAME = "RecentLayoutSetBranch";
064            public static final Object[][] TABLE_COLUMNS = {
065                            { "mvccVersion", Types.BIGINT },
066                            { "recentLayoutSetBranchId", Types.BIGINT },
067                            { "groupId", Types.BIGINT },
068                            { "companyId", Types.BIGINT },
069                            { "userId", Types.BIGINT },
070                            { "layoutSetBranchId", Types.BIGINT },
071                            { "layoutSetId", Types.BIGINT }
072                    };
073            public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
074    
075            static {
076                    TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT);
077                    TABLE_COLUMNS_MAP.put("recentLayoutSetBranchId", Types.BIGINT);
078                    TABLE_COLUMNS_MAP.put("groupId", Types.BIGINT);
079                    TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
080                    TABLE_COLUMNS_MAP.put("userId", Types.BIGINT);
081                    TABLE_COLUMNS_MAP.put("layoutSetBranchId", Types.BIGINT);
082                    TABLE_COLUMNS_MAP.put("layoutSetId", Types.BIGINT);
083            }
084    
085            public static final String TABLE_SQL_CREATE = "create table RecentLayoutSetBranch (mvccVersion LONG default 0,recentLayoutSetBranchId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,layoutSetBranchId LONG,layoutSetId LONG)";
086            public static final String TABLE_SQL_DROP = "drop table RecentLayoutSetBranch";
087            public static final String ORDER_BY_JPQL = " ORDER BY recentLayoutSetBranch.recentLayoutSetBranchId ASC";
088            public static final String ORDER_BY_SQL = " ORDER BY RecentLayoutSetBranch.recentLayoutSetBranchId ASC";
089            public static final String DATA_SOURCE = "liferayDataSource";
090            public static final String SESSION_FACTORY = "liferaySessionFactory";
091            public static final String TX_MANAGER = "liferayTransactionManager";
092            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
093                                    "value.object.entity.cache.enabled.com.liferay.portal.model.RecentLayoutSetBranch"),
094                            true);
095            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096                                    "value.object.finder.cache.enabled.com.liferay.portal.model.RecentLayoutSetBranch"),
097                            true);
098            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
099                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.RecentLayoutSetBranch"),
100                            true);
101            public static final long GROUPID_COLUMN_BITMASK = 1L;
102            public static final long LAYOUTSETBRANCHID_COLUMN_BITMASK = 2L;
103            public static final long LAYOUTSETID_COLUMN_BITMASK = 4L;
104            public static final long USERID_COLUMN_BITMASK = 8L;
105            public static final long RECENTLAYOUTSETBRANCHID_COLUMN_BITMASK = 16L;
106            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
107                                    "lock.expiration.time.com.liferay.portal.model.RecentLayoutSetBranch"));
108    
109            public RecentLayoutSetBranchModelImpl() {
110            }
111    
112            @Override
113            public long getPrimaryKey() {
114                    return _recentLayoutSetBranchId;
115            }
116    
117            @Override
118            public void setPrimaryKey(long primaryKey) {
119                    setRecentLayoutSetBranchId(primaryKey);
120            }
121    
122            @Override
123            public Serializable getPrimaryKeyObj() {
124                    return _recentLayoutSetBranchId;
125            }
126    
127            @Override
128            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
129                    setPrimaryKey(((Long)primaryKeyObj).longValue());
130            }
131    
132            @Override
133            public Class<?> getModelClass() {
134                    return RecentLayoutSetBranch.class;
135            }
136    
137            @Override
138            public String getModelClassName() {
139                    return RecentLayoutSetBranch.class.getName();
140            }
141    
142            @Override
143            public Map<String, Object> getModelAttributes() {
144                    Map<String, Object> attributes = new HashMap<String, Object>();
145    
146                    attributes.put("mvccVersion", getMvccVersion());
147                    attributes.put("recentLayoutSetBranchId", getRecentLayoutSetBranchId());
148                    attributes.put("groupId", getGroupId());
149                    attributes.put("companyId", getCompanyId());
150                    attributes.put("userId", getUserId());
151                    attributes.put("layoutSetBranchId", getLayoutSetBranchId());
152                    attributes.put("layoutSetId", getLayoutSetId());
153    
154                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
155                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
156    
157                    return attributes;
158            }
159    
160            @Override
161            public void setModelAttributes(Map<String, Object> attributes) {
162                    Long mvccVersion = (Long)attributes.get("mvccVersion");
163    
164                    if (mvccVersion != null) {
165                            setMvccVersion(mvccVersion);
166                    }
167    
168                    Long recentLayoutSetBranchId = (Long)attributes.get(
169                                    "recentLayoutSetBranchId");
170    
171                    if (recentLayoutSetBranchId != null) {
172                            setRecentLayoutSetBranchId(recentLayoutSetBranchId);
173                    }
174    
175                    Long groupId = (Long)attributes.get("groupId");
176    
177                    if (groupId != null) {
178                            setGroupId(groupId);
179                    }
180    
181                    Long companyId = (Long)attributes.get("companyId");
182    
183                    if (companyId != null) {
184                            setCompanyId(companyId);
185                    }
186    
187                    Long userId = (Long)attributes.get("userId");
188    
189                    if (userId != null) {
190                            setUserId(userId);
191                    }
192    
193                    Long layoutSetBranchId = (Long)attributes.get("layoutSetBranchId");
194    
195                    if (layoutSetBranchId != null) {
196                            setLayoutSetBranchId(layoutSetBranchId);
197                    }
198    
199                    Long layoutSetId = (Long)attributes.get("layoutSetId");
200    
201                    if (layoutSetId != null) {
202                            setLayoutSetId(layoutSetId);
203                    }
204            }
205    
206            @Override
207            public long getMvccVersion() {
208                    return _mvccVersion;
209            }
210    
211            @Override
212            public void setMvccVersion(long mvccVersion) {
213                    _mvccVersion = mvccVersion;
214            }
215    
216            @Override
217            public long getRecentLayoutSetBranchId() {
218                    return _recentLayoutSetBranchId;
219            }
220    
221            @Override
222            public void setRecentLayoutSetBranchId(long recentLayoutSetBranchId) {
223                    _recentLayoutSetBranchId = recentLayoutSetBranchId;
224            }
225    
226            @Override
227            public long getGroupId() {
228                    return _groupId;
229            }
230    
231            @Override
232            public void setGroupId(long groupId) {
233                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
234    
235                    if (!_setOriginalGroupId) {
236                            _setOriginalGroupId = true;
237    
238                            _originalGroupId = _groupId;
239                    }
240    
241                    _groupId = groupId;
242            }
243    
244            public long getOriginalGroupId() {
245                    return _originalGroupId;
246            }
247    
248            @Override
249            public long getCompanyId() {
250                    return _companyId;
251            }
252    
253            @Override
254            public void setCompanyId(long companyId) {
255                    _companyId = companyId;
256            }
257    
258            @Override
259            public long getUserId() {
260                    return _userId;
261            }
262    
263            @Override
264            public void setUserId(long userId) {
265                    _columnBitmask |= USERID_COLUMN_BITMASK;
266    
267                    if (!_setOriginalUserId) {
268                            _setOriginalUserId = true;
269    
270                            _originalUserId = _userId;
271                    }
272    
273                    _userId = userId;
274            }
275    
276            @Override
277            public String getUserUuid() {
278                    try {
279                            User user = UserLocalServiceUtil.getUserById(getUserId());
280    
281                            return user.getUuid();
282                    }
283                    catch (PortalException pe) {
284                            return StringPool.BLANK;
285                    }
286            }
287    
288            @Override
289            public void setUserUuid(String userUuid) {
290            }
291    
292            public long getOriginalUserId() {
293                    return _originalUserId;
294            }
295    
296            @Override
297            public long getLayoutSetBranchId() {
298                    return _layoutSetBranchId;
299            }
300    
301            @Override
302            public void setLayoutSetBranchId(long layoutSetBranchId) {
303                    _columnBitmask |= LAYOUTSETBRANCHID_COLUMN_BITMASK;
304    
305                    if (!_setOriginalLayoutSetBranchId) {
306                            _setOriginalLayoutSetBranchId = true;
307    
308                            _originalLayoutSetBranchId = _layoutSetBranchId;
309                    }
310    
311                    _layoutSetBranchId = layoutSetBranchId;
312            }
313    
314            public long getOriginalLayoutSetBranchId() {
315                    return _originalLayoutSetBranchId;
316            }
317    
318            @Override
319            public long getLayoutSetId() {
320                    return _layoutSetId;
321            }
322    
323            @Override
324            public void setLayoutSetId(long layoutSetId) {
325                    _columnBitmask |= LAYOUTSETID_COLUMN_BITMASK;
326    
327                    if (!_setOriginalLayoutSetId) {
328                            _setOriginalLayoutSetId = true;
329    
330                            _originalLayoutSetId = _layoutSetId;
331                    }
332    
333                    _layoutSetId = layoutSetId;
334            }
335    
336            public long getOriginalLayoutSetId() {
337                    return _originalLayoutSetId;
338            }
339    
340            public long getColumnBitmask() {
341                    return _columnBitmask;
342            }
343    
344            @Override
345            public ExpandoBridge getExpandoBridge() {
346                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
347                            RecentLayoutSetBranch.class.getName(), getPrimaryKey());
348            }
349    
350            @Override
351            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
352                    ExpandoBridge expandoBridge = getExpandoBridge();
353    
354                    expandoBridge.setAttributes(serviceContext);
355            }
356    
357            @Override
358            public RecentLayoutSetBranch toEscapedModel() {
359                    if (_escapedModel == null) {
360                            _escapedModel = (RecentLayoutSetBranch)ProxyUtil.newProxyInstance(_classLoader,
361                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
362                    }
363    
364                    return _escapedModel;
365            }
366    
367            @Override
368            public Object clone() {
369                    RecentLayoutSetBranchImpl recentLayoutSetBranchImpl = new RecentLayoutSetBranchImpl();
370    
371                    recentLayoutSetBranchImpl.setMvccVersion(getMvccVersion());
372                    recentLayoutSetBranchImpl.setRecentLayoutSetBranchId(getRecentLayoutSetBranchId());
373                    recentLayoutSetBranchImpl.setGroupId(getGroupId());
374                    recentLayoutSetBranchImpl.setCompanyId(getCompanyId());
375                    recentLayoutSetBranchImpl.setUserId(getUserId());
376                    recentLayoutSetBranchImpl.setLayoutSetBranchId(getLayoutSetBranchId());
377                    recentLayoutSetBranchImpl.setLayoutSetId(getLayoutSetId());
378    
379                    recentLayoutSetBranchImpl.resetOriginalValues();
380    
381                    return recentLayoutSetBranchImpl;
382            }
383    
384            @Override
385            public int compareTo(RecentLayoutSetBranch recentLayoutSetBranch) {
386                    long primaryKey = recentLayoutSetBranch.getPrimaryKey();
387    
388                    if (getPrimaryKey() < primaryKey) {
389                            return -1;
390                    }
391                    else if (getPrimaryKey() > primaryKey) {
392                            return 1;
393                    }
394                    else {
395                            return 0;
396                    }
397            }
398    
399            @Override
400            public boolean equals(Object obj) {
401                    if (this == obj) {
402                            return true;
403                    }
404    
405                    if (!(obj instanceof RecentLayoutSetBranch)) {
406                            return false;
407                    }
408    
409                    RecentLayoutSetBranch recentLayoutSetBranch = (RecentLayoutSetBranch)obj;
410    
411                    long primaryKey = recentLayoutSetBranch.getPrimaryKey();
412    
413                    if (getPrimaryKey() == primaryKey) {
414                            return true;
415                    }
416                    else {
417                            return false;
418                    }
419            }
420    
421            @Override
422            public int hashCode() {
423                    return (int)getPrimaryKey();
424            }
425    
426            @Override
427            public boolean isEntityCacheEnabled() {
428                    return ENTITY_CACHE_ENABLED;
429            }
430    
431            @Override
432            public boolean isFinderCacheEnabled() {
433                    return FINDER_CACHE_ENABLED;
434            }
435    
436            @Override
437            public void resetOriginalValues() {
438                    RecentLayoutSetBranchModelImpl recentLayoutSetBranchModelImpl = this;
439    
440                    recentLayoutSetBranchModelImpl._originalGroupId = recentLayoutSetBranchModelImpl._groupId;
441    
442                    recentLayoutSetBranchModelImpl._setOriginalGroupId = false;
443    
444                    recentLayoutSetBranchModelImpl._originalUserId = recentLayoutSetBranchModelImpl._userId;
445    
446                    recentLayoutSetBranchModelImpl._setOriginalUserId = false;
447    
448                    recentLayoutSetBranchModelImpl._originalLayoutSetBranchId = recentLayoutSetBranchModelImpl._layoutSetBranchId;
449    
450                    recentLayoutSetBranchModelImpl._setOriginalLayoutSetBranchId = false;
451    
452                    recentLayoutSetBranchModelImpl._originalLayoutSetId = recentLayoutSetBranchModelImpl._layoutSetId;
453    
454                    recentLayoutSetBranchModelImpl._setOriginalLayoutSetId = false;
455    
456                    recentLayoutSetBranchModelImpl._columnBitmask = 0;
457            }
458    
459            @Override
460            public CacheModel<RecentLayoutSetBranch> toCacheModel() {
461                    RecentLayoutSetBranchCacheModel recentLayoutSetBranchCacheModel = new RecentLayoutSetBranchCacheModel();
462    
463                    recentLayoutSetBranchCacheModel.mvccVersion = getMvccVersion();
464    
465                    recentLayoutSetBranchCacheModel.recentLayoutSetBranchId = getRecentLayoutSetBranchId();
466    
467                    recentLayoutSetBranchCacheModel.groupId = getGroupId();
468    
469                    recentLayoutSetBranchCacheModel.companyId = getCompanyId();
470    
471                    recentLayoutSetBranchCacheModel.userId = getUserId();
472    
473                    recentLayoutSetBranchCacheModel.layoutSetBranchId = getLayoutSetBranchId();
474    
475                    recentLayoutSetBranchCacheModel.layoutSetId = getLayoutSetId();
476    
477                    return recentLayoutSetBranchCacheModel;
478            }
479    
480            @Override
481            public String toString() {
482                    StringBundler sb = new StringBundler(15);
483    
484                    sb.append("{mvccVersion=");
485                    sb.append(getMvccVersion());
486                    sb.append(", recentLayoutSetBranchId=");
487                    sb.append(getRecentLayoutSetBranchId());
488                    sb.append(", groupId=");
489                    sb.append(getGroupId());
490                    sb.append(", companyId=");
491                    sb.append(getCompanyId());
492                    sb.append(", userId=");
493                    sb.append(getUserId());
494                    sb.append(", layoutSetBranchId=");
495                    sb.append(getLayoutSetBranchId());
496                    sb.append(", layoutSetId=");
497                    sb.append(getLayoutSetId());
498                    sb.append("}");
499    
500                    return sb.toString();
501            }
502    
503            @Override
504            public String toXmlString() {
505                    StringBundler sb = new StringBundler(25);
506    
507                    sb.append("<model><model-name>");
508                    sb.append("com.liferay.portal.model.RecentLayoutSetBranch");
509                    sb.append("</model-name>");
510    
511                    sb.append(
512                            "<column><column-name>mvccVersion</column-name><column-value><![CDATA[");
513                    sb.append(getMvccVersion());
514                    sb.append("]]></column-value></column>");
515                    sb.append(
516                            "<column><column-name>recentLayoutSetBranchId</column-name><column-value><![CDATA[");
517                    sb.append(getRecentLayoutSetBranchId());
518                    sb.append("]]></column-value></column>");
519                    sb.append(
520                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
521                    sb.append(getGroupId());
522                    sb.append("]]></column-value></column>");
523                    sb.append(
524                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
525                    sb.append(getCompanyId());
526                    sb.append("]]></column-value></column>");
527                    sb.append(
528                            "<column><column-name>userId</column-name><column-value><![CDATA[");
529                    sb.append(getUserId());
530                    sb.append("]]></column-value></column>");
531                    sb.append(
532                            "<column><column-name>layoutSetBranchId</column-name><column-value><![CDATA[");
533                    sb.append(getLayoutSetBranchId());
534                    sb.append("]]></column-value></column>");
535                    sb.append(
536                            "<column><column-name>layoutSetId</column-name><column-value><![CDATA[");
537                    sb.append(getLayoutSetId());
538                    sb.append("]]></column-value></column>");
539    
540                    sb.append("</model>");
541    
542                    return sb.toString();
543            }
544    
545            private static final ClassLoader _classLoader = RecentLayoutSetBranch.class.getClassLoader();
546            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
547                            RecentLayoutSetBranch.class
548                    };
549            private long _mvccVersion;
550            private long _recentLayoutSetBranchId;
551            private long _groupId;
552            private long _originalGroupId;
553            private boolean _setOriginalGroupId;
554            private long _companyId;
555            private long _userId;
556            private long _originalUserId;
557            private boolean _setOriginalUserId;
558            private long _layoutSetBranchId;
559            private long _originalLayoutSetBranchId;
560            private boolean _setOriginalLayoutSetBranchId;
561            private long _layoutSetId;
562            private long _originalLayoutSetId;
563            private boolean _setOriginalLayoutSetId;
564            private long _columnBitmask;
565            private RecentLayoutSetBranch _escapedModel;
566    }