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