Package uk.gov.gchq.gaffer.graph.hook
Class AddOperationsToChain
- java.lang.Object
-
- uk.gov.gchq.gaffer.graph.hook.AddOperationsToChain
-
- All Implemented Interfaces:
GraphHook
public class AddOperationsToChain extends Object implements GraphHook
AAddOperationsToChain
is aGraphHook
that allows a user to insert additional operations at certain points on the operation chain. At the start, before a specific Operation, after a specific Operation, or at the end. A user can also specify authorised Operations to add, and if the user has the opAuths, the additional Operations will be added to the chain.
-
-
Constructor Summary
Constructors Constructor Description AddOperationsToChain()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,List<Operation>>
getAfter()
LinkedHashMap<String,AdditionalOperations>
getAuthorisedOps()
Map<String,List<Operation>>
getBefore()
List<Operation>
getEnd()
List<Operation>
getStart()
<T> T
onFailure(T result, OperationChain<?> opChain, Context context, Exception e)
Called fromGraph
if an error occurs whilst executing theOperationChain
.<T> T
postExecute(T result, OperationChain<?> opChain, Context context)
Called fromGraph
after anOperationChain
is executed.void
preExecute(OperationChain<?> opChain, Context context)
Adds in the additional Operations specified.void
setAfter(Map<String,List<Operation>> after)
void
setAuthorisedOps(LinkedHashMap<String,AdditionalOperations> authorisedOps)
void
setBefore(Map<String,List<Operation>> before)
void
setEnd(List<Operation> end)
void
setStart(List<Operation> start)
-
-
-
Method Detail
-
preExecute
public void preExecute(OperationChain<?> opChain, Context context)
Adds in the additional Operations specified. The original opChain will be updated.- Specified by:
preExecute
in interfaceGraphHook
- Parameters:
opChain
- theOperationChain
being executed.context
- theContext
executing the operation chain
-
postExecute
public <T> T postExecute(T result, OperationChain<?> opChain, Context context)
Description copied from interface:GraphHook
Called fromGraph
after anOperationChain
is executed.- Specified by:
postExecute
in interfaceGraphHook
- Type Parameters:
T
- the result type- Parameters:
result
- the result from the operation chainopChain
- theOperationChain
that was executed. This can be modified/optimised in any GraphHook.context
- theContext
in which the operation chain was executed. The context also holds a reference to the original operation chain.- Returns:
- result object
-
onFailure
public <T> T onFailure(T result, OperationChain<?> opChain, Context context, Exception e)
Description copied from interface:GraphHook
Called fromGraph
if an error occurs whilst executing theOperationChain
.- Specified by:
onFailure
in interfaceGraphHook
- Type Parameters:
T
- the result type- Parameters:
result
- the result from the operation chain - likely to be null.opChain
- theOperationChain
that was executed. This can be modified/optimised in any GraphHook.context
- theContext
in which the operation chain was executed. The context also holds a reference to the original operation chain.e
- the exception- Returns:
- result object
-
getAuthorisedOps
public LinkedHashMap<String,AdditionalOperations> getAuthorisedOps()
-
setAuthorisedOps
public void setAuthorisedOps(LinkedHashMap<String,AdditionalOperations> authorisedOps)
-
-