Advertisement
Guest User

extract set data

a guest
Nov 18th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. MbOutputTerminal out = getOutputTerminal("out");
  2. MbOutputTerminal alt = getOutputTerminal("alternate");
  3.  
  4. MbMessage inMessage = inAssembly.getMessage();
  5. MbMessageAssembly outAssembly = null;
  6. try {
  7. // create new message as a copy of the input
  8. MbMessage outMessage = new MbMessage(inMessage);
  9. outAssembly = new MbMessageAssembly(inAssembly, outMessage);
  10. // ----------------------------------------------------------
  11. // Add user code below
  12. MbElement root = outMessage.getRootElement();
  13. MbElement rootLE = outAssembly.getLocalEnvironment().getRootElement();
  14.  
  15. Object record = root.evaluateXPath("JSON/Data/data/tasks/Item");
  16. List<MbElement> records = (List<MbElement>) record;
  17. String tkiid = null;
  18. if (records.size() > 0) {
  19. for (MbElement el : records) {
  20. tkiid = el.getFirstElementByPath("tkiid").getValueAsString();
  21. }
  22. }
  23.  
  24. rootLE.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"metrasys/tkiid", tkiid);
  25.  
  26. String url="http://jasindo-bpmdev.telkomsigma.co.id:9081/rest/bpm/wle/v1/service/"+tkiid+"?action=setData&params=";
  27. String params = rootLE.getFirstElementByPath("metrasys/param").getValueAsString();
  28. url = url+params+"&x-method-override=GET";
  29.  
  30. MbElement cabangHTTPRequest = root.createElementAsLastChild(MbElement.TYPE_NAME,"HTTPRequestHeader",null);
  31. cabangHTTPRequest.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,"X-Original-HTTP-URL", url);
  32.  
  33. String username = rootLE.getFirstElementByPath("metrasys/username").getValueAsString();
  34. String password = rootLE.getFirstElementByPath("metrasys/password").getValueAsString();
  35.  
  36. root.getFirstElementByPath("Properties/IdentitySourceType").setValue("usernameAndPassword");
  37. root.getFirstElementByPath("Properties/IdentitySourceToken").setValue(username);
  38. root.getFirstElementByPath("Properties/IdentitySourcePassword").setValue(password);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement