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