Class CompanyLocalServiceImpl

Object
com.liferay.portal.kernel.service.BaseLocalServiceImpl
com.liferay.portal.service.base.CompanyLocalServiceBaseImpl
com.liferay.portal.service.impl.CompanyLocalServiceImpl
All Implemented Interfaces:
com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService, com.liferay.portal.kernel.service.BaseLocalService, com.liferay.portal.kernel.service.CompanyLocalService, com.liferay.portal.kernel.service.PersistedModelLocalService

public class CompanyLocalServiceImpl extends CompanyLocalServiceBaseImpl
Provides the local service for adding, checking, and updating companies. Each company refers to a separate portal instance.
Author:
Brian Wing Shun Chan, Julio Camarero
  • Constructor Details

    • CompanyLocalServiceImpl

      public CompanyLocalServiceImpl()
  • Method Details

    • addCompany

      public com.liferay.portal.kernel.model.Company addCompany(com.liferay.portal.kernel.model.Company company)
      Description copied from class: CompanyLocalServiceBaseImpl
      Adds the company to the database. Also notifies the appropriate model listeners.

      Important: Inspect CompanyLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.

      Specified by:
      addCompany in interface com.liferay.portal.kernel.service.CompanyLocalService
      Overrides:
      addCompany in class CompanyLocalServiceBaseImpl
      Parameters:
      company - the company
      Returns:
      the company that was added
    • addCompany

      public com.liferay.portal.kernel.model.Company addCompany(Long companyId, String webId, String virtualHostname, String mx, int maxUsers, boolean active, boolean addDefaultAdminUser, String defaultAdminPassword, String defaultAdminScreenName, String defaultAdminEmailAddress, String defaultAdminFirstName, String defaultAdminMiddleName, String defaultAdminLastName) throws com.liferay.portal.kernel.exception.PortalException
      Adds a company with the primary key.
      Parameters:
      companyId - the primary key of the company (optionally null or 0 to generate a key automatically)
      webId - the the company's web domain
      virtualHostname - the company's virtual host name
      mx - the company's mail domain
      maxUsers - the max number of company users (optionally 0)
      active - whether the company is active
      Returns:
      the company
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • addDBPartitionCompany

      public com.liferay.portal.kernel.model.Company addDBPartitionCompany(long companyId, String name, String virtualHostname, String webId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • checkCompany

      public com.liferay.portal.kernel.model.Company checkCompany(String webId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the company with the web domain. The method sets mail domain to the web domain to the default name set in portal.properties
      Parameters:
      webId - the company's web domain
      Returns:
      the company with the web domain
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • checkCompanyKey

      public void checkCompanyKey(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Checks if the company has an encryption key. It will create a key if one does not exist.
      Parameters:
      companyId - the primary key of the company
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • copyDBPartitionCompany

      public com.liferay.portal.kernel.model.Company copyDBPartitionCompany(long fromCompanyId, Long toCompanyId, String name, String virtualHostname, String webId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteCompany

      public com.liferay.portal.kernel.model.Company deleteCompany(com.liferay.portal.kernel.model.Company company) throws com.liferay.portal.kernel.exception.PortalException
      Description copied from class: CompanyLocalServiceBaseImpl
      Deletes the company from the database. Also notifies the appropriate model listeners.

      Important: Inspect CompanyLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.

      Specified by:
      deleteCompany in interface com.liferay.portal.kernel.service.CompanyLocalService
      Overrides:
      deleteCompany in class CompanyLocalServiceBaseImpl
      Parameters:
      company - the company
      Returns:
      the company that was removed
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteCompany

      public com.liferay.portal.kernel.model.Company deleteCompany(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Description copied from class: CompanyLocalServiceBaseImpl
      Deletes the company with the primary key from the database. Also notifies the appropriate model listeners.

      Important: Inspect CompanyLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.

      Specified by:
      deleteCompany in interface com.liferay.portal.kernel.service.CompanyLocalService
      Overrides:
      deleteCompany in class CompanyLocalServiceBaseImpl
      Parameters:
      companyId - the primary key of the company
      Returns:
      the company that was removed
      Throws:
      com.liferay.portal.kernel.exception.PortalException - if a company with the primary key could not be found
    • deleteLogo

      public com.liferay.portal.kernel.model.Company deleteLogo(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Deletes the company's logo.
      Parameters:
      companyId - the primary key of the company
      Returns:
      the deleted logo's company
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • destroy

      public void destroy()
      Overrides:
      destroy in class CompanyLocalServiceBaseImpl
    • extractDBPartitionCompany

      public com.liferay.portal.kernel.model.Company extractDBPartitionCompany(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • fetchCompanyById

      public com.liferay.portal.kernel.model.Company fetchCompanyById(long companyId)
      Returns the company with the primary key.
      Parameters:
      companyId - the primary key of the company
      Returns:
      the company with the primary key, null if a company with the primary key could not be found
    • fetchCompanyByVirtualHost

      public com.liferay.portal.kernel.model.Company fetchCompanyByVirtualHost(String virtualHostname)
      Returns the company with the virtual host name.
      Parameters:
      virtualHostname - the virtual host name
      Returns:
      the company with the virtual host name, null if a company with the virtual host could not be found
    • forEachCompany

      @Transactional(enabled=false) public <E extends Exception> void forEachCompany(com.liferay.petra.function.UnsafeConsumer<com.liferay.portal.kernel.model.Company,E> unsafeConsumer) throws E
      Throws:
      E extends Exception
    • forEachCompany

      @Transactional(enabled=false) public <E extends Exception> void forEachCompany(com.liferay.petra.function.UnsafeConsumer<com.liferay.portal.kernel.model.Company,E> unsafeConsumer, List<com.liferay.portal.kernel.model.Company> companies) throws E
      Throws:
      E extends Exception
    • forEachCompanyId

      @Transactional(enabled=false) public <E extends Exception> void forEachCompanyId(com.liferay.petra.function.UnsafeConsumer<Long,E> unsafeConsumer) throws E
      Throws:
      E extends Exception
    • forEachCompanyId

      @Transactional(enabled=false) public <E extends Exception> void forEachCompanyId(com.liferay.petra.function.UnsafeConsumer<Long,E> unsafeConsumer, long[] companyIds) throws E
      Throws:
      E extends Exception
    • getCompanies

      public List<com.liferay.portal.kernel.model.Company> getCompanies()
      Returns all the companies.
      Returns:
      the companies
    • getCompanyById

      public com.liferay.portal.kernel.model.Company getCompanyById(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the company with the primary key.
      Parameters:
      companyId - the primary key of the company
      Returns:
      the company with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getCompanyByLogoId

      public com.liferay.portal.kernel.model.Company getCompanyByLogoId(long logoId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the company with the logo.
      Parameters:
      logoId - the ID of the company's logo
      Returns:
      the company with the logo
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getCompanyByMx

      public com.liferay.portal.kernel.model.Company getCompanyByMx(String mx) throws com.liferay.portal.kernel.exception.PortalException
      Returns the company with the mail domain.
      Parameters:
      mx - the company's mail domain
      Returns:
      the company with the mail domain
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getCompanyByVirtualHost

      public com.liferay.portal.kernel.model.Company getCompanyByVirtualHost(String virtualHostname) throws com.liferay.portal.kernel.exception.PortalException
      Returns the company with the virtual host name.
      Parameters:
      virtualHostname - the company's virtual host name
      Returns:
      the company with the virtual host name
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getCompanyByWebId

      public com.liferay.portal.kernel.model.Company getCompanyByWebId(String webId) throws com.liferay.portal.kernel.exception.PortalException
      Returns the company with the web domain.
      Parameters:
      webId - the company's web domain
      Returns:
      the company with the web domain
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getCompanyIdByUserId

      public long getCompanyIdByUserId(long userId) throws Exception
      Returns the user's company.
      Parameters:
      userId - the primary key of the user
      Returns:
      Returns the first company if there is only one company or the user's company if there are more than one company; 0 otherwise
      Throws:
      Exception - if a user with the primary key could not be found
    • removePreferences

      public void removePreferences(long companyId, String[] keys)
      Removes the values that match the keys of the company's preferences. This method is called by com.liferay.portlet.portalsettings.action.EditLDAPServerAction remotely through CompanyService.
      Parameters:
      companyId - the primary key of the company
      keys - the company's preferences keys to be remove
    • search

      public com.liferay.portal.kernel.search.Hits search(long companyId, long userId, String keywords, int start, int end)
      Returns an ordered range of all assets that match the keywords in the company. The method is called in com.liferay.portal.search.PortalOpenSearchImpl which is not longer used by the Search portlet.
      Parameters:
      companyId - the primary key of the company
      userId - the primary key of the user
      keywords - the keywords (space separated),which may occur in assets in the company (optionally null)
      start - the lower bound of the range of assets to return
      end - the upper bound of the range of assets to return (not inclusive)
      Returns:
      the matching assets in the company
    • search

      public com.liferay.portal.kernel.search.Hits search(long companyId, long userId, String portletId, long groupId, String type, String keywords, int start, int end)
      Returns an ordered range of all assets that match the keywords in the portlet within the company.
      Parameters:
      companyId - the primary key of the company
      userId - the primary key of the user
      portletId - the primary key of the portlet (optionally null)
      groupId - the primary key of the group (optionally 0)
      type - the mime type of assets to return(optionally null)
      keywords - the keywords (space separated), which may occur in any assets in the portlet (optionally null)
      start - the lower bound of the range of assets to return
      end - the upper bound of the range of assets to return (not inclusive)
      Returns:
      the matching assets in the portlet within the company
    • updateCompany

      public com.liferay.portal.kernel.model.Company updateCompany(com.liferay.portal.kernel.model.Company company)
      Description copied from class: CompanyLocalServiceBaseImpl
      Updates the company in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

      Important: Inspect CompanyLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.

      Specified by:
      updateCompany in interface com.liferay.portal.kernel.service.CompanyLocalService
      Overrides:
      updateCompany in class CompanyLocalServiceBaseImpl
      Parameters:
      company - the company
      Returns:
      the company that was updated
    • updateCompany

      public com.liferay.portal.kernel.model.Company updateCompany(long companyId, String virtualHostname, String mx, int maxUsers, boolean active) throws com.liferay.portal.kernel.exception.PortalException
      Updates the company.
      Parameters:
      companyId - the primary key of the company
      virtualHostname - the company's virtual host name
      mx - the company's mail domain
      maxUsers - the max number of company users (optionally 0)
      active - whether the company is active
      Returns:
      the company with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateCompany

      public com.liferay.portal.kernel.model.Company updateCompany(long companyId, String virtualHostname, String mx, String homeURL, boolean hasLogo, byte[] logoBytes, String name, String legalName, String legalId, String legalType, String sicCode, String tickerSymbol, String industry, String type, String size) throws com.liferay.portal.kernel.exception.PortalException
      Update the company with additional account information.
      Parameters:
      companyId - the primary key of the company
      virtualHostname - the company's virtual host name
      mx - the company's mail domain
      homeURL - the company's home URL (optionally null)
      hasLogo - if the company has a custom logo
      logoBytes - the new logo image data
      name - the company's account name(optionally null)
      legalName - the company's account legal name (optionally null)
      legalId - the company's account legal ID (optionally null)
      legalType - the company's account legal type (optionally null)
      sicCode - the company's account SIC code (optionally null)
      tickerSymbol - the company's account ticker symbol (optionally null)
      industry - the company's account industry (optionally null)
      type - the company's account type (optionally null)
      size - the company's account size (optionally null)
      Returns:
      the company with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateDisplay

      public void updateDisplay(long companyId, String languageId, String timeZoneId) throws com.liferay.portal.kernel.exception.PortalException
      Update the company's display.
      Parameters:
      companyId - the primary key of the company
      languageId - the ID of the company's default user's language
      timeZoneId - the ID of the company's default user's time zone
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateDisplayGroupNames

      @Async public void updateDisplayGroupNames(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateIndexNameNext

      public com.liferay.portal.kernel.model.Company updateIndexNameNext(long companyId, String indexNameNext) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateIndexNames

      public com.liferay.portal.kernel.model.Company updateIndexNames(long companyId, String indexNameCurrent, String indexNameNext) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateLogo

      public com.liferay.portal.kernel.model.Company updateLogo(long companyId, byte[] bytes) throws com.liferay.portal.kernel.exception.PortalException
      Updates the company's logo.
      Parameters:
      companyId - the primary key of the company
      bytes - the bytes of the company's logo image
      Returns:
      the company with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateLogo

      public com.liferay.portal.kernel.model.Company updateLogo(long companyId, File file) throws com.liferay.portal.kernel.exception.PortalException
      Updates the company's logo.
      Parameters:
      companyId - the primary key of the company
      file - the file of the company's logo image
      Returns:
      the company with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateLogo

      public com.liferay.portal.kernel.model.Company updateLogo(long companyId, InputStream inputStream) throws com.liferay.portal.kernel.exception.PortalException
      Update the company's logo.
      Parameters:
      companyId - the primary key of the company
      inputStream - the input stream of the company's logo image
      Returns:
      the company with the primary key
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updatePreferences

      public void updatePreferences(long companyId, com.liferay.portal.kernel.util.UnicodeProperties unicodeProperties) throws com.liferay.portal.kernel.exception.PortalException
      Updates the company's preferences. The company's default properties are found in portal.properties.
      Parameters:
      companyId - the primary key of the company
      unicodeProperties - the company's properties. See UnicodeProperties
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • updateSecurity

      public void updateSecurity(long companyId, String authType, boolean autoLogin, boolean sendPassword, boolean strangers, boolean strangersWithMx, boolean strangersVerify, boolean siteLogo)
      Updates the company's security properties.
      Parameters:
      companyId - the primary key of the company
      authType - the company's method of authenticating users
      autoLogin - whether to allow users to select the "remember me" feature
      sendPassword - whether to allow users to ask the company to send their password
      strangers - whether to allow strangers to create accounts register themselves in the company
      strangersWithMx - whether to allow strangers to create accounts with email addresses that match the company mail suffix
      strangersVerify - whether to require strangers who create accounts to be verified via email
      siteLogo - whether to allow site administrators to use their own logo instead of the enterprise logo
    • checkLogo

      protected com.liferay.portal.kernel.model.Company checkLogo(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • createSearchContext

      protected com.liferay.portal.kernel.search.SearchContext createSearchContext(long companyId, long userId, String portletId, long groupId, String keywords, int start, int end)
    • doDeleteCompany

      protected com.liferay.portal.kernel.model.Company doDeleteCompany(long companyId) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • preregisterCompany

      protected void preregisterCompany(com.liferay.portal.kernel.model.Company company)
    • preunregisterCompany

      protected void preunregisterCompany(com.liferay.portal.kernel.model.Company company)
    • registerCompany

      protected void registerCompany(com.liferay.portal.kernel.model.Company company)
    • syncVirtualHost

      protected com.liferay.portal.kernel.model.Company syncVirtualHost(com.liferay.portal.kernel.model.Company company) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • unregisterCompany

      protected void unregisterCompany(com.liferay.portal.kernel.model.Company company)
    • updateVirtualHostname

      protected com.liferay.portal.kernel.model.Company updateVirtualHostname(long companyId, String virtualHostname) throws com.liferay.portal.kernel.exception.CompanyVirtualHostException
      Throws:
      com.liferay.portal.kernel.exception.CompanyVirtualHostException
    • validateLanguageIds

      protected void validateLanguageIds(String languageIds) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validateMx

      protected void validateMx(long companyId, String mx) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validateName

      protected void validateName(long companyId, String name) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validateVirtualHost

      protected void validateVirtualHost(String webId, String virtualHostname) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • validateWebId

      protected void validateWebId(String webId) throws com.liferay.portal.kernel.exception.CompanyWebIdException
      Throws:
      com.liferay.portal.kernel.exception.CompanyWebIdException