Class GeneratePatchDiffService
- java.lang.Object
 - 
- com.adaptris.core.ServiceImp
 - 
- com.adaptris.core.json.jsonpatch.JsonPatchService
 - 
- com.adaptris.core.json.jsonpatch.GeneratePatchDiffService
 
 
 
 
- 
- All Implemented Interfaces:
 AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Generate a JSON patch diff between two documents", tag="service,json,jsonpatch", since="3.9.0") public class GeneratePatchDiffService extends JsonPatchServiceGenerate a JSON patch diff between two documentsJSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JavaScript Object Notation (JSON) document. This service generates the JSON that expresses the differences between 2 JSON documents as a sequence of operations.
For a given
diff-sourceof{"a": 0,"b": [1,2]}and adiff-targetof{"b": [1,2,0]}then the patch transformation generated and stored againstoutputshould be[{"op":"move","from":"/a","path":"/b/2"}].Note that zjsonpatch operates on JsonNode objects; this means keeping the both node trees in memory, so behaviour will be size/memory dependent.
In the adapter configuration file this class is aliased as json-patch-generate-diff which is the preferred alternative to the fully qualified classname when building your configuration.
 
- 
- 
Field Summary
- 
Fields inherited from class com.adaptris.core.json.jsonpatch.JsonPatchService
mapper 
- 
Fields inherited from class com.adaptris.core.ServiceImp
log 
 - 
 
- 
Constructor Summary
Constructors Constructor Description GeneratePatchDiffService() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoService(AdaptrisMessage msg)MessageWrapper<java.io.InputStream>getDiffSource()MessageWrapper<java.io.InputStream>getDiffTarget()java.util.List<PatchDiffFlag>getFlags()voidprepare()voidsetDiffSource(MessageWrapper<java.io.InputStream> diffSource)Specify the JSON document that will be transformed.voidsetDiffTarget(MessageWrapper<java.io.InputStream> diffTarget)Specify the target JSON document you want the patch to transform to.voidsetFlags(java.util.List<PatchDiffFlag> flags)Specify any additional flags for the diff operation.GeneratePatchDiffServicewithDiffSource(MessageWrapper<java.io.InputStream> diffSource)GeneratePatchDiffServicewithDiffTarget(MessageWrapper<java.io.InputStream> diffTarget)GeneratePatchDiffServicewithFlags(PatchDiffFlag... flags)GeneratePatchDiffServicewithFlags(java.util.List<PatchDiffFlag> flags)- 
Methods inherited from class com.adaptris.core.json.jsonpatch.JsonPatchService
closeService, getOutput, initService, output, readAndClose, setOutput, withOutput, writeAndClose 
- 
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId, start, stop 
 - 
 
 - 
 
- 
- 
Method Detail
- 
doService
public void doService(AdaptrisMessage msg) throws ServiceException
- Throws:
 ServiceException
 
- 
prepare
public void prepare() throws CoreException- Throws:
 CoreException
 
- 
getDiffSource
public MessageWrapper<java.io.InputStream> getDiffSource()
 
- 
setDiffSource
public void setDiffSource(MessageWrapper<java.io.InputStream> diffSource)
Specify the JSON document that will be transformed.- Parameters:
 diffSource- the source
 
- 
withDiffSource
public GeneratePatchDiffService withDiffSource(MessageWrapper<java.io.InputStream> diffSource)
 
- 
getDiffTarget
public MessageWrapper<java.io.InputStream> getDiffTarget()
 
- 
setDiffTarget
public void setDiffTarget(MessageWrapper<java.io.InputStream> diffTarget)
Specify the target JSON document you want the patch to transform to.- Parameters:
 diffTarget- the target JSON document
 
- 
withDiffTarget
public GeneratePatchDiffService withDiffTarget(MessageWrapper<java.io.InputStream> diffTarget)
 
- 
getFlags
public java.util.List<PatchDiffFlag> getFlags()
 
- 
setFlags
public void setFlags(java.util.List<PatchDiffFlag> flags)
Specify any additional flags for the diff operation.- Parameters:
 flags- the flags.
 
- 
withFlags
public GeneratePatchDiffService withFlags(java.util.List<PatchDiffFlag> flags)
 
- 
withFlags
public GeneratePatchDiffService withFlags(PatchDiffFlag... flags)
 
 - 
 
 -