001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.documentlibrary.service;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025:
026: import java.io.File;
027:
028: import java.rmi.RemoteException;
029:
030: /**
031: * <a href="DLServiceUtil.java.html"><b><i>View Source</i></b></a>
032: *
033: * @author Brian Wing Shun Chan
034: *
035: */
036: public class DLServiceUtil {
037:
038: public static void addDirectory(long companyId, long repositoryId,
039: String dirName) throws PortalException, RemoteException,
040: SystemException {
041:
042: DLService dlService = DLServiceFactory.getService();
043:
044: dlService.addDirectory(companyId, repositoryId, dirName);
045: }
046:
047: public static void addFile(long companyId, String portletId,
048: long groupId, long repositoryId, String fileName,
049: String properties, String[] tagsEntries, File file)
050: throws PortalException, RemoteException, SystemException {
051:
052: DLService dlService = DLServiceFactory.getService();
053:
054: dlService.addFile(companyId, portletId, groupId, repositoryId,
055: fileName, properties, tagsEntries, file);
056: }
057:
058: public static void addFile(long companyId, String portletId,
059: long groupId, long repositoryId, String fileName,
060: String properties, String[] tagsEntries, byte[] byteArray)
061: throws PortalException, RemoteException, SystemException {
062:
063: DLService dlService = DLServiceFactory.getService();
064:
065: dlService.addFile(companyId, portletId, groupId, repositoryId,
066: fileName, properties, tagsEntries, byteArray);
067: }
068:
069: public static void deleteDirectory(long companyId,
070: String portletId, long repositoryId, String dirName)
071: throws PortalException, RemoteException, SystemException {
072:
073: DLService dlService = DLServiceFactory.getService();
074:
075: dlService.deleteDirectory(companyId, portletId, repositoryId,
076: dirName);
077: }
078:
079: public static void deleteFile(long companyId, String portletId,
080: long repositoryId, String fileName) throws PortalException,
081: RemoteException, SystemException {
082:
083: DLService dlService = DLServiceFactory.getService();
084:
085: dlService.deleteFile(companyId, portletId, repositoryId,
086: fileName);
087: }
088:
089: public static void deleteFile(long companyId, String portletId,
090: long repositoryId, String fileName, double versionNumber)
091: throws PortalException, RemoteException, SystemException {
092:
093: DLService dlService = DLServiceFactory.getService();
094:
095: dlService.deleteFile(companyId, portletId, repositoryId,
096: fileName, versionNumber);
097: }
098:
099: public static byte[] getFile(long companyId, long repositoryId,
100: String fileName) throws PortalException, RemoteException,
101: SystemException {
102:
103: DLService dlService = DLServiceFactory.getService();
104:
105: return dlService.getFile(companyId, repositoryId, fileName);
106: }
107:
108: public static byte[] getFile(long companyId, long repositoryId,
109: String fileName, double versionNumber)
110: throws PortalException, RemoteException, SystemException {
111:
112: DLService dlService = DLServiceFactory.getService();
113:
114: return dlService.getFile(companyId, repositoryId, fileName,
115: versionNumber);
116: }
117:
118: public static String[] getFileNames(long companyId,
119: long repositoryId, String dirName) throws PortalException,
120: RemoteException, SystemException {
121:
122: DLService dlService = DLServiceFactory.getService();
123:
124: return dlService.getFileNames(companyId, repositoryId, dirName);
125: }
126:
127: public static long getFileSize(long companyId, long repositoryId,
128: String fileName) throws PortalException, RemoteException,
129: SystemException {
130:
131: DLService dlService = DLServiceFactory.getService();
132:
133: return dlService.getFileSize(companyId, repositoryId, fileName);
134: }
135:
136: public static void reIndex(String[] ids) throws PortalException,
137: RemoteException, SystemException {
138:
139: DLService dlService = DLServiceFactory.getService();
140:
141: dlService.reIndex(ids);
142: }
143:
144: public static void updateFile(long companyId, String portletId,
145: long groupId, long repositoryId, String fileName,
146: double versionNumber, String sourceFileName,
147: String properties, String[] tagsEntries, File file)
148: throws PortalException, RemoteException, SystemException {
149:
150: DLService dlService = DLServiceFactory.getService();
151:
152: dlService.updateFile(companyId, portletId, groupId,
153: repositoryId, fileName, versionNumber, sourceFileName,
154: properties, tagsEntries, file);
155: }
156:
157: public static void updateFile(long companyId, String portletId,
158: long groupId, long repositoryId, String fileName,
159: double versionNumber, String sourceFileName,
160: String properties, String[] tagsEntries, byte[] byteArray)
161: throws PortalException, RemoteException, SystemException {
162:
163: DLService dlService = DLServiceFactory.getService();
164:
165: dlService.updateFile(companyId, portletId, groupId,
166: repositoryId, fileName, versionNumber, sourceFileName,
167: properties, tagsEntries, byteArray);
168: }
169:
170: public static void updateFile(long companyId, String portletId,
171: long groupId, long repositoryId, long newRepositoryId,
172: String fileName) throws PortalException, RemoteException,
173: SystemException {
174:
175: DLService dlService = DLServiceFactory.getService();
176:
177: dlService.updateFile(companyId, portletId, groupId,
178: repositoryId, newRepositoryId, fileName);
179: }
180:
181: }
|