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.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.HashUtil;
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.MVCCModel;
024    import com.liferay.portal.model.WebDAVProps;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    import java.util.Date;
032    
033    /**
034     * The cache model class for representing WebDAVProps in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see WebDAVProps
038     * @generated
039     */
040    @ProviderType
041    public class WebDAVPropsCacheModel implements CacheModel<WebDAVProps>,
042            Externalizable, MVCCModel {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof WebDAVPropsCacheModel)) {
050                            return false;
051                    }
052    
053                    WebDAVPropsCacheModel webDAVPropsCacheModel = (WebDAVPropsCacheModel)obj;
054    
055                    if ((webDavPropsId == webDAVPropsCacheModel.webDavPropsId) &&
056                                    (mvccVersion == webDAVPropsCacheModel.mvccVersion)) {
057                            return true;
058                    }
059    
060                    return false;
061            }
062    
063            @Override
064            public int hashCode() {
065                    int hashCode = HashUtil.hash(0, webDavPropsId);
066    
067                    return HashUtil.hash(hashCode, mvccVersion);
068            }
069    
070            @Override
071            public long getMvccVersion() {
072                    return mvccVersion;
073            }
074    
075            @Override
076            public void setMvccVersion(long mvccVersion) {
077                    this.mvccVersion = mvccVersion;
078            }
079    
080            @Override
081            public String toString() {
082                    StringBundler sb = new StringBundler(17);
083    
084                    sb.append("{mvccVersion=");
085                    sb.append(mvccVersion);
086                    sb.append(", webDavPropsId=");
087                    sb.append(webDavPropsId);
088                    sb.append(", companyId=");
089                    sb.append(companyId);
090                    sb.append(", createDate=");
091                    sb.append(createDate);
092                    sb.append(", modifiedDate=");
093                    sb.append(modifiedDate);
094                    sb.append(", classNameId=");
095                    sb.append(classNameId);
096                    sb.append(", classPK=");
097                    sb.append(classPK);
098                    sb.append(", props=");
099                    sb.append(props);
100                    sb.append("}");
101    
102                    return sb.toString();
103            }
104    
105            @Override
106            public WebDAVProps toEntityModel() {
107                    WebDAVPropsImpl webDAVPropsImpl = new WebDAVPropsImpl();
108    
109                    webDAVPropsImpl.setMvccVersion(mvccVersion);
110                    webDAVPropsImpl.setWebDavPropsId(webDavPropsId);
111                    webDAVPropsImpl.setCompanyId(companyId);
112    
113                    if (createDate == Long.MIN_VALUE) {
114                            webDAVPropsImpl.setCreateDate(null);
115                    }
116                    else {
117                            webDAVPropsImpl.setCreateDate(new Date(createDate));
118                    }
119    
120                    if (modifiedDate == Long.MIN_VALUE) {
121                            webDAVPropsImpl.setModifiedDate(null);
122                    }
123                    else {
124                            webDAVPropsImpl.setModifiedDate(new Date(modifiedDate));
125                    }
126    
127                    webDAVPropsImpl.setClassNameId(classNameId);
128                    webDAVPropsImpl.setClassPK(classPK);
129    
130                    if (props == null) {
131                            webDAVPropsImpl.setProps(StringPool.BLANK);
132                    }
133                    else {
134                            webDAVPropsImpl.setProps(props);
135                    }
136    
137                    webDAVPropsImpl.resetOriginalValues();
138    
139                    return webDAVPropsImpl;
140            }
141    
142            @Override
143            public void readExternal(ObjectInput objectInput) throws IOException {
144                    mvccVersion = objectInput.readLong();
145                    webDavPropsId = objectInput.readLong();
146                    companyId = objectInput.readLong();
147                    createDate = objectInput.readLong();
148                    modifiedDate = objectInput.readLong();
149                    classNameId = objectInput.readLong();
150                    classPK = objectInput.readLong();
151                    props = objectInput.readUTF();
152            }
153    
154            @Override
155            public void writeExternal(ObjectOutput objectOutput)
156                    throws IOException {
157                    objectOutput.writeLong(mvccVersion);
158                    objectOutput.writeLong(webDavPropsId);
159                    objectOutput.writeLong(companyId);
160                    objectOutput.writeLong(createDate);
161                    objectOutput.writeLong(modifiedDate);
162                    objectOutput.writeLong(classNameId);
163                    objectOutput.writeLong(classPK);
164    
165                    if (props == null) {
166                            objectOutput.writeUTF(StringPool.BLANK);
167                    }
168                    else {
169                            objectOutput.writeUTF(props);
170                    }
171            }
172    
173            public long mvccVersion;
174            public long webDavPropsId;
175            public long companyId;
176            public long createDate;
177            public long modifiedDate;
178            public long classNameId;
179            public long classPK;
180            public String props;
181    }