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.asset.kernel.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.asset.kernel.model.AssetLink addAssetLink(
051                    com.liferay.asset.kernel.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.asset.kernel.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.asset.kernel.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.asset.kernel.model.AssetLink deleteAssetLink(
094                    com.liferay.asset.kernel.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.asset.kernel.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(com.liferay.asset.kernel.model.AssetLink link) {
120                    getService().deleteLink(link);
121            }
122    
123            /**
124            * Deletes the asset link.
125            *
126            * @param linkId the primary key of the asset link
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.kernel.model.PersistedModel deletePersistedModel(
156                    com.liferay.portal.kernel.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.asset.kernel.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.asset.kernel.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.asset.kernel.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 all the asset links whose first entry ID is the given entry ID.
287            *
288            * @param entryId the primary key of the asset entry
289            * @return the asset links whose first entry ID is the given entry ID
290            */
291            public static java.util.List<com.liferay.asset.kernel.model.AssetLink> getDirectLinks(
292                    long entryId) {
293                    return getService().getDirectLinks(entryId);
294            }
295    
296            /**
297            * Returns all the asset links of the given link type whose first entry ID
298            * is the given entry ID.
299            *
300            * @param entryId the primary key of the asset entry
301            * @param typeId the link type. Acceptable values include {@link
302            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
303            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
304            unidirectional relationship. For more information see {@link
305            AssetLinkConstants}
306            * @return the asset links of the given link type whose first entry ID is
307            the given entry ID
308            */
309            public static java.util.List<com.liferay.asset.kernel.model.AssetLink> getDirectLinks(
310                    long entryId, int typeId) {
311                    return getService().getDirectLinks(entryId, typeId);
312            }
313    
314            public static com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery getExportActionbleDynamicQuery(
315                    com.liferay.exportimport.kernel.lar.PortletDataContext portletDataContext) {
316                    return getService().getExportActionbleDynamicQuery(portletDataContext);
317            }
318    
319            public static com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
320                    return getService().getIndexableActionableDynamicQuery();
321            }
322    
323            /**
324            * Returns all the asset links whose first or second entry ID is the given
325            * entry ID.
326            *
327            * @param entryId the primary key of the asset entry
328            * @return the asset links whose first or second entry ID is the given entry
329            ID
330            */
331            public static java.util.List<com.liferay.asset.kernel.model.AssetLink> getLinks(
332                    long entryId) {
333                    return getService().getLinks(entryId);
334            }
335    
336            /**
337            * Returns all the asset links of the given link type whose first or second
338            * entry ID is the given entry ID.
339            *
340            * @param entryId the primary key of the asset entry
341            * @param typeId the link type. Acceptable values include {@link
342            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
343            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
344            unidirectional relationship. For more information see {@link
345            AssetLinkConstants}
346            * @return the asset links of the given link type whose first or second
347            entry ID is the given entry ID
348            */
349            public static java.util.List<com.liferay.asset.kernel.model.AssetLink> getLinks(
350                    long entryId, int typeId) {
351                    return getService().getLinks(entryId, typeId);
352            }
353    
354            /**
355            * Returns the OSGi service identifier.
356            *
357            * @return the OSGi service identifier
358            */
359            public static java.lang.String getOSGiServiceIdentifier() {
360                    return getService().getOSGiServiceIdentifier();
361            }
362    
363            public static com.liferay.portal.kernel.model.PersistedModel getPersistedModel(
364                    java.io.Serializable primaryKeyObj)
365                    throws com.liferay.portal.kernel.exception.PortalException {
366                    return getService().getPersistedModel(primaryKeyObj);
367            }
368    
369            /**
370            * Returns all the asset links of the given link type whose second entry ID
371            * is the given entry ID.
372            *
373            * @param entryId the primary key of the asset entry
374            * @param typeId the link type. Acceptable values include {@link
375            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
376            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
377            unidirectional relationship. For more information see {@link
378            AssetLinkConstants}
379            * @return the asset links of the given link type whose second entry ID is
380            the given entry ID
381            */
382            public static java.util.List<com.liferay.asset.kernel.model.AssetLink> getReverseLinks(
383                    long entryId, int typeId) {
384                    return getService().getReverseLinks(entryId, typeId);
385            }
386    
387            /**
388            * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
389            *
390            * @param assetLink the asset link
391            * @return the asset link that was updated
392            */
393            public static com.liferay.asset.kernel.model.AssetLink updateAssetLink(
394                    com.liferay.asset.kernel.model.AssetLink assetLink) {
395                    return getService().updateAssetLink(assetLink);
396            }
397    
398            public static com.liferay.asset.kernel.model.AssetLink updateLink(
399                    long userId, long entryId1, long entryId2, int typeId, int weight)
400                    throws com.liferay.portal.kernel.exception.PortalException {
401                    return getService()
402                                       .updateLink(userId, entryId1, entryId2, typeId, weight);
403            }
404    
405            /**
406            * Updates all links of the asset entry, replacing them with links
407            * associating the asset entry with the asset entries of the given link
408            * entry IDs.
409            *
410            * <p>
411            * If no link exists with a given link entry ID, a new link is created
412            * associating the current asset entry with the asset entry of that link
413            * entry ID. An existing link is deleted if either of its entry IDs is not
414            * contained in the given link entry IDs.
415            * </p>
416            *
417            * @param userId the primary key of the user updating the links
418            * @param entryId the primary key of the asset entry to be managed
419            * @param linkEntryIds the primary keys of the asset entries to be linked
420            with the asset entry to be managed
421            * @param typeId the type of the asset links to be created. Acceptable
422            values include {@link AssetLinkConstants#TYPE_RELATED} which is a
423            bidirectional relationship and {@link
424            AssetLinkConstants#TYPE_CHILD} which is a unidirectional
425            relationship. For more information see {@link AssetLinkConstants}
426            */
427            public static void updateLinks(long userId, long entryId,
428                    long[] linkEntryIds, int typeId)
429                    throws com.liferay.portal.kernel.exception.PortalException {
430                    getService().updateLinks(userId, entryId, linkEntryIds, typeId);
431            }
432    
433            public static AssetLinkLocalService getService() {
434                    if (_service == null) {
435                            _service = (AssetLinkLocalService)PortalBeanLocatorUtil.locate(AssetLinkLocalService.class.getName());
436    
437                            ReferenceRegistry.registerReference(AssetLinkLocalServiceUtil.class,
438                                    "_service");
439                    }
440    
441                    return _service;
442            }
443    
444            private static AssetLinkLocalService _service;
445    }