001 /** 002 * Copyright (c) 2000-present Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.document.library.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.document.library.kernel.exception.NoSuchContentException; 020 import com.liferay.document.library.kernel.model.DLContent; 021 import com.liferay.document.library.kernel.model.DLContentDataBlobModel; 022 023 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 024 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 025 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 026 import com.liferay.portal.kernel.dao.orm.Projection; 027 import com.liferay.portal.kernel.exception.PortalException; 028 import com.liferay.portal.kernel.exception.SystemException; 029 import com.liferay.portal.kernel.model.PersistedModel; 030 import com.liferay.portal.kernel.search.Indexable; 031 import com.liferay.portal.kernel.search.IndexableType; 032 import com.liferay.portal.kernel.service.BaseLocalService; 033 import com.liferay.portal.kernel.service.PersistedModelLocalService; 034 import com.liferay.portal.kernel.transaction.Isolation; 035 import com.liferay.portal.kernel.transaction.Propagation; 036 import com.liferay.portal.kernel.transaction.Transactional; 037 import com.liferay.portal.kernel.util.OrderByComparator; 038 039 import java.io.InputStream; 040 import java.io.Serializable; 041 042 import java.util.List; 043 044 /** 045 * Provides the local service interface for DLContent. Methods of this 046 * service will not have security checks based on the propagated JAAS 047 * credentials because this service can only be accessed from within the same 048 * VM. 049 * 050 * @author Brian Wing Shun Chan 051 * @see DLContentLocalServiceUtil 052 * @see com.liferay.portlet.documentlibrary.service.base.DLContentLocalServiceBaseImpl 053 * @see com.liferay.portlet.documentlibrary.service.impl.DLContentLocalServiceImpl 054 * @generated 055 */ 056 @ProviderType 057 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 058 PortalException.class, SystemException.class}) 059 public interface DLContentLocalService extends BaseLocalService, 060 PersistedModelLocalService { 061 /* 062 * NOTE FOR DEVELOPERS: 063 * 064 * Never modify or reference this interface directly. Always use {@link DLContentLocalServiceUtil} to access the document library content local service. Add custom service methods to {@link com.liferay.portlet.documentlibrary.service.impl.DLContentLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 065 */ 066 public DLContent addContent(long companyId, long repositoryId, 067 java.lang.String path, java.lang.String version, byte[] bytes); 068 069 public DLContent addContent(long companyId, long repositoryId, 070 java.lang.String path, java.lang.String version, 071 InputStream inputStream, long size); 072 073 /** 074 * Adds the document library content to the database. Also notifies the appropriate model listeners. 075 * 076 * @param dlContent the document library content 077 * @return the document library content that was added 078 */ 079 @Indexable(type = IndexableType.REINDEX) 080 public DLContent addDLContent(DLContent dlContent); 081 082 /** 083 * Creates a new document library content with the primary key. Does not add the document library content to the database. 084 * 085 * @param contentId the primary key for the new document library content 086 * @return the new document library content 087 */ 088 public DLContent createDLContent(long contentId); 089 090 public void deleteContent(long companyId, long repositoryId, 091 java.lang.String path, java.lang.String version) 092 throws PortalException; 093 094 public void deleteContents(long companyId, long repositoryId, 095 java.lang.String path); 096 097 public void deleteContentsByDirectory(long companyId, long repositoryId, 098 java.lang.String dirName); 099 100 /** 101 * Deletes the document library content with the primary key from the database. Also notifies the appropriate model listeners. 102 * 103 * @param contentId the primary key of the document library content 104 * @return the document library content that was removed 105 * @throws PortalException if a document library content with the primary key could not be found 106 */ 107 @Indexable(type = IndexableType.DELETE) 108 public DLContent deleteDLContent(long contentId) throws PortalException; 109 110 /** 111 * Deletes the document library content from the database. Also notifies the appropriate model listeners. 112 * 113 * @param dlContent the document library content 114 * @return the document library content that was removed 115 */ 116 @Indexable(type = IndexableType.DELETE) 117 public DLContent deleteDLContent(DLContent dlContent); 118 119 /** 120 * @throws PortalException 121 */ 122 @Override 123 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 124 throws PortalException; 125 126 public DynamicQuery dynamicQuery(); 127 128 /** 129 * Performs a dynamic query on the database and returns the matching rows. 130 * 131 * @param dynamicQuery the dynamic query 132 * @return the matching rows 133 */ 134 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 135 136 /** 137 * Performs a dynamic query on the database and returns a range of the matching rows. 138 * 139 * <p> 140 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.documentlibrary.model.impl.DLContentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 141 * </p> 142 * 143 * @param dynamicQuery the dynamic query 144 * @param start the lower bound of the range of model instances 145 * @param end the upper bound of the range of model instances (not inclusive) 146 * @return the range of matching rows 147 */ 148 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 149 int end); 150 151 /** 152 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 153 * 154 * <p> 155 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.documentlibrary.model.impl.DLContentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 156 * </p> 157 * 158 * @param dynamicQuery the dynamic query 159 * @param start the lower bound of the range of model instances 160 * @param end the upper bound of the range of model instances (not inclusive) 161 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 162 * @return the ordered range of matching rows 163 */ 164 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 165 int end, OrderByComparator<T> orderByComparator); 166 167 /** 168 * Returns the number of rows matching the dynamic query. 169 * 170 * @param dynamicQuery the dynamic query 171 * @return the number of rows matching the dynamic query 172 */ 173 public long dynamicQueryCount(DynamicQuery dynamicQuery); 174 175 /** 176 * Returns the number of rows matching the dynamic query. 177 * 178 * @param dynamicQuery the dynamic query 179 * @param projection the projection to apply to the query 180 * @return the number of rows matching the dynamic query 181 */ 182 public long dynamicQueryCount(DynamicQuery dynamicQuery, 183 Projection projection); 184 185 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 186 public DLContent fetchDLContent(long contentId); 187 188 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 189 public ActionableDynamicQuery getActionableDynamicQuery(); 190 191 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 192 public DLContent getContent(long companyId, long repositoryId, 193 java.lang.String path) throws NoSuchContentException; 194 195 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 196 public DLContent getContent(long companyId, long repositoryId, 197 java.lang.String path, java.lang.String version) 198 throws NoSuchContentException; 199 200 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 201 public List<DLContent> getContents(long companyId, long repositoryId); 202 203 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 204 public List<DLContent> getContents(long companyId, long repositoryId, 205 java.lang.String path); 206 207 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 208 public List<DLContent> getContentsByDirectory(long companyId, 209 long repositoryId, java.lang.String dirName); 210 211 /** 212 * Returns the document library content with the primary key. 213 * 214 * @param contentId the primary key of the document library content 215 * @return the document library content 216 * @throws PortalException if a document library content with the primary key could not be found 217 */ 218 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 219 public DLContent getDLContent(long contentId) throws PortalException; 220 221 /** 222 * Returns a range of all the document library contents. 223 * 224 * <p> 225 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portlet.documentlibrary.model.impl.DLContentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. 226 * </p> 227 * 228 * @param start the lower bound of the range of document library contents 229 * @param end the upper bound of the range of document library contents (not inclusive) 230 * @return the range of document library contents 231 */ 232 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 233 public List<DLContent> getDLContents(int start, int end); 234 235 /** 236 * Returns the number of document library contents. 237 * 238 * @return the number of document library contents 239 */ 240 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 241 public int getDLContentsCount(); 242 243 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 244 public DLContentDataBlobModel getDataBlobModel(Serializable primaryKey); 245 246 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 247 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 248 249 /** 250 * Returns the OSGi service identifier. 251 * 252 * @return the OSGi service identifier 253 */ 254 public java.lang.String getOSGiServiceIdentifier(); 255 256 @Override 257 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 258 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 259 throws PortalException; 260 261 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 262 public boolean hasContent(long companyId, long repositoryId, 263 java.lang.String path, java.lang.String version); 264 265 public void updateDLContent(long companyId, long oldRepositoryId, 266 long newRepositoryId, java.lang.String oldPath, java.lang.String newPath); 267 268 /** 269 * Updates the document library content in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 270 * 271 * @param dlContent the document library content 272 * @return the document library content that was updated 273 */ 274 @Indexable(type = IndexableType.REINDEX) 275 public DLContent updateDLContent(DLContent dlContent); 276 }