Class APIClient

java.lang.Object
org.bonitasoft.engine.api.APIClient

public class APIClient extends Object
Bonita Community Edition APIs client.

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

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

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

    Modifier and Type
    Method
    Description
    protected <T> T
    getAPI(Class<T> apiClass)
     
    org.bonitasoft.engine.api.ApplicationAPI
    Get API to manage Bonita Applications.
    org.bonitasoft.engine.api.BusinessDataAPI
    Deprecated.
    as of 7.3, see BusinessDataAPI for replacements
    org.bonitasoft.engine.api.CommandAPI
    Get API to manage commands and Tenant level dependencies.
    org.bonitasoft.engine.api.PageAPI
    Get API to manage portal pages.
    <T extends org.bonitasoft.engine.bdm.dao.BusinessObjectDAO>
    T
    getDAO(Class<T> daoInterface)
    Get an implementation instance of the DAO Interface.
    org.bonitasoft.engine.api.IdentityAPI
    Get API to manage the organization, i.e., users, groups and roles.
    org.bonitasoft.engine.api.ApplicationAPI
    Get API to manage Living Applications.
    protected org.bonitasoft.engine.api.LoginAPI
     
    protected <T extends org.bonitasoft.engine.api.LoginAPI>
    T
    getLoginAPI(Class<T> apiClass)
    This method 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.MaintenanceAPI
    Get API to manage Platform maintenance.
    org.bonitasoft.engine.api.PermissionAPI
    Get API to dynamically check REST API call access right.
    org.bonitasoft.engine.api.platform.PlatformInformationAPI
    Get API that retrieves information on the platform: basic information in a Community edition, More detailed information on license in a Subscription edition.
    org.bonitasoft.engine.api.ProcessAPI
    Get API to manage the business processes.
    org.bonitasoft.engine.api.ProfileAPI
    Get API to manage portal user profiles.
    org.bonitasoft.engine.session.APISession
     
    org.bonitasoft.engine.api.TemporaryContentAPI
    Get API to store and retrieve temporary content like uploaded files.
    org.bonitasoft.engine.api.TenantAdministrationAPI
    Get API to manage the tenant your are logged on.
    protected <T extends org.bonitasoft.engine.bdm.dao.BusinessObjectDAO>
    Class<T>
    loadClass(Class<T> daoInterface)
    Loads the class of the BusinessObjectDAO according to its class name.
    void
    login(String username, String password)
    Connects a user, identified by his (her) username and password, in order to use API methods of a tenant.
    void
    login(Map<String,Serializable> credentials)
    Connects a user, identified by credentials, in order to use API methods of a tenant.
    void
    Disconnect user from tenant APIs.

    Methods inherited from class java.lang.Object

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

    • session

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

    • APIClient

      public APIClient()
    • APIClient

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

    • getSession

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

      protected <T> T getAPI(Class<T> apiClass)
    • getLoginAPI

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

      protected <T extends org.bonitasoft.engine.api.LoginAPI> T getLoginAPI(Class<T> apiClass)
      This method 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:
      IllegalStateException - if the API cannot be retrieved.
    • login

      public void login(String username, 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
    • login

      public void login(Map<String,Serializable> credentials) throws org.bonitasoft.engine.platform.LoginException
      Connects a user, identified by credentials, in order to use API methods of a tenant.
      Parameters:
      credentials - the credentials to login with. Can be username / password couple, SSO ticket, ... depending on the implementation.
      By default possible map keys are:
      • Basic Authentication: authentication.username and authentication.password
      • CAS Authentication: ticket and service
      • Please refer to specific documentation regarding the Authentication Service in use, to know what the credentials must contain.
      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:
      10.3
    • 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(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> Class<T> loadClass(Class<T> daoInterface) throws 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:
      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
    • 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(since="7.3") 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
    • getTemporaryContentAPI

      public org.bonitasoft.engine.api.TemporaryContentAPI getTemporaryContentAPI()
      Get API to store and retrieve temporary content like uploaded files. For internal usage only.
      Since:
      9.0
    • getMaintenanceAPI

      public org.bonitasoft.engine.api.MaintenanceAPI getMaintenanceAPI()
      Get API to manage Platform maintenance.
      Since:
      9.0
    • getPlatformInformationAPI

      public org.bonitasoft.engine.api.platform.PlatformInformationAPI getPlatformInformationAPI()
      Get API that retrieves information on the platform: basic information in a Community edition, More detailed information on license in a Subscription edition.
      Since:
      10.2.0