001    /**
002     * Copyright (c) 2000-2013 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.ProxyUtil;
021    import com.liferay.portal.kernel.util.StringBundler;
022    import com.liferay.portal.kernel.util.StringPool;
023    import com.liferay.portal.model.CacheModel;
024    import com.liferay.portal.model.RepositoryEntry;
025    import com.liferay.portal.model.RepositoryEntryModel;
026    import com.liferay.portal.service.ServiceContext;
027    import com.liferay.portal.util.PortalUtil;
028    
029    import com.liferay.portlet.expando.model.ExpandoBridge;
030    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031    
032    import java.io.Serializable;
033    
034    import java.sql.Types;
035    
036    import java.util.Date;
037    import java.util.HashMap;
038    import java.util.Map;
039    
040    /**
041     * The base model implementation for the RepositoryEntry service. Represents a row in the "RepositoryEntry" database table, with each column mapped to a property of this class.
042     *
043     * <p>
044     * This implementation and its corresponding interface {@link com.liferay.portal.model.RepositoryEntryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link RepositoryEntryImpl}.
045     * </p>
046     *
047     * @author Brian Wing Shun Chan
048     * @see RepositoryEntryImpl
049     * @see com.liferay.portal.model.RepositoryEntry
050     * @see com.liferay.portal.model.RepositoryEntryModel
051     * @generated
052     */
053    public class RepositoryEntryModelImpl extends BaseModelImpl<RepositoryEntry>
054            implements RepositoryEntryModel {
055            /*
056             * NOTE FOR DEVELOPERS:
057             *
058             * Never modify or reference this class directly. All methods that expect a repository entry model instance should use the {@link com.liferay.portal.model.RepositoryEntry} interface instead.
059             */
060            public static final String TABLE_NAME = "RepositoryEntry";
061            public static final Object[][] TABLE_COLUMNS = {
062                            { "uuid_", Types.VARCHAR },
063                            { "repositoryEntryId", Types.BIGINT },
064                            { "groupId", Types.BIGINT },
065                            { "companyId", Types.BIGINT },
066                            { "userId", Types.BIGINT },
067                            { "userName", Types.VARCHAR },
068                            { "createDate", Types.TIMESTAMP },
069                            { "modifiedDate", Types.TIMESTAMP },
070                            { "repositoryId", Types.BIGINT },
071                            { "mappedId", Types.VARCHAR },
072                            { "manualCheckInRequired", Types.BOOLEAN }
073                    };
074            public static final String TABLE_SQL_CREATE = "create table RepositoryEntry (uuid_ VARCHAR(75) null,repositoryEntryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,repositoryId LONG,mappedId VARCHAR(75) null,manualCheckInRequired BOOLEAN)";
075            public static final String TABLE_SQL_DROP = "drop table RepositoryEntry";
076            public static final String ORDER_BY_JPQL = " ORDER BY repositoryEntry.repositoryEntryId ASC";
077            public static final String ORDER_BY_SQL = " ORDER BY RepositoryEntry.repositoryEntryId ASC";
078            public static final String DATA_SOURCE = "liferayDataSource";
079            public static final String SESSION_FACTORY = "liferaySessionFactory";
080            public static final String TX_MANAGER = "liferayTransactionManager";
081            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
082                                    "value.object.entity.cache.enabled.com.liferay.portal.model.RepositoryEntry"),
083                            true);
084            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
085                                    "value.object.finder.cache.enabled.com.liferay.portal.model.RepositoryEntry"),
086                            true);
087            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
088                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.RepositoryEntry"),
089                            true);
090            public static long COMPANYID_COLUMN_BITMASK = 1L;
091            public static long GROUPID_COLUMN_BITMASK = 2L;
092            public static long MAPPEDID_COLUMN_BITMASK = 4L;
093            public static long REPOSITORYID_COLUMN_BITMASK = 8L;
094            public static long UUID_COLUMN_BITMASK = 16L;
095            public static long REPOSITORYENTRYID_COLUMN_BITMASK = 32L;
096            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
097                                    "lock.expiration.time.com.liferay.portal.model.RepositoryEntry"));
098    
099            public RepositoryEntryModelImpl() {
100            }
101    
102            public long getPrimaryKey() {
103                    return _repositoryEntryId;
104            }
105    
106            public void setPrimaryKey(long primaryKey) {
107                    setRepositoryEntryId(primaryKey);
108            }
109    
110            public Serializable getPrimaryKeyObj() {
111                    return _repositoryEntryId;
112            }
113    
114            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
115                    setPrimaryKey(((Long)primaryKeyObj).longValue());
116            }
117    
118            public Class<?> getModelClass() {
119                    return RepositoryEntry.class;
120            }
121    
122            public String getModelClassName() {
123                    return RepositoryEntry.class.getName();
124            }
125    
126            @Override
127            public Map<String, Object> getModelAttributes() {
128                    Map<String, Object> attributes = new HashMap<String, Object>();
129    
130                    attributes.put("uuid", getUuid());
131                    attributes.put("repositoryEntryId", getRepositoryEntryId());
132                    attributes.put("groupId", getGroupId());
133                    attributes.put("companyId", getCompanyId());
134                    attributes.put("userId", getUserId());
135                    attributes.put("userName", getUserName());
136                    attributes.put("createDate", getCreateDate());
137                    attributes.put("modifiedDate", getModifiedDate());
138                    attributes.put("repositoryId", getRepositoryId());
139                    attributes.put("mappedId", getMappedId());
140                    attributes.put("manualCheckInRequired", getManualCheckInRequired());
141    
142                    return attributes;
143            }
144    
145            @Override
146            public void setModelAttributes(Map<String, Object> attributes) {
147                    String uuid = (String)attributes.get("uuid");
148    
149                    if (uuid != null) {
150                            setUuid(uuid);
151                    }
152    
153                    Long repositoryEntryId = (Long)attributes.get("repositoryEntryId");
154    
155                    if (repositoryEntryId != null) {
156                            setRepositoryEntryId(repositoryEntryId);
157                    }
158    
159                    Long groupId = (Long)attributes.get("groupId");
160    
161                    if (groupId != null) {
162                            setGroupId(groupId);
163                    }
164    
165                    Long companyId = (Long)attributes.get("companyId");
166    
167                    if (companyId != null) {
168                            setCompanyId(companyId);
169                    }
170    
171                    Long userId = (Long)attributes.get("userId");
172    
173                    if (userId != null) {
174                            setUserId(userId);
175                    }
176    
177                    String userName = (String)attributes.get("userName");
178    
179                    if (userName != null) {
180                            setUserName(userName);
181                    }
182    
183                    Date createDate = (Date)attributes.get("createDate");
184    
185                    if (createDate != null) {
186                            setCreateDate(createDate);
187                    }
188    
189                    Date modifiedDate = (Date)attributes.get("modifiedDate");
190    
191                    if (modifiedDate != null) {
192                            setModifiedDate(modifiedDate);
193                    }
194    
195                    Long repositoryId = (Long)attributes.get("repositoryId");
196    
197                    if (repositoryId != null) {
198                            setRepositoryId(repositoryId);
199                    }
200    
201                    String mappedId = (String)attributes.get("mappedId");
202    
203                    if (mappedId != null) {
204                            setMappedId(mappedId);
205                    }
206    
207                    Boolean manualCheckInRequired = (Boolean)attributes.get(
208                                    "manualCheckInRequired");
209    
210                    if (manualCheckInRequired != null) {
211                            setManualCheckInRequired(manualCheckInRequired);
212                    }
213            }
214    
215            public String getUuid() {
216                    if (_uuid == null) {
217                            return StringPool.BLANK;
218                    }
219                    else {
220                            return _uuid;
221                    }
222            }
223    
224            public void setUuid(String uuid) {
225                    if (_originalUuid == null) {
226                            _originalUuid = _uuid;
227                    }
228    
229                    _uuid = uuid;
230            }
231    
232            public String getOriginalUuid() {
233                    return GetterUtil.getString(_originalUuid);
234            }
235    
236            public long getRepositoryEntryId() {
237                    return _repositoryEntryId;
238            }
239    
240            public void setRepositoryEntryId(long repositoryEntryId) {
241                    _repositoryEntryId = repositoryEntryId;
242            }
243    
244            public long getGroupId() {
245                    return _groupId;
246            }
247    
248            public void setGroupId(long groupId) {
249                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
250    
251                    if (!_setOriginalGroupId) {
252                            _setOriginalGroupId = true;
253    
254                            _originalGroupId = _groupId;
255                    }
256    
257                    _groupId = groupId;
258            }
259    
260            public long getOriginalGroupId() {
261                    return _originalGroupId;
262            }
263    
264            public long getCompanyId() {
265                    return _companyId;
266            }
267    
268            public void setCompanyId(long companyId) {
269                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
270    
271                    if (!_setOriginalCompanyId) {
272                            _setOriginalCompanyId = true;
273    
274                            _originalCompanyId = _companyId;
275                    }
276    
277                    _companyId = companyId;
278            }
279    
280            public long getOriginalCompanyId() {
281                    return _originalCompanyId;
282            }
283    
284            public long getUserId() {
285                    return _userId;
286            }
287    
288            public void setUserId(long userId) {
289                    _userId = userId;
290            }
291    
292            public String getUserUuid() throws SystemException {
293                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
294            }
295    
296            public void setUserUuid(String userUuid) {
297                    _userUuid = userUuid;
298            }
299    
300            public String getUserName() {
301                    if (_userName == null) {
302                            return StringPool.BLANK;
303                    }
304                    else {
305                            return _userName;
306                    }
307            }
308    
309            public void setUserName(String userName) {
310                    _userName = userName;
311            }
312    
313            public Date getCreateDate() {
314                    return _createDate;
315            }
316    
317            public void setCreateDate(Date createDate) {
318                    _createDate = createDate;
319            }
320    
321            public Date getModifiedDate() {
322                    return _modifiedDate;
323            }
324    
325            public void setModifiedDate(Date modifiedDate) {
326                    _modifiedDate = modifiedDate;
327            }
328    
329            public long getRepositoryId() {
330                    return _repositoryId;
331            }
332    
333            public void setRepositoryId(long repositoryId) {
334                    _columnBitmask |= REPOSITORYID_COLUMN_BITMASK;
335    
336                    if (!_setOriginalRepositoryId) {
337                            _setOriginalRepositoryId = true;
338    
339                            _originalRepositoryId = _repositoryId;
340                    }
341    
342                    _repositoryId = repositoryId;
343            }
344    
345            public long getOriginalRepositoryId() {
346                    return _originalRepositoryId;
347            }
348    
349            public String getMappedId() {
350                    if (_mappedId == null) {
351                            return StringPool.BLANK;
352                    }
353                    else {
354                            return _mappedId;
355                    }
356            }
357    
358            public void setMappedId(String mappedId) {
359                    _columnBitmask |= MAPPEDID_COLUMN_BITMASK;
360    
361                    if (_originalMappedId == null) {
362                            _originalMappedId = _mappedId;
363                    }
364    
365                    _mappedId = mappedId;
366            }
367    
368            public String getOriginalMappedId() {
369                    return GetterUtil.getString(_originalMappedId);
370            }
371    
372            public boolean getManualCheckInRequired() {
373                    return _manualCheckInRequired;
374            }
375    
376            public boolean isManualCheckInRequired() {
377                    return _manualCheckInRequired;
378            }
379    
380            public void setManualCheckInRequired(boolean manualCheckInRequired) {
381                    _manualCheckInRequired = manualCheckInRequired;
382            }
383    
384            public long getColumnBitmask() {
385                    return _columnBitmask;
386            }
387    
388            @Override
389            public ExpandoBridge getExpandoBridge() {
390                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
391                            RepositoryEntry.class.getName(), getPrimaryKey());
392            }
393    
394            @Override
395            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
396                    ExpandoBridge expandoBridge = getExpandoBridge();
397    
398                    expandoBridge.setAttributes(serviceContext);
399            }
400    
401            @Override
402            public RepositoryEntry toEscapedModel() {
403                    if (_escapedModel == null) {
404                            _escapedModel = (RepositoryEntry)ProxyUtil.newProxyInstance(_classLoader,
405                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
406                    }
407    
408                    return _escapedModel;
409            }
410    
411            @Override
412            public Object clone() {
413                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
414    
415                    repositoryEntryImpl.setUuid(getUuid());
416                    repositoryEntryImpl.setRepositoryEntryId(getRepositoryEntryId());
417                    repositoryEntryImpl.setGroupId(getGroupId());
418                    repositoryEntryImpl.setCompanyId(getCompanyId());
419                    repositoryEntryImpl.setUserId(getUserId());
420                    repositoryEntryImpl.setUserName(getUserName());
421                    repositoryEntryImpl.setCreateDate(getCreateDate());
422                    repositoryEntryImpl.setModifiedDate(getModifiedDate());
423                    repositoryEntryImpl.setRepositoryId(getRepositoryId());
424                    repositoryEntryImpl.setMappedId(getMappedId());
425                    repositoryEntryImpl.setManualCheckInRequired(getManualCheckInRequired());
426    
427                    repositoryEntryImpl.resetOriginalValues();
428    
429                    return repositoryEntryImpl;
430            }
431    
432            public int compareTo(RepositoryEntry repositoryEntry) {
433                    long primaryKey = repositoryEntry.getPrimaryKey();
434    
435                    if (getPrimaryKey() < primaryKey) {
436                            return -1;
437                    }
438                    else if (getPrimaryKey() > primaryKey) {
439                            return 1;
440                    }
441                    else {
442                            return 0;
443                    }
444            }
445    
446            @Override
447            public boolean equals(Object obj) {
448                    if (obj == null) {
449                            return false;
450                    }
451    
452                    RepositoryEntry repositoryEntry = null;
453    
454                    try {
455                            repositoryEntry = (RepositoryEntry)obj;
456                    }
457                    catch (ClassCastException cce) {
458                            return false;
459                    }
460    
461                    long primaryKey = repositoryEntry.getPrimaryKey();
462    
463                    if (getPrimaryKey() == primaryKey) {
464                            return true;
465                    }
466                    else {
467                            return false;
468                    }
469            }
470    
471            @Override
472            public int hashCode() {
473                    return (int)getPrimaryKey();
474            }
475    
476            @Override
477            public void resetOriginalValues() {
478                    RepositoryEntryModelImpl repositoryEntryModelImpl = this;
479    
480                    repositoryEntryModelImpl._originalUuid = repositoryEntryModelImpl._uuid;
481    
482                    repositoryEntryModelImpl._originalGroupId = repositoryEntryModelImpl._groupId;
483    
484                    repositoryEntryModelImpl._setOriginalGroupId = false;
485    
486                    repositoryEntryModelImpl._originalCompanyId = repositoryEntryModelImpl._companyId;
487    
488                    repositoryEntryModelImpl._setOriginalCompanyId = false;
489    
490                    repositoryEntryModelImpl._originalRepositoryId = repositoryEntryModelImpl._repositoryId;
491    
492                    repositoryEntryModelImpl._setOriginalRepositoryId = false;
493    
494                    repositoryEntryModelImpl._originalMappedId = repositoryEntryModelImpl._mappedId;
495    
496                    repositoryEntryModelImpl._columnBitmask = 0;
497            }
498    
499            @Override
500            public CacheModel<RepositoryEntry> toCacheModel() {
501                    RepositoryEntryCacheModel repositoryEntryCacheModel = new RepositoryEntryCacheModel();
502    
503                    repositoryEntryCacheModel.uuid = getUuid();
504    
505                    String uuid = repositoryEntryCacheModel.uuid;
506    
507                    if ((uuid != null) && (uuid.length() == 0)) {
508                            repositoryEntryCacheModel.uuid = null;
509                    }
510    
511                    repositoryEntryCacheModel.repositoryEntryId = getRepositoryEntryId();
512    
513                    repositoryEntryCacheModel.groupId = getGroupId();
514    
515                    repositoryEntryCacheModel.companyId = getCompanyId();
516    
517                    repositoryEntryCacheModel.userId = getUserId();
518    
519                    repositoryEntryCacheModel.userName = getUserName();
520    
521                    String userName = repositoryEntryCacheModel.userName;
522    
523                    if ((userName != null) && (userName.length() == 0)) {
524                            repositoryEntryCacheModel.userName = null;
525                    }
526    
527                    Date createDate = getCreateDate();
528    
529                    if (createDate != null) {
530                            repositoryEntryCacheModel.createDate = createDate.getTime();
531                    }
532                    else {
533                            repositoryEntryCacheModel.createDate = Long.MIN_VALUE;
534                    }
535    
536                    Date modifiedDate = getModifiedDate();
537    
538                    if (modifiedDate != null) {
539                            repositoryEntryCacheModel.modifiedDate = modifiedDate.getTime();
540                    }
541                    else {
542                            repositoryEntryCacheModel.modifiedDate = Long.MIN_VALUE;
543                    }
544    
545                    repositoryEntryCacheModel.repositoryId = getRepositoryId();
546    
547                    repositoryEntryCacheModel.mappedId = getMappedId();
548    
549                    String mappedId = repositoryEntryCacheModel.mappedId;
550    
551                    if ((mappedId != null) && (mappedId.length() == 0)) {
552                            repositoryEntryCacheModel.mappedId = null;
553                    }
554    
555                    repositoryEntryCacheModel.manualCheckInRequired = getManualCheckInRequired();
556    
557                    return repositoryEntryCacheModel;
558            }
559    
560            @Override
561            public String toString() {
562                    StringBundler sb = new StringBundler(23);
563    
564                    sb.append("{uuid=");
565                    sb.append(getUuid());
566                    sb.append(", repositoryEntryId=");
567                    sb.append(getRepositoryEntryId());
568                    sb.append(", groupId=");
569                    sb.append(getGroupId());
570                    sb.append(", companyId=");
571                    sb.append(getCompanyId());
572                    sb.append(", userId=");
573                    sb.append(getUserId());
574                    sb.append(", userName=");
575                    sb.append(getUserName());
576                    sb.append(", createDate=");
577                    sb.append(getCreateDate());
578                    sb.append(", modifiedDate=");
579                    sb.append(getModifiedDate());
580                    sb.append(", repositoryId=");
581                    sb.append(getRepositoryId());
582                    sb.append(", mappedId=");
583                    sb.append(getMappedId());
584                    sb.append(", manualCheckInRequired=");
585                    sb.append(getManualCheckInRequired());
586                    sb.append("}");
587    
588                    return sb.toString();
589            }
590    
591            public String toXmlString() {
592                    StringBundler sb = new StringBundler(37);
593    
594                    sb.append("<model><model-name>");
595                    sb.append("com.liferay.portal.model.RepositoryEntry");
596                    sb.append("</model-name>");
597    
598                    sb.append(
599                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
600                    sb.append(getUuid());
601                    sb.append("]]></column-value></column>");
602                    sb.append(
603                            "<column><column-name>repositoryEntryId</column-name><column-value><![CDATA[");
604                    sb.append(getRepositoryEntryId());
605                    sb.append("]]></column-value></column>");
606                    sb.append(
607                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
608                    sb.append(getGroupId());
609                    sb.append("]]></column-value></column>");
610                    sb.append(
611                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
612                    sb.append(getCompanyId());
613                    sb.append("]]></column-value></column>");
614                    sb.append(
615                            "<column><column-name>userId</column-name><column-value><![CDATA[");
616                    sb.append(getUserId());
617                    sb.append("]]></column-value></column>");
618                    sb.append(
619                            "<column><column-name>userName</column-name><column-value><![CDATA[");
620                    sb.append(getUserName());
621                    sb.append("]]></column-value></column>");
622                    sb.append(
623                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
624                    sb.append(getCreateDate());
625                    sb.append("]]></column-value></column>");
626                    sb.append(
627                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
628                    sb.append(getModifiedDate());
629                    sb.append("]]></column-value></column>");
630                    sb.append(
631                            "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
632                    sb.append(getRepositoryId());
633                    sb.append("]]></column-value></column>");
634                    sb.append(
635                            "<column><column-name>mappedId</column-name><column-value><![CDATA[");
636                    sb.append(getMappedId());
637                    sb.append("]]></column-value></column>");
638                    sb.append(
639                            "<column><column-name>manualCheckInRequired</column-name><column-value><![CDATA[");
640                    sb.append(getManualCheckInRequired());
641                    sb.append("]]></column-value></column>");
642    
643                    sb.append("</model>");
644    
645                    return sb.toString();
646            }
647    
648            private static ClassLoader _classLoader = RepositoryEntry.class.getClassLoader();
649            private static Class<?>[] _escapedModelInterfaces = new Class[] {
650                            RepositoryEntry.class
651                    };
652            private String _uuid;
653            private String _originalUuid;
654            private long _repositoryEntryId;
655            private long _groupId;
656            private long _originalGroupId;
657            private boolean _setOriginalGroupId;
658            private long _companyId;
659            private long _originalCompanyId;
660            private boolean _setOriginalCompanyId;
661            private long _userId;
662            private String _userUuid;
663            private String _userName;
664            private Date _createDate;
665            private Date _modifiedDate;
666            private long _repositoryId;
667            private long _originalRepositoryId;
668            private boolean _setOriginalRepositoryId;
669            private String _mappedId;
670            private String _originalMappedId;
671            private boolean _manualCheckInRequired;
672            private long _columnBitmask;
673            private RepositoryEntry _escapedModel;
674    }