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