1
22
23 package com.liferay.portlet.tags.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29
30 import com.liferay.portlet.expando.model.ExpandoBridge;
31 import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;
32 import com.liferay.portlet.tags.model.TagsSource;
33 import com.liferay.portlet.tags.model.TagsSourceSoap;
34
35 import java.io.Serializable;
36
37 import java.lang.reflect.Proxy;
38
39 import java.sql.Types;
40
41 import java.util.ArrayList;
42 import java.util.List;
43
44
64 public class TagsSourceModelImpl extends BaseModelImpl<TagsSource> {
65 public static final String TABLE_NAME = "TagsSource";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "sourceId", new Integer(Types.BIGINT) },
68
69
70 { "parentSourceId", new Integer(Types.BIGINT) },
71
72
73 { "name", new Integer(Types.VARCHAR) },
74
75
76 { "acronym", new Integer(Types.VARCHAR) }
77 };
78 public static final String TABLE_SQL_CREATE = "create table TagsSource (sourceId LONG not null primary key,parentSourceId LONG,name VARCHAR(75) null,acronym VARCHAR(75) null)";
79 public static final String TABLE_SQL_DROP = "drop table TagsSource";
80 public static final String DATA_SOURCE = "liferayDataSource";
81 public static final String SESSION_FACTORY = "liferaySessionFactory";
82 public static final String TX_MANAGER = "liferayTransactionManager";
83 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
84 "value.object.entity.cache.enabled.com.liferay.portlet.tags.model.TagsSource"),
85 true);
86 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
87 "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsSource"),
88 true);
89
90 public static TagsSource toModel(TagsSourceSoap soapModel) {
91 TagsSource model = new TagsSourceImpl();
92
93 model.setSourceId(soapModel.getSourceId());
94 model.setParentSourceId(soapModel.getParentSourceId());
95 model.setName(soapModel.getName());
96 model.setAcronym(soapModel.getAcronym());
97
98 return model;
99 }
100
101 public static List<TagsSource> toModels(TagsSourceSoap[] soapModels) {
102 List<TagsSource> models = new ArrayList<TagsSource>(soapModels.length);
103
104 for (TagsSourceSoap soapModel : soapModels) {
105 models.add(toModel(soapModel));
106 }
107
108 return models;
109 }
110
111 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
112 "lock.expiration.time.com.liferay.portlet.tags.model.TagsSource"));
113
114 public TagsSourceModelImpl() {
115 }
116
117 public long getPrimaryKey() {
118 return _sourceId;
119 }
120
121 public void setPrimaryKey(long pk) {
122 setSourceId(pk);
123 }
124
125 public Serializable getPrimaryKeyObj() {
126 return new Long(_sourceId);
127 }
128
129 public long getSourceId() {
130 return _sourceId;
131 }
132
133 public void setSourceId(long sourceId) {
134 _sourceId = sourceId;
135 }
136
137 public long getParentSourceId() {
138 return _parentSourceId;
139 }
140
141 public void setParentSourceId(long parentSourceId) {
142 _parentSourceId = parentSourceId;
143 }
144
145 public String getName() {
146 return GetterUtil.getString(_name);
147 }
148
149 public void setName(String name) {
150 _name = name;
151 }
152
153 public String getAcronym() {
154 return GetterUtil.getString(_acronym);
155 }
156
157 public void setAcronym(String acronym) {
158 _acronym = acronym;
159 }
160
161 public TagsSource toEscapedModel() {
162 if (isEscapedModel()) {
163 return (TagsSource)this;
164 }
165 else {
166 TagsSource model = new TagsSourceImpl();
167
168 model.setNew(isNew());
169 model.setEscapedModel(true);
170
171 model.setSourceId(getSourceId());
172 model.setParentSourceId(getParentSourceId());
173 model.setName(HtmlUtil.escape(getName()));
174 model.setAcronym(HtmlUtil.escape(getAcronym()));
175
176 model = (TagsSource)Proxy.newProxyInstance(TagsSource.class.getClassLoader(),
177 new Class[] { TagsSource.class },
178 new ReadOnlyBeanHandler(model));
179
180 return model;
181 }
182 }
183
184 public ExpandoBridge getExpandoBridge() {
185 if (_expandoBridge == null) {
186 _expandoBridge = new ExpandoBridgeImpl(TagsSource.class.getName(),
187 getPrimaryKey());
188 }
189
190 return _expandoBridge;
191 }
192
193 public Object clone() {
194 TagsSourceImpl clone = new TagsSourceImpl();
195
196 clone.setSourceId(getSourceId());
197 clone.setParentSourceId(getParentSourceId());
198 clone.setName(getName());
199 clone.setAcronym(getAcronym());
200
201 return clone;
202 }
203
204 public int compareTo(TagsSource tagsSource) {
205 long pk = tagsSource.getPrimaryKey();
206
207 if (getPrimaryKey() < pk) {
208 return -1;
209 }
210 else if (getPrimaryKey() > pk) {
211 return 1;
212 }
213 else {
214 return 0;
215 }
216 }
217
218 public boolean equals(Object obj) {
219 if (obj == null) {
220 return false;
221 }
222
223 TagsSource tagsSource = null;
224
225 try {
226 tagsSource = (TagsSource)obj;
227 }
228 catch (ClassCastException cce) {
229 return false;
230 }
231
232 long pk = tagsSource.getPrimaryKey();
233
234 if (getPrimaryKey() == pk) {
235 return true;
236 }
237 else {
238 return false;
239 }
240 }
241
242 public int hashCode() {
243 return (int)getPrimaryKey();
244 }
245
246 public String toString() {
247 StringBuilder sb = new StringBuilder();
248
249 sb.append("{sourceId=");
250 sb.append(getSourceId());
251 sb.append(", parentSourceId=");
252 sb.append(getParentSourceId());
253 sb.append(", name=");
254 sb.append(getName());
255 sb.append(", acronym=");
256 sb.append(getAcronym());
257 sb.append("}");
258
259 return sb.toString();
260 }
261
262 public String toXmlString() {
263 StringBuilder sb = new StringBuilder();
264
265 sb.append("<model><model-name>");
266 sb.append("com.liferay.portlet.tags.model.TagsSource");
267 sb.append("</model-name>");
268
269 sb.append(
270 "<column><column-name>sourceId</column-name><column-value><![CDATA[");
271 sb.append(getSourceId());
272 sb.append("]]></column-value></column>");
273 sb.append(
274 "<column><column-name>parentSourceId</column-name><column-value><![CDATA[");
275 sb.append(getParentSourceId());
276 sb.append("]]></column-value></column>");
277 sb.append(
278 "<column><column-name>name</column-name><column-value><![CDATA[");
279 sb.append(getName());
280 sb.append("]]></column-value></column>");
281 sb.append(
282 "<column><column-name>acronym</column-name><column-value><![CDATA[");
283 sb.append(getAcronym());
284 sb.append("]]></column-value></column>");
285
286 sb.append("</model>");
287
288 return sb.toString();
289 }
290
291 private long _sourceId;
292 private long _parentSourceId;
293 private String _name;
294 private String _acronym;
295 private transient ExpandoBridge _expandoBridge;
296 }