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            public VirtualHost toEntityModel() {
054                    VirtualHostImpl virtualHostImpl = new VirtualHostImpl();
055    
056                    virtualHostImpl.setVirtualHostId(virtualHostId);
057                    virtualHostImpl.setCompanyId(companyId);
058                    virtualHostImpl.setLayoutSetId(layoutSetId);
059    
060                    if (hostname == null) {
061                            virtualHostImpl.setHostname(StringPool.BLANK);
062                    }
063                    else {
064                            virtualHostImpl.setHostname(hostname);
065                    }
066    
067                    virtualHostImpl.resetOriginalValues();
068    
069                    return virtualHostImpl;
070            }
071    
072            public void readExternal(ObjectInput objectInput) throws IOException {
073                    virtualHostId = objectInput.readLong();
074                    companyId = objectInput.readLong();
075                    layoutSetId = objectInput.readLong();
076                    hostname = objectInput.readUTF();
077            }
078    
079            public void writeExternal(ObjectOutput objectOutput)
080                    throws IOException {
081                    objectOutput.writeLong(virtualHostId);
082                    objectOutput.writeLong(companyId);
083                    objectOutput.writeLong(layoutSetId);
084    
085                    if (hostname == null) {
086                            objectOutput.writeUTF(StringPool.BLANK);
087                    }
088                    else {
089                            objectOutput.writeUTF(hostname);
090                    }
091            }
092    
093            public long virtualHostId;
094            public long companyId;
095            public long layoutSetId;
096            public String hostname;
097    }