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