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.dao.orm.ActionableDynamicQuery;
020    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
021    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
022    import com.liferay.portal.kernel.dao.orm.Projection;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.model.Company;
026    import com.liferay.portal.kernel.model.PersistedModel;
027    import com.liferay.portal.kernel.search.Hits;
028    import com.liferay.portal.kernel.search.Indexable;
029    import com.liferay.portal.kernel.search.IndexableType;
030    import com.liferay.portal.kernel.transaction.Isolation;
031    import com.liferay.portal.kernel.transaction.Propagation;
032    import com.liferay.portal.kernel.transaction.Transactional;
033    import com.liferay.portal.kernel.util.OrderByComparator;
034    import com.liferay.portal.kernel.util.UnicodeProperties;
035    
036    import java.io.File;
037    import java.io.InputStream;
038    import java.io.Serializable;
039    
040    import java.util.List;
041    
042    /**
043     * Provides the local service interface for Company. Methods of this
044     * service will not have security checks based on the propagated JAAS
045     * credentials because this service can only be accessed from within the same
046     * VM.
047     *
048     * @author Brian Wing Shun Chan
049     * @see CompanyLocalServiceUtil
050     * @see com.liferay.portal.service.base.CompanyLocalServiceBaseImpl
051     * @see com.liferay.portal.service.impl.CompanyLocalServiceImpl
052     * @generated
053     */
054    @ProviderType
055    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
056            PortalException.class, SystemException.class})
057    public interface CompanyLocalService extends BaseLocalService,
058            PersistedModelLocalService {
059            /*
060             * NOTE FOR DEVELOPERS:
061             *
062             * Never modify or reference this interface directly. Always use {@link CompanyLocalServiceUtil} to access the company local service. Add custom service methods to {@link com.liferay.portal.service.impl.CompanyLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
063             */
064            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
065            public ActionableDynamicQuery getActionableDynamicQuery();
066    
067            public DynamicQuery dynamicQuery();
068    
069            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
070            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
071    
072            /**
073            * Adds the company to the database. Also notifies the appropriate model listeners.
074            *
075            * @param company the company
076            * @return the company that was added
077            */
078            @Indexable(type = IndexableType.REINDEX)
079            public Company addCompany(Company company);
080    
081            /**
082            * Adds a company.
083            *
084            * @param webId the the company's web domain
085            * @param virtualHostname the company's virtual host name
086            * @param mx the company's mail domain
087            * @param system whether the company is the very first company (i.e., the
088            super company)
089            * @param maxUsers the max number of company users (optionally
090            <code>0</code>)
091            * @param active whether the company is active
092            * @return the company
093            */
094            public Company addCompany(java.lang.String webId,
095                    java.lang.String virtualHostname, java.lang.String mx, boolean system,
096                    int maxUsers, boolean active) throws PortalException;
097    
098            /**
099            * Returns the company with the web domain.
100            *
101            * The method sets mail domain to the web domain to the default name set in
102            * portal.properties
103            *
104            * @param webId the company's web domain
105            * @return the company with the web domain
106            */
107            public Company checkCompany(java.lang.String webId)
108                    throws PortalException;
109    
110            /**
111            * Returns the company with the web domain and mail domain. If no such
112            * company exits, the method will create a new company.
113            *
114            * The method goes through a series of checks to ensure that the company
115            * contains default users, groups, etc.
116            *
117            * @param webId the company's web domain
118            * @param mx the company's mail domain
119            * @return the company with the web domain and mail domain
120            */
121            @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
122                    PortalException.class, SystemException.class}
123            )
124            public Company checkCompany(java.lang.String webId, java.lang.String mx)
125                    throws PortalException;
126    
127            /**
128            * Creates a new company with the primary key. Does not add the company to the database.
129            *
130            * @param companyId the primary key for the new company
131            * @return the new company
132            */
133            public Company createCompany(long companyId);
134    
135            /**
136            * Deletes the company from the database. Also notifies the appropriate model listeners.
137            *
138            * @param company the company
139            * @return the company that was removed
140            * @throws PortalException
141            */
142            @Indexable(type = IndexableType.DELETE)
143            public Company deleteCompany(Company company) throws PortalException;
144    
145            /**
146            * Deletes the company with the primary key from the database. Also notifies the appropriate model listeners.
147            *
148            * @param companyId the primary key of the company
149            * @return the company that was removed
150            * @throws PortalException if a company with the primary key could not be found
151            */
152            @Indexable(type = IndexableType.DELETE)
153            public Company deleteCompany(long companyId) throws PortalException;
154    
155            /**
156            * Deletes the company's logo.
157            *
158            * @param companyId the primary key of the company
159            * @return the deleted logo's company
160            */
161            public Company deleteLogo(long companyId) throws PortalException;
162    
163            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
164            public Company fetchCompany(long companyId);
165    
166            /**
167            * Returns the company with the primary key.
168            *
169            * @param companyId the primary key of the company
170            * @return the company with the primary key, <code>null</code> if a company
171            with the primary key could not be found
172            */
173            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
174            public Company fetchCompanyById(long companyId);
175    
176            /**
177            * Returns the company with the virtual host name.
178            *
179            * @param virtualHostname the virtual host name
180            * @return the company with the virtual host name, <code>null</code> if a
181            company with the virtual host could not be found
182            */
183            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
184            public Company fetchCompanyByVirtualHost(java.lang.String virtualHostname);
185    
186            /**
187            * Returns the company with the primary key.
188            *
189            * @param companyId the primary key of the company
190            * @return the company
191            * @throws PortalException if a company with the primary key could not be found
192            */
193            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
194            public Company getCompany(long companyId) throws PortalException;
195    
196            /**
197            * Returns the company with the primary key.
198            *
199            * @param companyId the primary key of the company
200            * @return the company with the primary key
201            */
202            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
203            public Company getCompanyById(long companyId) throws PortalException;
204    
205            /**
206            * Returns the company with the logo.
207            *
208            * @param logoId the ID of the company's logo
209            * @return the company with the logo
210            */
211            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
212            public Company getCompanyByLogoId(long logoId) throws PortalException;
213    
214            /**
215            * Returns the company with the mail domain.
216            *
217            * @param mx the company's mail domain
218            * @return the company with the mail domain
219            */
220            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
221            public Company getCompanyByMx(java.lang.String mx)
222                    throws PortalException;
223    
224            /**
225            * Returns the company with the virtual host name.
226            *
227            * @param virtualHostname the company's virtual host name
228            * @return the company with the virtual host name
229            */
230            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
231            public Company getCompanyByVirtualHost(java.lang.String virtualHostname)
232                    throws PortalException;
233    
234            /**
235            * Returns the company with the web domain.
236            *
237            * @param webId the company's web domain
238            * @return the company with the web domain
239            */
240            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
241            public Company getCompanyByWebId(java.lang.String webId)
242                    throws PortalException;
243    
244            /**
245            * Updates the company in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
246            *
247            * @param company the company
248            * @return the company that was updated
249            */
250            @Indexable(type = IndexableType.REINDEX)
251            public Company updateCompany(Company company);
252    
253            /**
254            * Updates the company.
255            *
256            * @param companyId the primary key of the company
257            * @param virtualHostname the company's virtual host name
258            * @param mx the company's mail domain
259            * @param maxUsers the max number of company users (optionally
260            <code>0</code>)
261            * @param active whether the company is active
262            * @return the company with the primary key
263            */
264            public Company updateCompany(long companyId,
265                    java.lang.String virtualHostname, java.lang.String mx, int maxUsers,
266                    boolean active) throws PortalException;
267    
268            /**
269            * Update the company with additional account information.
270            *
271            * @param companyId the primary key of the company
272            * @param virtualHostname the company's virtual host name
273            * @param mx the company's mail domain
274            * @param homeURL the company's home URL (optionally <code>null</code>)
275            * @param logo whether to update the company's logo
276            * @param logoBytes the new logo image data
277            * @param name the company's account name(optionally <code>null</code>)
278            * @param legalName the company's account legal name (optionally
279            <code>null</code>)
280            * @param legalId the company's account legal ID (optionally
281            <code>null</code>)
282            * @param legalType the company's account legal type (optionally
283            <code>null</code>)
284            * @param sicCode the company's account SIC code (optionally
285            <code>null</code>)
286            * @param tickerSymbol the company's account ticker symbol (optionally
287            <code>null</code>)
288            * @param industry the company's account industry (optionally
289            <code>null</code>)
290            * @param type the company's account type (optionally <code>null</code>)
291            * @param size the company's account size (optionally <code>null</code>)
292            * @return the company with the primary key
293            */
294            public Company updateCompany(long companyId,
295                    java.lang.String virtualHostname, java.lang.String mx,
296                    java.lang.String homeURL, boolean logo, byte[] logoBytes,
297                    java.lang.String name, java.lang.String legalName,
298                    java.lang.String legalId, java.lang.String legalType,
299                    java.lang.String sicCode, java.lang.String tickerSymbol,
300                    java.lang.String industry, java.lang.String type, java.lang.String size)
301                    throws PortalException;
302    
303            /**
304            * Update the company with additional account information.
305            *
306            * @param companyId the primary key of the company
307            * @param virtualHostname the company's virtual host name
308            * @param mx the company's mail domain
309            * @param homeURL the company's home URL (optionally <code>null</code>)
310            * @param name the company's account name(optionally <code>null</code>)
311            * @param legalName the company's account legal name (optionally
312            <code>null</code>)
313            * @param legalId the company's account legal ID (optionally
314            <code>null</code>)
315            * @param legalType the company's account legal type (optionally
316            <code>null</code>)
317            * @param sicCode the company's account SIC code (optionally
318            <code>null</code>)
319            * @param tickerSymbol the company's account ticker symbol (optionally
320            <code>null</code>)
321            * @param industry the company's account industry (optionally
322            <code>null</code>)
323            * @param type the company's account type (optionally
324            <code>null</code>)
325            * @param size the company's account size (optionally
326            <code>null</code>)
327            * @return the company with the primary key
328            * @deprecated As of 7.0.0, replaced by {@link #updateCompany(long, String,
329            String, String, boolean, byte[], String, String, String,
330            String, String, String, String, String, String)}
331            */
332            @java.lang.Deprecated
333            public Company updateCompany(long companyId,
334                    java.lang.String virtualHostname, java.lang.String mx,
335                    java.lang.String homeURL, java.lang.String name,
336                    java.lang.String legalName, java.lang.String legalId,
337                    java.lang.String legalType, java.lang.String sicCode,
338                    java.lang.String tickerSymbol, java.lang.String industry,
339                    java.lang.String type, java.lang.String size) throws PortalException;
340    
341            /**
342            * Updates the company's logo.
343            *
344            * @param companyId the primary key of the company
345            * @param bytes the bytes of the company's logo image
346            * @return the company with the primary key
347            */
348            public Company updateLogo(long companyId, byte[] bytes)
349                    throws PortalException;
350    
351            /**
352            * Updates the company's logo.
353            *
354            * @param companyId the primary key of the company
355            * @param file the file of the company's logo image
356            * @return the company with the primary key
357            */
358            public Company updateLogo(long companyId, File file)
359                    throws PortalException;
360    
361            /**
362            * Update the company's logo.
363            *
364            * @param companyId the primary key of the company
365            * @param is the input stream of the company's logo image
366            * @return the company with the primary key
367            */
368            public Company updateLogo(long companyId, InputStream is)
369                    throws PortalException;
370    
371            /**
372            * @throws PortalException
373            */
374            @Override
375            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
376                    throws PortalException;
377    
378            @Override
379            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
380            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
381                    throws PortalException;
382    
383            /**
384            * Returns an ordered range of all assets that match the keywords in the
385            * company.
386            *
387            * The method is called in {@link
388            * com.liferay.portal.search.PortalOpenSearchImpl} which is not longer used
389            * by the Search portlet.
390            *
391            * @param companyId the primary key of the company
392            * @param userId the primary key of the user
393            * @param keywords the keywords (space separated),which may occur in assets
394            in the company (optionally <code>null</code>)
395            * @param start the lower bound of the range of assets to return
396            * @param end the upper bound of the range of assets to return (not
397            inclusive)
398            * @return the matching assets in the company
399            */
400            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
401            public Hits search(long companyId, long userId, java.lang.String keywords,
402                    int start, int end);
403    
404            /**
405            * Returns an ordered range of all assets that match the keywords in the
406            * portlet within the company.
407            *
408            * @param companyId the primary key of the company
409            * @param userId the primary key of the user
410            * @param portletId the primary key of the portlet (optionally
411            <code>null</code>)
412            * @param groupId the primary key of the group (optionally <code>0</code>)
413            * @param type the mime type of assets to return(optionally
414            <code>null</code>)
415            * @param keywords the keywords (space separated), which may occur in any
416            assets in the portlet (optionally <code>null</code>)
417            * @param start the lower bound of the range of assets to return
418            * @param end the upper bound of the range of assets to return (not
419            inclusive)
420            * @return the matching assets in the portlet within the company
421            */
422            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
423            public Hits search(long companyId, long userId, java.lang.String portletId,
424                    long groupId, java.lang.String type, java.lang.String keywords,
425                    int start, int end);
426    
427            /**
428            * Returns the number of companies.
429            *
430            * @return the number of companies
431            */
432            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
433            public int getCompaniesCount();
434    
435            /**
436            * Returns the number of companies used by WSRP.
437            *
438            * @param system whether the company is the very first company (i.e., the
439            super company)
440            * @return the number of companies used by WSRP
441            */
442            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
443            public int getCompaniesCount(boolean system);
444    
445            /**
446            * Returns the OSGi service identifier.
447            *
448            * @return the OSGi service identifier
449            */
450            public java.lang.String getOSGiServiceIdentifier();
451    
452            /**
453            * Performs a dynamic query on the database and returns the matching rows.
454            *
455            * @param dynamicQuery the dynamic query
456            * @return the matching rows
457            */
458            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
459    
460            /**
461            * Performs a dynamic query on the database and returns a range of the matching rows.
462            *
463            * <p>
464            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.CompanyModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
465            * </p>
466            *
467            * @param dynamicQuery the dynamic query
468            * @param start the lower bound of the range of model instances
469            * @param end the upper bound of the range of model instances (not inclusive)
470            * @return the range of matching rows
471            */
472            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
473                    int end);
474    
475            /**
476            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
477            *
478            * <p>
479            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.CompanyModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
480            * </p>
481            *
482            * @param dynamicQuery the dynamic query
483            * @param start the lower bound of the range of model instances
484            * @param end the upper bound of the range of model instances (not inclusive)
485            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
486            * @return the ordered range of matching rows
487            */
488            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
489                    int end, OrderByComparator<T> orderByComparator);
490    
491            /**
492            * Returns all the companies.
493            *
494            * @return the companies
495            */
496            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
497            public List<Company> getCompanies();
498    
499            /**
500            * Returns all the companies used by WSRP.
501            *
502            * @param system whether the company is the very first company (i.e., the
503            super company)
504            * @return the companies used by WSRP
505            */
506            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
507            public List<Company> getCompanies(boolean system);
508    
509            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
510            public List<Company> getCompanies(boolean system, int start, int end);
511    
512            /**
513            * Returns a range of all the companies.
514            *
515            * <p>
516            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.CompanyModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
517            * </p>
518            *
519            * @param start the lower bound of the range of companies
520            * @param end the upper bound of the range of companies (not inclusive)
521            * @return the range of companies
522            */
523            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
524            public List<Company> getCompanies(int start, int end);
525    
526            /**
527            * Returns the number of rows matching the dynamic query.
528            *
529            * @param dynamicQuery the dynamic query
530            * @return the number of rows matching the dynamic query
531            */
532            public long dynamicQueryCount(DynamicQuery dynamicQuery);
533    
534            /**
535            * Returns the number of rows matching the dynamic query.
536            *
537            * @param dynamicQuery the dynamic query
538            * @param projection the projection to apply to the query
539            * @return the number of rows matching the dynamic query
540            */
541            public long dynamicQueryCount(DynamicQuery dynamicQuery,
542                    Projection projection);
543    
544            /**
545            * Returns the user's company.
546            *
547            * @param userId the primary key of the user
548            * @return Returns the first company if there is only one company or the
549            user's company if there are more than one company; <code>0</code>
550            otherwise
551            * @throws Exception if a user with the primary key could not be found
552            */
553            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
554            public long getCompanyIdByUserId(long userId) throws java.lang.Exception;
555    
556            /**
557            * Checks if the company has an encryption key. It will create a key if one
558            * does not exist.
559            *
560            * @param companyId the primary key of the company
561            */
562            public void checkCompanyKey(long companyId) throws PortalException;
563    
564            /**
565            * Removes the values that match the keys of the company's preferences.
566            *
567            * This method is called by {@link
568            * com.liferay.portlet.portalsettings.action.EditLDAPServerAction} remotely
569            * through {@link CompanyService}.
570            *
571            * @param companyId the primary key of the company
572            * @param keys the company's preferences keys to be remove
573            */
574            public void removePreferences(long companyId, java.lang.String[] keys);
575    
576            /**
577            * Update the company's display.
578            *
579            * @param companyId the primary key of the company
580            * @param languageId the ID of the company's default user's language
581            * @param timeZoneId the ID of the company's default user's time zone
582            */
583            public void updateDisplay(long companyId, java.lang.String languageId,
584                    java.lang.String timeZoneId) throws PortalException;
585    
586            /**
587            * Updates the company's preferences. The company's default properties are
588            * found in portal.properties.
589            *
590            * @param companyId the primary key of the company
591            * @param properties the company's properties. See {@link UnicodeProperties}
592            */
593            public void updatePreferences(long companyId, UnicodeProperties properties)
594                    throws PortalException;
595    
596            /**
597            * Updates the company's security properties.
598            *
599            * @param companyId the primary key of the company
600            * @param authType the company's method of authenticating users
601            * @param autoLogin whether to allow users to select the "remember me"
602            feature
603            * @param sendPassword whether to allow users to ask the company to send
604            their password
605            * @param strangers whether to allow strangers to create accounts register
606            themselves in the company
607            * @param strangersWithMx whether to allow strangers to create accounts with
608            email addresses that match the company mail suffix
609            * @param strangersVerify whether to require strangers who create accounts
610            to be verified via email
611            * @param siteLogo whether to allow site administrators to use their own
612            logo instead of the enterprise logo
613            */
614            public void updateSecurity(long companyId, java.lang.String authType,
615                    boolean autoLogin, boolean sendPassword, boolean strangers,
616                    boolean strangersWithMx, boolean strangersVerify, boolean siteLogo);
617    }