--- /dev/null
+/**\r
+ * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.\r
+ *\r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the Free\r
+ * Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful, but WITHOUT\r
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\r
+ * details.\r
+ */\r
+\r
+package com.liferay.portlet.documentlibrary.store;\r
+\r
+import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;\r
+import com.liferay.portal.kernel.exception.SystemException;\r
+import com.liferay.portal.kernel.search.Hits;\r
+import com.liferay.portal.kernel.util.MethodCache;\r
+import com.liferay.portal.kernel.util.ReferenceRegistry;\r
+import com.liferay.portal.model.CompanyConstants;\r
+\r
+/**\r
+ * Provides methods for storing files in the portal. The file storage\r
+ * implementation can be selected in <code>portal.properties</code> under the\r
+ * property <code>dl.store.impl</code>. Virus checking can also be enabled under\r
+ * the property <code>dl.store.antivirus.impl</code>.\r
+ *\r
+ * <p>\r
+ * The main client for this class is the Document Library portlet. It is also\r
+ * used by other portlets like Wiki and Message Boards to store file\r
+ * attachments. For the Document Library portlet, the <code>repositoryId</code>\r
+ * can be obtained by calling {@link\r
+ * com.liferay.portlet.documentlibrary.model.DLFolderConstants#getDataRepositoryId(\r
+ * long,long)}. For all other portlets, the <code>repositoryId</code> should be\r
+ * set to {@link CompanyConstants#SYSTEM}. These methods can be used in plugins\r
+ * and other portlets, as shown below.\r
+ * </p>\r
+ *\r
+ * <pre>\r
+ * <code>\r
+ * long repositoryId = CompanyConstants.SYSTEM;\r
+ * String dirName = "portlet_name/1234";\r
+ *\r
+ * try {\r
+ * DLStoreUtil.addDirectory(companyId, repositoryId, dirName);\r
+ * }\r
+ * catch (DuplicateDirectoryException dde) {\r
+ * }\r
+ *\r
+ * DLStoreUtil.addFile(\r
+ * companyId, repositoryId, dirName + "/" + fileName, file);\r
+ * </code>\r
+ * </pre>\r
+ *\r
+ * @author Brian Wing Shun Chan\r
+ * @author Alexander Chow\r
+ * @author Edward Han\r
+ * @see DLStoreImpl\r
+ */\r
+public class CustomDLStoreUtil extends DLStoreUtil{\r
+ \r
+ public static Hits search(\r
+ long companyId, long userId, String portletId, long groupId,\r
+ long[] repositoryIds, String keywords, int start, int end)\r
+ throws SystemException {\r
+ \r
+ return getService().search(companyId, userId, portletId, groupId, repositoryIds, keywords, start, end);\r
+ }\r
+ \r
+ public static Hits searchByDate(\r
+ long companyId, String portletId, long groupId,\r
+ long userId, long[] repositoryIds, String keywords, int start,\r
+ int end) throws SystemException {\r
+ \r
+ return getService().searchByDate(companyId, portletId, groupId, userId, repositoryIds, keywords, start, end);\r
+ }\r
+\r
+ /**\r
+ * Returns the {@link DLStore} object. Used primarily by Spring and should\r
+ * not be used by the client.\r
+ *\r
+ * @return Returns the {@link DLStore} object\r
+ */\r
+ public static CustomDLStore getService() {\r
+ if (_service == null) {\r
+ _service = (CustomDLStore)PortalBeanLocatorUtil.locate(\r
+ CustomDLStore.class.getName());\r
+\r
+ ReferenceRegistry.registerReference(DLStoreUtil.class, "_service");\r
+\r
+ MethodCache.remove(CustomDLStore.class);\r
+ }\r
+\r
+ return _service;\r
+ }\r
+ \r
+ /**\r
+ * Set's the {@link DLStore} object. Used primarily by Spring and should not\r
+ * be used by the client.\r
+ *\r
+ * @param store the {@link DLStore} object\r
+ */\r
+ public void setService(CustomDLStore service) {\r
+ _service = service;\r
+\r
+ ReferenceRegistry.registerReference(CustomDLStoreUtil.class, "_service");\r
+\r
+ MethodCache.remove(CustomDLStore.class);\r
+ }\r
+\r
+ private static CustomDLStore _service;\r
+\r
+}
\ No newline at end of file