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            public ExpandoValue toEntityModel() {
063                    ExpandoValueImpl expandoValueImpl = new ExpandoValueImpl();
064    
065                    expandoValueImpl.setValueId(valueId);
066                    expandoValueImpl.setCompanyId(companyId);
067                    expandoValueImpl.setTableId(tableId);
068                    expandoValueImpl.setColumnId(columnId);
069                    expandoValueImpl.setRowId(rowId);
070                    expandoValueImpl.setClassNameId(classNameId);
071                    expandoValueImpl.setClassPK(classPK);
072    
073                    if (data == null) {
074                            expandoValueImpl.setData(StringPool.BLANK);
075                    }
076                    else {
077                            expandoValueImpl.setData(data);
078                    }
079    
080                    expandoValueImpl.resetOriginalValues();
081    
082                    return expandoValueImpl;
083            }
084    
085            public void readExternal(ObjectInput objectInput) throws IOException {
086                    valueId = objectInput.readLong();
087                    companyId = objectInput.readLong();
088                    tableId = objectInput.readLong();
089                    columnId = objectInput.readLong();
090                    rowId = objectInput.readLong();
091                    classNameId = objectInput.readLong();
092                    classPK = objectInput.readLong();
093                    data = objectInput.readUTF();
094            }
095    
096            public void writeExternal(ObjectOutput objectOutput)
097                    throws IOException {
098                    objectOutput.writeLong(valueId);
099                    objectOutput.writeLong(companyId);
100                    objectOutput.writeLong(tableId);
101                    objectOutput.writeLong(columnId);
102                    objectOutput.writeLong(rowId);
103                    objectOutput.writeLong(classNameId);
104                    objectOutput.writeLong(classPK);
105    
106                    if (data == null) {
107                            objectOutput.writeUTF(StringPool.BLANK);
108                    }
109                    else {
110                            objectOutput.writeUTF(data);
111                    }
112            }
113    
114            public long valueId;
115            public long companyId;
116            public long tableId;
117            public long columnId;
118            public long rowId;
119            public long classNameId;
120            public long classPK;
121            public String data;
122    }