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.ClusterGroup;
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 ClusterGroup in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see ClusterGroup
035     * @generated
036     */
037    @ProviderType
038    public class ClusterGroupCacheModel implements CacheModel<ClusterGroup>,
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(", clusterGroupId=");
057                    sb.append(clusterGroupId);
058                    sb.append(", name=");
059                    sb.append(name);
060                    sb.append(", clusterNodeIds=");
061                    sb.append(clusterNodeIds);
062                    sb.append(", wholeCluster=");
063                    sb.append(wholeCluster);
064                    sb.append("}");
065    
066                    return sb.toString();
067            }
068    
069            @Override
070            public ClusterGroup toEntityModel() {
071                    ClusterGroupImpl clusterGroupImpl = new ClusterGroupImpl();
072    
073                    clusterGroupImpl.setMvccVersion(mvccVersion);
074                    clusterGroupImpl.setClusterGroupId(clusterGroupId);
075    
076                    if (name == null) {
077                            clusterGroupImpl.setName(StringPool.BLANK);
078                    }
079                    else {
080                            clusterGroupImpl.setName(name);
081                    }
082    
083                    if (clusterNodeIds == null) {
084                            clusterGroupImpl.setClusterNodeIds(StringPool.BLANK);
085                    }
086                    else {
087                            clusterGroupImpl.setClusterNodeIds(clusterNodeIds);
088                    }
089    
090                    clusterGroupImpl.setWholeCluster(wholeCluster);
091    
092                    clusterGroupImpl.resetOriginalValues();
093    
094                    return clusterGroupImpl;
095            }
096    
097            @Override
098            public void readExternal(ObjectInput objectInput) throws IOException {
099                    mvccVersion = objectInput.readLong();
100                    clusterGroupId = objectInput.readLong();
101                    name = objectInput.readUTF();
102                    clusterNodeIds = objectInput.readUTF();
103                    wholeCluster = objectInput.readBoolean();
104            }
105    
106            @Override
107            public void writeExternal(ObjectOutput objectOutput)
108                    throws IOException {
109                    objectOutput.writeLong(mvccVersion);
110                    objectOutput.writeLong(clusterGroupId);
111    
112                    if (name == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(name);
117                    }
118    
119                    if (clusterNodeIds == null) {
120                            objectOutput.writeUTF(StringPool.BLANK);
121                    }
122                    else {
123                            objectOutput.writeUTF(clusterNodeIds);
124                    }
125    
126                    objectOutput.writeBoolean(wholeCluster);
127            }
128    
129            public long mvccVersion;
130            public long clusterGroupId;
131            public String name;
132            public String clusterNodeIds;
133            public boolean wholeCluster;
134    }