001 /** 002 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 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 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 360 long entryId, boolean excludeInvisibleLinks) 361 throws com.liferay.portal.kernel.exception.SystemException { 362 return getService().getDirectLinks(entryId, excludeInvisibleLinks); 363 } 364 365 /** 366 * Returns all the asset links of the given link type whose first entry ID 367 * is the given entry ID. 368 * 369 * @param entryId the primary key of the asset entry 370 * @param typeId the link type. Acceptable values include {@link 371 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 372 which is a bidirectional relationship and {@link 373 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 374 which is a unidirectional relationship. For more information see 375 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 376 * @return the asset links of the given link type whose first entry ID is 377 the given entry ID 378 * @throws SystemException if a system exception occurred 379 */ 380 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 381 long entryId, int typeId) 382 throws com.liferay.portal.kernel.exception.SystemException { 383 return getService().getDirectLinks(entryId, typeId); 384 } 385 386 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks( 387 long entryId, int typeId, boolean excludeInvisibleLinks) 388 throws com.liferay.portal.kernel.exception.SystemException { 389 return getService() 390 .getDirectLinks(entryId, typeId, excludeInvisibleLinks); 391 } 392 393 /** 394 * Returns all the asset links whose first or second entry ID is the given 395 * entry ID. 396 * 397 * @param entryId the primary key of the asset entry 398 * @return the asset links whose first or second entry ID is the given entry 399 ID 400 * @throws SystemException if a system exception occurred 401 */ 402 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 403 long entryId) 404 throws com.liferay.portal.kernel.exception.SystemException { 405 return getService().getLinks(entryId); 406 } 407 408 /** 409 * Returns all the asset links of the given link type whose first or second 410 * entry ID is the given entry ID. 411 * 412 * @param entryId the primary key of the asset entry 413 * @param typeId the link type. Acceptable values include {@link 414 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 415 which is a bidirectional relationship and {@link 416 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 417 which is a unidirectional relationship. For more information see 418 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 419 * @return the asset links of the given link type whose first or second 420 entry ID is the given entry ID 421 * @throws SystemException if a system exception occurred 422 */ 423 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks( 424 long entryId, int typeId) 425 throws com.liferay.portal.kernel.exception.SystemException { 426 return getService().getLinks(entryId, typeId); 427 } 428 429 /** 430 * Returns all the asset links of the given link type whose second entry ID 431 * is the given entry ID. 432 * 433 * @param entryId the primary key of the asset entry 434 * @param typeId the link type. Acceptable values include {@link 435 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 436 which is a bidirectional relationship and {@link 437 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 438 which is a unidirectional relationship. For more information see 439 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 440 * @return the asset links of the given link type whose second entry ID is 441 the given entry ID 442 * @throws SystemException if a system exception occurred 443 */ 444 public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getReverseLinks( 445 long entryId, int typeId) 446 throws com.liferay.portal.kernel.exception.SystemException { 447 return getService().getReverseLinks(entryId, typeId); 448 } 449 450 public static com.liferay.portlet.asset.model.AssetLink updateLink( 451 long userId, long entryId1, long entryId2, int typeId, int weight) 452 throws com.liferay.portal.kernel.exception.PortalException, 453 com.liferay.portal.kernel.exception.SystemException { 454 return getService() 455 .updateLink(userId, entryId1, entryId2, typeId, weight); 456 } 457 458 /** 459 * Updates all links of the asset entry, replacing them with links 460 * associating the asset entry with the asset entries of the given link 461 * entry IDs. 462 * 463 * <p> 464 * If no link exists with a given link entry ID, a new link is created 465 * associating the current asset entry with the asset entry of that link 466 * entry ID. An existing link is deleted if either of its entry IDs is not 467 * contained in the given link entry IDs. 468 * </p> 469 * 470 * @param userId the primary key of the user updating the links 471 * @param entryId the primary key of the asset entry to be managed 472 * @param linkEntryIds the primary keys of the asset entries to be linked 473 with the asset entry to be managed 474 * @param typeId the type of the asset links to be created. Acceptable 475 values include {@link 476 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED} 477 which is a bidirectional relationship and {@link 478 com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD} 479 which is a unidirectional relationship. For more information see 480 {@link com.liferay.portlet.asset.model.AssetLinkConstants} 481 * @throws PortalException if the user could not be found 482 * @throws SystemException if a system exception occurred 483 */ 484 public static void updateLinks(long userId, long entryId, 485 long[] linkEntryIds, int typeId) 486 throws com.liferay.portal.kernel.exception.PortalException, 487 com.liferay.portal.kernel.exception.SystemException { 488 getService().updateLinks(userId, entryId, linkEntryIds, typeId); 489 } 490 491 public static AssetLinkLocalService getService() { 492 if (_service == null) { 493 _service = (AssetLinkLocalService)PortalBeanLocatorUtil.locate(AssetLinkLocalService.class.getName()); 494 495 ReferenceRegistry.registerReference(AssetLinkLocalServiceUtil.class, 496 "_service"); 497 } 498 499 return _service; 500 } 501 502 /** 503 * @deprecated As of 6.2.0 504 */ 505 public void setService(AssetLinkLocalService service) { 506 } 507 508 private static AssetLinkLocalService _service; 509 }