private void saveWorkflowXml(JobType jobType, String appPath, String postBody,
                               Boolean overwrite) throws IOException {
    appPath = workflowFilesService.getWorkflowFileName(appPath.trim(), jobType);
    postBody = utils.formatXml(postBody);
    workflowFilesService.createFile(appPath, postBody, overwrite);
    String workflowDraftPath = workflowFilesService.getWorkflowDraftFileName(appPath.trim(), jobType);
    if (hdfsFileUtils.fileExists(workflowDraftPath)) {
      hdfsFileUtils.deleteFile(workflowDraftPath);
    }
  }
This is a class used to bridge the communication between the and the Oozie
API executing inside ambari.
contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieProxyImpersonator.java