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