001
014
015 package com.liferay.portal.repository.liferayrepository.model;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.repository.model.Folder;
020 import com.liferay.portal.security.permission.PermissionChecker;
021 import com.liferay.portlet.documentlibrary.model.DLFolder;
022 import com.liferay.portlet.documentlibrary.service.permission.DLFolderPermission;
023 import com.liferay.portlet.expando.model.ExpandoBridge;
024
025 import java.io.Serializable;
026
027 import java.util.Date;
028 import java.util.List;
029 import java.util.Map;
030
031
034 public class LiferayFolder extends LiferayModel implements Folder {
035
036 public LiferayFolder(DLFolder dlFolder) {
037 _dlFolder = dlFolder;
038 }
039
040 public LiferayFolder(DLFolder dlFolder, boolean escapedModel) {
041 _dlFolder = dlFolder;
042 _escapedModel = escapedModel;
043 }
044
045 public boolean containsPermission(
046 PermissionChecker permissionChecker, String actionId)
047 throws PortalException, SystemException {
048
049 return DLFolderPermission.contains(
050 permissionChecker, _dlFolder, actionId);
051 }
052
053 public List<Long> getAncestorFolderIds()
054 throws PortalException, SystemException {
055
056 return _dlFolder.getAncestorFolderIds();
057 }
058
059 public List<Folder> getAncestors() throws PortalException, SystemException {
060 return toFolders(_dlFolder.getAncestors());
061 }
062
063 public Map<String, Serializable> getAttributes() {
064 ExpandoBridge expandoBridge = getExpandoBridge();
065
066 return expandoBridge.getAttributes();
067 }
068
069 @Override
070 public long getCompanyId() {
071 return _dlFolder.getCompanyId();
072 }
073
074 public Date getCreateDate() {
075 return _dlFolder.getCreateDate();
076 }
077
078 public String getDescription() {
079 return _dlFolder.getDescription();
080 }
081
082 @Override
083 public ExpandoBridge getExpandoBridge() {
084 return _dlFolder.getExpandoBridge();
085 }
086
087 public long getFolderId() {
088 return _dlFolder.getFolderId();
089 }
090
091 public long getGroupId() {
092 return _dlFolder.getGroupId();
093 }
094
095 public Date getLastPostDate() {
096 return _dlFolder.getLastPostDate();
097 }
098
099 public Object getModel() {
100 return _dlFolder;
101 }
102
103 public Class<?> getModelClass() {
104 return DLFolder.class;
105 }
106
107 @Override
108 public String getModelClassName() {
109 return DLFolder.class.getName();
110 }
111
112 public Date getModifiedDate() {
113 return _dlFolder.getModifiedDate();
114 }
115
116 public String getName() {
117 return _dlFolder.getName();
118 }
119
120 public Folder getParentFolder() throws PortalException, SystemException {
121 DLFolder dlParentFolder = _dlFolder.getParentFolder();
122
123 if (dlParentFolder == null) {
124 return null;
125 }
126 else {
127 return new LiferayFolder(dlParentFolder);
128 }
129 }
130
131 public long getParentFolderId() {
132 return _dlFolder.getParentFolderId();
133 }
134
135 @Override
136 public long getPrimaryKey() {
137 return _dlFolder.getPrimaryKey();
138 }
139
140 public Serializable getPrimaryKeyObj() {
141 return getPrimaryKey();
142 }
143
144 public long getRepositoryId() {
145 return _dlFolder.getRepositoryId();
146 }
147
148 public long getUserId() {
149 return _dlFolder.getUserId();
150 }
151
152 public String getUserName() {
153 return _dlFolder.getUserName();
154 }
155
156 public String getUserUuid() throws SystemException {
157 return _dlFolder.getUserUuid();
158 }
159
160 public String getUuid() {
161 return _dlFolder.getUuid();
162 }
163
164 public boolean hasInheritableLock() {
165 return _dlFolder.hasInheritableLock();
166 }
167
168 public boolean hasLock() {
169 return _dlFolder.hasLock();
170 }
171
172 public boolean isDefaultRepository() {
173 if (_dlFolder.getGroupId() == _dlFolder.getRepositoryId()) {
174 return true;
175 }
176 else {
177 return false;
178 }
179 }
180
181 public boolean isEscapedModel() {
182 return _escapedModel;
183 }
184
185 public boolean isLocked() {
186 return _dlFolder.isLocked();
187 }
188
189 public boolean isMountPoint() {
190 return _dlFolder.isMountPoint();
191 }
192
193 public boolean isRoot() {
194 return _dlFolder.isRoot();
195 }
196
197 public boolean isSupportsLocking() {
198 if (isMountPoint()) {
199 return false;
200 }
201 else {
202 return true;
203 }
204 }
205
206 public boolean isSupportsMetadata() {
207 if (isMountPoint()) {
208 return false;
209 }
210 else {
211 return true;
212 }
213 }
214
215 public boolean isSupportsMultipleUpload() {
216 if (isMountPoint()) {
217 return false;
218 }
219 else {
220 return true;
221 }
222 }
223
224 public boolean isSupportsShortcuts() {
225 if (isMountPoint()) {
226 return false;
227 }
228 else {
229 return true;
230 }
231 }
232
233 public boolean isSupportsSocial() {
234 if (isMountPoint()) {
235 return false;
236 }
237 else {
238 return true;
239 }
240 }
241
242 public boolean isSupportsSubscribing() {
243 if (isMountPoint()) {
244 return false;
245 }
246 else {
247 return true;
248 }
249 }
250
251 public void setCompanyId(long companyId) {
252 _dlFolder.setCompanyId(companyId);
253 }
254
255 public void setCreateDate(Date date) {
256 _dlFolder.setCreateDate(date);
257 }
258
259 public void setGroupId(long groupId) {
260 _dlFolder.setGroupId(groupId);
261 }
262
263 public void setModifiedDate(Date date) {
264 _dlFolder.setModifiedDate(date);
265 }
266
267 public void setPrimaryKey(long primaryKey) {
268 _dlFolder.setPrimaryKey(primaryKey);
269 }
270
271 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
272 setPrimaryKey(((Long)primaryKeyObj).longValue());
273 }
274
275 public void setUserId(long userId) {
276 _dlFolder.setUserId(userId);
277 }
278
279 public void setUserName(String userName) {
280 _dlFolder.setUserName(userName);
281 }
282
283 public void setUserUuid(String userUuid) {
284 _dlFolder.setUserUuid(userUuid);
285 }
286
287 public Folder toEscapedModel() {
288 if (isEscapedModel()) {
289 return this;
290 }
291 else {
292 return new LiferayFolder(_dlFolder.toEscapedModel(), true);
293 }
294 }
295
296 @Override
297 public String toString() {
298 return _dlFolder.toString();
299 }
300
301 public Folder toUnescapedModel() {
302 if (isEscapedModel()) {
303 return new LiferayFolder(_dlFolder.toUnescapedModel(), true);
304 }
305 else {
306 return this;
307 }
308 }
309
310 private DLFolder _dlFolder;
311 private boolean _escapedModel;
312
313 }