Class DbGetAction<A extends DbGetAction>

  • All Implemented Interfaces:
    java.lang.Comparable<A>

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

      • maxRows

        protected int maxRows
    • Constructor Detail

      • DbGetAction

        public DbGetAction()
    • Method Detail

      • 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 java.util.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 java.lang.String getForeignKey​(Relationship rel,
                                                        io.inversion.json.JSMap node)
      • getResourceKey

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

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

        protected static java.lang.String expandPath​(java.lang.String path,
                                                     java.lang.Object next)
      • shouldExpand

        protected static boolean shouldExpand​(java.util.Set<java.lang.String> expands,
                                              java.lang.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
      • expand

        protected void expand​(Request request,
                              Collection collection,
                              java.util.List<io.inversion.json.JSMap> parentObjs,
                              java.util.Set expands,
                              java.lang.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 java.util.List<io.inversion.utils.KeyValue<java.lang.String,​java.lang.String>> getRelatedKeys​(Relationship rel,
                                                                                                                      Index idxToMatch,
                                                                                                                      Index idxToRetrieve,
                                                                                                                      java.util.List<java.lang.String> toMatchEks)
                                                                                                               throws ApiException
        Throws:
        ApiException
      • recursiveGet

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

        public int getMaxRows()
      • withMaxRows

        public DbGetAction withMaxRows​(int maxRows)