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