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