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