Class QueryService

java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.QueryService
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class QueryService extends ServiceConfig
Provides methods to retrieve application data
Author:
Pablo GARCIA
  • Field Details

  • Constructor Details

    • QueryService

      public QueryService(QueryLauncher queryLauncher, QueryUtil queryUtil)
      Autowired constructor
      Parameters:
      queryLauncher - Query launcher
      queryUtil - Query utilities
  • Method Details

    • launchQueryAction

      public ServiceData launchQueryAction() throws AWException
      Launches a query (must be defined in APP or AWE Queries.xml file) and generates the output Query comes defined in target-action variable
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • updateModelAction

      public ServiceData updateModelAction() throws AWException
      Update some criteria at once
      Returns:
      Service data
      Throws:
      AWException - Query failed
    • checkUniqueAction

      public ServiceData checkUniqueAction() throws AWException
      Check if a query returns data or not
      Returns:
      Service data
      Throws:
      AWException - Query failed
    • checkEmptyAction

      public ServiceData checkEmptyAction() throws AWException
      Check if a query returns data or not
      Returns:
      Service data
      Throws:
      AWException - Query failed
    • subscribeAction

      public ServiceData subscribeAction() throws AWException
      Subscribe to a query
      Returns:
      Service data
      Throws:
      AWException - Subscription failed
    • subscribe

      public ServiceData subscribe(String queryId, ComponentAddress address) throws AWException
      Subscribe to a query
      Parameters:
      queryId - Query identifier
      address - Component address
      Returns:
      Service data
      Throws:
      AWException - Error in subscription
    • onSubscribeData

      public ServiceData onSubscribeData(Query query, ComponentAddress address, ServiceData subscriptionData, Map<String,QueryParameter> parameterMap) throws AWException
      Manage subscription results
      Parameters:
      query - Query
      address - Component address
      subscriptionData - Subscription data
      parameterMap - Parameters
      Returns:
      Service data
      Throws:
      AWException - Error in subscription
    • launchQuery

      public ServiceData launchQuery(String queryId) throws AWException
      Launches a query (must be defined in APP or AWE Queries.xml file) and generates the output Query comes defined in target-action variable
      Parameters:
      queryId - Query identifier
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchQuery

      public ServiceData launchQuery(String queryId, String alias) throws AWException
      Launches a query (must be defined in APP or AWE Queries.xml file) and generates the output Query comes defined in target-action variable
      Parameters:
      queryId - Query identifier
      alias - Database alias
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchQuery

      public ServiceData launchQuery(String queryId, com.fasterxml.jackson.databind.node.ObjectNode parameters) throws AWException
      Launches a query (must be defined in APP or AWE Queries.xml file) and generates the output Query comes defined in target-action variable
      Parameters:
      queryId - Query identifier
      parameters - Parameters
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchPrivateQuery

      public ServiceData launchPrivateQuery(String queryId) throws AWException
      Launches a query (must be defined in APP or AWE Queries.xml file) and generates the output Query comes defined in target-action variable
      Parameters:
      queryId - Query identifier
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchPrivateQuery

      public ServiceData launchPrivateQuery(String queryId, String alias) throws AWException
      Launches a query (must be defined in APP or AWE Queries.xml file) and generates the output Query comes defined in target-action variable
      Parameters:
      queryId - Query identifier
      alias - Database alias
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchQuery

      public ServiceData launchQuery(String queryId, String alias, String forcedPage, String forcedMax, boolean checkSession) throws AWException
      Launches a query
      Parameters:
      queryId - Query identifier
      alias - Query alias
      forcedPage - Page
      forcedMax - Elements per page
      checkSession - Check if session is available
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchQuery

      public ServiceData launchQuery(Query query, String alias, String forcedPage, String forcedMax) throws AWException
      Launches a query
      Parameters:
      query - Query
      alias - Query alias
      forcedPage - Page
      forcedMax - Elements per page
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchQuery

      public ServiceData launchQuery(String queryId, com.fasterxml.jackson.databind.node.ObjectNode parameters, boolean checkSession) throws AWException
      Launches a query
      Parameters:
      queryId - Query identifier
      parameters - Parameters
      checkSession - Check if session is available
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchQuery

      public ServiceData launchQuery(String queryId, String forcedPage, String forcedMax) throws AWException
      Launches a query
      Parameters:
      queryId - Query identifier
      forcedPage - Page
      forcedMax - Elements per page
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchEnumQuery

      @Cacheable(value="queryEnum", key="#p0") public ServiceData launchEnumQuery(String enumId) throws AWException
      Launches an enumerated query
      Parameters:
      enumId - Enumerated identifier
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchPrivateQuery

      public ServiceData launchPrivateQuery(String queryId, String forcedPage, String forcedMax) throws AWException
      Launches a private query
      Parameters:
      queryId - Enumerated identifier
      forcedPage - Page
      forcedMax - Elements per page
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchPrivateQuery

      public ServiceData launchPrivateQuery(String queryId, com.fasterxml.jackson.databind.node.ObjectNode parameters) throws AWException
      Launches a private query
      Parameters:
      queryId - Enumerated identifier
      parameters - Parameters
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • launchEnumQuery

      @Cacheable(value="queryEnum", key="{ #p0, #p1, #p2 }") public ServiceData launchEnumQuery(String enumId, String forcedPage, String forcedMax) throws AWException
      Launches an enumerated query
      Parameters:
      enumId - Enumerated identifier
      forcedPage - Page
      forcedMax - Elements per page
      Returns:
      Query output
      Throws:
      AWException - Query failed
    • checkUnique

      public ServiceData checkUnique(String queryId) throws AWException
      Check if a query returns data or not
      Parameters:
      queryId - Query identifier
      Returns:
      Service data
      Throws:
      AWException - Query failed
    • checkEmpty

      public ServiceData checkEmpty(String queryId) throws AWException
      Check if a query returns no data
      Parameters:
      queryId - Query identifier
      Returns:
      Service data
      Throws:
      AWException - Query failed
    • initDatasourceConnections

      public void initDatasourceConnections()
      Init datasource connections
    • reloadDatasourceConnections

      public void reloadDatasourceConnections()
      Reload datasource connections
    • findLabel

      public String findLabel(String enumeratedId, String value) throws AWException
      Retrieve a label from an enumerated value
      Parameters:
      enumeratedId - Enumerated id
      value - Enumerated value
      Returns:
      Enumerated label
      Throws:
      AWException - AWE exception