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.portlet.softwarecatalog.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
020    import com.liferay.portal.kernel.exception.PortalException;
021    import com.liferay.portal.kernel.json.JSON;
022    import com.liferay.portal.kernel.util.DateUtil;
023    import com.liferay.portal.kernel.util.GetterUtil;
024    import com.liferay.portal.kernel.util.ProxyUtil;
025    import com.liferay.portal.kernel.util.StringBundler;
026    import com.liferay.portal.kernel.util.StringPool;
027    import com.liferay.portal.model.CacheModel;
028    import com.liferay.portal.model.User;
029    import com.liferay.portal.model.impl.BaseModelImpl;
030    import com.liferay.portal.service.ServiceContext;
031    import com.liferay.portal.service.UserLocalServiceUtil;
032    
033    import com.liferay.portlet.expando.model.ExpandoBridge;
034    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
035    import com.liferay.portlet.softwarecatalog.model.SCProductEntry;
036    import com.liferay.portlet.softwarecatalog.model.SCProductEntryModel;
037    import com.liferay.portlet.softwarecatalog.model.SCProductEntrySoap;
038    
039    import java.io.Serializable;
040    
041    import java.sql.Types;
042    
043    import java.util.ArrayList;
044    import java.util.Date;
045    import java.util.HashMap;
046    import java.util.List;
047    import java.util.Map;
048    
049    /**
050     * The base model implementation for the SCProductEntry service. Represents a row in the "SCProductEntry" database table, with each column mapped to a property of this class.
051     *
052     * <p>
053     * This implementation and its corresponding interface {@link SCProductEntryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link SCProductEntryImpl}.
054     * </p>
055     *
056     * @author Brian Wing Shun Chan
057     * @see SCProductEntryImpl
058     * @see SCProductEntry
059     * @see SCProductEntryModel
060     * @generated
061     */
062    @JSON(strict = true)
063    @ProviderType
064    public class SCProductEntryModelImpl extends BaseModelImpl<SCProductEntry>
065            implements SCProductEntryModel {
066            /*
067             * NOTE FOR DEVELOPERS:
068             *
069             * Never modify or reference this class directly. All methods that expect a s c product entry model instance should use the {@link SCProductEntry} interface instead.
070             */
071            public static final String TABLE_NAME = "SCProductEntry";
072            public static final Object[][] TABLE_COLUMNS = {
073                            { "productEntryId", Types.BIGINT },
074                            { "groupId", Types.BIGINT },
075                            { "companyId", Types.BIGINT },
076                            { "userId", Types.BIGINT },
077                            { "userName", Types.VARCHAR },
078                            { "createDate", Types.TIMESTAMP },
079                            { "modifiedDate", Types.TIMESTAMP },
080                            { "name", Types.VARCHAR },
081                            { "type_", Types.VARCHAR },
082                            { "tags", Types.VARCHAR },
083                            { "shortDescription", Types.VARCHAR },
084                            { "longDescription", Types.VARCHAR },
085                            { "pageURL", Types.VARCHAR },
086                            { "author", Types.VARCHAR },
087                            { "repoGroupId", Types.VARCHAR },
088                            { "repoArtifactId", Types.VARCHAR }
089                    };
090            public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
091    
092            static {
093                    TABLE_COLUMNS_MAP.put("productEntryId", Types.BIGINT);
094                    TABLE_COLUMNS_MAP.put("groupId", Types.BIGINT);
095                    TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
096                    TABLE_COLUMNS_MAP.put("userId", Types.BIGINT);
097                    TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR);
098                    TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
099                    TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
100                    TABLE_COLUMNS_MAP.put("name", Types.VARCHAR);
101                    TABLE_COLUMNS_MAP.put("type_", Types.VARCHAR);
102                    TABLE_COLUMNS_MAP.put("tags", Types.VARCHAR);
103                    TABLE_COLUMNS_MAP.put("shortDescription", Types.VARCHAR);
104                    TABLE_COLUMNS_MAP.put("longDescription", Types.VARCHAR);
105                    TABLE_COLUMNS_MAP.put("pageURL", Types.VARCHAR);
106                    TABLE_COLUMNS_MAP.put("author", Types.VARCHAR);
107                    TABLE_COLUMNS_MAP.put("repoGroupId", Types.VARCHAR);
108                    TABLE_COLUMNS_MAP.put("repoArtifactId", Types.VARCHAR);
109            }
110    
111            public static final String TABLE_SQL_CREATE = "create table SCProductEntry (productEntryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,type_ VARCHAR(75) null,tags VARCHAR(255) null,shortDescription STRING null,longDescription STRING null,pageURL STRING null,author VARCHAR(75) null,repoGroupId VARCHAR(75) null,repoArtifactId VARCHAR(75) null)";
112            public static final String TABLE_SQL_DROP = "drop table SCProductEntry";
113            public static final String ORDER_BY_JPQL = " ORDER BY scProductEntry.modifiedDate DESC, scProductEntry.name DESC";
114            public static final String ORDER_BY_SQL = " ORDER BY SCProductEntry.modifiedDate DESC, SCProductEntry.name DESC";
115            public static final String DATA_SOURCE = "liferayDataSource";
116            public static final String SESSION_FACTORY = "liferaySessionFactory";
117            public static final String TX_MANAGER = "liferayTransactionManager";
118            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
119                                    "value.object.entity.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
120                            true);
121            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
122                                    "value.object.finder.cache.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
123                            true);
124            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
125                                    "value.object.column.bitmask.enabled.com.liferay.portlet.softwarecatalog.model.SCProductEntry"),
126                            true);
127            public static final long COMPANYID_COLUMN_BITMASK = 1L;
128            public static final long GROUPID_COLUMN_BITMASK = 2L;
129            public static final long REPOARTIFACTID_COLUMN_BITMASK = 4L;
130            public static final long REPOGROUPID_COLUMN_BITMASK = 8L;
131            public static final long USERID_COLUMN_BITMASK = 16L;
132            public static final long MODIFIEDDATE_COLUMN_BITMASK = 32L;
133            public static final long NAME_COLUMN_BITMASK = 64L;
134    
135            /**
136             * Converts the soap model instance into a normal model instance.
137             *
138             * @param soapModel the soap model instance to convert
139             * @return the normal model instance
140             */
141            public static SCProductEntry toModel(SCProductEntrySoap soapModel) {
142                    if (soapModel == null) {
143                            return null;
144                    }
145    
146                    SCProductEntry model = new SCProductEntryImpl();
147    
148                    model.setProductEntryId(soapModel.getProductEntryId());
149                    model.setGroupId(soapModel.getGroupId());
150                    model.setCompanyId(soapModel.getCompanyId());
151                    model.setUserId(soapModel.getUserId());
152                    model.setUserName(soapModel.getUserName());
153                    model.setCreateDate(soapModel.getCreateDate());
154                    model.setModifiedDate(soapModel.getModifiedDate());
155                    model.setName(soapModel.getName());
156                    model.setType(soapModel.getType());
157                    model.setTags(soapModel.getTags());
158                    model.setShortDescription(soapModel.getShortDescription());
159                    model.setLongDescription(soapModel.getLongDescription());
160                    model.setPageURL(soapModel.getPageURL());
161                    model.setAuthor(soapModel.getAuthor());
162                    model.setRepoGroupId(soapModel.getRepoGroupId());
163                    model.setRepoArtifactId(soapModel.getRepoArtifactId());
164    
165                    return model;
166            }
167    
168            /**
169             * Converts the soap model instances into normal model instances.
170             *
171             * @param soapModels the soap model instances to convert
172             * @return the normal model instances
173             */
174            public static List<SCProductEntry> toModels(SCProductEntrySoap[] soapModels) {
175                    if (soapModels == null) {
176                            return null;
177                    }
178    
179                    List<SCProductEntry> models = new ArrayList<SCProductEntry>(soapModels.length);
180    
181                    for (SCProductEntrySoap soapModel : soapModels) {
182                            models.add(toModel(soapModel));
183                    }
184    
185                    return models;
186            }
187    
188            public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_NAME = "SCLicenses_SCProductEntries";
189            public static final Object[][] MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_COLUMNS =
190                    {
191                            { "companyId", Types.BIGINT },
192                            { "licenseId", Types.BIGINT },
193                            { "productEntryId", Types.BIGINT }
194                    };
195            public static final String MAPPING_TABLE_SCLICENSES_SCPRODUCTENTRIES_SQL_CREATE =
196                    "create table SCLicenses_SCProductEntries (companyId LONG not null,licenseId LONG not null,productEntryId LONG not null,primary key (companyId, licenseId, productEntryId))";
197            public static final boolean FINDER_CACHE_ENABLED_SCLICENSES_SCPRODUCTENTRIES =
198                    GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
199                                    "value.object.finder.cache.enabled.SCLicenses_SCProductEntries"),
200                            true);
201            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
202                                    "lock.expiration.time.com.liferay.portlet.softwarecatalog.model.SCProductEntry"));
203    
204            public SCProductEntryModelImpl() {
205            }
206    
207            @Override
208            public long getPrimaryKey() {
209                    return _productEntryId;
210            }
211    
212            @Override
213            public void setPrimaryKey(long primaryKey) {
214                    setProductEntryId(primaryKey);
215            }
216    
217            @Override
218            public Serializable getPrimaryKeyObj() {
219                    return _productEntryId;
220            }
221    
222            @Override
223            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
224                    setPrimaryKey(((Long)primaryKeyObj).longValue());
225            }
226    
227            @Override
228            public Class<?> getModelClass() {
229                    return SCProductEntry.class;
230            }
231    
232            @Override
233            public String getModelClassName() {
234                    return SCProductEntry.class.getName();
235            }
236    
237            @Override
238            public Map<String, Object> getModelAttributes() {
239                    Map<String, Object> attributes = new HashMap<String, Object>();
240    
241                    attributes.put("productEntryId", getProductEntryId());
242                    attributes.put("groupId", getGroupId());
243                    attributes.put("companyId", getCompanyId());
244                    attributes.put("userId", getUserId());
245                    attributes.put("userName", getUserName());
246                    attributes.put("createDate", getCreateDate());
247                    attributes.put("modifiedDate", getModifiedDate());
248                    attributes.put("name", getName());
249                    attributes.put("type", getType());
250                    attributes.put("tags", getTags());
251                    attributes.put("shortDescription", getShortDescription());
252                    attributes.put("longDescription", getLongDescription());
253                    attributes.put("pageURL", getPageURL());
254                    attributes.put("author", getAuthor());
255                    attributes.put("repoGroupId", getRepoGroupId());
256                    attributes.put("repoArtifactId", getRepoArtifactId());
257    
258                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
259                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
260    
261                    return attributes;
262            }
263    
264            @Override
265            public void setModelAttributes(Map<String, Object> attributes) {
266                    Long productEntryId = (Long)attributes.get("productEntryId");
267    
268                    if (productEntryId != null) {
269                            setProductEntryId(productEntryId);
270                    }
271    
272                    Long groupId = (Long)attributes.get("groupId");
273    
274                    if (groupId != null) {
275                            setGroupId(groupId);
276                    }
277    
278                    Long companyId = (Long)attributes.get("companyId");
279    
280                    if (companyId != null) {
281                            setCompanyId(companyId);
282                    }
283    
284                    Long userId = (Long)attributes.get("userId");
285    
286                    if (userId != null) {
287                            setUserId(userId);
288                    }
289    
290                    String userName = (String)attributes.get("userName");
291    
292                    if (userName != null) {
293                            setUserName(userName);
294                    }
295    
296                    Date createDate = (Date)attributes.get("createDate");
297    
298                    if (createDate != null) {
299                            setCreateDate(createDate);
300                    }
301    
302                    Date modifiedDate = (Date)attributes.get("modifiedDate");
303    
304                    if (modifiedDate != null) {
305                            setModifiedDate(modifiedDate);
306                    }
307    
308                    String name = (String)attributes.get("name");
309    
310                    if (name != null) {
311                            setName(name);
312                    }
313    
314                    String type = (String)attributes.get("type");
315    
316                    if (type != null) {
317                            setType(type);
318                    }
319    
320                    String tags = (String)attributes.get("tags");
321    
322                    if (tags != null) {
323                            setTags(tags);
324                    }
325    
326                    String shortDescription = (String)attributes.get("shortDescription");
327    
328                    if (shortDescription != null) {
329                            setShortDescription(shortDescription);
330                    }
331    
332                    String longDescription = (String)attributes.get("longDescription");
333    
334                    if (longDescription != null) {
335                            setLongDescription(longDescription);
336                    }
337    
338                    String pageURL = (String)attributes.get("pageURL");
339    
340                    if (pageURL != null) {
341                            setPageURL(pageURL);
342                    }
343    
344                    String author = (String)attributes.get("author");
345    
346                    if (author != null) {
347                            setAuthor(author);
348                    }
349    
350                    String repoGroupId = (String)attributes.get("repoGroupId");
351    
352                    if (repoGroupId != null) {
353                            setRepoGroupId(repoGroupId);
354                    }
355    
356                    String repoArtifactId = (String)attributes.get("repoArtifactId");
357    
358                    if (repoArtifactId != null) {
359                            setRepoArtifactId(repoArtifactId);
360                    }
361            }
362    
363            @JSON
364            @Override
365            public long getProductEntryId() {
366                    return _productEntryId;
367            }
368    
369            @Override
370            public void setProductEntryId(long productEntryId) {
371                    _productEntryId = productEntryId;
372            }
373    
374            @JSON
375            @Override
376            public long getGroupId() {
377                    return _groupId;
378            }
379    
380            @Override
381            public void setGroupId(long groupId) {
382                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
383    
384                    if (!_setOriginalGroupId) {
385                            _setOriginalGroupId = true;
386    
387                            _originalGroupId = _groupId;
388                    }
389    
390                    _groupId = groupId;
391            }
392    
393            public long getOriginalGroupId() {
394                    return _originalGroupId;
395            }
396    
397            @JSON
398            @Override
399            public long getCompanyId() {
400                    return _companyId;
401            }
402    
403            @Override
404            public void setCompanyId(long companyId) {
405                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
406    
407                    if (!_setOriginalCompanyId) {
408                            _setOriginalCompanyId = true;
409    
410                            _originalCompanyId = _companyId;
411                    }
412    
413                    _companyId = companyId;
414            }
415    
416            public long getOriginalCompanyId() {
417                    return _originalCompanyId;
418            }
419    
420            @JSON
421            @Override
422            public long getUserId() {
423                    return _userId;
424            }
425    
426            @Override
427            public void setUserId(long userId) {
428                    _columnBitmask |= USERID_COLUMN_BITMASK;
429    
430                    if (!_setOriginalUserId) {
431                            _setOriginalUserId = true;
432    
433                            _originalUserId = _userId;
434                    }
435    
436                    _userId = userId;
437            }
438    
439            @Override
440            public String getUserUuid() {
441                    try {
442                            User user = UserLocalServiceUtil.getUserById(getUserId());
443    
444                            return user.getUuid();
445                    }
446                    catch (PortalException pe) {
447                            return StringPool.BLANK;
448                    }
449            }
450    
451            @Override
452            public void setUserUuid(String userUuid) {
453            }
454    
455            public long getOriginalUserId() {
456                    return _originalUserId;
457            }
458    
459            @JSON
460            @Override
461            public String getUserName() {
462                    if (_userName == null) {
463                            return StringPool.BLANK;
464                    }
465                    else {
466                            return _userName;
467                    }
468            }
469    
470            @Override
471            public void setUserName(String userName) {
472                    _userName = userName;
473            }
474    
475            @JSON
476            @Override
477            public Date getCreateDate() {
478                    return _createDate;
479            }
480    
481            @Override
482            public void setCreateDate(Date createDate) {
483                    _createDate = createDate;
484            }
485    
486            @JSON
487            @Override
488            public Date getModifiedDate() {
489                    return _modifiedDate;
490            }
491    
492            public boolean hasSetModifiedDate() {
493                    return _setModifiedDate;
494            }
495    
496            @Override
497            public void setModifiedDate(Date modifiedDate) {
498                    _setModifiedDate = true;
499    
500                    _columnBitmask = -1L;
501    
502                    _modifiedDate = modifiedDate;
503            }
504    
505            @JSON
506            @Override
507            public String getName() {
508                    if (_name == null) {
509                            return StringPool.BLANK;
510                    }
511                    else {
512                            return _name;
513                    }
514            }
515    
516            @Override
517            public void setName(String name) {
518                    _columnBitmask = -1L;
519    
520                    _name = name;
521            }
522    
523            @JSON
524            @Override
525            public String getType() {
526                    if (_type == null) {
527                            return StringPool.BLANK;
528                    }
529                    else {
530                            return _type;
531                    }
532            }
533    
534            @Override
535            public void setType(String type) {
536                    _type = type;
537            }
538    
539            @JSON
540            @Override
541            public String getTags() {
542                    if (_tags == null) {
543                            return StringPool.BLANK;
544                    }
545                    else {
546                            return _tags;
547                    }
548            }
549    
550            @Override
551            public void setTags(String tags) {
552                    _tags = tags;
553            }
554    
555            @JSON
556            @Override
557            public String getShortDescription() {
558                    if (_shortDescription == null) {
559                            return StringPool.BLANK;
560                    }
561                    else {
562                            return _shortDescription;
563                    }
564            }
565    
566            @Override
567            public void setShortDescription(String shortDescription) {
568                    _shortDescription = shortDescription;
569            }
570    
571            @JSON
572            @Override
573            public String getLongDescription() {
574                    if (_longDescription == null) {
575                            return StringPool.BLANK;
576                    }
577                    else {
578                            return _longDescription;
579                    }
580            }
581    
582            @Override
583            public void setLongDescription(String longDescription) {
584                    _longDescription = longDescription;
585            }
586    
587            @JSON
588            @Override
589            public String getPageURL() {
590                    if (_pageURL == null) {
591                            return StringPool.BLANK;
592                    }
593                    else {
594                            return _pageURL;
595                    }
596            }
597    
598            @Override
599            public void setPageURL(String pageURL) {
600                    _pageURL = pageURL;
601            }
602    
603            @JSON
604            @Override
605            public String getAuthor() {
606                    if (_author == null) {
607                            return StringPool.BLANK;
608                    }
609                    else {
610                            return _author;
611                    }
612            }
613    
614            @Override
615            public void setAuthor(String author) {
616                    _author = author;
617            }
618    
619            @JSON
620            @Override
621            public String getRepoGroupId() {
622                    if (_repoGroupId == null) {
623                            return StringPool.BLANK;
624                    }
625                    else {
626                            return _repoGroupId;
627                    }
628            }
629    
630            @Override
631            public void setRepoGroupId(String repoGroupId) {
632                    _columnBitmask |= REPOGROUPID_COLUMN_BITMASK;
633    
634                    if (_originalRepoGroupId == null) {
635                            _originalRepoGroupId = _repoGroupId;
636                    }
637    
638                    _repoGroupId = repoGroupId;
639            }
640    
641            public String getOriginalRepoGroupId() {
642                    return GetterUtil.getString(_originalRepoGroupId);
643            }
644    
645            @JSON
646            @Override
647            public String getRepoArtifactId() {
648                    if (_repoArtifactId == null) {
649                            return StringPool.BLANK;
650                    }
651                    else {
652                            return _repoArtifactId;
653                    }
654            }
655    
656            @Override
657            public void setRepoArtifactId(String repoArtifactId) {
658                    _columnBitmask |= REPOARTIFACTID_COLUMN_BITMASK;
659    
660                    if (_originalRepoArtifactId == null) {
661                            _originalRepoArtifactId = _repoArtifactId;
662                    }
663    
664                    _repoArtifactId = repoArtifactId;
665            }
666    
667            public String getOriginalRepoArtifactId() {
668                    return GetterUtil.getString(_originalRepoArtifactId);
669            }
670    
671            public long getColumnBitmask() {
672                    return _columnBitmask;
673            }
674    
675            @Override
676            public ExpandoBridge getExpandoBridge() {
677                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
678                            SCProductEntry.class.getName(), getPrimaryKey());
679            }
680    
681            @Override
682            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
683                    ExpandoBridge expandoBridge = getExpandoBridge();
684    
685                    expandoBridge.setAttributes(serviceContext);
686            }
687    
688            @Override
689            public SCProductEntry toEscapedModel() {
690                    if (_escapedModel == null) {
691                            _escapedModel = (SCProductEntry)ProxyUtil.newProxyInstance(_classLoader,
692                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
693                    }
694    
695                    return _escapedModel;
696            }
697    
698            @Override
699            public Object clone() {
700                    SCProductEntryImpl scProductEntryImpl = new SCProductEntryImpl();
701    
702                    scProductEntryImpl.setProductEntryId(getProductEntryId());
703                    scProductEntryImpl.setGroupId(getGroupId());
704                    scProductEntryImpl.setCompanyId(getCompanyId());
705                    scProductEntryImpl.setUserId(getUserId());
706                    scProductEntryImpl.setUserName(getUserName());
707                    scProductEntryImpl.setCreateDate(getCreateDate());
708                    scProductEntryImpl.setModifiedDate(getModifiedDate());
709                    scProductEntryImpl.setName(getName());
710                    scProductEntryImpl.setType(getType());
711                    scProductEntryImpl.setTags(getTags());
712                    scProductEntryImpl.setShortDescription(getShortDescription());
713                    scProductEntryImpl.setLongDescription(getLongDescription());
714                    scProductEntryImpl.setPageURL(getPageURL());
715                    scProductEntryImpl.setAuthor(getAuthor());
716                    scProductEntryImpl.setRepoGroupId(getRepoGroupId());
717                    scProductEntryImpl.setRepoArtifactId(getRepoArtifactId());
718    
719                    scProductEntryImpl.resetOriginalValues();
720    
721                    return scProductEntryImpl;
722            }
723    
724            @Override
725            public int compareTo(SCProductEntry scProductEntry) {
726                    int value = 0;
727    
728                    value = DateUtil.compareTo(getModifiedDate(),
729                                    scProductEntry.getModifiedDate());
730    
731                    value = value * -1;
732    
733                    if (value != 0) {
734                            return value;
735                    }
736    
737                    value = getName().compareTo(scProductEntry.getName());
738    
739                    value = value * -1;
740    
741                    if (value != 0) {
742                            return value;
743                    }
744    
745                    return 0;
746            }
747    
748            @Override
749            public boolean equals(Object obj) {
750                    if (this == obj) {
751                            return true;
752                    }
753    
754                    if (!(obj instanceof SCProductEntry)) {
755                            return false;
756                    }
757    
758                    SCProductEntry scProductEntry = (SCProductEntry)obj;
759    
760                    long primaryKey = scProductEntry.getPrimaryKey();
761    
762                    if (getPrimaryKey() == primaryKey) {
763                            return true;
764                    }
765                    else {
766                            return false;
767                    }
768            }
769    
770            @Override
771            public int hashCode() {
772                    return (int)getPrimaryKey();
773            }
774    
775            @Override
776            public boolean isEntityCacheEnabled() {
777                    return ENTITY_CACHE_ENABLED;
778            }
779    
780            @Override
781            public boolean isFinderCacheEnabled() {
782                    return FINDER_CACHE_ENABLED;
783            }
784    
785            @Override
786            public void resetOriginalValues() {
787                    SCProductEntryModelImpl scProductEntryModelImpl = this;
788    
789                    scProductEntryModelImpl._originalGroupId = scProductEntryModelImpl._groupId;
790    
791                    scProductEntryModelImpl._setOriginalGroupId = false;
792    
793                    scProductEntryModelImpl._originalCompanyId = scProductEntryModelImpl._companyId;
794    
795                    scProductEntryModelImpl._setOriginalCompanyId = false;
796    
797                    scProductEntryModelImpl._originalUserId = scProductEntryModelImpl._userId;
798    
799                    scProductEntryModelImpl._setOriginalUserId = false;
800    
801                    scProductEntryModelImpl._setModifiedDate = false;
802    
803                    scProductEntryModelImpl._originalRepoGroupId = scProductEntryModelImpl._repoGroupId;
804    
805                    scProductEntryModelImpl._originalRepoArtifactId = scProductEntryModelImpl._repoArtifactId;
806    
807                    scProductEntryModelImpl._columnBitmask = 0;
808            }
809    
810            @Override
811            public CacheModel<SCProductEntry> toCacheModel() {
812                    SCProductEntryCacheModel scProductEntryCacheModel = new SCProductEntryCacheModel();
813    
814                    scProductEntryCacheModel.productEntryId = getProductEntryId();
815    
816                    scProductEntryCacheModel.groupId = getGroupId();
817    
818                    scProductEntryCacheModel.companyId = getCompanyId();
819    
820                    scProductEntryCacheModel.userId = getUserId();
821    
822                    scProductEntryCacheModel.userName = getUserName();
823    
824                    String userName = scProductEntryCacheModel.userName;
825    
826                    if ((userName != null) && (userName.length() == 0)) {
827                            scProductEntryCacheModel.userName = null;
828                    }
829    
830                    Date createDate = getCreateDate();
831    
832                    if (createDate != null) {
833                            scProductEntryCacheModel.createDate = createDate.getTime();
834                    }
835                    else {
836                            scProductEntryCacheModel.createDate = Long.MIN_VALUE;
837                    }
838    
839                    Date modifiedDate = getModifiedDate();
840    
841                    if (modifiedDate != null) {
842                            scProductEntryCacheModel.modifiedDate = modifiedDate.getTime();
843                    }
844                    else {
845                            scProductEntryCacheModel.modifiedDate = Long.MIN_VALUE;
846                    }
847    
848                    scProductEntryCacheModel.name = getName();
849    
850                    String name = scProductEntryCacheModel.name;
851    
852                    if ((name != null) && (name.length() == 0)) {
853                            scProductEntryCacheModel.name = null;
854                    }
855    
856                    scProductEntryCacheModel.type = getType();
857    
858                    String type = scProductEntryCacheModel.type;
859    
860                    if ((type != null) && (type.length() == 0)) {
861                            scProductEntryCacheModel.type = null;
862                    }
863    
864                    scProductEntryCacheModel.tags = getTags();
865    
866                    String tags = scProductEntryCacheModel.tags;
867    
868                    if ((tags != null) && (tags.length() == 0)) {
869                            scProductEntryCacheModel.tags = null;
870                    }
871    
872                    scProductEntryCacheModel.shortDescription = getShortDescription();
873    
874                    String shortDescription = scProductEntryCacheModel.shortDescription;
875    
876                    if ((shortDescription != null) && (shortDescription.length() == 0)) {
877                            scProductEntryCacheModel.shortDescription = null;
878                    }
879    
880                    scProductEntryCacheModel.longDescription = getLongDescription();
881    
882                    String longDescription = scProductEntryCacheModel.longDescription;
883    
884                    if ((longDescription != null) && (longDescription.length() == 0)) {
885                            scProductEntryCacheModel.longDescription = null;
886                    }
887    
888                    scProductEntryCacheModel.pageURL = getPageURL();
889    
890                    String pageURL = scProductEntryCacheModel.pageURL;
891    
892                    if ((pageURL != null) && (pageURL.length() == 0)) {
893                            scProductEntryCacheModel.pageURL = null;
894                    }
895    
896                    scProductEntryCacheModel.author = getAuthor();
897    
898                    String author = scProductEntryCacheModel.author;
899    
900                    if ((author != null) && (author.length() == 0)) {
901                            scProductEntryCacheModel.author = null;
902                    }
903    
904                    scProductEntryCacheModel.repoGroupId = getRepoGroupId();
905    
906                    String repoGroupId = scProductEntryCacheModel.repoGroupId;
907    
908                    if ((repoGroupId != null) && (repoGroupId.length() == 0)) {
909                            scProductEntryCacheModel.repoGroupId = null;
910                    }
911    
912                    scProductEntryCacheModel.repoArtifactId = getRepoArtifactId();
913    
914                    String repoArtifactId = scProductEntryCacheModel.repoArtifactId;
915    
916                    if ((repoArtifactId != null) && (repoArtifactId.length() == 0)) {
917                            scProductEntryCacheModel.repoArtifactId = null;
918                    }
919    
920                    return scProductEntryCacheModel;
921            }
922    
923            @Override
924            public String toString() {
925                    StringBundler sb = new StringBundler(33);
926    
927                    sb.append("{productEntryId=");
928                    sb.append(getProductEntryId());
929                    sb.append(", groupId=");
930                    sb.append(getGroupId());
931                    sb.append(", companyId=");
932                    sb.append(getCompanyId());
933                    sb.append(", userId=");
934                    sb.append(getUserId());
935                    sb.append(", userName=");
936                    sb.append(getUserName());
937                    sb.append(", createDate=");
938                    sb.append(getCreateDate());
939                    sb.append(", modifiedDate=");
940                    sb.append(getModifiedDate());
941                    sb.append(", name=");
942                    sb.append(getName());
943                    sb.append(", type=");
944                    sb.append(getType());
945                    sb.append(", tags=");
946                    sb.append(getTags());
947                    sb.append(", shortDescription=");
948                    sb.append(getShortDescription());
949                    sb.append(", longDescription=");
950                    sb.append(getLongDescription());
951                    sb.append(", pageURL=");
952                    sb.append(getPageURL());
953                    sb.append(", author=");
954                    sb.append(getAuthor());
955                    sb.append(", repoGroupId=");
956                    sb.append(getRepoGroupId());
957                    sb.append(", repoArtifactId=");
958                    sb.append(getRepoArtifactId());
959                    sb.append("}");
960    
961                    return sb.toString();
962            }
963    
964            @Override
965            public String toXmlString() {
966                    StringBundler sb = new StringBundler(52);
967    
968                    sb.append("<model><model-name>");
969                    sb.append("com.liferay.portlet.softwarecatalog.model.SCProductEntry");
970                    sb.append("</model-name>");
971    
972                    sb.append(
973                            "<column><column-name>productEntryId</column-name><column-value><![CDATA[");
974                    sb.append(getProductEntryId());
975                    sb.append("]]></column-value></column>");
976                    sb.append(
977                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
978                    sb.append(getGroupId());
979                    sb.append("]]></column-value></column>");
980                    sb.append(
981                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
982                    sb.append(getCompanyId());
983                    sb.append("]]></column-value></column>");
984                    sb.append(
985                            "<column><column-name>userId</column-name><column-value><![CDATA[");
986                    sb.append(getUserId());
987                    sb.append("]]></column-value></column>");
988                    sb.append(
989                            "<column><column-name>userName</column-name><column-value><![CDATA[");
990                    sb.append(getUserName());
991                    sb.append("]]></column-value></column>");
992                    sb.append(
993                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
994                    sb.append(getCreateDate());
995                    sb.append("]]></column-value></column>");
996                    sb.append(
997                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
998                    sb.append(getModifiedDate());
999                    sb.append("]]></column-value></column>");
1000                    sb.append(
1001                            "<column><column-name>name</column-name><column-value><![CDATA[");
1002                    sb.append(getName());
1003                    sb.append("]]></column-value></column>");
1004                    sb.append(
1005                            "<column><column-name>type</column-name><column-value><![CDATA[");
1006                    sb.append(getType());
1007                    sb.append("]]></column-value></column>");
1008                    sb.append(
1009                            "<column><column-name>tags</column-name><column-value><![CDATA[");
1010                    sb.append(getTags());
1011                    sb.append("]]></column-value></column>");
1012                    sb.append(
1013                            "<column><column-name>shortDescription</column-name><column-value><![CDATA[");
1014                    sb.append(getShortDescription());
1015                    sb.append("]]></column-value></column>");
1016                    sb.append(
1017                            "<column><column-name>longDescription</column-name><column-value><![CDATA[");
1018                    sb.append(getLongDescription());
1019                    sb.append("]]></column-value></column>");
1020                    sb.append(
1021                            "<column><column-name>pageURL</column-name><column-value><![CDATA[");
1022                    sb.append(getPageURL());
1023                    sb.append("]]></column-value></column>");
1024                    sb.append(
1025                            "<column><column-name>author</column-name><column-value><![CDATA[");
1026                    sb.append(getAuthor());
1027                    sb.append("]]></column-value></column>");
1028                    sb.append(
1029                            "<column><column-name>repoGroupId</column-name><column-value><![CDATA[");
1030                    sb.append(getRepoGroupId());
1031                    sb.append("]]></column-value></column>");
1032                    sb.append(
1033                            "<column><column-name>repoArtifactId</column-name><column-value><![CDATA[");
1034                    sb.append(getRepoArtifactId());
1035                    sb.append("]]></column-value></column>");
1036    
1037                    sb.append("</model>");
1038    
1039                    return sb.toString();
1040            }
1041    
1042            private static final ClassLoader _classLoader = SCProductEntry.class.getClassLoader();
1043            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1044                            SCProductEntry.class
1045                    };
1046            private long _productEntryId;
1047            private long _groupId;
1048            private long _originalGroupId;
1049            private boolean _setOriginalGroupId;
1050            private long _companyId;
1051            private long _originalCompanyId;
1052            private boolean _setOriginalCompanyId;
1053            private long _userId;
1054            private long _originalUserId;
1055            private boolean _setOriginalUserId;
1056            private String _userName;
1057            private Date _createDate;
1058            private Date _modifiedDate;
1059            private boolean _setModifiedDate;
1060            private String _name;
1061            private String _type;
1062            private String _tags;
1063            private String _shortDescription;
1064            private String _longDescription;
1065            private String _pageURL;
1066            private String _author;
1067            private String _repoGroupId;
1068            private String _originalRepoGroupId;
1069            private String _repoArtifactId;
1070            private String _originalRepoArtifactId;
1071            private long _columnBitmask;
1072            private SCProductEntry _escapedModel;
1073    }