001
014
015 package com.liferay.portlet.asset.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.impl.BaseModelImpl;
023 import com.liferay.portal.service.ServiceContext;
024 import com.liferay.portal.util.PortalUtil;
025
026 import com.liferay.portlet.asset.model.AssetLink;
027 import com.liferay.portlet.asset.model.AssetLinkModel;
028 import com.liferay.portlet.expando.model.ExpandoBridge;
029 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
030
031 import java.io.Serializable;
032
033 import java.lang.reflect.Proxy;
034
035 import java.sql.Types;
036
037 import java.util.Date;
038
039
056 public class AssetLinkModelImpl extends BaseModelImpl<AssetLink>
057 implements AssetLinkModel {
058 public static final String TABLE_NAME = "AssetLink";
059 public static final Object[][] TABLE_COLUMNS = {
060 { "linkId", new Integer(Types.BIGINT) },
061 { "companyId", new Integer(Types.BIGINT) },
062 { "userId", new Integer(Types.BIGINT) },
063 { "userName", new Integer(Types.VARCHAR) },
064 { "createDate", new Integer(Types.TIMESTAMP) },
065 { "entryId1", new Integer(Types.BIGINT) },
066 { "entryId2", new Integer(Types.BIGINT) },
067 { "type_", new Integer(Types.INTEGER) },
068 { "weight", new Integer(Types.INTEGER) }
069 };
070 public static final String TABLE_SQL_CREATE = "create table AssetLink (linkId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,entryId1 LONG,entryId2 LONG,type_ INTEGER,weight INTEGER)";
071 public static final String TABLE_SQL_DROP = "drop table AssetLink";
072 public static final String ORDER_BY_JPQL = " ORDER BY assetLink.weight ASC";
073 public static final String ORDER_BY_SQL = " ORDER BY AssetLink.weight ASC";
074 public static final String DATA_SOURCE = "liferayDataSource";
075 public static final String SESSION_FACTORY = "liferaySessionFactory";
076 public static final String TX_MANAGER = "liferayTransactionManager";
077 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078 "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetLink"),
079 true);
080 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081 "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetLink"),
082 true);
083 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
084 "lock.expiration.time.com.liferay.portlet.asset.model.AssetLink"));
085
086 public AssetLinkModelImpl() {
087 }
088
089 public long getPrimaryKey() {
090 return _linkId;
091 }
092
093 public void setPrimaryKey(long pk) {
094 setLinkId(pk);
095 }
096
097 public Serializable getPrimaryKeyObj() {
098 return new Long(_linkId);
099 }
100
101 public long getLinkId() {
102 return _linkId;
103 }
104
105 public void setLinkId(long linkId) {
106 _linkId = linkId;
107 }
108
109 public long getCompanyId() {
110 return _companyId;
111 }
112
113 public void setCompanyId(long companyId) {
114 _companyId = companyId;
115 }
116
117 public long getUserId() {
118 return _userId;
119 }
120
121 public void setUserId(long userId) {
122 _userId = userId;
123 }
124
125 public String getUserUuid() throws SystemException {
126 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
127 }
128
129 public void setUserUuid(String userUuid) {
130 _userUuid = userUuid;
131 }
132
133 public String getUserName() {
134 if (_userName == null) {
135 return StringPool.BLANK;
136 }
137 else {
138 return _userName;
139 }
140 }
141
142 public void setUserName(String userName) {
143 _userName = userName;
144 }
145
146 public Date getCreateDate() {
147 return _createDate;
148 }
149
150 public void setCreateDate(Date createDate) {
151 _createDate = createDate;
152 }
153
154 public long getEntryId1() {
155 return _entryId1;
156 }
157
158 public void setEntryId1(long entryId1) {
159 _entryId1 = entryId1;
160 }
161
162 public long getEntryId2() {
163 return _entryId2;
164 }
165
166 public void setEntryId2(long entryId2) {
167 _entryId2 = entryId2;
168 }
169
170 public int getType() {
171 return _type;
172 }
173
174 public void setType(int type) {
175 _type = type;
176 }
177
178 public int getWeight() {
179 return _weight;
180 }
181
182 public void setWeight(int weight) {
183 _weight = weight;
184 }
185
186 public AssetLink toEscapedModel() {
187 if (isEscapedModel()) {
188 return (AssetLink)this;
189 }
190 else {
191 return (AssetLink)Proxy.newProxyInstance(AssetLink.class.getClassLoader(),
192 new Class[] { AssetLink.class }, new AutoEscapeBeanHandler(this));
193 }
194 }
195
196 public ExpandoBridge getExpandoBridge() {
197 if (_expandoBridge == null) {
198 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
199 AssetLink.class.getName(), getPrimaryKey());
200 }
201
202 return _expandoBridge;
203 }
204
205 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
206 getExpandoBridge().setAttributes(serviceContext);
207 }
208
209 public Object clone() {
210 AssetLinkImpl clone = new AssetLinkImpl();
211
212 clone.setLinkId(getLinkId());
213 clone.setCompanyId(getCompanyId());
214 clone.setUserId(getUserId());
215 clone.setUserName(getUserName());
216 clone.setCreateDate(getCreateDate());
217 clone.setEntryId1(getEntryId1());
218 clone.setEntryId2(getEntryId2());
219 clone.setType(getType());
220 clone.setWeight(getWeight());
221
222 return clone;
223 }
224
225 public int compareTo(AssetLink assetLink) {
226 int value = 0;
227
228 if (getWeight() < assetLink.getWeight()) {
229 value = -1;
230 }
231 else if (getWeight() > assetLink.getWeight()) {
232 value = 1;
233 }
234 else {
235 value = 0;
236 }
237
238 if (value != 0) {
239 return value;
240 }
241
242 return 0;
243 }
244
245 public boolean equals(Object obj) {
246 if (obj == null) {
247 return false;
248 }
249
250 AssetLink assetLink = null;
251
252 try {
253 assetLink = (AssetLink)obj;
254 }
255 catch (ClassCastException cce) {
256 return false;
257 }
258
259 long pk = assetLink.getPrimaryKey();
260
261 if (getPrimaryKey() == pk) {
262 return true;
263 }
264 else {
265 return false;
266 }
267 }
268
269 public int hashCode() {
270 return (int)getPrimaryKey();
271 }
272
273 public String toString() {
274 StringBundler sb = new StringBundler(19);
275
276 sb.append("{linkId=");
277 sb.append(getLinkId());
278 sb.append(", companyId=");
279 sb.append(getCompanyId());
280 sb.append(", userId=");
281 sb.append(getUserId());
282 sb.append(", userName=");
283 sb.append(getUserName());
284 sb.append(", createDate=");
285 sb.append(getCreateDate());
286 sb.append(", entryId1=");
287 sb.append(getEntryId1());
288 sb.append(", entryId2=");
289 sb.append(getEntryId2());
290 sb.append(", type=");
291 sb.append(getType());
292 sb.append(", weight=");
293 sb.append(getWeight());
294 sb.append("}");
295
296 return sb.toString();
297 }
298
299 public String toXmlString() {
300 StringBundler sb = new StringBundler(31);
301
302 sb.append("<model><model-name>");
303 sb.append("com.liferay.portlet.asset.model.AssetLink");
304 sb.append("</model-name>");
305
306 sb.append(
307 "<column><column-name>linkId</column-name><column-value><![CDATA[");
308 sb.append(getLinkId());
309 sb.append("]]></column-value></column>");
310 sb.append(
311 "<column><column-name>companyId</column-name><column-value><![CDATA[");
312 sb.append(getCompanyId());
313 sb.append("]]></column-value></column>");
314 sb.append(
315 "<column><column-name>userId</column-name><column-value><![CDATA[");
316 sb.append(getUserId());
317 sb.append("]]></column-value></column>");
318 sb.append(
319 "<column><column-name>userName</column-name><column-value><![CDATA[");
320 sb.append(getUserName());
321 sb.append("]]></column-value></column>");
322 sb.append(
323 "<column><column-name>createDate</column-name><column-value><![CDATA[");
324 sb.append(getCreateDate());
325 sb.append("]]></column-value></column>");
326 sb.append(
327 "<column><column-name>entryId1</column-name><column-value><![CDATA[");
328 sb.append(getEntryId1());
329 sb.append("]]></column-value></column>");
330 sb.append(
331 "<column><column-name>entryId2</column-name><column-value><![CDATA[");
332 sb.append(getEntryId2());
333 sb.append("]]></column-value></column>");
334 sb.append(
335 "<column><column-name>type</column-name><column-value><![CDATA[");
336 sb.append(getType());
337 sb.append("]]></column-value></column>");
338 sb.append(
339 "<column><column-name>weight</column-name><column-value><![CDATA[");
340 sb.append(getWeight());
341 sb.append("]]></column-value></column>");
342
343 sb.append("</model>");
344
345 return sb.toString();
346 }
347
348 private long _linkId;
349 private long _companyId;
350 private long _userId;
351 private String _userUuid;
352 private String _userName;
353 private Date _createDate;
354 private long _entryId1;
355 private long _entryId2;
356 private int _type;
357 private int _weight;
358 private transient ExpandoBridge _expandoBridge;
359 }