001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    
019    /**
020     * The utility for the resource local service. This utility wraps {@link com.liferay.portal.service.impl.ResourceLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
021     *
022     * <p>
023     * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.ResourceLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
024     * </p>
025     *
026     * <p>
027     * 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.
028     * </p>
029     *
030     * @author Brian Wing Shun Chan
031     * @see ResourceLocalService
032     * @see com.liferay.portal.service.base.ResourceLocalServiceBaseImpl
033     * @see com.liferay.portal.service.impl.ResourceLocalServiceImpl
034     * @generated
035     */
036    public class ResourceLocalServiceUtil {
037            /**
038            * Adds the resource to the database. Also notifies the appropriate model listeners.
039            *
040            * @param resource the resource to add
041            * @return the resource that was added
042            * @throws SystemException if a system exception occurred
043            */
044            public static com.liferay.portal.model.Resource addResource(
045                    com.liferay.portal.model.Resource resource)
046                    throws com.liferay.portal.kernel.exception.SystemException {
047                    return getService().addResource(resource);
048            }
049    
050            /**
051            * Creates a new resource with the primary key. Does not add the resource to the database.
052            *
053            * @param resourceId the primary key for the new resource
054            * @return the new resource
055            */
056            public static com.liferay.portal.model.Resource createResource(
057                    long resourceId) {
058                    return getService().createResource(resourceId);
059            }
060    
061            /**
062            * Deletes the resource with the primary key from the database. Also notifies the appropriate model listeners.
063            *
064            * @param resourceId the primary key of the resource to delete
065            * @throws PortalException if a resource with the primary key could not be found
066            * @throws SystemException if a system exception occurred
067            */
068            public static void deleteResource(long resourceId)
069                    throws com.liferay.portal.kernel.exception.PortalException,
070                            com.liferay.portal.kernel.exception.SystemException {
071                    getService().deleteResource(resourceId);
072            }
073    
074            /**
075            * Deletes the resource from the database. Also notifies the appropriate model listeners.
076            *
077            * @param resource the resource to delete
078            * @throws SystemException if a system exception occurred
079            */
080            public static void deleteResource(
081                    com.liferay.portal.model.Resource resource)
082                    throws com.liferay.portal.kernel.exception.SystemException {
083                    getService().deleteResource(resource);
084            }
085    
086            /**
087            * Performs a dynamic query on the database and returns the matching rows.
088            *
089            * @param dynamicQuery the dynamic query to search with
090            * @return the matching rows
091            * @throws SystemException if a system exception occurred
092            */
093            @SuppressWarnings("rawtypes")
094            public static java.util.List dynamicQuery(
095                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
096                    throws com.liferay.portal.kernel.exception.SystemException {
097                    return getService().dynamicQuery(dynamicQuery);
098            }
099    
100            /**
101            * Performs a dynamic query on the database and returns a range of the matching rows.
102            *
103            * <p>
104            * 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.
105            * </p>
106            *
107            * @param dynamicQuery the dynamic query to search with
108            * @param start the lower bound of the range of model instances to return
109            * @param end the upper bound of the range of model instances to return (not inclusive)
110            * @return the range of matching rows
111            * @throws SystemException if a system exception occurred
112            */
113            @SuppressWarnings("rawtypes")
114            public static java.util.List dynamicQuery(
115                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
116                    int end) throws com.liferay.portal.kernel.exception.SystemException {
117                    return getService().dynamicQuery(dynamicQuery, start, end);
118            }
119    
120            /**
121            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
122            *
123            * <p>
124            * 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.
125            * </p>
126            *
127            * @param dynamicQuery the dynamic query to search with
128            * @param start the lower bound of the range of model instances to return
129            * @param end the upper bound of the range of model instances to return (not inclusive)
130            * @param orderByComparator the comparator to order the results by
131            * @return the ordered range of matching rows
132            * @throws SystemException if a system exception occurred
133            */
134            @SuppressWarnings("rawtypes")
135            public static java.util.List dynamicQuery(
136                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
137                    int end,
138                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
139                    throws com.liferay.portal.kernel.exception.SystemException {
140                    return getService()
141                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
142            }
143    
144            /**
145            * Counts the number of rows that match the dynamic query.
146            *
147            * @param dynamicQuery the dynamic query to search with
148            * @return the number of rows that match the dynamic query
149            * @throws SystemException if a system exception occurred
150            */
151            public static long dynamicQueryCount(
152                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
153                    throws com.liferay.portal.kernel.exception.SystemException {
154                    return getService().dynamicQueryCount(dynamicQuery);
155            }
156    
157            /**
158            * Gets the resource with the primary key.
159            *
160            * @param resourceId the primary key of the resource to get
161            * @return the resource
162            * @throws PortalException if a resource with the primary key could not be found
163            * @throws SystemException if a system exception occurred
164            */
165            public static com.liferay.portal.model.Resource getResource(long resourceId)
166                    throws com.liferay.portal.kernel.exception.PortalException,
167                            com.liferay.portal.kernel.exception.SystemException {
168                    return getService().getResource(resourceId);
169            }
170    
171            /**
172            * Gets a range of all the resources.
173            *
174            * <p>
175            * 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.
176            * </p>
177            *
178            * @param start the lower bound of the range of resources to return
179            * @param end the upper bound of the range of resources to return (not inclusive)
180            * @return the range of resources
181            * @throws SystemException if a system exception occurred
182            */
183            public static java.util.List<com.liferay.portal.model.Resource> getResources(
184                    int start, int end)
185                    throws com.liferay.portal.kernel.exception.SystemException {
186                    return getService().getResources(start, end);
187            }
188    
189            /**
190            * Gets the number of resources.
191            *
192            * @return the number of resources
193            * @throws SystemException if a system exception occurred
194            */
195            public static int getResourcesCount()
196                    throws com.liferay.portal.kernel.exception.SystemException {
197                    return getService().getResourcesCount();
198            }
199    
200            /**
201            * Updates the resource in the database. Also notifies the appropriate model listeners.
202            *
203            * @param resource the resource to update
204            * @return the resource that was updated
205            * @throws SystemException if a system exception occurred
206            */
207            public static com.liferay.portal.model.Resource updateResource(
208                    com.liferay.portal.model.Resource resource)
209                    throws com.liferay.portal.kernel.exception.SystemException {
210                    return getService().updateResource(resource);
211            }
212    
213            /**
214            * Updates the resource in the database. Also notifies the appropriate model listeners.
215            *
216            * @param resource the resource to update
217            * @param merge whether to merge the resource 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.
218            * @return the resource that was updated
219            * @throws SystemException if a system exception occurred
220            */
221            public static com.liferay.portal.model.Resource updateResource(
222                    com.liferay.portal.model.Resource resource, boolean merge)
223                    throws com.liferay.portal.kernel.exception.SystemException {
224                    return getService().updateResource(resource, merge);
225            }
226    
227            public static void addModelResources(long companyId, long groupId,
228                    long userId, java.lang.String name, long primKey,
229                    java.lang.String[] communityPermissions,
230                    java.lang.String[] guestPermissions)
231                    throws com.liferay.portal.kernel.exception.PortalException,
232                            com.liferay.portal.kernel.exception.SystemException {
233                    getService()
234                            .addModelResources(companyId, groupId, userId, name, primKey,
235                            communityPermissions, guestPermissions);
236            }
237    
238            public static void addModelResources(long companyId, long groupId,
239                    long userId, java.lang.String name, java.lang.String primKey,
240                    java.lang.String[] communityPermissions,
241                    java.lang.String[] guestPermissions)
242                    throws com.liferay.portal.kernel.exception.PortalException,
243                            com.liferay.portal.kernel.exception.SystemException {
244                    getService()
245                            .addModelResources(companyId, groupId, userId, name, primKey,
246                            communityPermissions, guestPermissions);
247            }
248    
249            public static com.liferay.portal.model.Resource addResource(
250                    long companyId, java.lang.String name, int scope,
251                    java.lang.String primKey)
252                    throws com.liferay.portal.kernel.exception.SystemException {
253                    return getService().addResource(companyId, name, scope, primKey);
254            }
255    
256            public static void addResources(long companyId, long groupId,
257                    java.lang.String name, boolean portletActions)
258                    throws com.liferay.portal.kernel.exception.PortalException,
259                            com.liferay.portal.kernel.exception.SystemException {
260                    getService().addResources(companyId, groupId, name, portletActions);
261            }
262    
263            public static void addResources(long companyId, long groupId, long userId,
264                    java.lang.String name, long primKey, boolean portletActions,
265                    boolean addCommunityPermissions, boolean addGuestPermissions)
266                    throws com.liferay.portal.kernel.exception.PortalException,
267                            com.liferay.portal.kernel.exception.SystemException {
268                    getService()
269                            .addResources(companyId, groupId, userId, name, primKey,
270                            portletActions, addCommunityPermissions, addGuestPermissions);
271            }
272    
273            public static void addResources(long companyId, long groupId, long userId,
274                    java.lang.String name, java.lang.String primKey,
275                    boolean portletActions, boolean addCommunityPermissions,
276                    boolean addGuestPermissions)
277                    throws com.liferay.portal.kernel.exception.PortalException,
278                            com.liferay.portal.kernel.exception.SystemException {
279                    getService()
280                            .addResources(companyId, groupId, userId, name, primKey,
281                            portletActions, addCommunityPermissions, addGuestPermissions);
282            }
283    
284            public static void deleteResource(long companyId, java.lang.String name,
285                    int scope, long primKey)
286                    throws com.liferay.portal.kernel.exception.PortalException,
287                            com.liferay.portal.kernel.exception.SystemException {
288                    getService().deleteResource(companyId, name, scope, primKey);
289            }
290    
291            public static void deleteResource(long companyId, java.lang.String name,
292                    int scope, java.lang.String primKey)
293                    throws com.liferay.portal.kernel.exception.PortalException,
294                            com.liferay.portal.kernel.exception.SystemException {
295                    getService().deleteResource(companyId, name, scope, primKey);
296            }
297    
298            public static void deleteResources(java.lang.String name)
299                    throws com.liferay.portal.kernel.exception.SystemException {
300                    getService().deleteResources(name);
301            }
302    
303            public static long getLatestResourceId()
304                    throws com.liferay.portal.kernel.exception.SystemException {
305                    return getService().getLatestResourceId();
306            }
307    
308            public static com.liferay.portal.model.Resource getResource(
309                    long companyId, java.lang.String name, int scope,
310                    java.lang.String primKey)
311                    throws com.liferay.portal.kernel.exception.PortalException,
312                            com.liferay.portal.kernel.exception.SystemException {
313                    return getService().getResource(companyId, name, scope, primKey);
314            }
315    
316            public static java.util.List<com.liferay.portal.model.Resource> getResources()
317                    throws com.liferay.portal.kernel.exception.SystemException {
318                    return getService().getResources();
319            }
320    
321            public static void updateResources(long companyId, java.lang.String name,
322                    int scope, java.lang.String primKey, java.lang.String newPrimKey)
323                    throws com.liferay.portal.kernel.exception.PortalException,
324                            com.liferay.portal.kernel.exception.SystemException {
325                    getService().updateResources(companyId, name, scope, primKey, newPrimKey);
326            }
327    
328            public static void updateResources(long companyId, long groupId,
329                    java.lang.String name, long primKey,
330                    java.lang.String[] communityPermissions,
331                    java.lang.String[] guestPermissions)
332                    throws com.liferay.portal.kernel.exception.PortalException,
333                            com.liferay.portal.kernel.exception.SystemException {
334                    getService()
335                            .updateResources(companyId, groupId, name, primKey,
336                            communityPermissions, guestPermissions);
337            }
338    
339            public static void updateResources(long companyId, long groupId,
340                    java.lang.String name, java.lang.String primKey,
341                    java.lang.String[] communityPermissions,
342                    java.lang.String[] guestPermissions)
343                    throws com.liferay.portal.kernel.exception.PortalException,
344                            com.liferay.portal.kernel.exception.SystemException {
345                    getService()
346                            .updateResources(companyId, groupId, name, primKey,
347                            communityPermissions, guestPermissions);
348            }
349    
350            public static ResourceLocalService getService() {
351                    if (_service == null) {
352                            _service = (ResourceLocalService)PortalBeanLocatorUtil.locate(ResourceLocalService.class.getName());
353                    }
354    
355                    return _service;
356            }
357    
358            public void setService(ResourceLocalService service) {
359                    _service = service;
360            }
361    
362            private static ResourceLocalService _service;
363    }