001    /**
002     * Copyright (c) 2000-2012 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.util.GetterUtil;
019    import com.liferay.portal.kernel.util.ProxyUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.RepositoryEntry;
024    import com.liferay.portal.model.RepositoryEntryModel;
025    import com.liferay.portal.service.ServiceContext;
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.sql.Types;
033    
034    import java.util.HashMap;
035    import java.util.Map;
036    
037    /**
038     * 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.
039     *
040     * <p>
041     * 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}.
042     * </p>
043     *
044     * @author Brian Wing Shun Chan
045     * @see RepositoryEntryImpl
046     * @see com.liferay.portal.model.RepositoryEntry
047     * @see com.liferay.portal.model.RepositoryEntryModel
048     * @generated
049     */
050    public class RepositoryEntryModelImpl extends BaseModelImpl<RepositoryEntry>
051            implements RepositoryEntryModel {
052            /*
053             * NOTE FOR DEVELOPERS:
054             *
055             * 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.
056             */
057            public static final String TABLE_NAME = "RepositoryEntry";
058            public static final Object[][] TABLE_COLUMNS = {
059                            { "uuid_", Types.VARCHAR },
060                            { "repositoryEntryId", Types.BIGINT },
061                            { "groupId", Types.BIGINT },
062                            { "repositoryId", Types.BIGINT },
063                            { "mappedId", Types.VARCHAR },
064                            { "manualCheckInRequired", Types.BOOLEAN }
065                    };
066            public static final String TABLE_SQL_CREATE = "create table RepositoryEntry (uuid_ VARCHAR(75) null,repositoryEntryId LONG not null primary key,groupId LONG,repositoryId LONG,mappedId VARCHAR(75) null,manualCheckInRequired BOOLEAN)";
067            public static final String TABLE_SQL_DROP = "drop table RepositoryEntry";
068            public static final String DATA_SOURCE = "liferayDataSource";
069            public static final String SESSION_FACTORY = "liferaySessionFactory";
070            public static final String TX_MANAGER = "liferayTransactionManager";
071            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072                                    "value.object.entity.cache.enabled.com.liferay.portal.model.RepositoryEntry"),
073                            true);
074            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075                                    "value.object.finder.cache.enabled.com.liferay.portal.model.RepositoryEntry"),
076                            true);
077            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078                                    "value.object.column.bitmask.enabled.com.liferay.portal.model.RepositoryEntry"),
079                            true);
080            public static long GROUPID_COLUMN_BITMASK = 1L;
081            public static long MAPPEDID_COLUMN_BITMASK = 2L;
082            public static long REPOSITORYID_COLUMN_BITMASK = 4L;
083            public static long UUID_COLUMN_BITMASK = 8L;
084            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
085                                    "lock.expiration.time.com.liferay.portal.model.RepositoryEntry"));
086    
087            public RepositoryEntryModelImpl() {
088            }
089    
090            public long getPrimaryKey() {
091                    return _repositoryEntryId;
092            }
093    
094            public void setPrimaryKey(long primaryKey) {
095                    setRepositoryEntryId(primaryKey);
096            }
097    
098            public Serializable getPrimaryKeyObj() {
099                    return new Long(_repositoryEntryId);
100            }
101    
102            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
103                    setPrimaryKey(((Long)primaryKeyObj).longValue());
104            }
105    
106            public Class<?> getModelClass() {
107                    return RepositoryEntry.class;
108            }
109    
110            public String getModelClassName() {
111                    return RepositoryEntry.class.getName();
112            }
113    
114            @Override
115            public Map<String, Object> getModelAttributes() {
116                    Map<String, Object> attributes = new HashMap<String, Object>();
117    
118                    attributes.put("uuid", getUuid());
119                    attributes.put("repositoryEntryId", getRepositoryEntryId());
120                    attributes.put("groupId", getGroupId());
121                    attributes.put("repositoryId", getRepositoryId());
122                    attributes.put("mappedId", getMappedId());
123                    attributes.put("manualCheckInRequired", getManualCheckInRequired());
124    
125                    return attributes;
126            }
127    
128            @Override
129            public void setModelAttributes(Map<String, Object> attributes) {
130                    String uuid = (String)attributes.get("uuid");
131    
132                    if (uuid != null) {
133                            setUuid(uuid);
134                    }
135    
136                    Long repositoryEntryId = (Long)attributes.get("repositoryEntryId");
137    
138                    if (repositoryEntryId != null) {
139                            setRepositoryEntryId(repositoryEntryId);
140                    }
141    
142                    Long groupId = (Long)attributes.get("groupId");
143    
144                    if (groupId != null) {
145                            setGroupId(groupId);
146                    }
147    
148                    Long repositoryId = (Long)attributes.get("repositoryId");
149    
150                    if (repositoryId != null) {
151                            setRepositoryId(repositoryId);
152                    }
153    
154                    String mappedId = (String)attributes.get("mappedId");
155    
156                    if (mappedId != null) {
157                            setMappedId(mappedId);
158                    }
159    
160                    Boolean manualCheckInRequired = (Boolean)attributes.get(
161                                    "manualCheckInRequired");
162    
163                    if (manualCheckInRequired != null) {
164                            setManualCheckInRequired(manualCheckInRequired);
165                    }
166            }
167    
168            public String getUuid() {
169                    if (_uuid == null) {
170                            return StringPool.BLANK;
171                    }
172                    else {
173                            return _uuid;
174                    }
175            }
176    
177            public void setUuid(String uuid) {
178                    if (_originalUuid == null) {
179                            _originalUuid = _uuid;
180                    }
181    
182                    _uuid = uuid;
183            }
184    
185            public String getOriginalUuid() {
186                    return GetterUtil.getString(_originalUuid);
187            }
188    
189            public long getRepositoryEntryId() {
190                    return _repositoryEntryId;
191            }
192    
193            public void setRepositoryEntryId(long repositoryEntryId) {
194                    _repositoryEntryId = repositoryEntryId;
195            }
196    
197            public long getGroupId() {
198                    return _groupId;
199            }
200    
201            public void setGroupId(long groupId) {
202                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
203    
204                    if (!_setOriginalGroupId) {
205                            _setOriginalGroupId = true;
206    
207                            _originalGroupId = _groupId;
208                    }
209    
210                    _groupId = groupId;
211            }
212    
213            public long getOriginalGroupId() {
214                    return _originalGroupId;
215            }
216    
217            public long getRepositoryId() {
218                    return _repositoryId;
219            }
220    
221            public void setRepositoryId(long repositoryId) {
222                    _columnBitmask |= REPOSITORYID_COLUMN_BITMASK;
223    
224                    if (!_setOriginalRepositoryId) {
225                            _setOriginalRepositoryId = true;
226    
227                            _originalRepositoryId = _repositoryId;
228                    }
229    
230                    _repositoryId = repositoryId;
231            }
232    
233            public long getOriginalRepositoryId() {
234                    return _originalRepositoryId;
235            }
236    
237            public String getMappedId() {
238                    if (_mappedId == null) {
239                            return StringPool.BLANK;
240                    }
241                    else {
242                            return _mappedId;
243                    }
244            }
245    
246            public void setMappedId(String mappedId) {
247                    _columnBitmask |= MAPPEDID_COLUMN_BITMASK;
248    
249                    if (_originalMappedId == null) {
250                            _originalMappedId = _mappedId;
251                    }
252    
253                    _mappedId = mappedId;
254            }
255    
256            public String getOriginalMappedId() {
257                    return GetterUtil.getString(_originalMappedId);
258            }
259    
260            public boolean getManualCheckInRequired() {
261                    return _manualCheckInRequired;
262            }
263    
264            public boolean isManualCheckInRequired() {
265                    return _manualCheckInRequired;
266            }
267    
268            public void setManualCheckInRequired(boolean manualCheckInRequired) {
269                    _manualCheckInRequired = manualCheckInRequired;
270            }
271    
272            public long getColumnBitmask() {
273                    return _columnBitmask;
274            }
275    
276            @Override
277            public ExpandoBridge getExpandoBridge() {
278                    return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
279                            RepositoryEntry.class.getName(), getPrimaryKey());
280            }
281    
282            @Override
283            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
284                    ExpandoBridge expandoBridge = getExpandoBridge();
285    
286                    expandoBridge.setAttributes(serviceContext);
287            }
288    
289            @Override
290            public RepositoryEntry toEscapedModel() {
291                    if (_escapedModelProxy == null) {
292                            _escapedModelProxy = (RepositoryEntry)ProxyUtil.newProxyInstance(_classLoader,
293                                            _escapedModelProxyInterfaces,
294                                            new AutoEscapeBeanHandler(this));
295                    }
296    
297                    return _escapedModelProxy;
298            }
299    
300            @Override
301            public Object clone() {
302                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
303    
304                    repositoryEntryImpl.setUuid(getUuid());
305                    repositoryEntryImpl.setRepositoryEntryId(getRepositoryEntryId());
306                    repositoryEntryImpl.setGroupId(getGroupId());
307                    repositoryEntryImpl.setRepositoryId(getRepositoryId());
308                    repositoryEntryImpl.setMappedId(getMappedId());
309                    repositoryEntryImpl.setManualCheckInRequired(getManualCheckInRequired());
310    
311                    repositoryEntryImpl.resetOriginalValues();
312    
313                    return repositoryEntryImpl;
314            }
315    
316            public int compareTo(RepositoryEntry repositoryEntry) {
317                    long primaryKey = repositoryEntry.getPrimaryKey();
318    
319                    if (getPrimaryKey() < primaryKey) {
320                            return -1;
321                    }
322                    else if (getPrimaryKey() > primaryKey) {
323                            return 1;
324                    }
325                    else {
326                            return 0;
327                    }
328            }
329    
330            @Override
331            public boolean equals(Object obj) {
332                    if (obj == null) {
333                            return false;
334                    }
335    
336                    RepositoryEntry repositoryEntry = null;
337    
338                    try {
339                            repositoryEntry = (RepositoryEntry)obj;
340                    }
341                    catch (ClassCastException cce) {
342                            return false;
343                    }
344    
345                    long primaryKey = repositoryEntry.getPrimaryKey();
346    
347                    if (getPrimaryKey() == primaryKey) {
348                            return true;
349                    }
350                    else {
351                            return false;
352                    }
353            }
354    
355            @Override
356            public int hashCode() {
357                    return (int)getPrimaryKey();
358            }
359    
360            @Override
361            public void resetOriginalValues() {
362                    RepositoryEntryModelImpl repositoryEntryModelImpl = this;
363    
364                    repositoryEntryModelImpl._originalUuid = repositoryEntryModelImpl._uuid;
365    
366                    repositoryEntryModelImpl._originalGroupId = repositoryEntryModelImpl._groupId;
367    
368                    repositoryEntryModelImpl._setOriginalGroupId = false;
369    
370                    repositoryEntryModelImpl._originalRepositoryId = repositoryEntryModelImpl._repositoryId;
371    
372                    repositoryEntryModelImpl._setOriginalRepositoryId = false;
373    
374                    repositoryEntryModelImpl._originalMappedId = repositoryEntryModelImpl._mappedId;
375    
376                    repositoryEntryModelImpl._columnBitmask = 0;
377            }
378    
379            @Override
380            public CacheModel<RepositoryEntry> toCacheModel() {
381                    RepositoryEntryCacheModel repositoryEntryCacheModel = new RepositoryEntryCacheModel();
382    
383                    repositoryEntryCacheModel.uuid = getUuid();
384    
385                    String uuid = repositoryEntryCacheModel.uuid;
386    
387                    if ((uuid != null) && (uuid.length() == 0)) {
388                            repositoryEntryCacheModel.uuid = null;
389                    }
390    
391                    repositoryEntryCacheModel.repositoryEntryId = getRepositoryEntryId();
392    
393                    repositoryEntryCacheModel.groupId = getGroupId();
394    
395                    repositoryEntryCacheModel.repositoryId = getRepositoryId();
396    
397                    repositoryEntryCacheModel.mappedId = getMappedId();
398    
399                    String mappedId = repositoryEntryCacheModel.mappedId;
400    
401                    if ((mappedId != null) && (mappedId.length() == 0)) {
402                            repositoryEntryCacheModel.mappedId = null;
403                    }
404    
405                    repositoryEntryCacheModel.manualCheckInRequired = getManualCheckInRequired();
406    
407                    return repositoryEntryCacheModel;
408            }
409    
410            @Override
411            public String toString() {
412                    StringBundler sb = new StringBundler(13);
413    
414                    sb.append("{uuid=");
415                    sb.append(getUuid());
416                    sb.append(", repositoryEntryId=");
417                    sb.append(getRepositoryEntryId());
418                    sb.append(", groupId=");
419                    sb.append(getGroupId());
420                    sb.append(", repositoryId=");
421                    sb.append(getRepositoryId());
422                    sb.append(", mappedId=");
423                    sb.append(getMappedId());
424                    sb.append(", manualCheckInRequired=");
425                    sb.append(getManualCheckInRequired());
426                    sb.append("}");
427    
428                    return sb.toString();
429            }
430    
431            public String toXmlString() {
432                    StringBundler sb = new StringBundler(22);
433    
434                    sb.append("<model><model-name>");
435                    sb.append("com.liferay.portal.model.RepositoryEntry");
436                    sb.append("</model-name>");
437    
438                    sb.append(
439                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
440                    sb.append(getUuid());
441                    sb.append("]]></column-value></column>");
442                    sb.append(
443                            "<column><column-name>repositoryEntryId</column-name><column-value><![CDATA[");
444                    sb.append(getRepositoryEntryId());
445                    sb.append("]]></column-value></column>");
446                    sb.append(
447                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
448                    sb.append(getGroupId());
449                    sb.append("]]></column-value></column>");
450                    sb.append(
451                            "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
452                    sb.append(getRepositoryId());
453                    sb.append("]]></column-value></column>");
454                    sb.append(
455                            "<column><column-name>mappedId</column-name><column-value><![CDATA[");
456                    sb.append(getMappedId());
457                    sb.append("]]></column-value></column>");
458                    sb.append(
459                            "<column><column-name>manualCheckInRequired</column-name><column-value><![CDATA[");
460                    sb.append(getManualCheckInRequired());
461                    sb.append("]]></column-value></column>");
462    
463                    sb.append("</model>");
464    
465                    return sb.toString();
466            }
467    
468            private static ClassLoader _classLoader = RepositoryEntry.class.getClassLoader();
469            private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
470                            RepositoryEntry.class
471                    };
472            private String _uuid;
473            private String _originalUuid;
474            private long _repositoryEntryId;
475            private long _groupId;
476            private long _originalGroupId;
477            private boolean _setOriginalGroupId;
478            private long _repositoryId;
479            private long _originalRepositoryId;
480            private boolean _setOriginalRepositoryId;
481            private String _mappedId;
482            private String _originalMappedId;
483            private boolean _manualCheckInRequired;
484            private long _columnBitmask;
485            private RepositoryEntry _escapedModelProxy;
486    }