001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.ClusterGroup;
022    import com.liferay.portal.model.ClusterGroupModel;
023    import com.liferay.portal.service.ServiceContext;
024    
025    import com.liferay.portlet.expando.model.ExpandoBridge;
026    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
027    
028    import java.io.Serializable;
029    
030    import java.lang.reflect.Proxy;
031    
032    import java.sql.Types;
033    
034    /**
035     * The base model implementation for the ClusterGroup service. Represents a row in the "ClusterGroup" database table, with each column mapped to a property of this class.
036     *
037     * <p>
038     * This implementation and its corresponding interface {@link com.liferay.portal.model.ClusterGroupModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ClusterGroupImpl}.
039     * </p>
040     *
041     * <p>
042     * Never modify or reference this class directly. All methods that expect a cluster group model instance should use the {@link com.liferay.portal.model.ClusterGroup} interface instead.
043     * </p>
044     *
045     * @author Brian Wing Shun Chan
046     * @see ClusterGroupImpl
047     * @see com.liferay.portal.model.ClusterGroup
048     * @see com.liferay.portal.model.ClusterGroupModel
049     * @generated
050     */
051    public class ClusterGroupModelImpl extends BaseModelImpl<ClusterGroup>
052            implements ClusterGroupModel {
053            public static final String TABLE_NAME = "ClusterGroup";
054            public static final Object[][] TABLE_COLUMNS = {
055                            { "clusterGroupId", new Integer(Types.BIGINT) },
056                            { "name", new Integer(Types.VARCHAR) },
057                            { "clusterNodeIds", new Integer(Types.VARCHAR) },
058                            { "wholeCluster", new Integer(Types.BOOLEAN) }
059                    };
060            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)";
061            public static final String TABLE_SQL_DROP = "drop table ClusterGroup";
062            public static final String DATA_SOURCE = "liferayDataSource";
063            public static final String SESSION_FACTORY = "liferaySessionFactory";
064            public static final String TX_MANAGER = "liferayTransactionManager";
065            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
066                                    "value.object.entity.cache.enabled.com.liferay.portal.model.ClusterGroup"),
067                            true);
068            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
069                                    "value.object.finder.cache.enabled.com.liferay.portal.model.ClusterGroup"),
070                            true);
071            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
072                                    "lock.expiration.time.com.liferay.portal.model.ClusterGroup"));
073    
074            public ClusterGroupModelImpl() {
075            }
076    
077            public long getPrimaryKey() {
078                    return _clusterGroupId;
079            }
080    
081            public void setPrimaryKey(long pk) {
082                    setClusterGroupId(pk);
083            }
084    
085            public Serializable getPrimaryKeyObj() {
086                    return new Long(_clusterGroupId);
087            }
088    
089            public long getClusterGroupId() {
090                    return _clusterGroupId;
091            }
092    
093            public void setClusterGroupId(long clusterGroupId) {
094                    _clusterGroupId = clusterGroupId;
095            }
096    
097            public String getName() {
098                    if (_name == null) {
099                            return StringPool.BLANK;
100                    }
101                    else {
102                            return _name;
103                    }
104            }
105    
106            public void setName(String name) {
107                    _name = name;
108            }
109    
110            public String getClusterNodeIds() {
111                    if (_clusterNodeIds == null) {
112                            return StringPool.BLANK;
113                    }
114                    else {
115                            return _clusterNodeIds;
116                    }
117            }
118    
119            public void setClusterNodeIds(String clusterNodeIds) {
120                    _clusterNodeIds = clusterNodeIds;
121            }
122    
123            public boolean getWholeCluster() {
124                    return _wholeCluster;
125            }
126    
127            public boolean isWholeCluster() {
128                    return _wholeCluster;
129            }
130    
131            public void setWholeCluster(boolean wholeCluster) {
132                    _wholeCluster = wholeCluster;
133            }
134    
135            public ClusterGroup toEscapedModel() {
136                    if (isEscapedModel()) {
137                            return (ClusterGroup)this;
138                    }
139                    else {
140                            return (ClusterGroup)Proxy.newProxyInstance(ClusterGroup.class.getClassLoader(),
141                                    new Class[] { ClusterGroup.class },
142                                    new AutoEscapeBeanHandler(this));
143                    }
144            }
145    
146            public ExpandoBridge getExpandoBridge() {
147                    if (_expandoBridge == null) {
148                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
149                                            ClusterGroup.class.getName(), getPrimaryKey());
150                    }
151    
152                    return _expandoBridge;
153            }
154    
155            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
156                    getExpandoBridge().setAttributes(serviceContext);
157            }
158    
159            public Object clone() {
160                    ClusterGroupImpl clusterGroupImpl = new ClusterGroupImpl();
161    
162                    clusterGroupImpl.setClusterGroupId(getClusterGroupId());
163    
164                    clusterGroupImpl.setName(getName());
165    
166                    clusterGroupImpl.setClusterNodeIds(getClusterNodeIds());
167    
168                    clusterGroupImpl.setWholeCluster(getWholeCluster());
169    
170                    return clusterGroupImpl;
171            }
172    
173            public int compareTo(ClusterGroup clusterGroup) {
174                    long pk = clusterGroup.getPrimaryKey();
175    
176                    if (getPrimaryKey() < pk) {
177                            return -1;
178                    }
179                    else if (getPrimaryKey() > pk) {
180                            return 1;
181                    }
182                    else {
183                            return 0;
184                    }
185            }
186    
187            public boolean equals(Object obj) {
188                    if (obj == null) {
189                            return false;
190                    }
191    
192                    ClusterGroup clusterGroup = null;
193    
194                    try {
195                            clusterGroup = (ClusterGroup)obj;
196                    }
197                    catch (ClassCastException cce) {
198                            return false;
199                    }
200    
201                    long pk = clusterGroup.getPrimaryKey();
202    
203                    if (getPrimaryKey() == pk) {
204                            return true;
205                    }
206                    else {
207                            return false;
208                    }
209            }
210    
211            public int hashCode() {
212                    return (int)getPrimaryKey();
213            }
214    
215            public String toString() {
216                    StringBundler sb = new StringBundler(9);
217    
218                    sb.append("{clusterGroupId=");
219                    sb.append(getClusterGroupId());
220                    sb.append(", name=");
221                    sb.append(getName());
222                    sb.append(", clusterNodeIds=");
223                    sb.append(getClusterNodeIds());
224                    sb.append(", wholeCluster=");
225                    sb.append(getWholeCluster());
226                    sb.append("}");
227    
228                    return sb.toString();
229            }
230    
231            public String toXmlString() {
232                    StringBundler sb = new StringBundler(16);
233    
234                    sb.append("<model><model-name>");
235                    sb.append("com.liferay.portal.model.ClusterGroup");
236                    sb.append("</model-name>");
237    
238                    sb.append(
239                            "<column><column-name>clusterGroupId</column-name><column-value><![CDATA[");
240                    sb.append(getClusterGroupId());
241                    sb.append("]]></column-value></column>");
242                    sb.append(
243                            "<column><column-name>name</column-name><column-value><![CDATA[");
244                    sb.append(getName());
245                    sb.append("]]></column-value></column>");
246                    sb.append(
247                            "<column><column-name>clusterNodeIds</column-name><column-value><![CDATA[");
248                    sb.append(getClusterNodeIds());
249                    sb.append("]]></column-value></column>");
250                    sb.append(
251                            "<column><column-name>wholeCluster</column-name><column-value><![CDATA[");
252                    sb.append(getWholeCluster());
253                    sb.append("]]></column-value></column>");
254    
255                    sb.append("</model>");
256    
257                    return sb.toString();
258            }
259    
260            private long _clusterGroupId;
261            private String _name;
262            private String _clusterNodeIds;
263            private boolean _wholeCluster;
264            private transient ExpandoBridge _expandoBridge;
265    }