001
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
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 public ClusterGroup toEntityModel() {
054 ClusterGroupImpl clusterGroupImpl = new ClusterGroupImpl();
055
056 clusterGroupImpl.setClusterGroupId(clusterGroupId);
057
058 if (name == null) {
059 clusterGroupImpl.setName(StringPool.BLANK);
060 }
061 else {
062 clusterGroupImpl.setName(name);
063 }
064
065 if (clusterNodeIds == null) {
066 clusterGroupImpl.setClusterNodeIds(StringPool.BLANK);
067 }
068 else {
069 clusterGroupImpl.setClusterNodeIds(clusterNodeIds);
070 }
071
072 clusterGroupImpl.setWholeCluster(wholeCluster);
073
074 clusterGroupImpl.resetOriginalValues();
075
076 return clusterGroupImpl;
077 }
078
079 public void readExternal(ObjectInput objectInput) throws IOException {
080 clusterGroupId = objectInput.readLong();
081 name = objectInput.readUTF();
082 clusterNodeIds = objectInput.readUTF();
083 wholeCluster = objectInput.readBoolean();
084 }
085
086 public void writeExternal(ObjectOutput objectOutput)
087 throws IOException {
088 objectOutput.writeLong(clusterGroupId);
089
090 if (name == null) {
091 objectOutput.writeUTF(StringPool.BLANK);
092 }
093 else {
094 objectOutput.writeUTF(name);
095 }
096
097 if (clusterNodeIds == null) {
098 objectOutput.writeUTF(StringPool.BLANK);
099 }
100 else {
101 objectOutput.writeUTF(clusterNodeIds);
102 }
103
104 objectOutput.writeBoolean(wholeCluster);
105 }
106
107 public long clusterGroupId;
108 public String name;
109 public String clusterNodeIds;
110 public boolean wholeCluster;
111 }