@Override public Workflow getWorkflow(String workflowURI) { Workflow ret = api.getWorkflow(callingCtx, workflowURI); return ret; }
@Override public PluginTransportItem encode(CallingContext ctx, String uri) { try { MessageDigest md = MessageDigest.getInstance("MD5"); StringBuilder buf = new StringBuilder(); DecisionApi api = Kernel.getDecision(); Workflow workflow = api.getWorkflow(ctx, uri); String json = JacksonUtil.jsonFromObject(workflow); buf.append(json); PluginTransportItem item = new PluginTransportItem(); item.setContent(buf.toString().getBytes(Charsets.UTF_8)); md.update(item.getContent()); item.setHash(Hex.encodeHexString(md.digest())); item.setUri(uri); return item; } catch (NoSuchAlgorithmException e) { // this can only happen if we use a JRE without MD5 support throw RaptureExceptionFactory.create(HttpURLConnection.HTTP_INTERNAL_ERROR, "Error encoding workflow", e); } } }