Class DbGetAction<A extends DbGetAction>

java.lang.Object
io.inversion.Rule<A>
io.inversion.Action<A>
io.inversion.action.db.DbGetAction<A>
All Implemented Interfaces:
Comparable<A>

public class DbGetAction<A extends DbGetAction> extends Action<A>
  • Field Details

    • maxRows

      protected int maxRows
  • Constructor Details

    • DbGetAction

      public DbGetAction()
  • Method Details

    • configureOp

      public void configureOp(io.inversion.utils.Task task, Op op)
      This task has been selected to run as part of the supplied operation, this callback allows actions to perform any custom configuration on the op.
      Overrides:
      configureOp in class Action<A extends DbGetAction>
      Parameters:
      task -
      op -
    • getDefaultIncludeMatchers

      protected List<Rule.RuleMatcher> getDefaultIncludeMatchers()
      Description copied from class: Rule
      Designed to allow subclasses to provide a default match behavior of no configuration was provided by the developer.
      Overrides:
      getDefaultIncludeMatchers in class Rule<A extends DbGetAction>
      Returns:
      the default include match "*","*"
    • getForeignKey

      protected static String getForeignKey(Relationship rel, io.inversion.json.JSMap node)
    • getResourceKey

      protected static String getResourceKey(Collection collection, io.inversion.json.JSMap node)
    • stripTerms

      public static String stripTerms(String url, String... tokens)
    • expandPath

      protected static String expandPath(String path, Object next)
    • shouldExpand

      protected static boolean shouldExpand(Set<String> expands, String path, Relationship rel)
    • run

      public void run(Request req, Response res) throws ApiException
      Description copied from class: Action
      Override this method with your custom business logic or override one of the http method "doMETHOD" specific handlers.
      Overrides:
      run in class Action<A extends DbGetAction>
      Parameters:
      req - the Request being serviced
      res - the Reponse being generated
      Throws:
      ApiException
    • select

      protected Results select(Request req, Collection collection, Api api) throws ApiException
      Throws:
      ApiException
    • expand

      protected void expand(Request request, Collection collection, List<io.inversion.json.JSMap> parentObjs, Set expands, String expandsPath, org.apache.commons.collections4.map.MultiKeyMap pkCache)
      This is more complicated than it seems like it would need to be because it attempts to retrieve all values of a relationship at a time for the whole document. It does not run a recursive query for each resource and each relationship which could mean hundreds and hundreds of queries per document. This should result in number of queries proportional to the number of expands terms that does not increase with the number of results at any level of the expansion.
      Parameters:
      request - the request being serviced
      collection - the collection being queried
      parentObjs - the records that were just selected
      expands - the definition of which properties should be expanded
      expandsPath - the path we are currently on
      pkCache - a cache of things already looked up
    • getRelatedKeys

      protected List<io.inversion.utils.KeyValue<String,String>> getRelatedKeys(Relationship rel, Index idxToMatch, Index idxToRetrieve, List<String> toMatchEks) throws ApiException
      Throws:
      ApiException
    • recursiveGet

      protected List<io.inversion.json.JSMap> recursiveGet(org.apache.commons.collections4.map.MultiKeyMap pkCache, Collection collection, Collection resourceKeys, String expandsPath) throws ApiException
      Throws:
      ApiException
    • getMaxRows

      public int getMaxRows()
    • withMaxRows

      public DbGetAction withMaxRows(int maxRows)