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