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 import java.util.HashMap;
035 import java.util.Map;
036
037
050 public class ClusterGroupModelImpl extends BaseModelImpl<ClusterGroup>
051 implements ClusterGroupModel {
052
057 public static final String TABLE_NAME = "ClusterGroup";
058 public static final Object[][] TABLE_COLUMNS = {
059 { "clusterGroupId", Types.BIGINT },
060 { "name", Types.VARCHAR },
061 { "clusterNodeIds", Types.VARCHAR },
062 { "wholeCluster", Types.BOOLEAN }
063 };
064 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)";
065 public static final String TABLE_SQL_DROP = "drop table ClusterGroup";
066 public static final String ORDER_BY_JPQL = " ORDER BY clusterGroup.clusterGroupId ASC";
067 public static final String ORDER_BY_SQL = " ORDER BY ClusterGroup.clusterGroupId ASC";
068 public static final String DATA_SOURCE = "liferayDataSource";
069 public static final String SESSION_FACTORY = "liferaySessionFactory";
070 public static final String TX_MANAGER = "liferayTransactionManager";
071 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
072 "value.object.entity.cache.enabled.com.liferay.portal.model.ClusterGroup"),
073 true);
074 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
075 "value.object.finder.cache.enabled.com.liferay.portal.model.ClusterGroup"),
076 true);
077 public static final boolean COLUMN_BITMASK_ENABLED = false;
078 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
079 "lock.expiration.time.com.liferay.portal.model.ClusterGroup"));
080
081 public ClusterGroupModelImpl() {
082 }
083
084 @Override
085 public long getPrimaryKey() {
086 return _clusterGroupId;
087 }
088
089 @Override
090 public void setPrimaryKey(long primaryKey) {
091 setClusterGroupId(primaryKey);
092 }
093
094 @Override
095 public Serializable getPrimaryKeyObj() {
096 return _clusterGroupId;
097 }
098
099 @Override
100 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
101 setPrimaryKey(((Long)primaryKeyObj).longValue());
102 }
103
104 @Override
105 public Class<?> getModelClass() {
106 return ClusterGroup.class;
107 }
108
109 @Override
110 public String getModelClassName() {
111 return ClusterGroup.class.getName();
112 }
113
114 @Override
115 public Map<String, Object> getModelAttributes() {
116 Map<String, Object> attributes = new HashMap<String, Object>();
117
118 attributes.put("clusterGroupId", getClusterGroupId());
119 attributes.put("name", getName());
120 attributes.put("clusterNodeIds", getClusterNodeIds());
121 attributes.put("wholeCluster", getWholeCluster());
122
123 return attributes;
124 }
125
126 @Override
127 public void setModelAttributes(Map<String, Object> attributes) {
128 Long clusterGroupId = (Long)attributes.get("clusterGroupId");
129
130 if (clusterGroupId != null) {
131 setClusterGroupId(clusterGroupId);
132 }
133
134 String name = (String)attributes.get("name");
135
136 if (name != null) {
137 setName(name);
138 }
139
140 String clusterNodeIds = (String)attributes.get("clusterNodeIds");
141
142 if (clusterNodeIds != null) {
143 setClusterNodeIds(clusterNodeIds);
144 }
145
146 Boolean wholeCluster = (Boolean)attributes.get("wholeCluster");
147
148 if (wholeCluster != null) {
149 setWholeCluster(wholeCluster);
150 }
151 }
152
153 @Override
154 public long getClusterGroupId() {
155 return _clusterGroupId;
156 }
157
158 @Override
159 public void setClusterGroupId(long clusterGroupId) {
160 _clusterGroupId = clusterGroupId;
161 }
162
163 @Override
164 public String getName() {
165 if (_name == null) {
166 return StringPool.BLANK;
167 }
168 else {
169 return _name;
170 }
171 }
172
173 @Override
174 public void setName(String name) {
175 _name = name;
176 }
177
178 @Override
179 public String getClusterNodeIds() {
180 if (_clusterNodeIds == null) {
181 return StringPool.BLANK;
182 }
183 else {
184 return _clusterNodeIds;
185 }
186 }
187
188 @Override
189 public void setClusterNodeIds(String clusterNodeIds) {
190 _clusterNodeIds = clusterNodeIds;
191 }
192
193 @Override
194 public boolean getWholeCluster() {
195 return _wholeCluster;
196 }
197
198 @Override
199 public boolean isWholeCluster() {
200 return _wholeCluster;
201 }
202
203 @Override
204 public void setWholeCluster(boolean wholeCluster) {
205 _wholeCluster = wholeCluster;
206 }
207
208 @Override
209 public ExpandoBridge getExpandoBridge() {
210 return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
211 ClusterGroup.class.getName(), getPrimaryKey());
212 }
213
214 @Override
215 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
216 ExpandoBridge expandoBridge = getExpandoBridge();
217
218 expandoBridge.setAttributes(serviceContext);
219 }
220
221 @Override
222 public ClusterGroup toEscapedModel() {
223 if (_escapedModel == null) {
224 _escapedModel = (ClusterGroup)ProxyUtil.newProxyInstance(_classLoader,
225 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
226 }
227
228 return _escapedModel;
229 }
230
231 @Override
232 public Object clone() {
233 ClusterGroupImpl clusterGroupImpl = new ClusterGroupImpl();
234
235 clusterGroupImpl.setClusterGroupId(getClusterGroupId());
236 clusterGroupImpl.setName(getName());
237 clusterGroupImpl.setClusterNodeIds(getClusterNodeIds());
238 clusterGroupImpl.setWholeCluster(getWholeCluster());
239
240 clusterGroupImpl.resetOriginalValues();
241
242 return clusterGroupImpl;
243 }
244
245 @Override
246 public int compareTo(ClusterGroup clusterGroup) {
247 long primaryKey = clusterGroup.getPrimaryKey();
248
249 if (getPrimaryKey() < primaryKey) {
250 return -1;
251 }
252 else if (getPrimaryKey() > primaryKey) {
253 return 1;
254 }
255 else {
256 return 0;
257 }
258 }
259
260 @Override
261 public boolean equals(Object obj) {
262 if (this == obj) {
263 return true;
264 }
265
266 if (!(obj instanceof ClusterGroup)) {
267 return false;
268 }
269
270 ClusterGroup clusterGroup = (ClusterGroup)obj;
271
272 long primaryKey = clusterGroup.getPrimaryKey();
273
274 if (getPrimaryKey() == primaryKey) {
275 return true;
276 }
277 else {
278 return false;
279 }
280 }
281
282 @Override
283 public int hashCode() {
284 return (int)getPrimaryKey();
285 }
286
287 @Override
288 public void resetOriginalValues() {
289 }
290
291 @Override
292 public CacheModel<ClusterGroup> toCacheModel() {
293 ClusterGroupCacheModel clusterGroupCacheModel = new ClusterGroupCacheModel();
294
295 clusterGroupCacheModel.clusterGroupId = getClusterGroupId();
296
297 clusterGroupCacheModel.name = getName();
298
299 String name = clusterGroupCacheModel.name;
300
301 if ((name != null) && (name.length() == 0)) {
302 clusterGroupCacheModel.name = null;
303 }
304
305 clusterGroupCacheModel.clusterNodeIds = getClusterNodeIds();
306
307 String clusterNodeIds = clusterGroupCacheModel.clusterNodeIds;
308
309 if ((clusterNodeIds != null) && (clusterNodeIds.length() == 0)) {
310 clusterGroupCacheModel.clusterNodeIds = null;
311 }
312
313 clusterGroupCacheModel.wholeCluster = getWholeCluster();
314
315 return clusterGroupCacheModel;
316 }
317
318 @Override
319 public String toString() {
320 StringBundler sb = new StringBundler(9);
321
322 sb.append("{clusterGroupId=");
323 sb.append(getClusterGroupId());
324 sb.append(", name=");
325 sb.append(getName());
326 sb.append(", clusterNodeIds=");
327 sb.append(getClusterNodeIds());
328 sb.append(", wholeCluster=");
329 sb.append(getWholeCluster());
330 sb.append("}");
331
332 return sb.toString();
333 }
334
335 @Override
336 public String toXmlString() {
337 StringBundler sb = new StringBundler(16);
338
339 sb.append("<model><model-name>");
340 sb.append("com.liferay.portal.model.ClusterGroup");
341 sb.append("</model-name>");
342
343 sb.append(
344 "<column><column-name>clusterGroupId</column-name><column-value><![CDATA[");
345 sb.append(getClusterGroupId());
346 sb.append("]]></column-value></column>");
347 sb.append(
348 "<column><column-name>name</column-name><column-value><![CDATA[");
349 sb.append(getName());
350 sb.append("]]></column-value></column>");
351 sb.append(
352 "<column><column-name>clusterNodeIds</column-name><column-value><![CDATA[");
353 sb.append(getClusterNodeIds());
354 sb.append("]]></column-value></column>");
355 sb.append(
356 "<column><column-name>wholeCluster</column-name><column-value><![CDATA[");
357 sb.append(getWholeCluster());
358 sb.append("]]></column-value></column>");
359
360 sb.append("</model>");
361
362 return sb.toString();
363 }
364
365 private static ClassLoader _classLoader = ClusterGroup.class.getClassLoader();
366 private static Class<?>[] _escapedModelInterfaces = new Class[] {
367 ClusterGroup.class
368 };
369 private long _clusterGroupId;
370 private String _name;
371 private String _clusterNodeIds;
372 private boolean _wholeCluster;
373 private ClusterGroup _escapedModel;
374 }