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