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.portal.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.exportimport.kernel.lar.PortletDataContext; 020 021 import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; 022 import com.liferay.portal.kernel.dao.orm.DynamicQuery; 023 import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery; 024 import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery; 025 import com.liferay.portal.kernel.dao.orm.Projection; 026 import com.liferay.portal.kernel.exception.PortalException; 027 import com.liferay.portal.kernel.exception.SystemException; 028 import com.liferay.portal.kernel.model.PersistedModel; 029 import com.liferay.portal.kernel.model.Repository; 030 import com.liferay.portal.kernel.model.SystemEventConstants; 031 import com.liferay.portal.kernel.search.Indexable; 032 import com.liferay.portal.kernel.search.IndexableType; 033 import com.liferay.portal.kernel.systemevent.SystemEvent; 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 import com.liferay.portal.kernel.util.UnicodeProperties; 039 040 import java.io.Serializable; 041 042 import java.util.List; 043 044 /** 045 * Provides the local service interface for Repository. 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 RepositoryLocalServiceUtil 052 * @see com.liferay.portal.service.base.RepositoryLocalServiceBaseImpl 053 * @see com.liferay.portal.service.impl.RepositoryLocalServiceImpl 054 * @generated 055 */ 056 @ProviderType 057 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 058 PortalException.class, SystemException.class}) 059 public interface RepositoryLocalService extends BaseLocalService, 060 PersistedModelLocalService { 061 /* 062 * NOTE FOR DEVELOPERS: 063 * 064 * Never modify or reference this interface directly. Always use {@link RepositoryLocalServiceUtil} to access the repository local service. Add custom service methods to {@link com.liferay.portal.service.impl.RepositoryLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 065 */ 066 067 /** 068 * Adds the repository to the database. Also notifies the appropriate model listeners. 069 * 070 * @param repository the repository 071 * @return the repository that was added 072 */ 073 @Indexable(type = IndexableType.REINDEX) 074 public Repository addRepository(Repository repository); 075 076 public Repository addRepository(long userId, long groupId, 077 long classNameId, long parentFolderId, java.lang.String name, 078 java.lang.String description, java.lang.String portletId, 079 UnicodeProperties typeSettingsProperties, boolean hidden, 080 com.liferay.portal.kernel.service.ServiceContext serviceContext) 081 throws PortalException; 082 083 public void checkRepository(long repositoryId); 084 085 /** 086 * Creates a new repository with the primary key. Does not add the repository to the database. 087 * 088 * @param repositoryId the primary key for the new repository 089 * @return the new repository 090 */ 091 public Repository createRepository(long repositoryId); 092 093 /** 094 * @throws PortalException 095 */ 096 @Override 097 public PersistedModel deletePersistedModel(PersistedModel persistedModel) 098 throws PortalException; 099 100 public void deleteRepositories(long groupId) throws PortalException; 101 102 /** 103 * Deletes the repository from the database. Also notifies the appropriate model listeners. 104 * 105 * @param repository the repository 106 * @return the repository that was removed 107 */ 108 @Indexable(type = IndexableType.DELETE) 109 @SystemEvent(action = SystemEventConstants.ACTION_SKIP, type = SystemEventConstants.TYPE_DELETE) 110 public Repository deleteRepository(Repository repository); 111 112 /** 113 * Deletes the repository with the primary key from the database. Also notifies the appropriate model listeners. 114 * 115 * @param repositoryId the primary key of the repository 116 * @return the repository that was removed 117 * @throws PortalException if a repository with the primary key could not be found 118 */ 119 @Indexable(type = IndexableType.DELETE) 120 public Repository deleteRepository(long repositoryId) 121 throws PortalException; 122 123 public DynamicQuery dynamicQuery(); 124 125 /** 126 * Performs a dynamic query on the database and returns the matching rows. 127 * 128 * @param dynamicQuery the dynamic query 129 * @return the matching rows 130 */ 131 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); 132 133 /** 134 * Performs a dynamic query on the database and returns a range of the matching rows. 135 * 136 * <p> 137 * 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.portal.model.impl.RepositoryModelImpl}. 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. 138 * </p> 139 * 140 * @param dynamicQuery the dynamic query 141 * @param start the lower bound of the range of model instances 142 * @param end the upper bound of the range of model instances (not inclusive) 143 * @return the range of matching rows 144 */ 145 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 146 int end); 147 148 /** 149 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 150 * 151 * <p> 152 * 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.portal.model.impl.RepositoryModelImpl}. 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. 153 * </p> 154 * 155 * @param dynamicQuery the dynamic query 156 * @param start the lower bound of the range of model instances 157 * @param end the upper bound of the range of model instances (not inclusive) 158 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 159 * @return the ordered range of matching rows 160 */ 161 public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, 162 int end, OrderByComparator<T> orderByComparator); 163 164 /** 165 * Returns the number of rows matching the dynamic query. 166 * 167 * @param dynamicQuery the dynamic query 168 * @return the number of rows matching the dynamic query 169 */ 170 public long dynamicQueryCount(DynamicQuery dynamicQuery); 171 172 /** 173 * Returns the number of rows matching the dynamic query. 174 * 175 * @param dynamicQuery the dynamic query 176 * @param projection the projection to apply to the query 177 * @return the number of rows matching the dynamic query 178 */ 179 public long dynamicQueryCount(DynamicQuery dynamicQuery, 180 Projection projection); 181 182 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 183 public Repository fetchRepository(long groupId, java.lang.String name, 184 java.lang.String portletId); 185 186 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 187 public Repository fetchRepository(long groupId, java.lang.String portletId); 188 189 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 190 public Repository fetchRepository(long repositoryId); 191 192 /** 193 * Returns the repository matching the UUID and group. 194 * 195 * @param uuid the repository's UUID 196 * @param groupId the primary key of the group 197 * @return the matching repository, or <code>null</code> if a matching repository could not be found 198 */ 199 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 200 public Repository fetchRepositoryByUuidAndGroupId(java.lang.String uuid, 201 long groupId); 202 203 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 204 public ActionableDynamicQuery getActionableDynamicQuery(); 205 206 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 207 public ExportActionableDynamicQuery getExportActionableDynamicQuery( 208 PortletDataContext portletDataContext); 209 210 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 211 public List<Repository> getGroupRepositories(long groupId); 212 213 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 214 public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 215 216 /** 217 * Returns the OSGi service identifier. 218 * 219 * @return the OSGi service identifier 220 */ 221 public java.lang.String getOSGiServiceIdentifier(); 222 223 @Override 224 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 225 public PersistedModel getPersistedModel(Serializable primaryKeyObj) 226 throws PortalException; 227 228 /** 229 * Returns a range of all the repositories. 230 * 231 * <p> 232 * 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.portal.model.impl.RepositoryModelImpl}. 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. 233 * </p> 234 * 235 * @param start the lower bound of the range of repositories 236 * @param end the upper bound of the range of repositories (not inclusive) 237 * @return the range of repositories 238 */ 239 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 240 public List<Repository> getRepositories(int start, int end); 241 242 /** 243 * Returns all the repositories matching the UUID and company. 244 * 245 * @param uuid the UUID of the repositories 246 * @param companyId the primary key of the company 247 * @return the matching repositories, or an empty list if no matches were found 248 */ 249 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 250 public List<Repository> getRepositoriesByUuidAndCompanyId( 251 java.lang.String uuid, long companyId); 252 253 /** 254 * Returns a range of repositories matching the UUID and company. 255 * 256 * @param uuid the UUID of the repositories 257 * @param companyId the primary key of the company 258 * @param start the lower bound of the range of repositories 259 * @param end the upper bound of the range of repositories (not inclusive) 260 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 261 * @return the range of matching repositories, or an empty list if no matches were found 262 */ 263 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 264 public List<Repository> getRepositoriesByUuidAndCompanyId( 265 java.lang.String uuid, long companyId, int start, int end, 266 OrderByComparator<Repository> orderByComparator); 267 268 /** 269 * Returns the number of repositories. 270 * 271 * @return the number of repositories 272 */ 273 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 274 public int getRepositoriesCount(); 275 276 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 277 public Repository getRepository(long groupId, java.lang.String name, 278 java.lang.String portletId) throws PortalException; 279 280 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 281 public Repository getRepository(long groupId, java.lang.String portletId) 282 throws PortalException; 283 284 /** 285 * Returns the repository with the primary key. 286 * 287 * @param repositoryId the primary key of the repository 288 * @return the repository 289 * @throws PortalException if a repository with the primary key could not be found 290 */ 291 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 292 public Repository getRepository(long repositoryId) 293 throws PortalException; 294 295 /** 296 * Returns the repository matching the UUID and group. 297 * 298 * @param uuid the repository's UUID 299 * @param groupId the primary key of the group 300 * @return the matching repository 301 * @throws PortalException if a matching repository could not be found 302 */ 303 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 304 public Repository getRepositoryByUuidAndGroupId(java.lang.String uuid, 305 long groupId) throws PortalException; 306 307 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 308 public UnicodeProperties getTypeSettingsProperties(long repositoryId) 309 throws PortalException; 310 311 /** 312 * Updates the repository in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 313 * 314 * @param repository the repository 315 * @return the repository that was updated 316 */ 317 @Indexable(type = IndexableType.REINDEX) 318 public Repository updateRepository(Repository repository); 319 320 public void updateRepository(long repositoryId, java.lang.String name, 321 java.lang.String description) throws PortalException; 322 323 public void updateRepository(long repositoryId, 324 UnicodeProperties typeSettingsProperties) throws PortalException; 325 }