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