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