| MBThreadImpl.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.portlet.messageboards.model.impl;
16
17 import com.liferay.portal.model.Lock;
18 import com.liferay.portal.service.LockLocalServiceUtil;
19 import com.liferay.portlet.messageboards.model.MBThread;
20
21 /**
22 * <a href="MBThreadImpl.java.html"><b><i>View Source</i></b></a>
23 *
24 * @author Brian Wing Shun Chan
25 * @author Mika Koivisto
26 */
27 public class MBThreadImpl extends MBThreadModelImpl implements MBThread {
28
29 public MBThreadImpl() {
30 }
31
32 public String getAttachmentsDir() {
33 return "messageboards/" + getThreadId();
34 }
35
36 public Lock getLock() {
37 try {
38 return LockLocalServiceUtil.getLock(
39 MBThread.class.getName(), getThreadId());
40 }
41 catch (Exception e) {
42 }
43
44 return null;
45 }
46
47 public boolean hasLock(long userId) {
48 try {
49 return LockLocalServiceUtil.hasLock(
50 userId, MBThread.class.getName(), getThreadId());
51 }
52 catch (Exception e) {
53 }
54
55 return false;
56 }
57
58 public boolean isLocked() {
59 try {
60 return LockLocalServiceUtil.isLocked(
61 MBThread.class.getName(), getThreadId());
62 }
63 catch (Exception e) {
64 }
65
66 return false;
67 }
68
69 }