001 /** 002 * Copyright (c) 2000-2013 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 * @throws SystemException if a system exception occurred 050 */ 051 public static com.liferay.portlet.asset.model.AssetLink addAssetLink( 052 com.liferay.portlet.asset.model.AssetLink assetLink) 053 throws com.liferay.portal.kernel.exception.SystemException { 054 return getService().addAssetLink(assetLink); 055 } 056 057 /** 058 * Creates a new asset link with the primary key. Does not add the asset link to the database. 059 * 060 * @param linkId the primary key for the new asset link 061 * @return the new asset link 062 */ 063 public static com.liferay.portlet.asset.model.AssetLink createAssetLink( 064 long linkId) { 065 return getService().createAssetLink(linkId); 066 } 067 068 /** 069 * Deletes the asset link with the primary key from the database. Also notifies the appropriate model listeners. 070 * 071 * @param linkId the primary key of the asset link 072 * @return the asset link that was removed 073 * @throws PortalException if a asset link with the primary key could not be found 074 * @throws SystemException if a system exception occurred 075 */ 076 public static com.liferay.portlet.asset.model.AssetLink deleteAssetLink( 077 long linkId) 078 throws com.liferay.portal.kernel.exception.PortalException, 079 com.liferay.portal.kernel.exception.SystemException { 080 return getService().deleteAssetLink(linkId); 081 } 082 083 /** 084 * Deletes the asset link from the database. Also notifies the appropriate model listeners. 085 * 086 * @param assetLink the asset link 087 * @return the asset link that was removed 088 * @throws SystemException if a system exception occurred 089 */ 090 public static com.liferay.portlet.asset.model.AssetLink deleteAssetLink( 091 com.liferay.portlet.asset.model.AssetLink assetLink) 092 throws com.liferay.portal.kernel.exception.SystemException { 093 return getService().deleteAssetLink(assetLink); 094 } 095 096 public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() { 097 return getService().dynamicQuery(); 098 } 099 100 /** 101 * Performs a dynamic query on the database and returns the matching rows. 102 * 103 * @param dynamicQuery the dynamic query 104 * @return the matching rows 105 * @throws SystemException if a system exception occurred 106 */ 107 @SuppressWarnings("rawtypes") 108 public static java.util.List dynamicQuery( 109 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 110 throws com.liferay.portal.kernel.exception.SystemException { 111 return getService().dynamicQuery(dynamicQuery); 112 } 113 114 /** 115 * Performs a dynamic query on the database and returns a range of the matching rows. 116 * 117 * <p> 118 * 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. 119 * </p> 120 * 121 * @param dynamicQuery the dynamic query 122 * @param start the lower bound of the range of model instances 123 * @param end the upper bound of the range of model instances (not inclusive) 124 * @return the range of matching rows 125 * @throws SystemException if a system exception occurred 126 */ 127 @SuppressWarnings("rawtypes") 128 public static java.util.List dynamicQuery( 129 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 130 int end) throws com.liferay.portal.kernel.exception.SystemException { 131 return getService().dynamicQuery(dynamicQuery, start, end); 132 } 133 134 /** 135 * Performs a dynamic query on the database and returns an ordered range of the matching rows. 136 * 137 * <p> 138 * 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. 139 * </p> 140 * 141 * @param dynamicQuery the dynamic query 142 * @param start the lower bound of the range of model instances 143 * @param end the upper bound of the range of model instances (not inclusive) 144 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) 145 * @return the ordered range of matching rows 146 * @throws SystemException if a system exception occurred 147 */ 148 @SuppressWarnings("rawtypes") 149 public static java.util.List dynamicQuery( 150 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, 151 int end, 152 com.liferay.portal.kernel.util.OrderByComparator orderByComparator) 153 throws com.liferay.portal.kernel.exception.SystemException { 154 return getService() 155 .dynamicQuery(dynamicQuery, start, end, orderByComparator); 156 } 157 158 /** 159 * Returns the number of rows that match the dynamic query. 160 * 161 * @param dynamicQuery the dynamic query 162 * @return the number of rows that match the dynamic query 163 * @throws SystemException if a system exception occurred 164 */ 165 public static long dynamicQueryCount( 166 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) 167 throws com.liferay.portal.kernel.exception.SystemException { 168 return getService().dynamicQueryCount(dynamicQuery); 169 } 170 171 /** 172 * Returns the number of rows that match the dynamic query. 173 * 174 * @param dynamicQuery the dynamic query 175 * @param projection the projection to apply to the query 176 * @return the number of rows that match the dynamic query 177 * @throws SystemException if a system exception occurred 178 */ 179 public static long dynamicQueryCount( 180 com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, 181 com.liferay.portal.kernel.dao.orm.Projection projection) 182 throws com.liferay.portal.kernel.exception.SystemException { 183 return getService().dynamicQueryCount(dynamicQuery, projection); 184 } 185 186 public static com.liferay.portlet.asset.model.AssetLink fetchAssetLink( 187 long linkId) throws com.liferay.portal.kernel.exception.SystemException { 188 return getService().fetchAssetLink(linkId); 189 } 190 191 /** 192 * Returns the asset link with the primary key. 193 * 194 * @param linkId the primary key of the asset link 195 * @return the asset link 196 * @throws PortalException if a asset link with the primary key could not be found 197 * @throws SystemException if a system exception occurred 198 */ 199 public static com.liferay.portlet.asset.model.AssetLink getAssetLink( 200 long linkId) 201 throws com.liferay.portal.kernel.exception.PortalException, 202 com.liferay.portal.kernel.exception.SystemException { 203 return getService().getAssetLink(linkId); 204 } 205 206 public static com.liferay.portal.model.PersistedModel getPersistedModel( 207 java.io.Serializable primaryKeyObj) 208 throws com.liferay.portal.kernel.exception.PortalException, 209 com.liferay.portal.kernel.exception.SystemException { 210 return getService().getPersistedModel(primaryKeyObj); 211 } 212 213 /** 214 * Returns a range of all the asset links. 215 * 216 * <p> 217 * 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. 218 * </p> 219 * 220 * @param start the lower bound of the range of asset links 221 * @param end the upper bound of the range of asset links (not inclusive) 222 * @return the range of asset links 223 * @throws SystemException if a system exception occurred 224 */ 225 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getAssetLinks( 226 int start, int end) 227 throws com.liferay.portal.kernel.exception.SystemException { 228 return getService().getAssetLinks(start, end); 229 } 230 231 /** 232 * Returns the number of asset links. 233 * 234 * @return the number of asset links 235 * @throws SystemException if a system exception occurred 236 */ 237 public static int getAssetLinksCount() 238 throws com.liferay.portal.kernel.exception.SystemException { 239 return getService().getAssetLinksCount(); 240 } 241 242 /** 243 * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners. 244 * 245 * @param assetLink the asset link 246 * @return the asset link that was updated 247 * @throws SystemException if a system exception occurred 248 */ 249 public static com.liferay.portlet.asset.model.AssetLink updateAssetLink( 250 com.liferay.portlet.asset.model.AssetLink assetLink) 251 throws com.liferay.portal.kernel.exception.SystemException { 252 return getService().updateAssetLink(assetLink); 253 } 254 255 /** 256 * Returns the Spring bean ID for this bean. 257 * 258 * @return the Spring bean ID for this bean 259 */ 260 public static java.lang.String getBeanIdentifier() { 261 return getService().getBeanIdentifier(); 262 } 263 264 /** 265 * Sets the Spring bean ID for this bean. 266 * 267 * @param beanIdentifier the Spring bean ID for this bean 268 */ 269 public static void setBeanIdentifier(java.lang.String beanIdentifier) { 270 getService().setBeanIdentifier(beanIdentifier); 271 } 272 273 /** 274 * Adds a new asset link. 275 * 276 * @param userId the primary key of the link's creator 277 * @param entryId1 the primary key of the first asset entry 278 * @param entryId2 the primary key of the second asset entry 279 * @param type the link type. Acceptable values include {@link 280 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 281 which is a bidirectional relationship and {@link 282 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 283 which is a unidirectional relationship. For more information see 284 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 285 * @param weight the weight of the relationship, allowing precedence 286 ordering of links 287 * @return the asset link 288 * @throws PortalException if the user could not be found 289 * @throws SystemException if a system exception occurred 290 */ 291 public static com.liferay.portlet.asset.model.AssetLink addLink( 292 long userId, long entryId1, long entryId2, int type, int weight) 293 throws com.liferay.portal.kernel.exception.PortalException, 294 com.liferay.portal.kernel.exception.SystemException { 295 return getService().addLink(userId, entryId1, entryId2, type, weight); 296 } 297 298 /** 299 * Deletes the asset link. 300 * 301 * @param link the asset link 302 * @throws SystemException if a system exception occurred 303 */ 304 public static void deleteLink( 305 com.liferay.portlet.asset.model.AssetLink link) 306 throws com.liferay.portal.kernel.exception.SystemException { 307 getService().deleteLink(link); 308 } 309 310 /** 311 * Deletes the asset link. 312 * 313 * @param linkId the primary key of the asset link 314 * @throws PortalException if the asset link could not be found 315 * @throws SystemException if a system exception occurred 316 */ 317 public static void deleteLink(long linkId) 318 throws com.liferay.portal.kernel.exception.PortalException, 319 com.liferay.portal.kernel.exception.SystemException { 320 getService().deleteLink(linkId); 321 } 322 323 /** 324 * Deletes all links associated with the asset entry. 325 * 326 * @param entryId the primary key of the asset entry 327 * @throws SystemException if a system exception occurred 328 */ 329 public static void deleteLinks(long entryId) 330 throws com.liferay.portal.kernel.exception.SystemException { 331 getService().deleteLinks(entryId); 332 } 333 334 /** 335 * Delete all links that associate the two asset entries. 336 * 337 * @param entryId1 the primary key of the first asset entry 338 * @param entryId2 the primary key of the second asset entry 339 * @throws SystemException if a system exception occurred 340 */ 341 public static void deleteLinks(long entryId1, long entryId2) 342 throws com.liferay.portal.kernel.exception.SystemException { 343 getService().deleteLinks(entryId1, entryId2); 344 } 345 346 /** 347 * Returns all the asset links whose first entry ID is the given entry ID. 348 * 349 * @param entryId the primary key of the asset entry 350 * @return the asset links whose first entry ID is the given entry ID 351 * @throws SystemException if a system exception occurred 352 */ 353 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 354 long entryId) 355 throws com.liferay.portal.kernel.exception.SystemException { 356 return getService().getDirectLinks(entryId); 357 } 358 359 /** 360 * Returns all the asset links of the given link type whose first entry ID 361 * is the given entry ID. 362 * 363 * @param entryId the primary key of the asset entry 364 * @param typeId the link type. Acceptable values include {@link 365 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 366 which is a bidirectional relationship and {@link 367 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 368 which is a unidirectional relationship. For more information see 369 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 370 * @return the asset links of the given link type whose first entry ID is 371 the given entry ID 372 * @throws SystemException if a system exception occurred 373 */ 374 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 375 long entryId, int typeId) 376 throws com.liferay.portal.kernel.exception.SystemException { 377 return getService().getDirectLinks(entryId, typeId); 378 } 379 380 /** 381 * Returns all the asset links whose first or second entry ID is the given 382 * entry ID. 383 * 384 * @param entryId the primary key of the asset entry 385 * @return the asset links whose first or second entry ID is the given entry 386 ID 387 * @throws SystemException if a system exception occurred 388 */ 389 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 390 long entryId) 391 throws com.liferay.portal.kernel.exception.SystemException { 392 return getService().getLinks(entryId); 393 } 394 395 /** 396 * Returns all the asset links of the given link type whose first or second 397 * entry ID is the given entry ID. 398 * 399 * @param entryId the primary key of the asset entry 400 * @param typeId the link type. Acceptable values include {@link 401 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 402 which is a bidirectional relationship and {@link 403 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 404 which is a unidirectional relationship. For more information see 405 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 406 * @return the asset links of the given link type whose first or second 407 entry ID is the given entry ID 408 * @throws SystemException if a system exception occurred 409 */ 410 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 411 long entryId, int typeId) 412 throws com.liferay.portal.kernel.exception.SystemException { 413 return getService().getLinks(entryId, typeId); 414 } 415 416 /** 417 * Returns all the asset links of the given link type whose second entry ID 418 * is the given entry ID. 419 * 420 * @param entryId the primary key of the asset entry 421 * @param typeId the link type. Acceptable values include {@link 422 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 423 which is a bidirectional relationship and {@link 424 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 425 which is a unidirectional relationship. For more information see 426 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 427 * @return the asset links of the given link type whose second entry ID is 428 the given entry ID 429 * @throws SystemException if a system exception occurred 430 */ 431 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getReverseLinks( 432 long entryId, int typeId) 433 throws com.liferay.portal.kernel.exception.SystemException { 434 return getService().getReverseLinks(entryId, typeId); 435 } 436 437 public static com.liferay.portlet.asset.model.AssetLink updateLink( 438 long userId, long entryId1, long entryId2, int typeId, int weight) 439 throws com.liferay.portal.kernel.exception.PortalException, 440 com.liferay.portal.kernel.exception.SystemException { 441 return getService() 442 .updateLink(userId, entryId1, entryId2, typeId, weight); 443 } 444 445 /** 446 * Updates all links of the asset entry, replacing them with links 447 * associating the asset entry with the asset entries of the given link 448 * entry IDs. 449 * 450 * <p> 451 * If no link exists with a given link entry ID, a new link is created 452 * associating the current asset entry with the asset entry of that link 453 * entry ID. An existing link is deleted if either of its entry IDs is not 454 * contained in the given link entry IDs. 455 * </p> 456 * 457 * @param userId the primary key of the user updating the links 458 * @param entryId the primary key of the asset entry to be managed 459 * @param linkEntryIds the primary keys of the asset entries to be linked 460 with the asset entry to be managed 461 * @param typeId the type of the asset links to be created. Acceptable 462 values include {@link 463 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 464 which is a bidirectional relationship and {@link 465 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 466 which is a unidirectional relationship. For more information see 467 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 468 * @throws PortalException if the user could not be found 469 * @throws SystemException if a system exception occurred 470 */ 471 public static void updateLinks(long userId, long entryId, 472 long[] linkEntryIds, int typeId) 473 throws com.liferay.portal.kernel.exception.PortalException, 474 com.liferay.portal.kernel.exception.SystemException { 475 getService().updateLinks(userId, entryId, linkEntryIds, typeId); 476 } 477 478 public static AssetLinkLocalService getService() { 479 if (_service == null) { 480 _service = (AssetLinkLocalService)PortalBeanLocatorUtil.locate(AssetLinkLocalService.class.getName()); 481 482 ReferenceRegistry.registerReference(AssetLinkLocalServiceUtil.class, 483 "_service"); 484 } 485 486 return _service; 487 } 488 489 /** 490 * @deprecated As of 6.2.0 491 */ 492 public void setService(AssetLinkLocalService service) { 493 } 494 495 private static AssetLinkLocalService _service; 496 }