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