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.MVCCModel;
023    import com.liferay.portal.model.VirtualHost;
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 VirtualHost in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see VirtualHost
035     * @generated
036     */
037    @ProviderType
038    public class VirtualHostCacheModel implements CacheModel<VirtualHost>,
039            Externalizable, 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(11);
053    
054                    sb.append("{mvccVersion=");
055                    sb.append(mvccVersion);
056                    sb.append(", virtualHostId=");
057                    sb.append(virtualHostId);
058                    sb.append(", companyId=");
059                    sb.append(companyId);
060                    sb.append(", layoutSetId=");
061                    sb.append(layoutSetId);
062                    sb.append(", hostname=");
063                    sb.append(hostname);
064                    sb.append("}");
065    
066                    return sb.toString();
067            }
068    
069            @Override
070            public VirtualHost toEntityModel() {
071                    VirtualHostImpl virtualHostImpl = new VirtualHostImpl();
072    
073                    virtualHostImpl.setMvccVersion(mvccVersion);
074                    virtualHostImpl.setVirtualHostId(virtualHostId);
075                    virtualHostImpl.setCompanyId(companyId);
076                    virtualHostImpl.setLayoutSetId(layoutSetId);
077    
078                    if (hostname == null) {
079                            virtualHostImpl.setHostname(StringPool.BLANK);
080                    }
081                    else {
082                            virtualHostImpl.setHostname(hostname);
083                    }
084    
085                    virtualHostImpl.resetOriginalValues();
086    
087                    return virtualHostImpl;
088            }
089    
090            @Override
091            public void readExternal(ObjectInput objectInput) throws IOException {
092                    mvccVersion = objectInput.readLong();
093                    virtualHostId = objectInput.readLong();
094                    companyId = objectInput.readLong();
095                    layoutSetId = objectInput.readLong();
096                    hostname = objectInput.readUTF();
097            }
098    
099            @Override
100            public void writeExternal(ObjectOutput objectOutput)
101                    throws IOException {
102                    objectOutput.writeLong(mvccVersion);
103                    objectOutput.writeLong(virtualHostId);
104                    objectOutput.writeLong(companyId);
105                    objectOutput.writeLong(layoutSetId);
106    
107                    if (hostname == null) {
108                            objectOutput.writeUTF(StringPool.BLANK);
109                    }
110                    else {
111                            objectOutput.writeUTF(hostname);
112                    }
113            }
114    
115            public long mvccVersion;
116            public long virtualHostId;
117            public long companyId;
118            public long layoutSetId;
119            public String hostname;
120    }