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