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.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 set asset category IDs, asset tag names,
085            and expando bridge attributes for the organization.
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 set asset category IDs, asset tag names,
134            and expando bridge attributes for the organization.
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            * Sets the organizations in the group, removing and adding organizations to
330            * the group as necessary.
331            *
332            * @param groupId the primary key of the group
333            * @param organizationIds the primary keys of the organizations
334            * @throws PortalException if a group or organization with the primary key
335            could not be found or if the user did not have permission to
336            assign group members
337            * @throws SystemException if a system exception occurred
338            */
339            public static void setGroupOrganizations(long groupId,
340                    long[] organizationIds)
341                    throws com.liferay.portal.kernel.exception.PortalException,
342                            com.liferay.portal.kernel.exception.SystemException {
343                    getService().setGroupOrganizations(groupId, organizationIds);
344            }
345    
346            /**
347            * Removes the organizations from the group.
348            *
349            * @param groupId the primary key of the group
350            * @param organizationIds the primary keys of the organizations
351            * @throws PortalException if a group or organization with the primary key
352            could not be found or if the user did not have permission to
353            assign group members
354            * @throws SystemException if a system exception occurred
355            */
356            public static void unsetGroupOrganizations(long groupId,
357                    long[] organizationIds)
358                    throws com.liferay.portal.kernel.exception.PortalException,
359                            com.liferay.portal.kernel.exception.SystemException {
360                    getService().unsetGroupOrganizations(groupId, organizationIds);
361            }
362    
363            /**
364            * Removes the organizations from the password policy.
365            *
366            * @param passwordPolicyId the primary key of the password policy
367            * @param organizationIds the primary keys of the organizations
368            * @throws PortalException if a password policy or organization with the
369            primary key could not be found, or if the user did not have
370            permission to update the password policy
371            * @throws SystemException if a system exception occurred
372            */
373            public static void unsetPasswordPolicyOrganizations(long passwordPolicyId,
374                    long[] organizationIds)
375                    throws com.liferay.portal.kernel.exception.PortalException,
376                            com.liferay.portal.kernel.exception.SystemException {
377                    getService()
378                            .unsetPasswordPolicyOrganizations(passwordPolicyId, organizationIds);
379            }
380    
381            /**
382            * Updates the organization with additional parameters.
383            *
384            * @param organizationId the primary key of the organization
385            * @param parentOrganizationId the primary key of the organization's parent
386            organization
387            * @param name the organization's name
388            * @param type the organization's type
389            * @param recursable whether the permissions of the organization are to be
390            inherited by its sub-organizations
391            * @param regionId the primary key of the organization's region
392            * @param countryId the primary key of the organization's country
393            * @param statusId the organization's workflow status
394            * @param comments the comments about the organization
395            * @param site whether the organization is to be associated with a main
396            site
397            * @param addresses the organization's addresses
398            * @param emailAddresses the organization's email addresses
399            * @param orgLabors the organization's hours of operation
400            * @param phones the organization's phone numbers
401            * @param websites the organization's websites
402            * @param serviceContext the organization's service context (optionally
403            <code>null</code>). Can set asset category IDs and asset tag
404            names for the organization, and merge expando bridge attributes
405            for the organization.
406            * @return the organization
407            * @throws PortalException if an organization or parent organization with
408            the primary key could not be found, if the user did not have
409            permission to update the organization information, or if the new
410            information was invalid
411            * @throws SystemException if a system exception occurred
412            */
413            public static com.liferay.portal.model.Organization updateOrganization(
414                    long organizationId, long parentOrganizationId, java.lang.String name,
415                    java.lang.String type, boolean recursable, long regionId,
416                    long countryId, int statusId, java.lang.String comments, boolean site,
417                    java.util.List<com.liferay.portal.model.Address> addresses,
418                    java.util.List<com.liferay.portal.model.EmailAddress> emailAddresses,
419                    java.util.List<com.liferay.portal.model.OrgLabor> orgLabors,
420                    java.util.List<com.liferay.portal.model.Phone> phones,
421                    java.util.List<com.liferay.portal.model.Website> websites,
422                    com.liferay.portal.service.ServiceContext serviceContext)
423                    throws com.liferay.portal.kernel.exception.PortalException,
424                            com.liferay.portal.kernel.exception.SystemException {
425                    return getService()
426                                       .updateOrganization(organizationId, parentOrganizationId,
427                            name, type, recursable, regionId, countryId, statusId, comments,
428                            site, addresses, emailAddresses, orgLabors, phones, websites,
429                            serviceContext);
430            }
431    
432            /**
433            * Updates the organization.
434            *
435            * @param organizationId the primary key of the organization
436            * @param parentOrganizationId the primary key of the organization's parent
437            organization
438            * @param name the organization's name
439            * @param type the organization's type
440            * @param recursable whether permissions of the organization are to be
441            inherited by its sub-organizations
442            * @param regionId the primary key of the organization's region
443            * @param countryId the primary key of the organization's country
444            * @param statusId the organization's workflow status
445            * @param comments the comments about the organization
446            * @param site whether the organization is to be associated with a main
447            site
448            * @param serviceContext the organization's service context (optionally
449            <code>null</code>). Can set asset category IDs and asset tag
450            names for the organization, and merge expando bridge attributes
451            for the organization.
452            * @return the organization
453            * @throws PortalException if an organization or parent organization with
454            the primary key could not be found, if the user did not have
455            permission to update the organization, or if the new information
456            was invalid
457            * @throws SystemException if a system exception occurred
458            */
459            public static com.liferay.portal.model.Organization updateOrganization(
460                    long organizationId, long parentOrganizationId, java.lang.String name,
461                    java.lang.String type, boolean recursable, long regionId,
462                    long countryId, int statusId, java.lang.String comments, boolean site,
463                    com.liferay.portal.service.ServiceContext serviceContext)
464                    throws com.liferay.portal.kernel.exception.PortalException,
465                            com.liferay.portal.kernel.exception.SystemException {
466                    return getService()
467                                       .updateOrganization(organizationId, parentOrganizationId,
468                            name, type, recursable, regionId, countryId, statusId, comments,
469                            site, serviceContext);
470            }
471    
472            public static OrganizationService getService() {
473                    if (_service == null) {
474                            _service = (OrganizationService)PortalBeanLocatorUtil.locate(OrganizationService.class.getName());
475    
476                            ReferenceRegistry.registerReference(OrganizationServiceUtil.class,
477                                    "_service");
478                            MethodCache.remove(OrganizationService.class);
479                    }
480    
481                    return _service;
482            }
483    
484            public void setService(OrganizationService service) {
485                    MethodCache.remove(OrganizationService.class);
486    
487                    _service = service;
488    
489                    ReferenceRegistry.registerReference(OrganizationServiceUtil.class,
490                            "_service");
491                    MethodCache.remove(OrganizationService.class);
492            }
493    
494            private static OrganizationService _service;
495    }