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