コード例 #1
0
 public XmlFile getXmlFile(Job prj) {
   // default behaviour
   File rootDir = prj.getRootDir();
   File credentialFile = new File(rootDir, credentialsFileName);
   if (credentialFile.exists()) {
     return new XmlFile(credentialFile);
   }
   // matrix configuration project
   if (prj instanceof MatrixConfiguration && prj.getParent() != null) {
     ItemGroup parent = prj.getParent();
     if (parent instanceof Job) {
       return getXmlFile((Job) parent);
     }
   }
   if (prj.hasCascadingProject()) {
     return getXmlFile(prj.getCascadingProject());
   }
   return new XmlFile(new File(rootDir, credentialsFileName));
 }
コード例 #2
0
  private void renameJob(Job from, String to) throws IOException {
    LOGGER.info(format("Renaming job %s to %s", from.getFullName(), to));

    ItemGroup fromParent = from.getParent();
    ItemGroup toParent = lookupStrategy.getParent(build.getProject(), to);
    if (fromParent != toParent) {
      LOGGER.info(
          format("Moving Job %s to folder %s", fromParent.getFullName(), toParent.getFullName()));
      if (toParent instanceof DirectlyModifiableTopLevelItemGroup) {
        DirectlyModifiableTopLevelItemGroup itemGroup =
            (DirectlyModifiableTopLevelItemGroup) toParent;
        move(from, itemGroup);
      } else {
        throw new DslException(
            format(
                Messages.RenameJobMatching_DestinationNotFolder(),
                from.getFullName(),
                toParent.getFullName()));
      }
    }
    from.renameTo(FilenameUtils.getName(to));
  }