public class DbPostAction extends Action<DbPostAction>
Rule.RuleMatcher| Modifier and Type | Field and Description |
|---|---|
protected boolean |
collapseAll |
protected boolean |
getResponse |
protected boolean |
strictRest
When true, forces PUTs to have an resourceKey in the URL
|
configMap, configStr, excludeMatchers, excludeOn, includeMatchers, includeOn, log, name, order| Constructor and Description |
|---|
DbPostAction() |
| Modifier and Type | Method and Description |
|---|---|
static void |
collapse(JSNode parent,
boolean collapseAll,
java.util.Set collapses,
java.lang.String path) |
boolean |
isCollapseAll() |
boolean |
isGetResponse() |
boolean |
isStrictRest() |
static java.lang.String |
nextPath(java.lang.String path,
java.lang.String next) |
void |
patch(Request req,
Response res)
Unlike upsert for POST/PUT, this method is specifically NOT recursive for patching
nested documents.
|
void |
run(Request req,
Response res)
Override this method with your custom business logic or override one of the
http method "doMETHOD" specific handlers.
|
protected java.util.List<java.lang.String> |
upsert(Request req,
Collection collection,
JSArray nodes)
README README README README
|
void |
upsert(Request req,
Response res) |
DbPostAction |
withCollapseAll(boolean collapseAll) |
DbPostAction |
withGetResponse(boolean expandResponse) |
DbPostAction |
withStrictRest(boolean strictRest) |
checkLazyConfig, compareTo, doLazyConfig, getAllExcludePaths, getAllIncludePaths, getConfig, getConfig, getConfigKeys, getDefaultIncludeMatch, getExcludeMatchers, getIncludeMatchers, getName, getOrder, match, matches, matches, toString, withConfig, withExcludeOn, withExcludeOn, withExcludeOn, withIncludeOn, withIncludeOn, withIncludeOn, withName, withOrderprotected boolean collapseAll
protected boolean strictRest
protected boolean getResponse
public static java.lang.String nextPath(java.lang.String path,
java.lang.String next)
public void run(Request req, Response res) throws ApiException
Actionrun in class Action<DbPostAction>req - the Request being servicedres - the Reponse being generatedApiExceptionpublic void patch(Request req, Response res) throws ApiException
TODO: add support for JSON Patch format...maybe
req - the request to runres - the response to populateApiExceptionpublic void upsert(Request req, Response res) throws ApiException
ApiExceptionprotected java.util.List<java.lang.String> upsert(Request req, Collection collection, JSArray nodes)
Algorithm:
Step 1: Upsert all nodes in this generation...meaning not recursively including
key values for all many-to-one foreign keys but excluding all one-to-many and many-to-many
key changes...non many-to-one relationships involve modifying other tables that have foreign
keys back to this collection's table, not the direct modification of the single table
underlying this collection.
Step 2: For each relationship POST back through the "front door". This is the primary recursion that enables nested documents to submitted all at once by client. Putting this step first ensure that all new objects are POSTed, with their newly created hrefs placed back in the JSON prior to any PUTs that depend on relationship keys to exist.
Step 3: PKs generated for child documents which are actually relationship parents, are set as foreign keys back on the parent json (which is actually the one-to-many child)
Step 4: Find the key values for all new/kept one-to-many and many-to-many relationships
Step 5.1 Upsert all of those new/kept relationships and create the RQL queries needed find all relationships NOT in the upserts.
Step 5.2 Null out all now invalid many-to-one foreign keys back and delete all now invalid many-to-many relationships rows.
req - the request being servicedcollection - the collection be modifiednodes - the records to updatepublic boolean isCollapseAll()
public DbPostAction withCollapseAll(boolean collapseAll)
public boolean isStrictRest()
public DbPostAction withStrictRest(boolean strictRest)
public boolean isGetResponse()
public DbPostAction withGetResponse(boolean expandResponse)
public static void collapse(JSNode parent, boolean collapseAll, java.util.Set collapses, java.lang.String path)
Copyright © 2021 Rocket Partners, LLC. All rights reserved.