hudson.model.TopLevelItem.getFullName()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(93)

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

TopLevelItem.getFullName介绍

暂无

代码示例

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

public FilePath getWorkspaceFor(TopLevelItem item) {
  for (WorkspaceLocator l : WorkspaceLocator.all()) {
    FilePath workspace = l.locate(item, this);
    if (workspace != null) {
      return workspace;
    }
  }
  FilePath r = getWorkspaceRoot();
  if(r==null)     return null;    // offline
  return r.child(item.getFullName());
}

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

if (Secret.decrypt(matcher.group(1)) != null) {
  throw new AccessDeniedException(Messages.ItemGroupMixIn_may_not_copy_as_it_contains_secrets_and_(src.getFullName(), Jenkins.getAuthentication().getName(), Item.PERMISSIONS.title, Item.EXTENDED_READ.name, Item.CONFIGURE.name));

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

@Override
public String getFullName() {
  return item().getFullName();
}

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

private void applyDisabled(I item, boolean disabled) {
  try {
    // TODO revisit once on 2.61+ for https://github.com/jenkinsci/jenkins/pull/2866
    if (item instanceof AbstractFolder) {
      ((AbstractFolder) item).makeDisabled(disabled);
    } else if (item instanceof AbstractProject) {
      ((AbstractProject) item).makeDisabled(disabled);
    } else {
      try {
        Method makeDisabled = item.getClass().getMethod("makeDisabled", boolean.class);
        makeDisabled.invoke(item, disabled);
      } catch (NoSuchMethodException | IllegalAccessException e) {
        // it's just not supported, so we cannot expect it to succeed
        LOGGER.log(Level.FINE,
            "Cannot not " + (disabled ? "disable " : "enable ") + item.getFullName(), e);
      } catch (InvocationTargetException e) {
        // it's supported but something went wrong
        LOGGER.log(Level.WARNING,
            "Could not " + (disabled ? "disable " : "enable ") + item.getFullName(), e);
      }
    }
  } catch (IOException e) {
    LOGGER.log(Level.WARNING,
        "Could not " + (disabled ? "disable " : "enable ") + item.getFullName(), e);
  }
}

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

private void applyDisabled(I item, boolean disabled) {
  try {
    // TODO revisit once https://github.com/jenkinsci/jenkins/pull/2866 available in baseline Jenkins
    if (item instanceof AbstractFolder) {
      ((AbstractFolder) item).makeDisabled(disabled);
    } else if (item instanceof AbstractProject) {
      ((AbstractProject) item).makeDisabled(disabled);
    } else {
      try {
        Method makeDisabled = item.getClass().getMethod("makeDisabled", boolean.class);
        makeDisabled.invoke(item, disabled);
      } catch (NoSuchMethodException | IllegalAccessException e) {
        // it's just not supported, so we cannot expect it to succeed
        LOGGER.log(Level.FINE,
            "Cannot not " + (disabled ? "disable " : "enanble ") + item.getFullName(), e);
      } catch (InvocationTargetException e) {
        // it's supported but something went wrong
        LOGGER.log(Level.WARNING,
            "Could not " + (disabled ? "disable " : "enanble ") + item.getFullName(), e);
      }
    }
  } catch (IOException e) {
    LOGGER.log(Level.WARNING,
        "Could not " + (disabled ? "disable " : "enanble ") + item.getFullName(), e);
  }
}

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

@Override
  public String call(I item) {
    String fullName = item.getFullName();
    t.setName("Loading job " + fullName);
    float percentage = 100.0f * jobEncountered.incrementAndGet() / Math.max(1, jobTotal.get());
    long now = System.currentTimeMillis();
    if (loadingTick == 0) {
      loadingTick = now;
    } else if (now - loadingTick > TICK_INTERVAL) {
      LOGGER.log(Level.INFO, String.format("Loading job %s (%.1f%%)", fullName, percentage));
      loadingTick = now;
    }
    if (childNameGenerator == null) {
      return item.getName();
    } else {
      String name = childNameGenerator.itemNameFromItem(AbstractFolder.this, item);
      if (name == null) {
        return childNameGenerator.itemNameFromLegacy(AbstractFolder.this, item.getName());
      }
      return name;
    }
  }
});

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

@Override
  public String call(I item) {
    String fullName = item.getFullName();
    t.setName("Loading job " + fullName);
    float percentage = 100.0f * jobEncountered.incrementAndGet() / Math.max(1, jobTotal.get());
    long now = System.currentTimeMillis();
    if (loadingTick == 0) {
      loadingTick = now;
    } else if (now - loadingTick > TICK_INTERVAL) {
      LOGGER.log(Level.INFO, String.format("Loading job %s (%.1f%%)", fullName, percentage));
      loadingTick = now;
    }
    if (childNameGenerator == null) {
      return item.getName();
    } else {
      String name = childNameGenerator.itemNameFromItem(AbstractFolder.this, item);
      if (name == null) {
        return childNameGenerator.itemNameFromLegacy(AbstractFolder.this, item.getName());
      }
      return name;
    }
  }
});

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

public FilePath getWorkspaceFor(TopLevelItem item) {
  for (WorkspaceLocator l : WorkspaceLocator.all()) {
    FilePath workspace = l.locate(item, this);
    if (workspace != null) {
      return workspace;
    }
  }
  FilePath r = getWorkspaceRoot();
  if(r==null)     return null;    // offline
  return r.child(item.getFullName());
}

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

/**
 * Loads the job's config.xml via the jenkins cli command <code>get-job</code>.
 *
 * @param job the job to get the config for
 * @return the xml document
 * @throws Exception if so
 */
Document loadConfigXmlViaCli(TopLevelItem job) throws Exception {
  List<String> cmd = javaCliJarCmd("get-job", job.getFullName());
  Process process = Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]));
  String xml = IOUtils.toString(process.getInputStream());
  assertEquals(0, process.waitFor());
  DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  return db.parse(is);
}

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

} catch (IOException e) {
  LOGGER.log(Level.WARNING, "Could not update {0} after applying folder naming rules",
      item.getFullName());

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

} catch (IOException e) {
  LOGGER.log(Level.WARNING, "Could not update {0} after applying folder naming rules",
      item.getFullName());

代码示例来源:origin: org.jenkins-ci.plugins/security-inspector

@Override
protected Boolean getEntryReport(TopLevelItem column, Permission item) {
  
  final Authentication auth;
  try {
    auth = user4report.impersonate();
  } catch (UsernameNotFoundException ex) {
    return Boolean.FALSE;
  }
  
  SecurityContext initialContext = null;
  Item i = JenkinsHelper.getInstanceOrFail().getItemByFullName(column.getFullName());
  if (i == null) {
    return Boolean.FALSE;
  }
  try {
    initialContext = hudson.security.ACL.impersonate(auth);
    return i.hasPermission(item);
  } finally {
    if (initialContext != null) {
      SecurityContextHolder.setContext(initialContext);
    }
  }
}

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

/**
 * Tests that configuring an existing project via jenkins cli doesn't produce duplicated triggers
 * and that the trigger is configured for the new project pattern.
 *
 * @throws Exception if so
 */
@Test
@LocalData
public void testReconfigureUsingCli() throws Exception {
  assertNrOfEventListeners(0);
  TopLevelItem testProj = j.jenkins.getItem("testProj");
  String gerritProjectPattern = "someotherproject";
  Document document = loadConfigXmlViaCli(testProj);
  String xml = changeConfigXml(gerritProjectPattern, document);
  List<String> cmd = javaCliJarCmd("update-job", testProj.getFullName());
  Process process = Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()]));
  OutputStream output = process.getOutputStream();
  IOUtils.write(xml, output);
  IOUtils.closeQuietly(output);
  String response = IOUtils.toString(process.getInputStream());
  System.out.println(response);
  assertEquals(0, process.waitFor());
  assertNrOfEventListeners(0);
  assertEventListenerWithSomeOtherProjectSet(gerritProjectPattern);
}

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

FilePath child = r.child(item.getFullName());
if (child!=null && item instanceof AbstractProject) {
 AbstractProject project = (AbstractProject) item;

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

if (Secret.decrypt(matcher.group(1)) != null) {
  throw new AccessDeniedException(Messages.ItemGroupMixIn_may_not_copy_as_it_contains_secrets_and_(src.getFullName(), Jenkins.getAuthentication().getName(), Item.PERMISSIONS.title, Item.EXTENDED_READ.name, Item.CONFIGURE.name));

相关文章