Class AbstractSearchEntity<C extends Serializable,S extends PersistentObject>

java.lang.Object
org.bonitasoft.engine.search.AbstractSearchEntity<C,S>
Type Parameters:
C - The client object
S - The server object
All Implemented Interfaces:
TransactionContent, TransactionContentWithResult<org.bonitasoft.engine.search.SearchResult<C>>
Direct Known Subclasses:
AbstractActivityInstanceSearchEntity, AbstractArchiveActivityInstanceSearchEntity, AbstractArchivedCommentsSearchEntity, AbstractArchivedConnectorInstanceSearchEntity, AbstractArchivedDocumentSearchEntity, AbstractArchivedHumanTaskInstanceSearchEntity, AbstractArchivedProcessInstanceSearchEntity, AbstractCommandSearchEntity, AbstractCommentSearchEntity, AbstractDocumentSearchEntity, AbstractGroupSearchEntity, AbstractHumanTaskInstanceSearchEntity, AbstractProcessDeploymentInfoSearchEntity, AbstractProcessInstanceSearchEntity, AbstractProfileSearchEntity, AbstractRoleSearchEntity, AbstractSupervisorSearchEntity, AbstractUserSearchEntity, SearchApplicationMenus, SearchApplicationPages, SearchApplications, SearchApplicationsOfUser, SearchArchivedActivityInstanceSupervisedBy, SearchArchivedFlowNodeInstances, SearchArchivedFlowNodeInstanceSupervisedBy, SearchCustomUserInfoValues, SearchFlowNodeInstances, SearchFlowNodeInstanceSupervisedBy, SearchFormMappings, SearchPages, SearchProfileMembersForProfile, SearchProfiles, SearchTimerEventTriggerInstances, SearchWaitingEvents

public abstract class AbstractSearchEntity<C extends Serializable,S extends PersistentObject> extends Object implements TransactionContentWithResult<org.bonitasoft.engine.search.SearchResult<C>>
Abstract class to allow to search server object and convert them to client object
Author:
Matthieu Chaffotte, Baptiste Mesta, Celine Souchet
  • Constructor Details

    • AbstractSearchEntity

      public AbstractSearchEntity(SearchEntityDescriptor searchDescriptor, org.bonitasoft.engine.search.SearchOptions options)
      Parameters:
      searchDescriptor - The search descriptor of the searched entity
      options - The options of the search
  • Method Details

    • validateQuery

      protected void validateQuery(org.bonitasoft.engine.search.SearchOptions options) throws SBonitaException
      Throws:
      SBonitaException
    • execute

      public void execute() throws SBonitaException
      Specified by:
      execute in interface TransactionContent
      Throws:
      SBonitaException
    • search

      public org.bonitasoft.engine.search.SearchResult<C> search() throws org.bonitasoft.engine.exception.SearchException
      execute this search and return the result
      Returns:
      the result of the search
      Throws:
      org.bonitasoft.engine.exception.SearchException
    • executeCount

      public abstract long executeCount(QueryOptions queryOptions) throws SBonitaReadException
      Execute the count here
      Parameters:
      queryOptions - The query options to execute the count with
      Returns:
      The number of result on the server
      Throws:
      SBonitaReadException - when the search failed to retrieve the count number
    • executeSearch

      public abstract List<S> executeSearch(QueryOptions queryOptions) throws SBonitaReadException
      Execute the search here
      Parameters:
      queryOptions - The query options to execute the search with
      Returns:
      The list of searched server objects
      Throws:
      SBonitaReadException - when the search failed to retrieve the results
    • convertToClientObjects

      public abstract List<C> convertToClientObjects(List<S> serverObjects) throws SBonitaException
      Must convert server objects in client objects here
      Parameters:
      serverObjects - The server object to convert
      Returns:
      The list of the client objects corresponding to the server objects
      Throws:
      SBonitaException
    • getResult

      public org.bonitasoft.engine.search.SearchResult<C> getResult()
      Specified by:
      getResult in interface TransactionContentWithResult<C extends Serializable>
    • getSearchFilter

      protected org.bonitasoft.engine.search.impl.SearchFilter getSearchFilter(org.bonitasoft.engine.search.SearchOptions searchOptions, String searchedKey)
    • search

      public static <C extends Serializable, S extends PersistentObject> org.bonitasoft.engine.search.SearchResult<C> search(SearchEntityDescriptor searchDescriptor, org.bonitasoft.engine.search.SearchOptions options, BonitaReadFunction<List<S>,List<C>> converter, BonitaReadFunction<QueryOptions,Long> count, BonitaReadFunction<QueryOptions,List<S>> search) throws org.bonitasoft.engine.exception.SearchException
      Throws:
      org.bonitasoft.engine.exception.SearchException