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