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
62 public class TagsSourceModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "TagsSource";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "sourceId", new Integer(Types.BIGINT) },
66
67
68 { "parentSourceId", new Integer(Types.BIGINT) },
69
70
71 { "name", new Integer(Types.VARCHAR) },
72
73
74 { "acronym", new Integer(Types.VARCHAR) }
75 };
76 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)";
77 public static final String TABLE_SQL_DROP = "drop table TagsSource";
78 public static final String DATA_SOURCE = "liferayDataSource";
79 public static final String SESSION_FACTORY = "liferaySessionFactory";
80 public static final String TX_MANAGER = "liferayTransactionManager";
81 public static final boolean 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 if (sourceId != _sourceId) {
130 _sourceId = sourceId;
131 }
132 }
133
134 public long getParentSourceId() {
135 return _parentSourceId;
136 }
137
138 public void setParentSourceId(long parentSourceId) {
139 if (parentSourceId != _parentSourceId) {
140 _parentSourceId = parentSourceId;
141 }
142 }
143
144 public String getName() {
145 return GetterUtil.getString(_name);
146 }
147
148 public void setName(String name) {
149 if (((name == null) && (_name != null)) ||
150 ((name != null) && (_name == null)) ||
151 ((name != null) && (_name != null) && !name.equals(_name))) {
152 _name = name;
153 }
154 }
155
156 public String getAcronym() {
157 return GetterUtil.getString(_acronym);
158 }
159
160 public void setAcronym(String acronym) {
161 if (((acronym == null) && (_acronym != null)) ||
162 ((acronym != null) && (_acronym == null)) ||
163 ((acronym != null) && (_acronym != null) &&
164 !acronym.equals(_acronym))) {
165 _acronym = acronym;
166 }
167 }
168
169 public TagsSource toEscapedModel() {
170 if (isEscapedModel()) {
171 return (TagsSource)this;
172 }
173 else {
174 TagsSource model = new TagsSourceImpl();
175
176 model.setEscapedModel(true);
177
178 model.setSourceId(getSourceId());
179 model.setParentSourceId(getParentSourceId());
180 model.setName(HtmlUtil.escape(getName()));
181 model.setAcronym(HtmlUtil.escape(getAcronym()));
182
183 model = (TagsSource)Proxy.newProxyInstance(TagsSource.class.getClassLoader(),
184 new Class[] { TagsSource.class },
185 new ReadOnlyBeanHandler(model));
186
187 return model;
188 }
189 }
190
191 public Object clone() {
192 TagsSourceImpl clone = new TagsSourceImpl();
193
194 clone.setSourceId(getSourceId());
195 clone.setParentSourceId(getParentSourceId());
196 clone.setName(getName());
197 clone.setAcronym(getAcronym());
198
199 return clone;
200 }
201
202 public int compareTo(Object obj) {
203 if (obj == null) {
204 return -1;
205 }
206
207 TagsSourceImpl tagsSource = (TagsSourceImpl)obj;
208
209 long pk = tagsSource.getPrimaryKey();
210
211 if (getPrimaryKey() < pk) {
212 return -1;
213 }
214 else if (getPrimaryKey() > pk) {
215 return 1;
216 }
217 else {
218 return 0;
219 }
220 }
221
222 public boolean equals(Object obj) {
223 if (obj == null) {
224 return false;
225 }
226
227 TagsSourceImpl tagsSource = null;
228
229 try {
230 tagsSource = (TagsSourceImpl)obj;
231 }
232 catch (ClassCastException cce) {
233 return false;
234 }
235
236 long pk = tagsSource.getPrimaryKey();
237
238 if (getPrimaryKey() == pk) {
239 return true;
240 }
241 else {
242 return false;
243 }
244 }
245
246 public int hashCode() {
247 return (int)getPrimaryKey();
248 }
249
250 private long _sourceId;
251 private long _parentSourceId;
252 private String _name;
253 private String _acronym;
254 }