Class DbGetAction

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

public class DbGetAction extends Action<DbGetAction>
  • Field Details

    • maxRows

      protected int maxRows
  • Constructor Details

    • DbGetAction

      public DbGetAction()
  • Method Details

    • exclude

      protected static boolean exclude(String path, Set<String> includes, Set<String> excludes)
    • getResourceKey

      protected static String getResourceKey(Object obj)
    • stripTerms

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

      protected static String stripTerm(String str, String startToken, char... endingTokens)
    • expandPath

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

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

      protected static boolean find(Collection<String> params, String path, boolean matchStart)
    • 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<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
    • exclude

      protected void exclude(List<JSNode> nodes)
    • exclude

      protected void exclude(JSNode node, Set<String> includes, Set<String> excludes, String path)
    • expand

      protected void expand(Request request, Collection collection, List<JSNode> 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<org.apache.commons.collections4.KeyValue<String,String>> getRelatedKeys(Relationship rel, Index idxToMatch, Index idxToRetrieve, List<String> toMatchEks) throws ApiException
      Throws:
      ApiException
    • recursiveGet

      protected List<JSNode> 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)