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.portlet.expando.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    
021    import com.liferay.portlet.expando.model.ExpandoValue;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    /**
029     * The cache model class for representing ExpandoValue in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see ExpandoValue
033     * @generated
034     */
035    public class ExpandoValueCacheModel implements CacheModel<ExpandoValue>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(17);
040    
041                    sb.append("{valueId=");
042                    sb.append(valueId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", tableId=");
046                    sb.append(tableId);
047                    sb.append(", columnId=");
048                    sb.append(columnId);
049                    sb.append(", rowId=");
050                    sb.append(rowId);
051                    sb.append(", classNameId=");
052                    sb.append(classNameId);
053                    sb.append(", classPK=");
054                    sb.append(classPK);
055                    sb.append(", data=");
056                    sb.append(data);
057                    sb.append("}");
058    
059                    return sb.toString();
060            }
061    
062            @Override
063            public ExpandoValue toEntityModel() {
064                    ExpandoValueImpl expandoValueImpl = new ExpandoValueImpl();
065    
066                    expandoValueImpl.setValueId(valueId);
067                    expandoValueImpl.setCompanyId(companyId);
068                    expandoValueImpl.setTableId(tableId);
069                    expandoValueImpl.setColumnId(columnId);
070                    expandoValueImpl.setRowId(rowId);
071                    expandoValueImpl.setClassNameId(classNameId);
072                    expandoValueImpl.setClassPK(classPK);
073    
074                    if (data == null) {
075                            expandoValueImpl.setData(StringPool.BLANK);
076                    }
077                    else {
078                            expandoValueImpl.setData(data);
079                    }
080    
081                    expandoValueImpl.resetOriginalValues();
082    
083                    return expandoValueImpl;
084            }
085    
086            @Override
087            public void readExternal(ObjectInput objectInput) throws IOException {
088                    valueId = objectInput.readLong();
089                    companyId = objectInput.readLong();
090                    tableId = objectInput.readLong();
091                    columnId = objectInput.readLong();
092                    rowId = objectInput.readLong();
093                    classNameId = objectInput.readLong();
094                    classPK = objectInput.readLong();
095                    data = objectInput.readUTF();
096            }
097    
098            @Override
099            public void writeExternal(ObjectOutput objectOutput)
100                    throws IOException {
101                    objectOutput.writeLong(valueId);
102                    objectOutput.writeLong(companyId);
103                    objectOutput.writeLong(tableId);
104                    objectOutput.writeLong(columnId);
105                    objectOutput.writeLong(rowId);
106                    objectOutput.writeLong(classNameId);
107                    objectOutput.writeLong(classPK);
108    
109                    if (data == null) {
110                            objectOutput.writeUTF(StringPool.BLANK);
111                    }
112                    else {
113                            objectOutput.writeUTF(data);
114                    }
115            }
116    
117            public long valueId;
118            public long companyId;
119            public long tableId;
120            public long columnId;
121            public long rowId;
122            public long classNameId;
123            public long classPK;
124            public String data;
125    }