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.portal.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    import com.liferay.portal.model.VirtualHost;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing VirtualHost in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see VirtualHost
032     * @generated
033     */
034    public class VirtualHostCacheModel implements CacheModel<VirtualHost>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(9);
039    
040                    sb.append("{virtualHostId=");
041                    sb.append(virtualHostId);
042                    sb.append(", companyId=");
043                    sb.append(companyId);
044                    sb.append(", layoutSetId=");
045                    sb.append(layoutSetId);
046                    sb.append(", hostname=");
047                    sb.append(hostname);
048                    sb.append("}");
049    
050                    return sb.toString();
051            }
052    
053            @Override
054            public VirtualHost toEntityModel() {
055                    VirtualHostImpl virtualHostImpl = new VirtualHostImpl();
056    
057                    virtualHostImpl.setVirtualHostId(virtualHostId);
058                    virtualHostImpl.setCompanyId(companyId);
059                    virtualHostImpl.setLayoutSetId(layoutSetId);
060    
061                    if (hostname == null) {
062                            virtualHostImpl.setHostname(StringPool.BLANK);
063                    }
064                    else {
065                            virtualHostImpl.setHostname(hostname);
066                    }
067    
068                    virtualHostImpl.resetOriginalValues();
069    
070                    return virtualHostImpl;
071            }
072    
073            @Override
074            public void readExternal(ObjectInput objectInput) throws IOException {
075                    virtualHostId = objectInput.readLong();
076                    companyId = objectInput.readLong();
077                    layoutSetId = objectInput.readLong();
078                    hostname = objectInput.readUTF();
079            }
080    
081            @Override
082            public void writeExternal(ObjectOutput objectOutput)
083                    throws IOException {
084                    objectOutput.writeLong(virtualHostId);
085                    objectOutput.writeLong(companyId);
086                    objectOutput.writeLong(layoutSetId);
087    
088                    if (hostname == null) {
089                            objectOutput.writeUTF(StringPool.BLANK);
090                    }
091                    else {
092                            objectOutput.writeUTF(hostname);
093                    }
094            }
095    
096            public long virtualHostId;
097            public long companyId;
098            public long layoutSetId;
099            public String hostname;
100    }