Interface QueryManagementService


@NotFinalAPI public interface QueryManagementService
  • Method Details

    • getFactory

      TopologyQueryFactory getFactory()
    • saveQuery

      Query saveQuery(QueryDefinition queryDefinition)
      Saves the query definition to the server, updating an existing query by the same name if such exists.

      If a query by the same name exists, it is overwritten. If that query is attached to a folder, its position will remain the same. Otherwise, the query is created in the root folder.

      Parameters:
      queryDefinition - the definition to save.
      Returns:
      the previous query (already fully loaded), if any exists, or null (same as Map.put(K, V)).
    • saveQuery

      Query saveQuery(String str)
      Saves the query definition from XML string to the server, updating an existing query by the same name if such exists.

      If a query by the same name exists, it is overwritten. If that query is attached to a folder, its position will remain the same. Otherwise, the query is created in the root folder. It is better to use this method when saving a query from XML, rather than loading a query definition from XML and than saving it.

      Parameters:
      str - the definition XML string to save.
      Returns:
      the previous query (already fully loaded), if any exists, or null (same as Map.put(K, V)).
    • saveQuery

      Query saveQuery(QueryReferenceDefinition<?> queryReferenceDefinition)
      Saves the query reference definition to the server, updating an existing query by the same name if such exists.

      If a query by the same name exists, it is overwritten. If that query is attached to a folder, its position will remain the same. Otherwise, the query is created in the root folder.

      Parameters:
      queryReferenceDefinition - the definition to save.
      Returns:
      the previous query (already fully loaded), if any exists, or null (same as Map.put(K, V)).
    • saveSingleQueryReferenceDefinition

      @Deprecated @NotFinalAPI Query saveSingleQueryReferenceDefinition(SingleQueryReferenceDefinition queryReferenceDefinition)
    • saveMultipleReferencesWithFunctionDefinition

      @Deprecated @NotFinalAPI Query saveMultipleReferencesWithFunctionDefinition(MultipleReferencesWithFunctionDefinition queryReferenceDefinition)
    • savePerspectiveApplication

      @NotFinalAPI void savePerspectiveApplication(String topLevelName, List<Set<String>> perspectiveHierarhcy, String seedQueryName, QueryDefinitionRecalcPriority recalcPriority, QueryDefinitionFirstLoadStrategy firstLoadStrategy)
      Saves the perspective application of the perspective hierarchy over the seed query.

      Perspectives are queries with at least one node defined as "perspective contact" node (PerspectiveContactable.setAsPerspectiveContact()). A perspective contact node is restricted by the "previous result" (see below) while the rest of the perspective is not restricted. This can allow perspectives to enrich the "previous result" with more information.

      Perspectives are executed in partial order, defined by a List of Set. Each perspective from a specific "level" in the list (N) is restricted by the results of the unioned previous level (N-1). The results of all perspectives from the level are then unioned with the results of the previous level. The "zero-th" perspective "level" is the seed query.

      The end result can be fetched by executing the query with the "top level name", which is the union of the top-most perspective level.

      All of the perspectives and the seed query name must be saved before this operation.

      While it is possible to define recalculation priority and first load strategy, the actual recaculation priority and first load strategy is the minimum of those given and those from the seed query.

      You cannot parameterize a saved perspective application using ExecutableQuery.

      Parameters:
      topLevelName - the name of the top level union query. This name should be used to execute the perspective application.
      perspectiveHierarhcy - the partial order of perspective query names.
      seedQueryName - the seed query name.
      recalcPriority - the recalculation prioirty of the entire perspective structure.
      firstLoadStrategy - the first load strategy of the entire perspective structure.
    • deleteQuery

      Query deleteQuery(String queryName)
      Deletes a query, query reference, or perspective application from the server.

      If the query represents the top level query of a perspective application, the entire perspective application hierarhcy is deleted. In that case, the return value is of the top level query.

      Parameters:
      queryName - the query to delete.
      Returns:
      the previous query (already fully loaded) if the delete was successful, or null on failure (same as Map.remove(java.lang.Object)).
    • deleteQueryByName

      boolean deleteQueryByName(String queryName)
      Deletes a query, query reference, or perspective application from the server.

      If the query represents the top level query of a perspective application, the entire perspective application hierarchy is deleted. In that case, the return value is of the top level query.

      Parameters:
      queryName - the query to delete.
      Returns:
      true if a view was deleted, false if it was not found.
    • getQueriesTree

      @NotFinalAPI QueryFolder getQueriesTree()
      Returns the query folders tree. The returned folder represents the root of the tree.
    • getBundleNamesToQueries

      @NotFinalAPI Map<String,Collection<String>> getBundleNamesToQueries()
      Returns a map from name of bundle to the collection of its bundled queries.
    • getBundleNamesToQueries

      @NotFinalAPI Map<String,Collection<String>> getBundleNamesToQueries(Collection<String> bundleNames)
      Returns a map from name of bundle to the collection of its bundled queries.
    • getBundleNamesToQueriesWithoutPermission

      @NotFinalAPI Map<String,Collection<String>> getBundleNamesToQueriesWithoutPermission(Collection<String> bundleNames)
      Returns a map from name of bundle to the collection of its bundled queries without permissions.
    • getAllQueriesBundleNames

      @NotFinalAPI Map<String,Collection<String>> getAllQueriesBundleNames()
      Returns a map from defined query name to a collection of its bundles' names.
    • getAllQueries

      @NotFinalAPI Collection<? extends Query> getAllQueries()
      Returns the entire queries list, including those not in the folders tree.
    • getAllQueriesFromBundles

      @NotFinalAPI Map<String,Collection<Query>> getAllQueriesFromBundles(Set<String> bundles)
      Returns the entire queries list, including those not in the folders tree.
      Parameters:
      bundles - the names of the bundles
      Returns:
      the queries from the given bundles
    • getQueriesFoldersSubService

      Returns the sub service for folder management.
      Returns:
      the sub service for folder management.
    • registerQueryManagementListener

      @NotFinalAPI String registerQueryManagementListener(QueryManagementListener listener, QueryManagementListenerFilter filter)
      Registers a listener to be called when query management change occurs.
      Parameters:
      listener - a listener to be called when a query management change occurs.
      filter - filters query management changes.
      Returns:
      registration ID
    • registerQueryManagementListener

      @NotFinalAPI String registerQueryManagementListener(QueryManagementListener listener, QueryManagementListenerFilter filter, int port)
      Registers a listener to be called when query management change occurs.
      Parameters:
      listener - a listener to be called when a query management change occurs.
      filter - filters query management changes.
      port - port number
      Returns:
      registration ID
    • unregisterQueryManagementListener

      @NotFinalAPI void unregisterQueryManagementListener(String listenerId)
      Unregisters the query management listener.
      Parameters:
      listenerId - registration ID of the listener
    • unregisterQueryManagementListener

      @NotFinalAPI void unregisterQueryManagementListener(String listenerId, int port)
      Unregisters the query management listener.
      Parameters:
      listenerId - registration ID of the listener
      port - port number
    • registerQueryDependenciesChangeListener

      @NotFinalAPI String registerQueryDependenciesChangeListener(QueryDependenciesChangeListener listener, QueryManagementListenerFilter filter)
      Registers a listener to be called when the dependencies of the query have changed.
      Parameters:
      listener - a listener to be called when the dependencies of the query have changed.
      filter - filters the changes by name and/or bundles of a root resource (dependent).
      Returns:
      registration ID
    • registerQueryDependenciesChangeListener

      @NotFinalAPI String registerQueryDependenciesChangeListener(QueryDependenciesChangeListener listener, QueryManagementListenerFilter filter, int port)
      Registers a listener to be called when the dependencies of the query have changed.
      Parameters:
      listener - a listener to be called when the dependencies of the query have changed.
      filter - filters the changes by name and/or bundles of a root resource (dependent).
      port - port number
      Returns:
      registration ID
    • unregisterQueryDependenciesChangeListener

      @NotFinalAPI void unregisterQueryDependenciesChangeListener(String listenerId)
      Unregisters the query dependencies change listener.
      Parameters:
      listenerId - registration ID of the listener
    • unregisterQueryDependenciesChangeListener

      @NotFinalAPI void unregisterQueryDependenciesChangeListener(String listenerId, int port)
      Unregisters the query dependencies change listener.
      Parameters:
      listenerId - registration ID of the listener
      port - port number
    • modifyQuery

      @NotFinalAPI QueryChangeResult modifyQuery(QueryChangeCommand queryChangeCommand)
      Modifies an existing query according to the given command.

      This API is different from the normal "get definition, modify, save" since it does not require the client to have any knowledge of the query internals or of its dependencies. This is the preferred way of changing a query that is not owned by the client.

      Depending on the changes requested and the query type, more than one query may be modified. The return value holds the modified queries (before and after the change) with data already fetched from the server.

      Parameters:
      queryChangeCommand - the command. Can be created using TopologyQueryFactory.createQueryChangeCommand(String).
      Returns:
      the structure holding the changed queries, before and after the change.
      Throws:
      ExecutionException - if the change could not be made.
    • whoDependsOn

      @NotFinalAPI DependsOnQuery whoDependsOn(String queryName)
    • validateBulk

      @NotFinalAPI void validateBulk(QueryValidationBulk bulk)
    • getQueryType

      @NotFinalAPI QueryType getQueryType(String queryName)
    • getQueryDefinition

      ExecutableQuery getQueryDefinition(String queryName)
    • getSearchResult

      List<ResourceFolderTreeNode> getSearchResult(String queryString)
    • getResourcesUnderFolder

      FolderResourcesGetResult getResourcesUnderFolder(List<String> folderPath, String resourceType, int start, int limit, boolean showEmptyFolder, List<String> bundles)
    • getFolderNode

      ResourceFolderTreeNode getFolderNode(List<String> folderPath, String resourceType)