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