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 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 067 public boolean hasContent(long companyId, long repositoryId, 068 java.lang.String path, java.lang.String version); 069 070 public DLContent addContent(long companyId, long repositoryId, 071 java.lang.String path, java.lang.String version, byte[] bytes); 072 073 public DLContent addContent(long companyId, long repositoryId, 074 java.lang.String path, java.lang.String version, 075 InputStream inputStream, long size); 076 077 /** 078 * Adds the document library content to the database. Also notifies the appropriate model listeners. 079 * 080 * @param dlContent the document library content 081 * @return the document library content that was added 082 */ 083 @Indexable(type = IndexableType.REINDEX) 084 public DLContent addDLContent(DLContent dlContent); 085 086 /** 087 * Creates a new document library content with the primary key. Does not add the document library content to the database. 088 * 089 * @param contentId the primary key for the new document library content 090 * @return the new document library content 091 */ 092 public DLContent createDLContent(long contentId); 093 094 /** 095 * Deletes the document library content from the database. Also notifies the appropriate model listeners. 096 * 097 * @param dlContent the document library content 098 * @return the document library content that was removed 099 */ 100 @Indexable(type = IndexableType.DELETE) 101 public DLContent deleteDLContent(DLContent dlContent); 102 103 /** 104 * Deletes the document library content with the primary key from the database. Also notifies the appropriate model listeners. 105 * 106 * @param contentId the primary key of the document library content 107 * @return the document library content that was removed 108 * @throws PortalException if a document library content with the primary key could not be found 109 */ 110 @Indexable(type = IndexableType.DELETE) 111 public DLContent deleteDLContent(long contentId) throws PortalException; 112 113 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 114 public DLContent fetchDLContent(long contentId); 115 116 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 117 public DLContent getContent(long companyId, long repositoryId, 118 java.lang.String path) throws NoSuchContentException; 119 120 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 121 public DLContent getContent(long companyId, long repositoryId, 122 java.lang.String path, java.lang.String version) 123 throws NoSuchContentException; 124 125 /** 126 * Returns the document library content with the primary key. 127 * 128 * @param contentId the primary key of the document library content 129 * @return the document library content 130 * @throws PortalException if a document library content with the primary key could not be found 131 */ 132 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 133 public DLContent getDLContent(long contentId) throws PortalException; 134 135 /** 136 * Updates the document library content in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 137 * 138 * @param dlContent the document library content 139 * @return the document library content that was updated 140 */ 141 @Indexable(type = IndexableType.REINDEX) 142 public DLContent updateDLContent(DLContent dlContent); 143 144 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 145 public DLContentDataBlobModel getDataBlobModel(Serializable primaryKey); 146 147 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 148 public ActionableDynamicQuery getActionableDynamicQuery(); 149 150 public DynamicQuery dynamicQuery(); 151 152 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 153 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 154 155 /** 156 * @throws PortalException 157 */ 158 @Override 159 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 160 throws PortalException; 161 162 @Override 163 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 164 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 165 throws PortalException; 166 167 /** 168 * Returns the number of document library contents. 169 * 170 * @return the number of document library contents 171 */ 172 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 173 public int getDLContentsCount(); 174 175 /** 176 * Returns the OSGi service identifier. 177 * 178 * @return the OSGi service identifier 179 */ 180 public java.lang.String getOSGiServiceIdentifier(); 181 182 /** 183 * Performs a dynamic query on the database and returns the matching rows. 184 * 185 * @param dynamicQuery the dynamic query 186 * @return the matching rows 187 */ 188 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 189 190 /** 191 * Performs a dynamic query on the database and returns a range of the matching rows. 192 * 193 * <p> 194 * 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. 195 * </p> 196 * 197 * @param dynamicQuery the dynamic query 198 * @param start the lower bound of the range of model instances 199 * @param end the upper bound of the range of model instances (not inclusive) 200 * @return the range of matching rows 201 */ 202 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 203 int end); 204 205 /** 206 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 207 * 208 * <p> 209 * 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. 210 * </p> 211 * 212 * @param dynamicQuery the dynamic query 213 * @param start the lower bound of the range of model instances 214 * @param end the upper bound of the range of model instances (not inclusive) 215 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 216 * @return the ordered range of matching rows 217 */ 218 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 219 int end, OrderByComparator<T> orderByComparator); 220 221 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 222 public List<DLContent> getContents(long companyId, long repositoryId); 223 224 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 225 public List<DLContent> getContents(long companyId, long repositoryId, 226 java.lang.String path); 227 228 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 229 public List<DLContent> getContentsByDirectory(long companyId, 230 long repositoryId, java.lang.String dirName); 231 232 /** 233 * Returns a range of all the document library contents. 234 * 235 * <p> 236 * 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. 237 * </p> 238 * 239 * @param start the lower bound of the range of document library contents 240 * @param end the upper bound of the range of document library contents (not inclusive) 241 * @return the range of document library contents 242 */ 243 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 244 public List<DLContent> getDLContents(int start, int end); 245 246 /** 247 * Returns the number of rows matching the dynamic query. 248 * 249 * @param dynamicQuery the dynamic query 250 * @return the number of rows matching the dynamic query 251 */ 252 public long dynamicQueryCount(DynamicQuery dynamicQuery); 253 254 /** 255 * Returns the number of rows matching the dynamic query. 256 * 257 * @param dynamicQuery the dynamic query 258 * @param projection the projection to apply to the query 259 * @return the number of rows matching the dynamic query 260 */ 261 public long dynamicQueryCount(DynamicQuery dynamicQuery, 262 Projection projection); 263 264 public void deleteContent(long companyId, long repositoryId, 265 java.lang.String path, java.lang.String version) 266 throws PortalException; 267 268 public void deleteContents(long companyId, long repositoryId, 269 java.lang.String path); 270 271 public void deleteContentsByDirectory(long companyId, long repositoryId, 272 java.lang.String dirName); 273 274 public void updateDLContent(long companyId, long oldRepositoryId, 275 long newRepositoryId, java.lang.String oldPath, java.lang.String newPath); 276 }