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