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