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