Class APIClient


  • public class APIClient
    extends java.lang.Object
    Bonita Community Edition APIs client.

    • IdentityAPI,
    • ProcessAPI,
    • ThemeAPI
    • CommandAPI,
    • ProfileAPI,
    • TenantAdministrationAPI,
    • PageAPI,
    • ApplicationAPI,
    • PermissionAPI,
    • BusinessDataAPI (deprecated as of 7.3),
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.bonitasoft.engine.session.APISession session  
    • Constructor Summary

      Constructors 
      Constructor Description
      APIClient()  
      APIClient​(org.bonitasoft.engine.session.APISession session)  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected <T> T getAPI​(java.lang.Class<T> apiClass)  
      org.bonitasoft.engine.api.ApplicationAPI getApplicationAPI()
      Get API to manage Bonita Applications.
      org.bonitasoft.engine.api.BusinessDataAPI getBusinessDataAPI()
      Deprecated.
      as of 7.3, see BusinessDataAPI for replacements
      org.bonitasoft.engine.api.CommandAPI getCommandAPI()
      Get API to manage commands and Tenant level dependencies.
      org.bonitasoft.engine.api.PageAPI getCustomPageAPI()
      Get API to manage portal pages.
      <T extends org.bonitasoft.engine.bdm.dao.BusinessObjectDAO>
      T
      getDAO​(java.lang.Class<T> daoInterface)
      Get an implementation instance of the DAO Interface.
      org.bonitasoft.engine.api.IdentityAPI getIdentityAPI()
      Get API to manage the organization, i.e., users, groups and roles.
      org.bonitasoft.engine.api.ApplicationAPI getLivingApplicationAPI()
      Get API to manage Living Applications.
      protected org.bonitasoft.engine.api.LoginAPI getLoginAPI()  
      protected <T extends org.bonitasoft.engine.api.LoginAPI>
      T
      getLoginAPI​(java.lang.Class<T> apiClass)
      This methods serves the purpose to remove confusion between getAPI() when a session is mandatory, and this one, where no session is needed to access the API class.
      org.bonitasoft.engine.api.PermissionAPI getPermissionAPI()
      Get API to dynamically check REST API call access right.
      org.bonitasoft.engine.api.ProcessAPI getProcessAPI()
      Get API to manage the business processes.
      org.bonitasoft.engine.api.ProfileAPI getProfileAPI()
      Get API to manage portal user profiles.
      org.bonitasoft.engine.session.APISession getSession()  
      org.bonitasoft.engine.api.TenantAdministrationAPI getTenantAdministrationAPI()
      Get API to manage the tenant your are logged on.
      org.bonitasoft.engine.api.ThemeAPI getThemeAPI()
      Deprecated.
      since 7.13.0, ThemeAPI does nothing.
      protected <T extends org.bonitasoft.engine.bdm.dao.BusinessObjectDAO>
      java.lang.Class<T>
      loadClass​(java.lang.Class<T> daoInterface)
      Loads the class of the BusinessObjectDAO according to its class name.
      void login​(java.lang.String username, java.lang.String password)
      Connects a user, identified by his (her) username and password, in order to use API methods of a tenant.
      void logout()
      Disconnect user from tenant APIs.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • session

        protected org.bonitasoft.engine.session.APISession session
    • Constructor Detail

      • APIClient

        public APIClient()
      • APIClient

        public APIClient​(org.bonitasoft.engine.session.APISession session)
    • Method Detail

      • getSession

        public org.bonitasoft.engine.session.APISession getSession()
      • getAPI

        protected <T> T getAPI​(java.lang.Class<T> apiClass)
      • getLoginAPI

        protected org.bonitasoft.engine.api.LoginAPI getLoginAPI()
      • getLoginAPI

        protected <T extends org.bonitasoft.engine.api.LoginAPI> T getLoginAPI​(java.lang.Class<T> apiClass)
        This methods serves the purpose to remove confusion between getAPI() when a session is mandatory, and this one, where no session is needed to access the API class.
        Type Parameters:
        T - The type of the API, extending LoginAPI
        Parameters:
        apiClass - the API to retrieve
        Returns:
        the retrieved API
        Throws:
        java.lang.IllegalStateException - if the API cannot be retrieved.
      • login

        public void login​(java.lang.String username,
                          java.lang.String password)
                   throws org.bonitasoft.engine.platform.LoginException
        Connects a user, identified by his (her) username and password, in order to use API methods of a tenant.
        Parameters:
        username - the user name
        password - the password
        Throws:
        org.bonitasoft.engine.platform.LoginException - occurs when an exception is thrown during the login (userName does not exist, or couple (userName, password) is incorrect)
        Since:
        7.2
      • logout

        public void logout()
                    throws org.bonitasoft.engine.platform.LogoutException
        Disconnect user from tenant APIs.
        Throws:
        org.bonitasoft.engine.platform.LogoutException
        Since:
        7.2
      • getDAO

        public <T extends org.bonitasoft.engine.bdm.dao.BusinessObjectDAO> T getDAO​(java.lang.Class<T> daoInterface)
                                                                             throws BusinessObjectDaoCreationException
        Get an implementation instance of the DAO Interface.
        Parameters:
        daoInterface - the interface of the DAO
        Returns:
        the implementation of the DAO
        Throws:
        BusinessObjectDaoCreationException - if the factory is not able to instantiate the DAO
      • loadClass

        protected <T extends org.bonitasoft.engine.bdm.dao.BusinessObjectDAO> java.lang.Class<T> loadClass​(java.lang.Class<T> daoInterface)
                                                                                                    throws java.lang.ClassNotFoundException
        Loads the class of the BusinessObjectDAO according to its class name.

        The loading is done in the current Thread ClassLoader.

        Parameters:
        daoInterface - the DAO's interface
        Returns:
        the Implementation class of the BusinessObjectDAO
        Throws:
        java.lang.ClassNotFoundException - if the implementation class name is unknown by the current Thread ClassLoader
      • getIdentityAPI

        public org.bonitasoft.engine.api.IdentityAPI getIdentityAPI()
        Get API to manage the organization, i.e., users, groups and roles.
        Since:
        7.2
      • getProcessAPI

        public org.bonitasoft.engine.api.ProcessAPI getProcessAPI()
        Get API to manage the business processes.
        Since:
        7.2
      • getThemeAPI

        @Deprecated(since="7.13.0")
        public org.bonitasoft.engine.api.ThemeAPI getThemeAPI()
        Deprecated.
        since 7.13.0, ThemeAPI does nothing. There is no replacement, as it used to serve old removed feature.
        Get API to manage themes (Portal and mobile).
        Since:
        7.2
      • getCommandAPI

        public org.bonitasoft.engine.api.CommandAPI getCommandAPI()
        Get API to manage commands and Tenant level dependencies.
        Since:
        7.2
      • getProfileAPI

        public org.bonitasoft.engine.api.ProfileAPI getProfileAPI()
        Get API to manage portal user profiles.
        Since:
        7.2
      • getTenantAdministrationAPI

        public org.bonitasoft.engine.api.TenantAdministrationAPI getTenantAdministrationAPI()
        Get API to manage the tenant your are logged on.
        Since:
        7.2
      • getCustomPageAPI

        public org.bonitasoft.engine.api.PageAPI getCustomPageAPI()
        Get API to manage portal pages.
        Since:
        7.2
      • getLivingApplicationAPI

        public org.bonitasoft.engine.api.ApplicationAPI getLivingApplicationAPI()
        Get API to manage Living Applications.
        Since:
        7.2
      • getPermissionAPI

        public org.bonitasoft.engine.api.PermissionAPI getPermissionAPI()
        Get API to dynamically check REST API call access right.
        Since:
        7.2
      • getBusinessDataAPI

        @Deprecated
        public org.bonitasoft.engine.api.BusinessDataAPI getBusinessDataAPI()
        Deprecated.
        as of 7.3, see BusinessDataAPI for replacements
        Get API to access Business Data related to processes.
        Since:
        7.2
      • getApplicationAPI

        public org.bonitasoft.engine.api.ApplicationAPI getApplicationAPI()
        Get API to manage Bonita Applications.
        Since:
        7.10