MCPcopy Create free account
hub / github.com/jgraph/drawio / addPatch

Method addPatch

src/main/java/com/mxgraph/online/AbsCache.java:418–447  ·  view source on GitHub ↗

Adds the given patch and returns true if collaborators should be notified.

(String id, String data, String secret, String token,
			String from, String to, String lastSecret)

Source from the content-addressed store, hash-verified

416 * Adds the given patch and returns true if collaborators should be notified.
417 */
418 protected void addPatch(String id, String data, String secret, String token,
419 String from, String to, String lastSecret)
420 throws UnauthorizedException
421 {
422 if (secret != null && cache.remove(createTokenKey(id, secret), token))
423 {
424 if (from != null && to != null && data != null
425 && data.length() < maxCacheSize)
426 {
427 // Checks if the last patch has a valid secret
428 checkPatch(id, from, lastSecret);
429 cache.put(createCacheEntryKey(id, from),
430 new CacheEntry(to, data, secret));
431
432 // Maps from current to last for keeping chain valid
433 if (secret != null)
434 {
435 cache.put(createLastVersionKey(id, to), from);
436 }
437
438 debug("addPatch id=" + id + " from=" + from + " to=" + to
439 + " secret=" + secret + " token=" + token + " data="
440 + data);
441 }
442 }
443 else if (data != null)
444 {
445 throw new UnauthorizedException();
446 }
447 }
448
449 /**
450 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)

Callers 1

doPostAbstMethod · 0.95

Calls 8

createTokenKeyMethod · 0.95
checkPatchMethod · 0.95
createCacheEntryKeyMethod · 0.95
createLastVersionKeyMethod · 0.95
debugMethod · 0.95
removeMethod · 0.45
lengthMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected