001    /**
002     * Copyright (c) 2000-2011 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.portal.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 organization remote service. This utility wraps {@link com.liferay.portal.service.impl.OrganizationServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
023     *
024     * <p>
025     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see OrganizationService
030     * @see com.liferay.portal.service.base.OrganizationServiceBaseImpl
031     * @see com.liferay.portal.service.impl.OrganizationServiceImpl
032     * @generated
033     */
034    public class OrganizationServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.OrganizationServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the organizations to the group.
043            *
044            * @param groupId the primary key of the group
045            * @param organizationIds the primary keys of the organizations
046            * @throws PortalException if a group or organization with the primary key
047            could not be found or if the user did not have permission to
048            assign group members
049            * @throws SystemException if a system exception occurred
050            */
051            public static void addGroupOrganizations(long groupId,
052                    long[] organizationIds)
053                    throws com.liferay.portal.kernel.exception.PortalException,
054                            com.liferay.portal.kernel.exception.SystemException {
055                    getService().addGroupOrganizations(groupId, organizationIds);
056            }
057    
058            /**
059            * Adds an organization with additional parameters.
060            *
061            * <p>
062            * This method handles the creation and bookkeeping of the organization
063            * including its resources, metadata, and internal data structures.
064            * </p>
065            *
066            * @param parentOrganizationId the primary key of the organization's parent
067            organization
068            * @param name the organization's name
069            * @param type the organization's type
070            * @param recursable whether the permissions of the organization are to be
071            inherited by its sub-organizations
072            * @param regionId the primary key of the organization's region
073            * @param countryId the primary key of the organization's country
074            * @param statusId the organization's workflow status
075            * @param comments the comments about the organization
076            * @param site whether the organization is to be associated with a main
077            site
078            * @param addresses the organization's addresses
079            * @param emailAddresses the organization's email addresses
080            * @param orgLabors the organization's hours of operation
081            * @param phones the organization's phone numbers
082            * @param websites the organization's websites
083            * @param serviceContext the organization's service context (optionally
084            <code>null</code>). Can specify the organization's asset category
085            IDs, asset tag names, and expando bridge attributes.
086            * @return the organization
087            * @throws PortalException if a parent organization with the primary key
088            could not be found, if the organization's information was
089            invalid, or if the user did not have permission to add the
090            organization
091            * @throws SystemException if a system exception occurred
092            */
093            public static com.liferay.portal.model.Organization addOrganization(
094                    long parentOrganizationId, java.lang.String name,
095                    java.lang.String type, boolean recursable, long regionId,
096                    long countryId, int statusId, java.lang.String comments, boolean site,
097                    java.util.List<com.liferay.portal.model.Address> addresses,
098                    java.util.List<com.liferay.portal.model.EmailAddress> emailAddresses,
099                    java.util.List<com.liferay.portal.model.OrgLabor> orgLabors,
100                    java.util.List<com.liferay.portal.model.Phone> phones,
101                    java.util.List<com.liferay.portal.model.Website> websites,
102                    com.liferay.portal.service.ServiceContext serviceContext)
103                    throws com.liferay.portal.kernel.exception.PortalException,
104                            com.liferay.portal.kernel.exception.SystemException {
105                    return getService()
106                                       .addOrganization(parentOrganizationId, name, type,
107                            recursable, regionId, countryId, statusId, comments, site,
108                            addresses, emailAddresses, orgLabors, phones, websites,
109                            serviceContext);
110            }
111    
112            /**
113            * Adds an organization.
114            *
115            * <p>
116            * This method handles the creation and bookkeeping of the organization
117            * including its resources, metadata, and internal data structures.
118            * </p>
119            *
120            * @param parentOrganizationId the primary key of the organization's parent
121            organization
122            * @param name the organization's name
123            * @param type the organization's type
124            * @param recursable whether the permissions of the organization are to be
125            inherited by its sub-organizations
126            * @param regionId the primary key of the organization's region
127            * @param countryId the primary key of the organization's country
128            * @param statusId the organization's workflow status
129            * @param comments the comments about the organization
130            * @param site whether the organization is to be associated with a main
131            site
132            * @param serviceContext the organization's service context (optionally
133            <code>null</code>). Can specify the organization's asset category
134            IDs, asset tag names, and expando bridge attributes.
135            * @return the organization
136            * @throws PortalException if the parent organization with the primary key
137            could not be found, if the organization information was invalid,
138            or if the user did not have permission to add the organization
139            * @throws SystemException if a system exception occurred
140            */
141            public static com.liferay.portal.model.Organization addOrganization(
142                    long parentOrganizationId, java.lang.String name,
143                    java.lang.String type, boolean recursable, long regionId,
144                    long countryId, int statusId, java.lang.String comments, boolean site,
145                    com.liferay.portal.service.ServiceContext serviceContext)
146                    throws com.liferay.portal.kernel.exception.PortalException,
147                            com.liferay.portal.kernel.exception.SystemException {
148                    return getService()
149                                       .addOrganization(parentOrganizationId, name, type,
150                            recursable, regionId, countryId, statusId, comments, site,
151                            serviceContext);
152            }
153    
154            /**
155            * Assigns the password policy to the organizations, removing any other
156            * currently assigned password policies.
157            *
158            * @param passwordPolicyId the primary key of the password policy
159            * @param organizationIds the primary keys of the organizations
160            * @throws PortalException if the user did not have permission to update the
161            password policy
162            * @throws SystemException if a system exception occurred
163            */
164            public static void addPasswordPolicyOrganizations(long passwordPolicyId,
165                    long[] organizationIds)
166                    throws com.liferay.portal.kernel.exception.PortalException,
167                            com.liferay.portal.kernel.exception.SystemException {
168                    getService()
169                            .addPasswordPolicyOrganizations(passwordPolicyId, organizationIds);
170            }
171    
172            /**
173            * Deletes the logo of the organization.
174            *
175            * @param organizationId the primary key of the organization
176            * @throws PortalException if an organization with the primary key could not
177            be found, if the organization's logo could not be found, or if
178            the user did not have permission to update the organization
179            * @throws SystemException if a system exception occurred
180            */
181            public static void deleteLogo(long organizationId)
182                    throws com.liferay.portal.kernel.exception.PortalException,
183                            com.liferay.portal.kernel.exception.SystemException {
184                    getService().deleteLogo(organizationId);
185            }
186    
187            /**
188            * Deletes the organization. The organization's associated resources and
189            * assets are also deleted.
190            *
191            * @param organizationId the primary key of the organization
192            * @throws PortalException if an organization with the primary key could not
193            be found, if the user did not have permission to delete the
194            organization, if the organization had a workflow in approved
195            status, or if the organization was a parent organization
196            * @throws SystemException if a system exception occurred
197            */
198            public static void deleteOrganization(long organizationId)
199                    throws com.liferay.portal.kernel.exception.PortalException,
200                            com.liferay.portal.kernel.exception.SystemException {
201                    getService().deleteOrganization(organizationId);
202            }
203    
204            /**
205            * Returns all the organizations which the user has permission to manage.
206            *
207            * @param actionId the permitted action
208            * @param max the maximum number of the organizations to be considered
209            * @return the organizations which the user has permission to manage
210            * @throws PortalException if a portal exception occurred
211            * @throws SystemException if a system exception occurred
212            * @deprecated Replaced by {@link #getOrganizations(long, long, int, int)}
213            */
214            public static java.util.List<com.liferay.portal.model.Organization> getManageableOrganizations(
215                    java.lang.String actionId, int max)
216                    throws com.liferay.portal.kernel.exception.PortalException,
217                            com.liferay.portal.kernel.exception.SystemException {
218                    return getService().getManageableOrganizations(actionId, max);
219            }
220    
221            /**
222            * Returns the organization with the primary key.
223            *
224            * @param organizationId the primary key of the organization
225            * @return the organization with the primary key
226            * @throws PortalException if an organization with the primary key could not
227            be found or if the user did not have permission to view the
228            organization
229            * @throws SystemException if a system exception occurred
230            */
231            public static com.liferay.portal.model.Organization getOrganization(
232                    long organizationId)
233                    throws com.liferay.portal.kernel.exception.PortalException,
234                            com.liferay.portal.kernel.exception.SystemException {
235                    return getService().getOrganization(organizationId);
236            }
237    
238            /**
239            * Returns the primary key of the organization with the name.
240            *
241            * @param companyId the primary key of the organization's company
242            * @param name the organization's name
243            * @return the primary key of the organization with the name, or
244            <code>0</code> if the organization could not be found
245            * @throws SystemException if a system exception occurred
246            */
247            public static long getOrganizationId(long companyId, java.lang.String name)
248                    throws com.liferay.portal.kernel.exception.SystemException {
249                    return getService().getOrganizationId(companyId, name);
250            }
251    
252            /**
253            * Returns all the organizations belonging to the parent organization.
254            *
255            * @param companyId the primary key of the organizations' company
256            * @param parentOrganizationId the primary key of the organizations' parent
257            organization
258            * @return the organizations belonging to the parent organization
259            * @throws SystemException if a system exception occurred
260            */
261            public static java.util.List<com.liferay.portal.model.Organization> getOrganizations(
262                    long companyId, long parentOrganizationId)
263                    throws com.liferay.portal.kernel.exception.SystemException {
264                    return getService().getOrganizations(companyId, parentOrganizationId);
265            }
266    
267            /**
268            * Returns a range of all the organizations belonging to the parent
269            * organization.
270            *
271            * <p>
272            * Useful when paginating results. Returns a maximum of <code>end -
273            * start</code> instances. <code>start</code> and <code>end</code> are not
274            * primary keys, they are indexes in the result set. Thus, <code>0</code>
275            * refers to the first result in the set. Setting both <code>start</code>
276            * and <code>end</code> to {@link
277            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
278            * result set.
279            * </p>
280            *
281            * @param companyId the primary key of the organizations' company
282            * @param parentOrganizationId the primary key of the organizations' parent
283            organization
284            * @param start the lower bound of the range of organizations to return
285            * @param end the upper bound of the range of organizations to return (not
286            inclusive)
287            * @return the range of organizations belonging to the parent organization
288            * @throws SystemException if a system exception occurred
289            */
290            public static java.util.List<com.liferay.portal.model.Organization> getOrganizations(
291                    long companyId, long parentOrganizationId, int start, int end)
292                    throws com.liferay.portal.kernel.exception.SystemException {
293                    return getService()
294                                       .getOrganizations(companyId, parentOrganizationId, start, end);
295            }
296    
297            /**
298            * Returns the number of organizations belonging to the parent organization.
299            *
300            * @param companyId the primary key of the organizations' company
301            * @param parentOrganizationId the primary key of the organizations' parent
302            organization
303            * @return the number of organizations belonging to the parent organization
304            * @throws SystemException if a system exception occurred
305            */
306            public static int getOrganizationsCount(long companyId,
307                    long parentOrganizationId)
308                    throws com.liferay.portal.kernel.exception.SystemException {
309                    return getService()
310                                       .getOrganizationsCount(companyId, parentOrganizationId);
311            }
312    
313            /**
314            * Returns all the organizations associated with the user.
315            *
316            * @param userId the primary key of the user
317            * @return the organizations associated with the user
318            * @throws PortalException if a user with the primary key could not be found
319            * @throws SystemException if a system exception occurred
320            */
321            public static java.util.List<com.liferay.portal.model.Organization> getUserOrganizations(
322                    long userId)
323                    throws com.liferay.portal.kernel.exception.PortalException,
324                            com.liferay.portal.kernel.exception.SystemException {
325                    return getService().getUserOrganizations(userId);
326            }
327    
328            /**
329            * Returns all the organizations associated with the user, optionally
330            * including the organizations associated with the user groups to which the
331            * user belongs.
332            *
333            * @param userId the primary key of the user
334            * @param inheritUserGroups whether to include organizations associated
335            with the user groups to which the user belongs
336            * @return the organizations associated with the user
337            * @throws PortalException if a user with the primary key could not be found
338            * @throws SystemException if a system exception occurred
339            */
340            public static java.util.List<com.liferay.portal.model.Organization> getUserOrganizations(
341                    long userId, boolean inheritUserGroups)
342                    throws com.liferay.portal.kernel.exception.PortalException,
343                            com.liferay.portal.kernel.exception.SystemException {
344                    return getService().getUserOrganizations(userId, inheritUserGroups);
345            }
346    
347            /**
348            * Sets the organizations in the group, removing and adding organizations to
349            * the group as necessary.
350            *
351            * @param groupId the primary key of the group
352            * @param organizationIds the primary keys of the organizations
353            * @throws PortalException if a group or organization with the primary key
354            could not be found or if the user did not have permission to
355            assign group members
356            * @throws SystemException if a system exception occurred
357            */
358            public static void setGroupOrganizations(long groupId,
359                    long[] organizationIds)
360                    throws com.liferay.portal.kernel.exception.PortalException,
361                            com.liferay.portal.kernel.exception.SystemException {
362                    getService().setGroupOrganizations(groupId, organizationIds);
363            }
364    
365            /**
366            * Removes the organizations from the group.
367            *
368            * @param groupId the primary key of the group
369            * @param organizationIds the primary keys of the organizations
370            * @throws PortalException if a group or organization with the primary key
371            could not be found or if the user did not have permission to
372            assign group members
373            * @throws SystemException if a system exception occurred
374            */
375            public static void unsetGroupOrganizations(long groupId,
376                    long[] organizationIds)
377                    throws com.liferay.portal.kernel.exception.PortalException,
378                            com.liferay.portal.kernel.exception.SystemException {
379                    getService().unsetGroupOrganizations(groupId, organizationIds);
380            }
381    
382            /**
383            * Removes the organizations from the password policy.
384            *
385            * @param passwordPolicyId the primary key of the password policy
386            * @param organizationIds the primary keys of the organizations
387            * @throws PortalException if a password policy or organization with the
388            primary key could not be found, or if the user did not have
389            permission to update the password policy.
390            * @throws SystemException if a system exception occurred
391            */
392            public static void unsetPasswordPolicyOrganizations(long passwordPolicyId,
393                    long[] organizationIds)
394                    throws com.liferay.portal.kernel.exception.PortalException,
395                            com.liferay.portal.kernel.exception.SystemException {
396                    getService()
397                            .unsetPasswordPolicyOrganizations(passwordPolicyId, organizationIds);
398            }
399    
400            /**
401            * Updates the organization with additional parameters.
402            *
403            * @param organizationId the primary key of the organization
404            * @param parentOrganizationId the primary key of the organization's parent
405            organization
406            * @param name the organization's name
407            * @param type the organization's type
408            * @param recursable whether the permissions of the organization are to be
409            inherited by its sub-organizations
410            * @param regionId the primary key of the organization's region
411            * @param countryId the primary key of the organization's country
412            * @param statusId the organization's workflow status
413            * @param comments the comments about the organization
414            * @param site whether the organization is to be associated with a main
415            site
416            * @param addresses the organization's addresses
417            * @param emailAddresses the organization's email addresses
418            * @param orgLabors the organization's hours of operation
419            * @param phones the organization's phone numbers
420            * @param websites the organization's websites
421            * @param serviceContext the organization's service context (optionally
422            <code>null</code>). Can specify the organization's replacement
423            asset category IDs, replacement asset tag names, and new expando
424            bridge attributes.
425            * @return the organization
426            * @throws PortalException if an organization or parent organization with
427            the primary key could not be found, if the user did not have
428            permission to update the organization information, or if the new
429            information was invalid
430            * @throws SystemException if a system exception occurred
431            */
432            public static com.liferay.portal.model.Organization updateOrganization(
433                    long organizationId, long parentOrganizationId, java.lang.String name,
434                    java.lang.String type, boolean recursable, long regionId,
435                    long countryId, int statusId, java.lang.String comments, boolean site,
436                    java.util.List<com.liferay.portal.model.Address> addresses,
437                    java.util.List<com.liferay.portal.model.EmailAddress> emailAddresses,
438                    java.util.List<com.liferay.portal.model.OrgLabor> orgLabors,
439                    java.util.List<com.liferay.portal.model.Phone> phones,
440                    java.util.List<com.liferay.portal.model.Website> websites,
441                    com.liferay.portal.service.ServiceContext serviceContext)
442                    throws com.liferay.portal.kernel.exception.PortalException,
443                            com.liferay.portal.kernel.exception.SystemException {
444                    return getService()
445                                       .updateOrganization(organizationId, parentOrganizationId,
446                            name, type, recursable, regionId, countryId, statusId, comments,
447                            site, addresses, emailAddresses, orgLabors, phones, websites,
448                            serviceContext);
449            }
450    
451            /**
452            * Updates the organization.
453            *
454            * @param organizationId the primary key of the organization
455            * @param parentOrganizationId the primary key of the organization's parent
456            organization
457            * @param name the organization's name
458            * @param type the organization's type
459            * @param recursable whether permissions of the organization are to be
460            inherited by its sub-organizations
461            * @param regionId the primary key of the organization's region
462            * @param countryId the primary key of the organization's country
463            * @param statusId the organization's workflow status
464            * @param comments the comments about the organization
465            * @param site whether the organization is to be associated with a main
466            site
467            * @param serviceContext the organization's service context (optionally
468            <code>null</code>). Can specify the organization's replacement
469            asset category IDs, replacement asset tag names, and new expando
470            bridge attributes.
471            * @return the organization
472            * @throws PortalException if an organization or parent organization with
473            the primary key could not be found, if the user did not have
474            permission to update the organization, or if the new information
475            was invalid
476            * @throws SystemException if a system exception occurred
477            */
478            public static com.liferay.portal.model.Organization updateOrganization(
479                    long organizationId, long parentOrganizationId, java.lang.String name,
480                    java.lang.String type, boolean recursable, long regionId,
481                    long countryId, int statusId, java.lang.String comments, boolean site,
482                    com.liferay.portal.service.ServiceContext serviceContext)
483                    throws com.liferay.portal.kernel.exception.PortalException,
484                            com.liferay.portal.kernel.exception.SystemException {
485                    return getService()
486                                       .updateOrganization(organizationId, parentOrganizationId,
487                            name, type, recursable, regionId, countryId, statusId, comments,
488                            site, serviceContext);
489            }
490    
491            public static OrganizationService getService() {
492                    if (_service == null) {
493                            _service = (OrganizationService)PortalBeanLocatorUtil.locate(OrganizationService.class.getName());
494    
495                            ReferenceRegistry.registerReference(OrganizationServiceUtil.class,
496                                    "_service");
497                            MethodCache.remove(OrganizationService.class);
498                    }
499    
500                    return _service;
501            }
502    
503            public void setService(OrganizationService service) {
504                    MethodCache.remove(OrganizationService.class);
505    
506                    _service = service;
507    
508                    ReferenceRegistry.registerReference(OrganizationServiceUtil.class,
509                            "_service");
510                    MethodCache.remove(OrganizationService.class);
511            }
512    
513            private static OrganizationService _service;
514    }