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

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

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

AbstractItem.renameTo介绍

[英]Renames this item. Not all the Items need to support this operation, but if you decide to do so, you can use this method.
[中]重命名此项目。并非所有项目都需要支持此操作,但如果您决定这样做,则可以使用此方法。

代码示例

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

/**
 * Renames a job.
 */
@Override
public void renameTo(String newName) throws IOException {
  File oldBuildDir = getBuildDir();
  super.renameTo(newName);
  File newBuildDir = getBuildDir();
  if (oldBuildDir.isDirectory() && !newBuildDir.isDirectory()) {
    if (!newBuildDir.getParentFile().isDirectory()) {
      newBuildDir.getParentFile().mkdirs();
    }
    if (!oldBuildDir.renameTo(newBuildDir)) {
      throw new IOException("failed to rename " + oldBuildDir + " to " + newBuildDir);
    }
  }
}

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

/**
 * Renames this item
 */
@RequirePOST
@Restricted(NoExternalUse.class)
public HttpResponse doConfirmRename(@QueryParameter String newName) throws IOException {
  newName = newName == null ? null : newName.trim();
  FormValidation validationError = doCheckNewName(newName);
  if (validationError.kind != FormValidation.Kind.OK) {
    throw new Failure(validationError.getMessage());
  }
  renameTo(newName);
  // send to the new job page
  // note we can't use getUrl() because that would pick up old name in the
  // Ancestor.getUrl()
  return HttpResponses.redirectTo("../" + newName);
}

代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder

/**
 * Renames this item container.
 */
@Override
public void renameTo(String newName) throws IOException {
  super.renameTo(newName);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Renames a job.
 */
@Override
public synchronized void renameTo(String newName) throws IOException {
  super.renameTo(newName);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Renames a job.
 */
@Override
public void renameTo(String newName) throws IOException {
  super.renameTo(newName);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Renames a job.
 */
@Override
public synchronized void renameTo(String newName) throws IOException {
  super.renameTo(newName);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Renames a job.
 */
@Override
public synchronized void renameTo(String newName) throws IOException {
  super.renameTo(newName);
}

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

/**
 * Renames this item container.
 */
@Override
public void renameTo(String newName) throws IOException {
  super.renameTo(newName);
}

代码示例来源:origin: jenkinsci/jenkins-test-harness

@Override public void renameTo(String newName) throws IOException {
  super.renameTo(newName); // just to make it public
}

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

/**
 * Renames a job.
 */
@Override
public void renameTo(String newName) throws IOException {
  File oldBuildDir = getBuildDir();
  super.renameTo(newName);
  File newBuildDir = getBuildDir();
  if (oldBuildDir.isDirectory() && !newBuildDir.isDirectory()) {
    if (!newBuildDir.getParentFile().isDirectory()) {
      newBuildDir.getParentFile().mkdirs();
    }
    if (!oldBuildDir.renameTo(newBuildDir)) {
      throw new IOException("failed to rename " + oldBuildDir + " to " + newBuildDir);
    }
  }
}

相关文章