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: import com.liferay.portal.kernel.search.Hits;
026:
027: import java.io.File;
028: import java.io.InputStream;
029:
030: /**
031: * <a href="DLLocalServiceUtil.java.html"><b><i>View Source</i></b></a>
032: *
033: * @author Brian Wing Shun Chan
034: *
035: */
036: public class DLLocalServiceUtil {
037:
038: public static void addFile(long companyId, String portletId,
039: long groupId, long repositoryId, String fileName,
040: String properties, String[] tagsEntries, InputStream is)
041: throws PortalException, SystemException {
042:
043: DLLocalService dlLocalService = DLLocalServiceFactory
044: .getService();
045:
046: dlLocalService.addFile(companyId, portletId, groupId,
047: repositoryId, fileName, properties, tagsEntries, is);
048: }
049:
050: public static void checkRoot(long companyId) throws SystemException {
051: DLLocalService dlLocalService = DLLocalServiceFactory
052: .getService();
053:
054: dlLocalService.checkRoot(companyId);
055: }
056:
057: public static InputStream getFileAsStream(long companyId,
058: long repositoryId, String fileName) throws PortalException,
059: SystemException {
060:
061: DLLocalService dlLocalService = DLLocalServiceFactory
062: .getService();
063:
064: return dlLocalService.getFileAsStream(companyId, repositoryId,
065: fileName);
066: }
067:
068: public static InputStream getFileAsStream(long companyId,
069: long repositoryId, String fileName, double versionNumber)
070: throws PortalException, SystemException {
071:
072: DLLocalService dlLocalService = DLLocalServiceFactory
073: .getService();
074:
075: return dlLocalService.getFileAsStream(companyId, repositoryId,
076: fileName, versionNumber);
077: }
078:
079: public static boolean hasFile(long companyId, long repositoryId,
080: String fileName, double versionNumber)
081: throws PortalException, SystemException {
082:
083: DLLocalService dlLocalService = DLLocalServiceFactory
084: .getService();
085:
086: return dlLocalService.hasFile(companyId, repositoryId,
087: fileName, versionNumber);
088: }
089:
090: public static void move(String srcDir, String destDir)
091: throws SystemException {
092:
093: DLLocalService dlLocalService = DLLocalServiceFactory
094: .getService();
095:
096: dlLocalService.move(srcDir, destDir);
097: }
098:
099: public static Hits search(long companyId, String portletId,
100: long groupId, long[] repositoryIds, String keywords)
101: throws SystemException {
102:
103: DLLocalService dlLocalService = DLLocalServiceFactory
104: .getService();
105:
106: return dlLocalService.search(companyId, portletId, groupId,
107: repositoryIds, keywords);
108: }
109:
110: public static void updateFile(long companyId, String portletId,
111: long groupId, long repositoryId, String fileName,
112: double versionNumber, String sourceFileName,
113: String properties, String[] tagsEntries, InputStream is)
114: throws PortalException, SystemException {
115:
116: DLLocalService dlLocalService = DLLocalServiceFactory
117: .getService();
118:
119: dlLocalService.updateFile(companyId, portletId, groupId,
120: repositoryId, fileName, versionNumber, sourceFileName,
121: properties, tagsEntries, is);
122: }
123:
124: public static void validate(String fileName, File file)
125: throws PortalException {
126:
127: DLLocalService dlLocalService = DLLocalServiceFactory
128: .getService();
129:
130: dlLocalService.validate(fileName, file);
131: }
132:
133: public static void validate(String fileName, byte[] byteArray)
134: throws PortalException {
135:
136: DLLocalService dlLocalService = DLLocalServiceFactory
137: .getService();
138:
139: dlLocalService.validate(fileName, byteArray);
140: }
141:
142: public static void validate(String fileName, InputStream is)
143: throws PortalException {
144:
145: DLLocalService dlLocalService = DLLocalServiceFactory
146: .getService();
147:
148: dlLocalService.validate(fileName, is);
149: }
150:
151: public static void validate(String fileName, String sourceFileName,
152: InputStream is) throws PortalException {
153:
154: DLLocalService dlLocalService = DLLocalServiceFactory
155: .getService();
156:
157: dlLocalService.validate(fileName, sourceFileName, is);
158: }
159:
160: }
|