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