Package io.inversion.action.db
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>
-
Nested Class Summary
Nested classes/interfaces inherited from class io.inversion.Rule
Rule.RuleMatcher -
Field Summary
FieldsFields inherited from class io.inversion.Rule
ALL_METHODS, configMap, description, excludeMatchers, excludeOn, includeMatchers, includeOn, log, name, order, params -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureOp(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.protected voidexpand(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.protected static StringexpandPath(String path, Object next) protected List<Rule.RuleMatcher>Designed to allow subclasses to provide a default match behavior of no configuration was provided by the developer.protected static StringgetForeignKey(Relationship rel, io.inversion.json.JSMap node) intgetRelatedKeys(Relationship rel, Index idxToMatch, Index idxToRetrieve, List<String> toMatchEks) protected static StringgetResourceKey(Collection collection, io.inversion.json.JSMap node) protected List<io.inversion.json.JSMap>recursiveGet(org.apache.commons.collections4.map.MultiKeyMap pkCache, Collection collection, Collection resourceKeys, String expandsPath) voidOverride this method with your custom business logic or override one of the http method "doMETHOD" specific handlers.protected Resultsselect(Request req, Collection collection, Api api) protected static booleanshouldExpand(Set<String> expands, String path, Relationship rel) static StringstripTerms(String url, String... tokens) withMaxRows(int maxRows) Methods inherited from class io.inversion.Action
doDelete, doGet, doPatch, doPost, doPut, getFullIncludePaths, getIncludePaths, isDecoration, joinPaths, joinPaths0, run0, withDecorationMethods inherited from class io.inversion.Rule
afterWiringComplete, checkLazyConfig, compareTo, doLazyConfig, getAllExcludePaths, getAllIncludeMethods, getAllIncludePaths, getDescription, getExcludeMatchers, getIncludeMatchers, getName, getOrder, getParams, match, match, matches, matches, toString, withDescription, withExcludeOn, withExcludeOn, withIncludeOn, withIncludeOn, withName, withOrder, withParam, withParams
-
Field Details
-
maxRows
protected int maxRows
-
-
Constructor Details
-
DbGetAction
public DbGetAction()
-
-
Method Details
-
configureOp
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:
configureOpin classAction<A extends DbGetAction>- Parameters:
task-op-
-
getDefaultIncludeMatchers
Description copied from class:RuleDesigned to allow subclasses to provide a default match behavior of no configuration was provided by the developer.- Overrides:
getDefaultIncludeMatchersin classRule<A extends DbGetAction>- Returns:
- the default include match "*","*"
-
getForeignKey
-
getResourceKey
-
stripTerms
-
expandPath
-
shouldExpand
-
run
Description copied from class:ActionOverride this method with your custom business logic or override one of the http method "doMETHOD" specific handlers.- Overrides:
runin classAction<A extends DbGetAction>- Parameters:
req- the Request being servicedres- the Reponse being generated- Throws:
ApiException
-
select
- 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 servicedcollection- the collection being queriedparentObjs- the records that were just selectedexpands- the definition of which properties should be expandedexpandsPath- the path we are currently onpkCache- 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
-