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.ClusterGroup;
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 ClusterGroup in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ClusterGroup
032     * @generated
033     */
034    public class ClusterGroupCacheModel implements CacheModel<ClusterGroup>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(9);
039    
040                    sb.append("{clusterGroupId=");
041                    sb.append(clusterGroupId);
042                    sb.append(", name=");
043                    sb.append(name);
044                    sb.append(", clusterNodeIds=");
045                    sb.append(clusterNodeIds);
046                    sb.append(", wholeCluster=");
047                    sb.append(wholeCluster);
048                    sb.append("}");
049    
050                    return sb.toString();
051            }
052    
053            @Override
054            public ClusterGroup toEntityModel() {
055                    ClusterGroupImpl clusterGroupImpl = new ClusterGroupImpl();
056    
057                    clusterGroupImpl.setClusterGroupId(clusterGroupId);
058    
059                    if (name == null) {
060                            clusterGroupImpl.setName(StringPool.BLANK);
061                    }
062                    else {
063                            clusterGroupImpl.setName(name);
064                    }
065    
066                    if (clusterNodeIds == null) {
067                            clusterGroupImpl.setClusterNodeIds(StringPool.BLANK);
068                    }
069                    else {
070                            clusterGroupImpl.setClusterNodeIds(clusterNodeIds);
071                    }
072    
073                    clusterGroupImpl.setWholeCluster(wholeCluster);
074    
075                    clusterGroupImpl.resetOriginalValues();
076    
077                    return clusterGroupImpl;
078            }
079    
080            @Override
081            public void readExternal(ObjectInput objectInput) throws IOException {
082                    clusterGroupId = objectInput.readLong();
083                    name = objectInput.readUTF();
084                    clusterNodeIds = objectInput.readUTF();
085                    wholeCluster = objectInput.readBoolean();
086            }
087    
088            @Override
089            public void writeExternal(ObjectOutput objectOutput)
090                    throws IOException {
091                    objectOutput.writeLong(clusterGroupId);
092    
093                    if (name == null) {
094                            objectOutput.writeUTF(StringPool.BLANK);
095                    }
096                    else {
097                            objectOutput.writeUTF(name);
098                    }
099    
100                    if (clusterNodeIds == null) {
101                            objectOutput.writeUTF(StringPool.BLANK);
102                    }
103                    else {
104                            objectOutput.writeUTF(clusterNodeIds);
105                    }
106    
107                    objectOutput.writeBoolean(wholeCluster);
108            }
109    
110            public long clusterGroupId;
111            public String name;
112            public String clusterNodeIds;
113            public boolean wholeCluster;
114    }