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.ListType;
023    import com.liferay.portal.model.MVCCModel;
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 ListType in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see ListType
035     * @generated
036     */
037    @ProviderType
038    public class ListTypeCacheModel implements CacheModel<ListType>, Externalizable,
039            MVCCModel {
040            @Override
041            public long getMvccVersion() {
042                    return mvccVersion;
043            }
044    
045            @Override
046            public void setMvccVersion(long mvccVersion) {
047                    this.mvccVersion = mvccVersion;
048            }
049    
050            @Override
051            public String toString() {
052                    StringBundler sb = new StringBundler(9);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", listTypeId=");
057                    sb.append(listTypeId);
058                    sb.append(", name=");
059                    sb.append(name);
060                    sb.append(", type=");
061                    sb.append(type);
062                    sb.append("}");
063    
064                    return sb.toString();
065            }
066    
067            @Override
068            public ListType toEntityModel() {
069                    ListTypeImpl listTypeImpl = new ListTypeImpl();
070    
071                    listTypeImpl.setMvccVersion(mvccVersion);
072                    listTypeImpl.setListTypeId(listTypeId);
073    
074                    if (name == null) {
075                            listTypeImpl.setName(StringPool.BLANK);
076                    }
077                    else {
078                            listTypeImpl.setName(name);
079                    }
080    
081                    if (type == null) {
082                            listTypeImpl.setType(StringPool.BLANK);
083                    }
084                    else {
085                            listTypeImpl.setType(type);
086                    }
087    
088                    listTypeImpl.resetOriginalValues();
089    
090                    return listTypeImpl;
091            }
092    
093            @Override
094            public void readExternal(ObjectInput objectInput) throws IOException {
095                    mvccVersion = objectInput.readLong();
096                    listTypeId = objectInput.readInt();
097                    name = objectInput.readUTF();
098                    type = objectInput.readUTF();
099            }
100    
101            @Override
102            public void writeExternal(ObjectOutput objectOutput)
103                    throws IOException {
104                    objectOutput.writeLong(mvccVersion);
105                    objectOutput.writeInt(listTypeId);
106    
107                    if (name == null) {
108                            objectOutput.writeUTF(StringPool.BLANK);
109                    }
110                    else {
111                            objectOutput.writeUTF(name);
112                    }
113    
114                    if (type == null) {
115                            objectOutput.writeUTF(StringPool.BLANK);
116                    }
117                    else {
118                            objectOutput.writeUTF(type);
119                    }
120            }
121    
122            public long mvccVersion;
123            public int listTypeId;
124            public String name;
125            public String type;
126    }