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 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 069 which is a bidirectional relationship and {@link 070 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 071 which is a unidirectional relationship. For more information see 072 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 073 * @param weight the weight of the relationship, allowing precedence 074 ordering of links 075 * @return the asset link 076 * @throws PortalException if the user could not be found 077 */ 078 public com.liferay.portlet.asset.model.AssetLink addLink(long userId, 079 long entryId1, long entryId2, int type, int weight) 080 throws com.liferay.portal.kernel.exception.PortalException; 081 082 /** 083 * Creates a new asset link with the primary key. Does not add the asset link to the database. 084 * 085 * @param linkId the primary key for the new asset link 086 * @return the new asset link 087 */ 088 public com.liferay.portlet.asset.model.AssetLink createAssetLink( 089 long linkId); 090 091 /** 092 * Deletes the asset link from the database. Also notifies the appropriate model listeners. 093 * 094 * @param assetLink the asset link 095 * @return the asset link that was removed 096 */ 097 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 098 public com.liferay.portlet.asset.model.AssetLink deleteAssetLink( 099 com.liferay.portlet.asset.model.AssetLink assetLink); 100 101 /** 102 * Deletes the asset link with the primary key from the database. Also notifies the appropriate model listeners. 103 * 104 * @param linkId the primary key of the asset link 105 * @return the asset link that was removed 106 * @throws PortalException if a asset link with the primary key could not be found 107 */ 108 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.DELETE) 109 public com.liferay.portlet.asset.model.AssetLink deleteAssetLink( 110 long linkId) throws com.liferay.portal.kernel.exception.PortalException; 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 * @throws PortalException if the asset link could not be found 124 */ 125 public void deleteLink(long linkId) 126 throws com.liferay.portal.kernel.exception.PortalException; 127 128 /** 129 * Deletes all links associated with the asset entry. 130 * 131 * @param entryId the primary key of the asset entry 132 */ 133 public void deleteLinks(long entryId); 134 135 /** 136 * Delete all links that associate the two asset entries. 137 * 138 * @param entryId1 the primary key of the first asset entry 139 * @param entryId2 the primary key of the second asset entry 140 */ 141 public void deleteLinks(long entryId1, long entryId2); 142 143 /** 144 * @throws PortalException 145 */ 146 @Override 147 public com.liferay.portal.model.PersistedModel deletePersistedModel( 148 com.liferay.portal.model.PersistedModel persistedModel) 149 throws com.liferay.portal.kernel.exception.PortalException; 150 151 public com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery(); 152 153 /** 154 * Performs a dynamic query on the database and returns the matching rows. 155 * 156 * @param dynamicQuery the dynamic query 157 * @return the matching rows 158 */ 159 public <T> java.util.List<T> dynamicQuery( 160 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 161 162 /** 163 * Performs a dynamic query on the database and returns a range of the matching rows. 164 * 165 * <p> 166 * 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. 167 * </p> 168 * 169 * @param dynamicQuery the dynamic query 170 * @param start the lower bound of the range of model instances 171 * @param end the upper bound of the range of model instances (not inclusive) 172 * @return the range of matching rows 173 */ 174 public <T> java.util.List<T> dynamicQuery( 175 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 176 int end); 177 178 /** 179 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 180 * 181 * <p> 182 * 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. 183 * </p> 184 * 185 * @param dynamicQuery the dynamic query 186 * @param start the lower bound of the range of model instances 187 * @param end the upper bound of the range of model instances (not inclusive) 188 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 189 * @return the ordered range of matching rows 190 */ 191 public <T> java.util.List<T> dynamicQuery( 192 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 193 int end, 194 com.liferay.portal.kernel.util.OrderByComparator<T> orderByComparator); 195 196 /** 197 * Returns the number of rows matching the dynamic query. 198 * 199 * @param dynamicQuery the dynamic query 200 * @return the number of rows matching the dynamic query 201 */ 202 public long dynamicQueryCount( 203 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery); 204 205 /** 206 * Returns the number of rows matching the dynamic query. 207 * 208 * @param dynamicQuery the dynamic query 209 * @param projection the projection to apply to the query 210 * @return the number of rows matching the dynamic query 211 */ 212 public long dynamicQueryCount( 213 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 214 com.liferay.portal.kernel.dao.orm.Projection projection); 215 216 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 217 public com.liferay.portlet.asset.model.AssetLink fetchAssetLink(long linkId); 218 219 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 220 public com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(); 221 222 /** 223 * Returns the asset link with the primary key. 224 * 225 * @param linkId the primary key of the asset link 226 * @return the asset link 227 * @throws PortalException if a asset link with the primary key could not be found 228 */ 229 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 230 public com.liferay.portlet.asset.model.AssetLink getAssetLink(long linkId) 231 throws com.liferay.portal.kernel.exception.PortalException; 232 233 /** 234 * Returns a range of all the asset links. 235 * 236 * <p> 237 * 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. 238 * </p> 239 * 240 * @param start the lower bound of the range of asset links 241 * @param end the upper bound of the range of asset links (not inclusive) 242 * @return the range of asset links 243 */ 244 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 245 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getAssetLinks( 246 int start, int end); 247 248 /** 249 * Returns the number of asset links. 250 * 251 * @return the number of asset links 252 */ 253 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 254 public int getAssetLinksCount(); 255 256 /** 257 * Returns the Spring bean ID for this bean. 258 * 259 * @return the Spring bean ID for this bean 260 */ 261 public java.lang.String getBeanIdentifier(); 262 263 /** 264 * Returns all the asset links whose first entry ID is the given entry ID. 265 * 266 * @param entryId the primary key of the asset entry 267 * @return the asset links whose first entry ID is the given entry ID 268 */ 269 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 270 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 271 long entryId); 272 273 /** 274 * Returns all the asset links of the given link type whose first entry ID 275 * is the given entry ID. 276 * 277 * @param entryId the primary key of the asset entry 278 * @param typeId the link type. Acceptable values include {@link 279 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 280 which is a bidirectional relationship and {@link 281 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 282 which is a unidirectional relationship. For more information see 283 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 284 * @return the asset links of the given link type whose first entry ID is 285 the given entry ID 286 */ 287 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 288 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 289 long entryId, int typeId); 290 291 /** 292 * Returns all the asset links whose first or second entry ID is the given 293 * entry ID. 294 * 295 * @param entryId the primary key of the asset entry 296 * @return the asset links whose first or second entry ID is the given entry 297 ID 298 */ 299 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 300 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 301 long entryId); 302 303 /** 304 * Returns all the asset links of the given link type whose first or second 305 * entry ID is the given entry ID. 306 * 307 * @param entryId the primary key of the asset entry 308 * @param typeId the link type. Acceptable values include {@link 309 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 310 which is a bidirectional relationship and {@link 311 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 312 which is a unidirectional relationship. For more information see 313 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 314 * @return the asset links of the given link type whose first or second 315 entry ID is the given entry ID 316 */ 317 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 318 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 319 long entryId, int typeId); 320 321 @Override 322 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 323 public com.liferay.portal.model.PersistedModel getPersistedModel( 324 java.io.Serializable primaryKeyObj) 325 throws com.liferay.portal.kernel.exception.PortalException; 326 327 /** 328 * Returns all the asset links of the given link type whose second entry ID 329 * is the given entry ID. 330 * 331 * @param entryId the primary key of the asset entry 332 * @param typeId the link type. Acceptable values include {@link 333 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 334 which is a bidirectional relationship and {@link 335 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 336 which is a unidirectional relationship. For more information see 337 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 338 * @return the asset links of the given link type whose second entry ID is 339 the given entry ID 340 */ 341 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 342 public java.util.List<com.liferay.portlet.asset.model.AssetLink> getReverseLinks( 343 long entryId, int typeId); 344 345 /** 346 * Sets the Spring bean ID for this bean. 347 * 348 * @param beanIdentifier the Spring bean ID for this bean 349 */ 350 public void setBeanIdentifier(java.lang.String beanIdentifier); 351 352 /** 353 * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 354 * 355 * @param assetLink the asset link 356 * @return the asset link that was updated 357 */ 358 @com.liferay.portal.kernel.search.Indexable(type = IndexableType.REINDEX) 359 public com.liferay.portlet.asset.model.AssetLink updateAssetLink( 360 com.liferay.portlet.asset.model.AssetLink assetLink); 361 362 public com.liferay.portlet.asset.model.AssetLink updateLink(long userId, 363 long entryId1, long entryId2, int typeId, int weight) 364 throws com.liferay.portal.kernel.exception.PortalException; 365 366 /** 367 * Updates all links of the asset entry, replacing them with links 368 * associating the asset entry with the asset entries of the given link 369 * entry IDs. 370 * 371 * <p> 372 * If no link exists with a given link entry ID, a new link is created 373 * associating the current asset entry with the asset entry of that link 374 * entry ID. An existing link is deleted if either of its entry IDs is not 375 * contained in the given link entry IDs. 376 * </p> 377 * 378 * @param userId the primary key of the user updating the links 379 * @param entryId the primary key of the asset entry to be managed 380 * @param linkEntryIds the primary keys of the asset entries to be linked 381 with the asset entry to be managed 382 * @param typeId the type of the asset links to be created. Acceptable 383 values include {@link 384 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 385 which is a bidirectional relationship and {@link 386 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 387 which is a unidirectional relationship. For more information see 388 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 389 * @throws PortalException if the user could not be found 390 */ 391 public void updateLinks(long userId, long entryId, long[] linkEntryIds, 392 int typeId) throws com.liferay.portal.kernel.exception.PortalException; 393 }