001    /**
002     * Copyright (c) 2000-2012 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 com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the asset link local service. This utility wraps {@link com.liferay.portlet.asset.service.impl.AssetLinkLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
023     *
024     * <p>
025     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see AssetLinkLocalService
030     * @see com.liferay.portlet.asset.service.base.AssetLinkLocalServiceBaseImpl
031     * @see com.liferay.portlet.asset.service.impl.AssetLinkLocalServiceImpl
032     * @generated
033     */
034    public class AssetLinkLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * 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.
039             */
040    
041            /**
042            * Adds the asset link to the database. Also notifies the appropriate model listeners.
043            *
044            * @param assetLink the asset link
045            * @return the asset link that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portlet.asset.model.AssetLink addAssetLink(
049                    com.liferay.portlet.asset.model.AssetLink assetLink)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addAssetLink(assetLink);
052            }
053    
054            /**
055            * Creates a new asset link with the primary key. Does not add the asset link to the database.
056            *
057            * @param linkId the primary key for the new asset link
058            * @return the new asset link
059            */
060            public static com.liferay.portlet.asset.model.AssetLink createAssetLink(
061                    long linkId) {
062                    return getService().createAssetLink(linkId);
063            }
064    
065            /**
066            * Deletes the asset link with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param linkId the primary key of the asset link
069            * @throws PortalException if a asset link with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deleteAssetLink(long linkId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteAssetLink(linkId);
076            }
077    
078            /**
079            * Deletes the asset link from the database. Also notifies the appropriate model listeners.
080            *
081            * @param assetLink the asset link
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deleteAssetLink(
085                    com.liferay.portlet.asset.model.AssetLink assetLink)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    getService().deleteAssetLink(assetLink);
088            }
089    
090            /**
091            * Performs a dynamic query on the database and returns the matching rows.
092            *
093            * @param dynamicQuery the dynamic query
094            * @return the matching rows
095            * @throws SystemException if a system exception occurred
096            */
097            @SuppressWarnings("rawtypes")
098            public static java.util.List dynamicQuery(
099                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getService().dynamicQuery(dynamicQuery);
102            }
103    
104            /**
105            * Performs a dynamic query on the database and returns a range of the matching rows.
106            *
107            * <p>
108            * 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.
109            * </p>
110            *
111            * @param dynamicQuery the dynamic query
112            * @param start the lower bound of the range of model instances
113            * @param end the upper bound of the range of model instances (not inclusive)
114            * @return the range of matching rows
115            * @throws SystemException if a system exception occurred
116            */
117            @SuppressWarnings("rawtypes")
118            public static java.util.List dynamicQuery(
119                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
120                    int end) throws com.liferay.portal.kernel.exception.SystemException {
121                    return getService().dynamicQuery(dynamicQuery, start, end);
122            }
123    
124            /**
125            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
126            *
127            * <p>
128            * 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.
129            * </p>
130            *
131            * @param dynamicQuery the dynamic query
132            * @param start the lower bound of the range of model instances
133            * @param end the upper bound of the range of model instances (not inclusive)
134            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
135            * @return the ordered range of matching rows
136            * @throws SystemException if a system exception occurred
137            */
138            @SuppressWarnings("rawtypes")
139            public static java.util.List dynamicQuery(
140                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
141                    int end,
142                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
143                    throws com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
146            }
147    
148            /**
149            * Returns the number of rows that match the dynamic query.
150            *
151            * @param dynamicQuery the dynamic query
152            * @return the number of rows that match the dynamic query
153            * @throws SystemException if a system exception occurred
154            */
155            public static long dynamicQueryCount(
156                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getService().dynamicQueryCount(dynamicQuery);
159            }
160    
161            public static com.liferay.portlet.asset.model.AssetLink fetchAssetLink(
162                    long linkId) throws com.liferay.portal.kernel.exception.SystemException {
163                    return getService().fetchAssetLink(linkId);
164            }
165    
166            /**
167            * Returns the asset link with the primary key.
168            *
169            * @param linkId the primary key of the asset link
170            * @return the asset link
171            * @throws PortalException if a asset link with the primary key could not be found
172            * @throws SystemException if a system exception occurred
173            */
174            public static com.liferay.portlet.asset.model.AssetLink getAssetLink(
175                    long linkId)
176                    throws com.liferay.portal.kernel.exception.PortalException,
177                            com.liferay.portal.kernel.exception.SystemException {
178                    return getService().getAssetLink(linkId);
179            }
180    
181            public static com.liferay.portal.model.PersistedModel getPersistedModel(
182                    java.io.Serializable primaryKeyObj)
183                    throws com.liferay.portal.kernel.exception.PortalException,
184                            com.liferay.portal.kernel.exception.SystemException {
185                    return getService().getPersistedModel(primaryKeyObj);
186            }
187    
188            /**
189            * Returns a range of all the asset links.
190            *
191            * <p>
192            * 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.
193            * </p>
194            *
195            * @param start the lower bound of the range of asset links
196            * @param end the upper bound of the range of asset links (not inclusive)
197            * @return the range of asset links
198            * @throws SystemException if a system exception occurred
199            */
200            public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getAssetLinks(
201                    int start, int end)
202                    throws com.liferay.portal.kernel.exception.SystemException {
203                    return getService().getAssetLinks(start, end);
204            }
205    
206            /**
207            * Returns the number of asset links.
208            *
209            * @return the number of asset links
210            * @throws SystemException if a system exception occurred
211            */
212            public static int getAssetLinksCount()
213                    throws com.liferay.portal.kernel.exception.SystemException {
214                    return getService().getAssetLinksCount();
215            }
216    
217            /**
218            * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
219            *
220            * @param assetLink the asset link
221            * @return the asset link that was updated
222            * @throws SystemException if a system exception occurred
223            */
224            public static com.liferay.portlet.asset.model.AssetLink updateAssetLink(
225                    com.liferay.portlet.asset.model.AssetLink assetLink)
226                    throws com.liferay.portal.kernel.exception.SystemException {
227                    return getService().updateAssetLink(assetLink);
228            }
229    
230            /**
231            * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
232            *
233            * @param assetLink the asset link
234            * @param merge whether to merge the asset link with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
235            * @return the asset link that was updated
236            * @throws SystemException if a system exception occurred
237            */
238            public static com.liferay.portlet.asset.model.AssetLink updateAssetLink(
239                    com.liferay.portlet.asset.model.AssetLink assetLink, boolean merge)
240                    throws com.liferay.portal.kernel.exception.SystemException {
241                    return getService().updateAssetLink(assetLink, merge);
242            }
243    
244            /**
245            * Returns the Spring bean ID for this bean.
246            *
247            * @return the Spring bean ID for this bean
248            */
249            public static java.lang.String getBeanIdentifier() {
250                    return getService().getBeanIdentifier();
251            }
252    
253            /**
254            * Sets the Spring bean ID for this bean.
255            *
256            * @param beanIdentifier the Spring bean ID for this bean
257            */
258            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
259                    getService().setBeanIdentifier(beanIdentifier);
260            }
261    
262            /**
263            * Adds a new asset link.
264            *
265            * @param userId the primary key of the link's creator
266            * @param entryId1 the primary key of the first asset entry
267            * @param entryId2 the primary key of the second asset entry
268            * @param type the link type. Acceptable values include {@link
269            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED}
270            which is a bidirectional relationship and {@link
271            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD}
272            which is a unidirectional relationship. For more information see
273            {@link com.liferay.portlet.asset.model.AssetLinkConstants}
274            * @param weight the weight of the relationship, allowing precedence
275            ordering of links
276            * @return the asset link
277            * @throws PortalException if the user could not be found
278            * @throws SystemException if a system exception occurred
279            */
280            public static com.liferay.portlet.asset.model.AssetLink addLink(
281                    long userId, long entryId1, long entryId2, int type, int weight)
282                    throws com.liferay.portal.kernel.exception.PortalException,
283                            com.liferay.portal.kernel.exception.SystemException {
284                    return getService().addLink(userId, entryId1, entryId2, type, weight);
285            }
286    
287            /**
288            * Deletes the asset link.
289            *
290            * @param link the asset link
291            * @throws SystemException if a system exception occurred
292            */
293            public static void deleteLink(
294                    com.liferay.portlet.asset.model.AssetLink link)
295                    throws com.liferay.portal.kernel.exception.SystemException {
296                    getService().deleteLink(link);
297            }
298    
299            /**
300            * Deletes the asset link.
301            *
302            * @param linkId the primary key of the asset link
303            * @throws PortalException if the asset link could not be found
304            * @throws SystemException if a system exception occurred
305            */
306            public static void deleteLink(long linkId)
307                    throws com.liferay.portal.kernel.exception.PortalException,
308                            com.liferay.portal.kernel.exception.SystemException {
309                    getService().deleteLink(linkId);
310            }
311    
312            /**
313            * Deletes all links associated with the asset entry.
314            *
315            * @param entryId the primary key of the asset entry
316            * @throws SystemException if a system exception occurred
317            */
318            public static void deleteLinks(long entryId)
319                    throws com.liferay.portal.kernel.exception.SystemException {
320                    getService().deleteLinks(entryId);
321            }
322    
323            /**
324            * Delete all links that associate the two asset entries.
325            *
326            * @param entryId1 the primary key of the first asset entry
327            * @param entryId2 the primary key of the second asset entry
328            * @throws SystemException if a system exception occurred
329            */
330            public static void deleteLinks(long entryId1, long entryId2)
331                    throws com.liferay.portal.kernel.exception.SystemException {
332                    getService().deleteLinks(entryId1, entryId2);
333            }
334    
335            /**
336            * Returns all the asset links whose first entry ID is the given entry ID.
337            *
338            * @param entryId the primary key of the asset entry
339            * @return the asset links whose first entry ID is the given entry ID
340            * @throws SystemException if a system exception occurred
341            */
342            public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks(
343                    long entryId)
344                    throws com.liferay.portal.kernel.exception.SystemException {
345                    return getService().getDirectLinks(entryId);
346            }
347    
348            /**
349            * Returns all the asset links of the given link type whose first entry ID
350            * is the given entry ID.
351            *
352            * @param entryId the primary key of the asset entry
353            * @param typeId the link type. Acceptable values include {@link
354            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED}
355            which is a bidirectional relationship and {@link
356            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD}
357            which is a unidirectional relationship. For more information see
358            {@link com.liferay.portlet.asset.model.AssetLinkConstants}
359            * @return the asset links of the given link type whose first entry ID is
360            the given entry ID
361            * @throws SystemException if a system exception occurred
362            */
363            public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getDirectLinks(
364                    long entryId, int typeId)
365                    throws com.liferay.portal.kernel.exception.SystemException {
366                    return getService().getDirectLinks(entryId, typeId);
367            }
368    
369            /**
370            * Returns all the asset links whose first or second entry ID is the given
371            * entry ID.
372            *
373            * @param entryId the primary key of the asset entry
374            * @return the asset links whose first or second entry ID is the given entry
375            ID
376            * @throws SystemException if a system exception occurred
377            */
378            public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks(
379                    long entryId)
380                    throws com.liferay.portal.kernel.exception.SystemException {
381                    return getService().getLinks(entryId);
382            }
383    
384            /**
385            * Returns all the asset links of the given link type whose first or second
386            * entry ID is the given entry ID.
387            *
388            * @param entryId the primary key of the asset entry
389            * @param typeId the link type. Acceptable values include {@link
390            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED}
391            which is a bidirectional relationship and {@link
392            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD}
393            which is a unidirectional relationship. For more information see
394            {@link com.liferay.portlet.asset.model.AssetLinkConstants}
395            * @return the asset links of the given link type whose first or second
396            entry ID is the given entry ID
397            * @throws SystemException if a system exception occurred
398            */
399            public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getLinks(
400                    long entryId, int typeId)
401                    throws com.liferay.portal.kernel.exception.SystemException {
402                    return getService().getLinks(entryId, typeId);
403            }
404    
405            /**
406            * Returns all the asset links of the given link type whose second entry ID
407            * is the given entry ID.
408            *
409            * @param entryId the primary key of the asset entry
410            * @param typeId the link type. Acceptable values include {@link
411            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED}
412            which is a bidirectional relationship and {@link
413            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD}
414            which is a unidirectional relationship. For more information see
415            {@link com.liferay.portlet.asset.model.AssetLinkConstants}
416            * @return the asset links of the given link type whose second entry ID is
417            the given entry ID
418            * @throws SystemException if a system exception occurred
419            */
420            public static java.util.List<com.liferay.portlet.asset.model.AssetLink> getReverseLinks(
421                    long entryId, int typeId)
422                    throws com.liferay.portal.kernel.exception.SystemException {
423                    return getService().getReverseLinks(entryId, typeId);
424            }
425    
426            /**
427            * Updates all links of the asset entry, replacing them with links
428            * associating the asset entry with the asset entries of the given link
429            * entry IDs.
430            *
431            * <p>
432            * If no link exists with a given link entry ID, a new link is created
433            * associating the current asset entry with the asset entry of that link
434            * entry ID. An existing link is deleted if either of its entry IDs is not
435            * contained in the given link entry IDs.
436            * </p>
437            *
438            * @param userId the primary key of the user updating the links
439            * @param entryId the primary key of the asset entry to be managed
440            * @param linkEntryIds the primary keys of the asset entries to be linked
441            with the asset entry to be managed
442            * @param typeId the type of the asset links to be created. Acceptable
443            values include {@link
444            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_RELATED}
445            which is a bidirectional relationship and {@link
446            com.liferay.portlet.asset.model.AssetLinkConstants#TYPE_CHILD}
447            which is a unidirectional relationship. For more information see
448            {@link com.liferay.portlet.asset.model.AssetLinkConstants}
449            * @throws PortalException if the user could not be found
450            * @throws SystemException if a system exception occurred
451            */
452            public static void updateLinks(long userId, long entryId,
453                    long[] linkEntryIds, int typeId)
454                    throws com.liferay.portal.kernel.exception.PortalException,
455                            com.liferay.portal.kernel.exception.SystemException {
456                    getService().updateLinks(userId, entryId, linkEntryIds, typeId);
457            }
458    
459            public static AssetLinkLocalService getService() {
460                    if (_service == null) {
461                            _service = (AssetLinkLocalService)PortalBeanLocatorUtil.locate(AssetLinkLocalService.class.getName());
462    
463                            ReferenceRegistry.registerReference(AssetLinkLocalServiceUtil.class,
464                                    "_service");
465                            MethodCache.remove(AssetLinkLocalService.class);
466                    }
467    
468                    return _service;
469            }
470    
471            public void setService(AssetLinkLocalService service) {
472                    MethodCache.remove(AssetLinkLocalService.class);
473    
474                    _service = service;
475    
476                    ReferenceRegistry.registerReference(AssetLinkLocalServiceUtil.class,
477                            "_service");
478                    MethodCache.remove(AssetLinkLocalService.class);
479            }
480    
481            private static AssetLinkLocalService _service;
482    }