001    /**
002     * Copyright (c) 2000-2010 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 clone = new ClusterGroupImpl();
161    
162                    clone.setClusterGroupId(getClusterGroupId());
163                    clone.setName(getName());
164                    clone.setClusterNodeIds(getClusterNodeIds());
165                    clone.setWholeCluster(getWholeCluster());
166    
167                    return clone;
168            }
169    
170            public int compareTo(ClusterGroup clusterGroup) {
171                    long pk = clusterGroup.getPrimaryKey();
172    
173                    if (getPrimaryKey() < pk) {
174                            return -1;
175                    }
176                    else if (getPrimaryKey() > pk) {
177                            return 1;
178                    }
179                    else {
180                            return 0;
181                    }
182            }
183    
184            public boolean equals(Object obj) {
185                    if (obj == null) {
186                            return false;
187                    }
188    
189                    ClusterGroup clusterGroup = null;
190    
191                    try {
192                            clusterGroup = (ClusterGroup)obj;
193                    }
194                    catch (ClassCastException cce) {
195                            return false;
196                    }
197    
198                    long pk = clusterGroup.getPrimaryKey();
199    
200                    if (getPrimaryKey() == pk) {
201                            return true;
202                    }
203                    else {
204                            return false;
205                    }
206            }
207    
208            public int hashCode() {
209                    return (int)getPrimaryKey();
210            }
211    
212            public String toString() {
213                    StringBundler sb = new StringBundler(9);
214    
215                    sb.append("{clusterGroupId=");
216                    sb.append(getClusterGroupId());
217                    sb.append(", name=");
218                    sb.append(getName());
219                    sb.append(", clusterNodeIds=");
220                    sb.append(getClusterNodeIds());
221                    sb.append(", wholeCluster=");
222                    sb.append(getWholeCluster());
223                    sb.append("}");
224    
225                    return sb.toString();
226            }
227    
228            public String toXmlString() {
229                    StringBundler sb = new StringBundler(16);
230    
231                    sb.append("<model><model-name>");
232                    sb.append("com.liferay.portal.model.ClusterGroup");
233                    sb.append("</model-name>");
234    
235                    sb.append(
236                            "<column><column-name>clusterGroupId</column-name><column-value><![CDATA[");
237                    sb.append(getClusterGroupId());
238                    sb.append("]]></column-value></column>");
239                    sb.append(
240                            "<column><column-name>name</column-name><column-value><![CDATA[");
241                    sb.append(getName());
242                    sb.append("]]></column-value></column>");
243                    sb.append(
244                            "<column><column-name>clusterNodeIds</column-name><column-value><![CDATA[");
245                    sb.append(getClusterNodeIds());
246                    sb.append("]]></column-value></column>");
247                    sb.append(
248                            "<column><column-name>wholeCluster</column-name><column-value><![CDATA[");
249                    sb.append(getWholeCluster());
250                    sb.append("]]></column-value></column>");
251    
252                    sb.append("</model>");
253    
254                    return sb.toString();
255            }
256    
257            private long _clusterGroupId;
258            private String _name;
259            private String _clusterNodeIds;
260            private boolean _wholeCluster;
261            private transient ExpandoBridge _expandoBridge;
262    }