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