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.portlet.asset.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.search.IndexableType; 022 import com.liferay.portal.kernel.transaction.Isolation; 023 import com.liferay.portal.kernel.transaction.Propagation; 024 import com.liferay.portal.kernel.transaction.Transactional; 025 import com.liferay.portal.service.BaseLocalService; 026 import com.liferay.portal.service.PersistedModelLocalService; 027 028 /** 029 * Provides the local service interface for AssetLink. Methods of this 030 * service will not have security checks based on the propagated JAAS 031 * credentials because this service can only be accessed from within the same 032 * VM. 033 * 034 * @author Brian Wing Shun Chan 035 * @see AssetLinkLocalServiceUtil 036 * @see com.liferay.portlet.asset.service.base.AssetLinkLocalServiceBaseImpl 037 * @see com.liferay.portlet.asset.service.impl.AssetLinkLocalServiceImpl 038 * @generated 039 */ 040 @ProviderType 041 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 042 PortalException.class, SystemException.class}) 043 public interface AssetLinkLocalService extends BaseLocalService, 044 PersistedModelLocalService { 045 /* 046 * NOTE FOR DEVELOPERS: 047 * 048 * Never modify or reference this interface directly. Always use {@link AssetLinkLocalServiceUtil} to access the asset link local service. Add custom service methods to {@link com.liferay.portlet.asset.service.impl.AssetLinkLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 049 */ 050 051 /** 052 * Adds the asset link to the database. Also notifies the appropriate model listeners. 053 * 054 * @param assetLink the asset link 055 * @return the asset link that was added 056 */ 057 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 058 public com.liferay.portlet.asset.model.AssetLink addAssetLink( 059 com.liferay.portlet.asset.model.AssetLink assetLink); 060 061 /** 062 * Adds a new asset link. 063 * 064 * @param userId the primary key of the link's creator 065 * @param entryId1 the primary key of the first asset entry 066 * @param entryId2 the primary key of the second asset entry 067 * @param type the link type. Acceptable values include {@link 068 AssetLinkConstants#TYPE_RELATED} which is a bidirectional 069 relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a 070 unidirectional relationship. For more information see {@link 071 AssetLinkConstants} 072 * @param weight the weight of the relationship, allowing precedence 073 ordering of links 074 * @return the asset link 075 */ 076 public com.liferay.portlet.asset.model.AssetLink addLink(long userId, 077 long entryId1, long entryId2, int type, int weight) 078 throws PortalException; 079 080 /** 081 * Creates a new asset link with the primary key. Does not add the asset link to the database. 082 * 083 * @param linkId the primary key for the new asset link 084 * @return the new asset link 085 */ 086 public com.liferay.portlet.asset.model.AssetLink createAssetLink( 087 long linkId); 088 089 /** 090 * Deletes the asset link from the database. Also notifies the appropriate model listeners. 091 * 092 * @param assetLink the asset link 093 * @return the asset link that was removed 094 */ 095 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 096 public com.liferay.portlet.asset.model.AssetLink deleteAssetLink( 097 com.liferay.portlet.asset.model.AssetLink assetLink); 098 099 /** 100 * Deletes the asset link with the primary key from the database. Also notifies the appropriate model listeners. 101 * 102 * @param linkId the primary key of the asset link 103 * @return the asset link that was removed 104 * @throws PortalException if a asset link with the primary key could not be found 105 */ 106 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 107 public com.liferay.portlet.asset.model.AssetLink deleteAssetLink( 108 long linkId) throws PortalException; 109 110 public void deleteGroupLinks(long groupId); 111 112 /** 113 * Deletes the asset link. 114 * 115 * @param link the asset link 116 */ 117 public void deleteLink(com.liferay.portlet.asset.model.AssetLink link); 118 119 /** 120 * Deletes the asset link. 121 * 122 * @param linkId the primary key of the asset link 123 */ 124 public void deleteLink(long linkId) throws PortalException; 125 126 /** 127 * Deletes all links associated with the asset entry. 128 * 129 * @param entryId the primary key of the asset entry 130 */ 131 public void deleteLinks(long entryId); 132 133 /** 134 * Delete all links that associate the two asset entries. 135 * 136 * @param entryId1 the primary key of the first asset entry 137 * @param entryId2 the primary key of the second asset entry 138 */ 139 public void deleteLinks(long entryId1, long entryId2); 140 141 /** 142 * @throws PortalException 143 */ 144 @Override 145 public com.liferay.portal.model.PersistedModel deletePersistedModel( 146 com.liferay.portal.model.PersistedModel persistedModel) 147 throws PortalException; 148 149 public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); 150 151 /** 152 * Performs a dynamic query on the database and returns the matching rows. 153 * 154 * @param dynamicQuery the dynamic query 155 * @return the matching rows 156 */ 157 public <T> java.util.List<T> dynamicQuery( 158 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 159 160 /** 161 * Performs a dynamic query on the database and returns a range of the matching rows. 162 * 163 * <p> 164 * 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.asset.model.impl.AssetLinkModelImpl}. 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. 165 * </p> 166 * 167 * @param dynamicQuery the dynamic query 168 * @param start the lower bound of the range of model instances 169 * @param end the upper bound of the range of model instances (not inclusive) 170 * @return the range of matching rows 171 */ 172 public <T> java.util.List<T> dynamicQuery( 173 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 174 int end); 175 176 /** 177 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 178 * 179 * <p> 180 * 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.asset.model.impl.AssetLinkModelImpl}. 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. 181 * </p> 182 * 183 * @param dynamicQuery the dynamic query 184 * @param start the lower bound of the range of model instances 185 * @param end the upper bound of the range of model instances (not inclusive) 186 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 187 * @return the ordered range of matching rows 188 */ 189 public <T> java.util.List<T> dynamicQuery( 190 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 191 int end, 192 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator); 193 194 /** 195 * Returns the number of rows matching the dynamic query. 196 * 197 * @param dynamicQuery the dynamic query 198 * @return the number of rows matching the dynamic query 199 */ 200 public long dynamicQueryCount( 201 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 202 203 /** 204 * Returns the number of rows matching the dynamic query. 205 * 206 * @param dynamicQuery the dynamic query 207 * @param projection the projection to apply to the query 208 * @return the number of rows matching the dynamic query 209 */ 210 public long dynamicQueryCount( 211 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 212 com.liferay.portal.kernel.dao.orm.Projection projection); 213 214 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 215 public com.liferay.portlet.asset.model.AssetLink fetchAssetLink(long linkId); 216 217 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 218 public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(); 219 220 /** 221 * Returns the asset link with the primary key. 222 * 223 * @param linkId the primary key of the asset link 224 * @return the asset link 225 * @throws PortalException if a asset link with the primary key could not be found 226 */ 227 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 228 public com.liferay.portlet.asset.model.AssetLink getAssetLink(long linkId) 229 throws PortalException; 230 231 /** 232 * Returns a range of all the asset links. 233 * 234 * <p> 235 * 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.asset.model.impl.AssetLinkModelImpl}. 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. 236 * </p> 237 * 238 * @param start the lower bound of the range of asset links 239 * @param end the upper bound of the range of asset links (not inclusive) 240 * @return the range of asset links 241 */ 242 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 243 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getAssetLinks( 244 int start, int end); 245 246 /** 247 * Returns the number of asset links. 248 * 249 * @return the number of asset links 250 */ 251 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 252 public int getAssetLinksCount(); 253 254 /** 255 * Returns all the asset links whose first entry ID is the given entry ID. 256 * 257 * @param entryId the primary key of the asset entry 258 * @return the asset links whose first entry ID is the given entry ID 259 */ 260 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 261 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 262 long entryId); 263 264 /** 265 * Returns all the asset links of the given link type whose first entry ID 266 * is the given entry ID. 267 * 268 * @param entryId the primary key of the asset entry 269 * @param typeId the link type. Acceptable values include {@link 270 AssetLinkConstants#TYPE_RELATED} which is a bidirectional 271 relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a 272 unidirectional relationship. For more information see {@link 273 AssetLinkConstants} 274 * @return the asset links of the given link type whose first entry ID is 275 the given entry ID 276 */ 277 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 278 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 279 long entryId, int typeId); 280 281 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 282 public com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery getExportActionbleDynamicQuery( 283 com.liferay.portlet.exportimport.lar.PortletDataContext portletDataContext); 284 285 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 286 public com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery(); 287 288 /** 289 * Returns all the asset links whose first or second entry ID is the given 290 * entry ID. 291 * 292 * @param entryId the primary key of the asset entry 293 * @return the asset links whose first or second entry ID is the given entry 294 ID 295 */ 296 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 297 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 298 long entryId); 299 300 /** 301 * Returns all the asset links of the given link type whose first or second 302 * entry ID is the given entry ID. 303 * 304 * @param entryId the primary key of the asset entry 305 * @param typeId the link type. Acceptable values include {@link 306 AssetLinkConstants#TYPE_RELATED} which is a bidirectional 307 relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a 308 unidirectional relationship. For more information see {@link 309 AssetLinkConstants} 310 * @return the asset links of the given link type whose first or second 311 entry ID is the given entry ID 312 */ 313 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 314 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 315 long entryId, int typeId); 316 317 /** 318 * Returns the OSGi service identifier. 319 * 320 * @return the OSGi service identifier 321 */ 322 public java.lang.String getOSGiServiceIdentifier(); 323 324 @Override 325 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 326 public com.liferay.portal.model.PersistedModel getPersistedModel( 327 java.io.Serializable primaryKeyObj) throws PortalException; 328 329 /** 330 * Returns all the asset links of the given link type whose second entry ID 331 * is the given entry ID. 332 * 333 * @param entryId the primary key of the asset entry 334 * @param typeId the link type. Acceptable values include {@link 335 AssetLinkConstants#TYPE_RELATED} which is a bidirectional 336 relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a 337 unidirectional relationship. For more information see {@link 338 AssetLinkConstants} 339 * @return the asset links of the given link type whose second entry ID is 340 the given entry ID 341 */ 342 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 343 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getReverseLinks( 344 long entryId, int typeId); 345 346 /** 347 * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 348 * 349 * @param assetLink the asset link 350 * @return the asset link that was updated 351 */ 352 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 353 public com.liferay.portlet.asset.model.AssetLink updateAssetLink( 354 com.liferay.portlet.asset.model.AssetLink assetLink); 355 356 public com.liferay.portlet.asset.model.AssetLink updateLink(long userId, 357 long entryId1, long entryId2, int typeId, int weight) 358 throws PortalException; 359 360 /** 361 * Updates all links of the asset entry, replacing them with links 362 * associating the asset entry with the asset entries of the given link 363 * entry IDs. 364 * 365 * <p> 366 * If no link exists with a given link entry ID, a new link is created 367 * associating the current asset entry with the asset entry of that link 368 * entry ID. An existing link is deleted if either of its entry IDs is not 369 * contained in the given link entry IDs. 370 * </p> 371 * 372 * @param userId the primary key of the user updating the links 373 * @param entryId the primary key of the asset entry to be managed 374 * @param linkEntryIds the primary keys of the asset entries to be linked 375 with the asset entry to be managed 376 * @param typeId the type of the asset links to be created. Acceptable 377 values include {@link AssetLinkConstants#TYPE_RELATED} which is a 378 bidirectional relationship and {@link 379 AssetLinkConstants#TYPE_CHILD} which is a unidirectional 380 relationship. For more information see {@link AssetLinkConstants} 381 */ 382 public void updateLinks(long userId, long entryId, long[] linkEntryIds, 383 int typeId) throws PortalException; 384 }