001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.ProxyUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023 import com.liferay.portal.model.ClusterGroup;
024 import com.liferay.portal.model.ClusterGroupModel;
025 import com.liferay.portal.service.ServiceContext;
026
027 import com.liferay.portlet.expando.model.ExpandoBridge;
028 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
029
030 import java.io.Serializable;
031
032 import java.sql.Types;
033
034
047 public class ClusterGroupModelImpl extends BaseModelImpl<ClusterGroup>
048 implements ClusterGroupModel {
049
054 public static final String TABLE_NAME = "ClusterGroup";
055 public static final Object[][] TABLE_COLUMNS = {
056 { "clusterGroupId", Types.BIGINT },
057 { "name", Types.VARCHAR },
058 { "clusterNodeIds", Types.VARCHAR },
059 { "wholeCluster", Types.BOOLEAN }
060 };
061 public static final String TABLE_SQL_CREATE = "create table ClusterGroup (clusterGroupId LONG not null primary key,name VARCHAR(75) null,clusterNodeIds VARCHAR(75) null,wholeCluster BOOLEAN)";
062 public static final String TABLE_SQL_DROP = "drop table ClusterGroup";
063 public static final String DATA_SOURCE = "liferayDataSource";
064 public static final String SESSION_FACTORY = "liferaySessionFactory";
065 public static final String TX_MANAGER = "liferayTransactionManager";
066 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
067 "value.object.entity.cache.enabled.com.liferay.portal.model.ClusterGroup"),
068 true);
069 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
070 "value.object.finder.cache.enabled.com.liferay.portal.model.ClusterGroup"),
071 true);
072 public static final boolean COLUMN_BITMASK_ENABLED = false;
073 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
074 "lock.expiration.time.com.liferay.portal.model.ClusterGroup"));
075
076 public ClusterGroupModelImpl() {
077 }
078
079 public long getPrimaryKey() {
080 return _clusterGroupId;
081 }
082
083 public void setPrimaryKey(long primaryKey) {
084 setClusterGroupId(primaryKey);
085 }
086
087 public Serializable getPrimaryKeyObj() {
088 return new Long(_clusterGroupId);
089 }
090
091 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
092 setPrimaryKey(((Long)primaryKeyObj).longValue());
093 }
094
095 public Class<?> getModelClass() {
096 return ClusterGroup.class;
097 }
098
099 public String getModelClassName() {
100 return ClusterGroup.class.getName();
101 }
102
103 public long getClusterGroupId() {
104 return _clusterGroupId;
105 }
106
107 public void setClusterGroupId(long clusterGroupId) {
108 _clusterGroupId = clusterGroupId;
109 }
110
111 public String getName() {
112 if (_name == null) {
113 return StringPool.BLANK;
114 }
115 else {
116 return _name;
117 }
118 }
119
120 public void setName(String name) {
121 _name = name;
122 }
123
124 public String getClusterNodeIds() {
125 if (_clusterNodeIds == null) {
126 return StringPool.BLANK;
127 }
128 else {
129 return _clusterNodeIds;
130 }
131 }
132
133 public void setClusterNodeIds(String clusterNodeIds) {
134 _clusterNodeIds = clusterNodeIds;
135 }
136
137 public boolean getWholeCluster() {
138 return _wholeCluster;
139 }
140
141 public boolean isWholeCluster() {
142 return _wholeCluster;
143 }
144
145 public void setWholeCluster(boolean wholeCluster) {
146 _wholeCluster = wholeCluster;
147 }
148
149 @Override
150 public ClusterGroup toEscapedModel() {
151 if (_escapedModelProxy == null) {
152 _escapedModelProxy = (ClusterGroup)ProxyUtil.newProxyInstance(_classLoader,
153 _escapedModelProxyInterfaces,
154 new AutoEscapeBeanHandler(this));
155 }
156
157 return _escapedModelProxy;
158 }
159
160 @Override
161 public ExpandoBridge getExpandoBridge() {
162 if (_expandoBridge == null) {
163 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
164 ClusterGroup.class.getName(), getPrimaryKey());
165 }
166
167 return _expandoBridge;
168 }
169
170 @Override
171 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
172 getExpandoBridge().setAttributes(serviceContext);
173 }
174
175 @Override
176 public Object clone() {
177 ClusterGroupImpl clusterGroupImpl = new ClusterGroupImpl();
178
179 clusterGroupImpl.setClusterGroupId(getClusterGroupId());
180 clusterGroupImpl.setName(getName());
181 clusterGroupImpl.setClusterNodeIds(getClusterNodeIds());
182 clusterGroupImpl.setWholeCluster(getWholeCluster());
183
184 clusterGroupImpl.resetOriginalValues();
185
186 return clusterGroupImpl;
187 }
188
189 public int compareTo(ClusterGroup clusterGroup) {
190 long primaryKey = clusterGroup.getPrimaryKey();
191
192 if (getPrimaryKey() < primaryKey) {
193 return -1;
194 }
195 else if (getPrimaryKey() > primaryKey) {
196 return 1;
197 }
198 else {
199 return 0;
200 }
201 }
202
203 @Override
204 public boolean equals(Object obj) {
205 if (obj == null) {
206 return false;
207 }
208
209 ClusterGroup clusterGroup = null;
210
211 try {
212 clusterGroup = (ClusterGroup)obj;
213 }
214 catch (ClassCastException cce) {
215 return false;
216 }
217
218 long primaryKey = clusterGroup.getPrimaryKey();
219
220 if (getPrimaryKey() == primaryKey) {
221 return true;
222 }
223 else {
224 return false;
225 }
226 }
227
228 @Override
229 public int hashCode() {
230 return (int)getPrimaryKey();
231 }
232
233 @Override
234 public void resetOriginalValues() {
235 }
236
237 @Override
238 public CacheModel<ClusterGroup> toCacheModel() {
239 ClusterGroupCacheModel clusterGroupCacheModel = new ClusterGroupCacheModel();
240
241 clusterGroupCacheModel.clusterGroupId = getClusterGroupId();
242
243 clusterGroupCacheModel.name = getName();
244
245 String name = clusterGroupCacheModel.name;
246
247 if ((name != null) && (name.length() == 0)) {
248 clusterGroupCacheModel.name = null;
249 }
250
251 clusterGroupCacheModel.clusterNodeIds = getClusterNodeIds();
252
253 String clusterNodeIds = clusterGroupCacheModel.clusterNodeIds;
254
255 if ((clusterNodeIds != null) && (clusterNodeIds.length() == 0)) {
256 clusterGroupCacheModel.clusterNodeIds = null;
257 }
258
259 clusterGroupCacheModel.wholeCluster = getWholeCluster();
260
261 return clusterGroupCacheModel;
262 }
263
264 @Override
265 public String toString() {
266 StringBundler sb = new StringBundler(9);
267
268 sb.append("{clusterGroupId=");
269 sb.append(getClusterGroupId());
270 sb.append(", name=");
271 sb.append(getName());
272 sb.append(", clusterNodeIds=");
273 sb.append(getClusterNodeIds());
274 sb.append(", wholeCluster=");
275 sb.append(getWholeCluster());
276 sb.append("}");
277
278 return sb.toString();
279 }
280
281 public String toXmlString() {
282 StringBundler sb = new StringBundler(16);
283
284 sb.append("<model><model-name>");
285 sb.append("com.liferay.portal.model.ClusterGroup");
286 sb.append("</model-name>");
287
288 sb.append(
289 "<column><column-name>clusterGroupId</column-name><column-value><![CDATA[");
290 sb.append(getClusterGroupId());
291 sb.append("]]></column-value></column>");
292 sb.append(
293 "<column><column-name>name</column-name><column-value><![CDATA[");
294 sb.append(getName());
295 sb.append("]]></column-value></column>");
296 sb.append(
297 "<column><column-name>clusterNodeIds</column-name><column-value><![CDATA[");
298 sb.append(getClusterNodeIds());
299 sb.append("]]></column-value></column>");
300 sb.append(
301 "<column><column-name>wholeCluster</column-name><column-value><![CDATA[");
302 sb.append(getWholeCluster());
303 sb.append("]]></column-value></column>");
304
305 sb.append("</model>");
306
307 return sb.toString();
308 }
309
310 private static ClassLoader _classLoader = ClusterGroup.class.getClassLoader();
311 private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
312 ClusterGroup.class
313 };
314 private long _clusterGroupId;
315 private String _name;
316 private String _clusterNodeIds;
317 private boolean _wholeCluster;
318 private transient ExpandoBridge _expandoBridge;
319 private ClusterGroup _escapedModelProxy;
320 }