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.setNew(isNew());
177 model.setEscapedModel(true);
178
179 model.setSourceId(getSourceId());
180 model.setParentSourceId(getParentSourceId());
181 model.setName(HtmlUtil.escape(getName()));
182 model.setAcronym(HtmlUtil.escape(getAcronym()));
183
184 model = (TagsSource)Proxy.newProxyInstance(TagsSource.class.getClassLoader(),
185 new Class[] { TagsSource.class },
186 new ReadOnlyBeanHandler(model));
187
188 return model;
189 }
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(Object obj) {
204 if (obj == null) {
205 return -1;
206 }
207
208 TagsSourceImpl tagsSource = (TagsSourceImpl)obj;
209
210 long pk = tagsSource.getPrimaryKey();
211
212 if (getPrimaryKey() < pk) {
213 return -1;
214 }
215 else if (getPrimaryKey() > pk) {
216 return 1;
217 }
218 else {
219 return 0;
220 }
221 }
222
223 public boolean equals(Object obj) {
224 if (obj == null) {
225 return false;
226 }
227
228 TagsSourceImpl tagsSource = null;
229
230 try {
231 tagsSource = (TagsSourceImpl)obj;
232 }
233 catch (ClassCastException cce) {
234 return false;
235 }
236
237 long pk = tagsSource.getPrimaryKey();
238
239 if (getPrimaryKey() == pk) {
240 return true;
241 }
242 else {
243 return false;
244 }
245 }
246
247 public int hashCode() {
248 return (int)getPrimaryKey();
249 }
250
251 private long _sourceId;
252 private long _parentSourceId;
253 private String _name;
254 private String _acronym;
255 }