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.asset.kernel.model.AssetLink;
020    
021    import com.liferay.exportimport.kernel.lar.PortletDataContext;
022    
023    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
024    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.Projection;
028    import com.liferay.portal.kernel.exception.PortalException;
029    import com.liferay.portal.kernel.exception.SystemException;
030    import com.liferay.portal.kernel.model.PersistedModel;
031    import com.liferay.portal.kernel.search.Indexable;
032    import com.liferay.portal.kernel.search.IndexableType;
033    import com.liferay.portal.kernel.service.BaseLocalService;
034    import com.liferay.portal.kernel.service.PersistedModelLocalService;
035    import com.liferay.portal.kernel.transaction.Isolation;
036    import com.liferay.portal.kernel.transaction.Propagation;
037    import com.liferay.portal.kernel.transaction.Transactional;
038    import com.liferay.portal.kernel.util.OrderByComparator;
039    
040    import java.io.Serializable;
041    
042    import java.util.List;
043    
044    /**
045     * Provides the local service interface for AssetLink. Methods of this
046     * service will not have security checks based on the propagated JAAS
047     * credentials because this service can only be accessed from within the same
048     * VM.
049     *
050     * @author Brian Wing Shun Chan
051     * @see AssetLinkLocalServiceUtil
052     * @see com.liferay.portlet.asset.service.base.AssetLinkLocalServiceBaseImpl
053     * @see com.liferay.portlet.asset.service.impl.AssetLinkLocalServiceImpl
054     * @generated
055     */
056    @ProviderType
057    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
058            PortalException.class, SystemException.class})
059    public interface AssetLinkLocalService extends BaseLocalService,
060            PersistedModelLocalService {
061            /*
062             * NOTE FOR DEVELOPERS:
063             *
064             * Never modify or reference this interface directly. Always use {@link AssetLinkLocalServiceUtil} to access the asset link local service. Add custom service methods to {@link com.liferay.portlet.asset.service.impl.AssetLinkLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
065             */
066    
067            /**
068            * Adds the asset link to the database. Also notifies the appropriate model listeners.
069            *
070            * @param assetLink the asset link
071            * @return the asset link that was added
072            */
073            @Indexable(type = IndexableType.REINDEX)
074            public AssetLink addAssetLink(AssetLink assetLink);
075    
076            /**
077            * Adds a new asset link.
078            *
079            * @param userId the primary key of the link's creator
080            * @param entryId1 the primary key of the first asset entry
081            * @param entryId2 the primary key of the second asset entry
082            * @param type the link type. Acceptable values include {@link
083            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
084            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
085            unidirectional relationship. For more information see {@link
086            AssetLinkConstants}
087            * @param weight the weight of the relationship, allowing precedence
088            ordering of links
089            * @return the asset link
090            */
091            public AssetLink addLink(long userId, long entryId1, long entryId2,
092                    int type, int weight) throws PortalException;
093    
094            /**
095            * Creates a new asset link with the primary key. Does not add the asset link to the database.
096            *
097            * @param linkId the primary key for the new asset link
098            * @return the new asset link
099            */
100            public AssetLink createAssetLink(long linkId);
101    
102            /**
103            * Deletes the asset link from the database. Also notifies the appropriate model listeners.
104            *
105            * @param assetLink the asset link
106            * @return the asset link that was removed
107            */
108            @Indexable(type = IndexableType.DELETE)
109            public AssetLink deleteAssetLink(AssetLink assetLink);
110    
111            /**
112            * Deletes the asset link with the primary key from the database. Also notifies the appropriate model listeners.
113            *
114            * @param linkId the primary key of the asset link
115            * @return the asset link that was removed
116            * @throws PortalException if a asset link with the primary key could not be found
117            */
118            @Indexable(type = IndexableType.DELETE)
119            public AssetLink deleteAssetLink(long linkId) throws PortalException;
120    
121            public void deleteGroupLinks(long groupId);
122    
123            /**
124            * Deletes the asset link.
125            *
126            * @param link the asset link
127            */
128            public void deleteLink(AssetLink link);
129    
130            /**
131            * Deletes the asset link.
132            *
133            * @param linkId the primary key of the asset link
134            */
135            public void deleteLink(long linkId) throws PortalException;
136    
137            /**
138            * Deletes all links associated with the asset entry.
139            *
140            * @param entryId the primary key of the asset entry
141            */
142            public void deleteLinks(long entryId);
143    
144            /**
145            * Delete all links that associate the two asset entries.
146            *
147            * @param entryId1 the primary key of the first asset entry
148            * @param entryId2 the primary key of the second asset entry
149            */
150            public void deleteLinks(long entryId1, long entryId2);
151    
152            /**
153            * @throws PortalException
154            */
155            @Override
156            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
157                    throws PortalException;
158    
159            public DynamicQuery dynamicQuery();
160    
161            /**
162            * Performs a dynamic query on the database and returns the matching rows.
163            *
164            * @param dynamicQuery the dynamic query
165            * @return the matching rows
166            */
167            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
168    
169            /**
170            * Performs a dynamic query on the database and returns a range of the matching rows.
171            *
172            * <p>
173            * 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.
174            * </p>
175            *
176            * @param dynamicQuery the dynamic query
177            * @param start the lower bound of the range of model instances
178            * @param end the upper bound of the range of model instances (not inclusive)
179            * @return the range of matching rows
180            */
181            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
182                    int end);
183    
184            /**
185            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
186            *
187            * <p>
188            * 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.
189            * </p>
190            *
191            * @param dynamicQuery the dynamic query
192            * @param start the lower bound of the range of model instances
193            * @param end the upper bound of the range of model instances (not inclusive)
194            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
195            * @return the ordered range of matching rows
196            */
197            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
198                    int end, OrderByComparator<T> orderByComparator);
199    
200            /**
201            * Returns the number of rows matching the dynamic query.
202            *
203            * @param dynamicQuery the dynamic query
204            * @return the number of rows matching the dynamic query
205            */
206            public long dynamicQueryCount(DynamicQuery dynamicQuery);
207    
208            /**
209            * Returns the number of rows matching the dynamic query.
210            *
211            * @param dynamicQuery the dynamic query
212            * @param projection the projection to apply to the query
213            * @return the number of rows matching the dynamic query
214            */
215            public long dynamicQueryCount(DynamicQuery dynamicQuery,
216                    Projection projection);
217    
218            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
219            public AssetLink fetchAssetLink(long linkId);
220    
221            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
222            public ActionableDynamicQuery getActionableDynamicQuery();
223    
224            /**
225            * Returns the asset link with the primary key.
226            *
227            * @param linkId the primary key of the asset link
228            * @return the asset link
229            * @throws PortalException if a asset link with the primary key could not be found
230            */
231            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
232            public AssetLink getAssetLink(long linkId) throws PortalException;
233    
234            /**
235            * Returns a range of all the asset links.
236            *
237            * <p>
238            * 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.
239            * </p>
240            *
241            * @param start the lower bound of the range of asset links
242            * @param end the upper bound of the range of asset links (not inclusive)
243            * @return the range of asset links
244            */
245            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
246            public List<AssetLink> getAssetLinks(int start, int end);
247    
248            /**
249            * Returns the number of asset links.
250            *
251            * @return the number of asset links
252            */
253            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
254            public int getAssetLinksCount();
255    
256            /**
257            * Returns all the asset links whose first entry ID is the given entry ID.
258            *
259            * @param entryId the primary key of the asset entry
260            * @return the asset links whose first entry ID is the given entry ID
261            */
262            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
263            public List<AssetLink> getDirectLinks(long entryId);
264    
265            /**
266            * Returns all the asset links of the given link type whose first entry ID
267            * is the given entry ID.
268            *
269            * @param entryId the primary key of the asset entry
270            * @param typeId the link type. Acceptable values include {@link
271            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
272            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
273            unidirectional relationship. For more information see {@link
274            AssetLinkConstants}
275            * @return the asset links of the given link type whose first entry ID is
276            the given entry ID
277            */
278            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
279            public List<AssetLink> getDirectLinks(long entryId, int typeId);
280    
281            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
282            public ExportActionableDynamicQuery getExportActionbleDynamicQuery(
283                    PortletDataContext portletDataContext);
284    
285            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
286            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
287    
288            /**
289            * Returns all the asset links whose first or second entry ID is the given
290            * entry ID.
291            *
292            * @param entryId the primary key of the asset entry
293            * @return the asset links whose first or second entry ID is the given entry
294            ID
295            */
296            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
297            public List<AssetLink> getLinks(long entryId);
298    
299            /**
300            * Returns all the asset links of the given link type whose first or second
301            * entry ID is the given entry ID.
302            *
303            * @param entryId the primary key of the asset entry
304            * @param typeId the link type. Acceptable values include {@link
305            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
306            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
307            unidirectional relationship. For more information see {@link
308            AssetLinkConstants}
309            * @return the asset links of the given link type whose first or second
310            entry ID is the given entry ID
311            */
312            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
313            public List<AssetLink> getLinks(long entryId, int typeId);
314    
315            /**
316            * Returns the OSGi service identifier.
317            *
318            * @return the OSGi service identifier
319            */
320            public java.lang.String getOSGiServiceIdentifier();
321    
322            @Override
323            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
324            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
325                    throws PortalException;
326    
327            /**
328            * Returns all the asset links of the given link type whose second entry ID
329            * is the given entry ID.
330            *
331            * @param entryId the primary key of the asset entry
332            * @param typeId the link type. Acceptable values include {@link
333            AssetLinkConstants#TYPE_RELATED} which is a bidirectional
334            relationship and {@link AssetLinkConstants#TYPE_CHILD} which is a
335            unidirectional relationship. For more information see {@link
336            AssetLinkConstants}
337            * @return the asset links of the given link type whose second entry ID is
338            the given entry ID
339            */
340            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
341            public List<AssetLink> getReverseLinks(long entryId, int typeId);
342    
343            /**
344            * Updates the asset link in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
345            *
346            * @param assetLink the asset link
347            * @return the asset link that was updated
348            */
349            @Indexable(type = IndexableType.REINDEX)
350            public AssetLink updateAssetLink(AssetLink assetLink);
351    
352            public AssetLink updateLink(long userId, long entryId1, long entryId2,
353                    int typeId, int weight) throws PortalException;
354    
355            /**
356            * Updates all links of the asset entry, replacing them with links
357            * associating the asset entry with the asset entries of the given link
358            * entry IDs.
359            *
360            * <p>
361            * If no link exists with a given link entry ID, a new link is created
362            * associating the current asset entry with the asset entry of that link
363            * entry ID. An existing link is deleted if either of its entry IDs is not
364            * contained in the given link entry IDs.
365            * </p>
366            *
367            * @param userId the primary key of the user updating the links
368            * @param entryId the primary key of the asset entry to be managed
369            * @param linkEntryIds the primary keys of the asset entries to be linked
370            with the asset entry to be managed
371            * @param typeId the type of the asset links to be created. Acceptable
372            values include {@link AssetLinkConstants#TYPE_RELATED} which is a
373            bidirectional relationship and {@link
374            AssetLinkConstants#TYPE_CHILD} which is a unidirectional
375            relationship. For more information see {@link AssetLinkConstants}
376            */
377            public void updateLinks(long userId, long entryId, long[] linkEntryIds,
378                    int typeId) throws PortalException;
379    }