1
14
15 package com.liferay.documentlibrary.service;
16
17 import com.liferay.portal.PortalException;
18 import com.liferay.portal.SystemException;
19 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
20 import com.liferay.portal.kernel.util.MethodCache;
21 import com.liferay.portal.kernel.util.ReferenceRegistry;
22
23 import java.io.File;
24
25 import java.util.Date;
26
27
32 public class DLServiceUtil {
33
34 public static void addDirectory(
35 long companyId, long repositoryId, String dirName)
36 throws PortalException, SystemException {
37
38 getService().addDirectory(companyId, repositoryId, dirName);
39 }
40
41 public static void addFile(
42 long companyId, String portletId, long groupId, long repositoryId,
43 String fileName, long fileEntryId, String properties,
44 Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
45 File file)
46 throws PortalException, SystemException {
47
48 getService().addFile(
49 companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
50 properties, modifiedDate, tagsCategories, tagsEntries, file);
51 }
52
53 public static void addFile(
54 long companyId, String portletId, long groupId, long repositoryId,
55 String fileName, long fileEntryId, String properties,
56 Date modifiedDate, String[] tagsCategories, String[] tagsEntries,
57 byte[] bytes)
58 throws PortalException, SystemException {
59
60 getService().addFile(
61 companyId, portletId, groupId, repositoryId, fileName, fileEntryId,
62 properties, modifiedDate, tagsCategories, tagsEntries, bytes);
63 }
64
65 public static void deleteDirectory(
66 long companyId, String portletId, long repositoryId, String dirName)
67 throws PortalException, SystemException {
68
69 getService().deleteDirectory(
70 companyId, portletId, repositoryId, dirName);
71 }
72
73 public static void deleteFile(
74 long companyId, String portletId, long repositoryId,
75 String fileName)
76 throws PortalException, SystemException {
77
78 getService().deleteFile(companyId, portletId, repositoryId, fileName);
79 }
80
81 public static void deleteFile(
82 long companyId, String portletId, long repositoryId,
83 String fileName, double versionNumber)
84 throws PortalException, SystemException {
85
86 getService().deleteFile(
87 companyId, portletId, repositoryId, fileName, versionNumber);
88 }
89
90 public static byte[] getFile(
91 long companyId, long repositoryId, String fileName)
92 throws PortalException, SystemException {
93
94 return getService().getFile(companyId, repositoryId, fileName);
95 }
96
97 public static byte[] getFile(
98 long companyId, long repositoryId, String fileName,
99 double versionNumber)
100 throws PortalException, SystemException {
101
102 return getService().getFile(
103 companyId, repositoryId, fileName, versionNumber);
104 }
105
106 public static String[] getFileNames(
107 long companyId, long repositoryId, String dirName)
108 throws PortalException, SystemException {
109
110 return getService().getFileNames(companyId, repositoryId, dirName);
111 }
112
113 public static long getFileSize(
114 long companyId, long repositoryId, String fileName)
115 throws PortalException, SystemException {
116
117 return getService().getFileSize(companyId, repositoryId, fileName);
118 }
119
120 public static DLService getService() {
121 if (_service == null) {
122 _service = (DLService)PortalBeanLocatorUtil.locate(
123 DLService.class.getName());
124
125 ReferenceRegistry.registerReference(
126 DLServiceUtil.class, "_service");
127
128 MethodCache.remove(DLService.class);
129 }
130
131 return _service;
132 }
133
134 public static void reIndex(String[] ids) throws SystemException {
135 getService().reIndex(ids);
136 }
137
138 public static void updateFile(
139 long companyId, String portletId, long groupId, long repositoryId,
140 String fileName, double versionNumber, String sourceFileName,
141 long fileEntryId, String properties, Date modifiedDate,
142 String[] tagsCategories, String[] tagsEntries, File file)
143 throws PortalException, SystemException {
144
145 getService().updateFile(
146 companyId, portletId, groupId, repositoryId, fileName,
147 versionNumber, sourceFileName, fileEntryId, properties,
148 modifiedDate, tagsCategories, tagsEntries, file);
149 }
150
151 public static void updateFile(
152 long companyId, String portletId, long groupId, long repositoryId,
153 String fileName, double versionNumber, String sourceFileName,
154 long fileEntryId, String properties, Date modifiedDate,
155 String[] tagsCategories, String[] tagsEntries, byte[] bytes)
156 throws PortalException, SystemException {
157
158 getService().updateFile(
159 companyId, portletId, groupId, repositoryId, fileName,
160 versionNumber, sourceFileName, fileEntryId, properties,
161 modifiedDate, tagsCategories, tagsEntries, bytes);
162 }
163
164 public static void updateFile(
165 long companyId, String portletId, long groupId, long repositoryId,
166 long newRepositoryId, String fileName, long fileEntryId)
167 throws PortalException, SystemException {
168
169 getService().updateFile(
170 companyId, portletId, groupId, repositoryId, newRepositoryId,
171 fileName, fileEntryId);
172 }
173
174 public void setService(DLService service) {
175 _service = service;
176
177 ReferenceRegistry.registerReference(DLServiceUtil.class, "_service");
178
179 MethodCache.remove(DLService.class);
180 }
181
182 private static DLService _service;
183
184 }