hudson.model.AbstractItem.updateByXml()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中hudson.model.AbstractItem.updateByXml()方法的一些代码示例,展示了AbstractItem.updateByXml()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractItem.updateByXml()方法的具体详情如下:
包路径:hudson.model.AbstractItem
类名称:AbstractItem
方法名:updateByXml

AbstractItem.updateByXml介绍

[英]Updates an Item by its XML definition.
[中]根据项目的XML定义更新项目。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * @deprecated as of 1.473
 *      Use {@link #updateByXml(Source)}
 */
@Deprecated
public void updateByXml(StreamSource source) throws IOException {
  updateByXml((Source)source);
}

代码示例来源:origin: jenkinsci/jenkins

protected int run() throws Exception {
    job.updateByXml((Source)new StreamSource(stdin));
    return 0;
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Accepts {@code config.xml} submission, as well as serve it.
 */
@WebMethod(name = "config.xml")
public void doConfigDotXml(StaplerRequest req, StaplerResponse rsp)
    throws IOException {
  if (req.getMethod().equals("GET")) {
    // read
    rsp.setContentType("application/xml");
    writeConfigDotXml(rsp.getOutputStream());
    return;
  }
  if (req.getMethod().equals("POST")) {
    // submission
    updateByXml((Source)new StreamSource(req.getReader()));
    return;
  }
  // huh?
  rsp.sendError(SC_BAD_REQUEST);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * @deprecated as of 1.473
 *      Use {@link #updateByXml(Source)}
 */
@Deprecated
public void updateByXml(StreamSource source) throws IOException {
  updateByXml((Source)source);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

protected int run() throws Exception {
    job.updateByXml((Source)new StreamSource(stdin));
    return 0;
  }
}

代码示例来源:origin: stackoverflow.com

AbstractItem item= (AbstractItem) Jenkins.getInstance().getItemByFullName(itemName)
Source streamSource = new StreamSource(new StringReader(config))
item.updateByXml(streamSource);
item.save();

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Accepts <tt>config.xml</tt> submission, as well as serve it.
 */
@WebMethod(name = "config.xml")
public void doConfigDotXml(StaplerRequest req, StaplerResponse rsp)
    throws IOException {
  if (req.getMethod().equals("GET")) {
    // read
    rsp.setContentType("application/xml");
    writeConfigDotXml(rsp.getOutputStream());
    return;
  }
  if (req.getMethod().equals("POST")) {
    // submission
    updateByXml((Source)new StreamSource(req.getReader()));
    return;
  }
  // huh?
  rsp.sendError(SC_BAD_REQUEST);
}

代码示例来源:origin: jenkinsci/jobConfigHistory-plugin

/**
 * Action when 'restore' button is pressed: Replace current config file by
 * older version.
 *
 * @param req
 *            Incoming StaplerRequest
 * @param rsp
 *            Outgoing StaplerResponse
 * @throws IOException
 *             If something goes wrong
 */
public final void doRestore(StaplerRequest req, StaplerResponse rsp)
    throws IOException {
  checkConfigurePermission();
  final String timestamp = req.getParameter("timestamp");
  final XmlFile xmlFile = getHistoryDao().getOldRevision(project,
      timestamp);
  final InputStream is = new ByteArrayInputStream(
      xmlFile.asString().getBytes("UTF-8"));
  project.updateByXml((Source) new StreamSource(is));
  project.save();
  rsp.sendRedirect(getJenkins().getRootUrl() + project.getUrl());
}

相关文章