use of uk.gov.gchq.gaffer.operation.OperationChainDAO in project Gaffer by gchq.
the class AddNamedOperation method setOperationChain.
@JsonIgnore
public void setOperationChain(final OperationChain operationChain) {
try {
if (operationChain instanceof OperationChainDAO) {
this.operations = new String(JSONSerialiser.serialise(operationChain), Charset.forName(CHARSET_NAME));
} else {
final OperationChainDAO dao = new OperationChainDAO(operationChain.getOperations());
this.operations = new String(JSONSerialiser.serialise(dao), Charset.forName(CHARSET_NAME));
}
} catch (final SerialisationException se) {
throw new IllegalArgumentException(se.getMessage());
}
}
use of uk.gov.gchq.gaffer.operation.OperationChainDAO in project Gaffer by gchq.
the class OperationService method _execute.
@SuppressWarnings("ThrowFromFinallyBlock")
protected <O> O _execute(final OperationChainDAO<O> opChain) {
final Context context = userFactory.createContext();
preOperationHook(opChain, context);
O result;
try {
result = graphFactory.getGraph().execute(opChain, context);
} catch (final OperationException e) {
CloseableUtil.close(opChain);
throw new RuntimeException("Error executing operation chain: " + e.getMessage(), e);
} finally {
try {
postOperationHook(opChain, context);
} catch (final Exception e) {
CloseableUtil.close(opChain);
throw e;
}
}
return result;
}
Aggregations