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