当前位置: 首页>>代码示例>>Java>>正文


Java Item类代码示例

本文整理汇总了Java中hudson.model.Item的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Item类属于hudson.model包,在下文中一共展示了Item类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onChange

import hudson.model.Item; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onChange(Saveable o, XmlFile file) {
    if (!(o instanceof Item)) {
        // must be an Item
        return;
    }
    SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem((Item) o);
    if (item == null) {
        // more specifically must be an SCMTriggerItem
        return;
    }
    SCMTrigger trigger = item.getSCMTrigger();
    if (trigger == null || trigger.isIgnorePostCommitHooks()) {
        // must have the trigger enabled and not opted out of post commit hooks
        return;
    }
    for (SCM scm : item.getSCMs()) {
        if (scm instanceof GitSCM) {
            // we have a winner
            GiteaWebhookListener.register(item, (GitSCM) scm);
        }
    }
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:27,代码来源:GiteaWebhookListener.java

示例2: doFillMirrorgateCredentialsIdItems

import hudson.model.Item; //导入依赖的package包/类
public ListBoxModel doFillMirrorgateCredentialsIdItems(
        @AncestorInPath Item item,
        @QueryParameter("mirrorgateCredentialsId") String credentialsId) {

    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else if (!item.hasPermission(Item.EXTENDED_READ)
            && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
        return result.includeCurrentValue(credentialsId);
    }
    return result
            .includeEmptyValue()
            .includeAs(ACL.SYSTEM, item, StandardUsernamePasswordCredentials.class);
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:18,代码来源:MirrorGatePublisher.java

示例3: doCheckMirrorgateCredentialsId

import hudson.model.Item; //导入依赖的package包/类
public FormValidation doCheckMirrorgateCredentialsId(
        @AncestorInPath Item item,
        @QueryParameter("mirrorgateCredentialsId") String credentialsId) {

    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return FormValidation.ok();
        }
    } else if (!item.hasPermission(Item.EXTENDED_READ)
            && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
        return FormValidation.ok();
    }
    if (StringUtils.isBlank(credentialsId)) {
        return FormValidation.ok();
    }
    if (credentialsId.startsWith("${") && credentialsId.endsWith("}")) {
        return FormValidation.warning(
                "Cannot validate expression based credentials");
    }
    return FormValidation.ok();
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:22,代码来源:MirrorGatePublisher.java

示例4: doIndex

import hudson.model.Item; //导入依赖的package包/类
@SuppressWarnings("unused")
public void doIndex() throws IOException {
  HttpServletRequest req = Stapler.getCurrentRequest();
  GerritProjectEvent projectEvent = getBody(req);

  log.info("GerritWebHook invoked for event " + projectEvent);

  List<Item> jenkinsItems = Jenkins.getActiveInstance().getAllItems();
  for (Item item : jenkinsItems) {
    if (item instanceof SCMSourceOwner) {
      SCMSourceOwner scmJob = (SCMSourceOwner) item;
      log.info("Found SCM job " + scmJob);
      List<SCMSource> scmSources = scmJob.getSCMSources();
      for (SCMSource scmSource : scmSources) {
        if (scmSource instanceof GerritSCMSource) {
          GerritSCMSource gerritSCMSource = (GerritSCMSource) scmSource;
          if (projectEvent.matches(gerritSCMSource.getRemote())) {
            log.info(
                "Triggering SCM event for source " + scmSources.get(0) + " on job " + scmJob);
            scmJob.onSCMSourceUpdated(scmSource);
          }
        }
      }
    }
  }
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:27,代码来源:GerritWebHook.java

示例5: doFillCredentialsIdItems

import hudson.model.Item; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(
    @AncestorInPath Item context,
    @QueryParameter String remote,
    @QueryParameter String credentialsId) {
  if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
      || context != null && !context.hasPermission(Item.EXTENDED_READ)) {
    return new StandardListBoxModel().includeCurrentValue(credentialsId);
  }
  return new StandardListBoxModel()
      .includeEmptyValue()
      .includeMatchingAs(
          context instanceof Queue.Task
              ? Tasks.getAuthenticationOf((Queue.Task) context)
              : ACL.SYSTEM,
          context,
          StandardUsernameCredentials.class,
          URIRequirementBuilder.fromUri(remote).build(),
          GitClient.CREDENTIALS_MATCHER)
      .includeCurrentValue(credentialsId);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:21,代码来源:GerritSCMSource.java

示例6: doFillCheckoutCredentialsIdItems

import hudson.model.Item; //导入依赖的package包/类
@Restricted(NoExternalUse.class)
public ListBoxModel doFillCheckoutCredentialsIdItems(@AncestorInPath SCMSourceOwner context, @QueryParameter String connectionName, @QueryParameter String checkoutCredentialsId) {
    if (context == null && !Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ||
            context != null && !context.hasPermission(Item.EXTENDED_READ)) {
        return new StandardListBoxModel().includeCurrentValue(checkoutCredentialsId);
    }

    StandardListBoxModel result = new StandardListBoxModel();
    result.add("- anonymous -", CHECKOUT_CREDENTIALS_ANONYMOUS);
    return result.includeMatchingAs(
            context instanceof Queue.Task
                    ? Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                    : ACL.SYSTEM,
            context,
            StandardUsernameCredentials.class,
            SettingsUtils.gitLabConnectionRequirements(connectionName),
            GitClient.CREDENTIALS_MATCHER
    );
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:20,代码来源:GitLabSCMSourceSettings.java

示例7: doFillConnectionIdItems

import hudson.model.Item; //导入依赖的package包/类
/**
 * Fills in the Host Connection selection box with applicable connections.
 * 
 * @param context
 *            filter for host connections
 * @param connectionId
 *            an existing host connection identifier; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return host connection selections
 */
public ListBoxModel doFillConnectionIdItems(@AncestorInPath Jenkins context, @QueryParameter String connectionId,
		@AncestorInPath Item project)
{
	CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
	HostConnection[] hostConnections = globalConfig.getHostConnections();

	ListBoxModel model = new ListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (HostConnection connection : hostConnections)
	{
		boolean isSelected = false;
		if (connectionId != null)
		{
			isSelected = connectionId.matches(connection.getConnectionId());
		}

		model.add(new Option(connection.getDescription() + " [" + connection.getHostPort() + ']', //$NON-NLS-1$
				connection.getConnectionId(), isSelected));
	}

	return model;
}
 
开发者ID:Compuware-Corp,项目名称:CPWR-CodeCoverage,代码行数:36,代码来源:CodeCoverageBuilder.java

示例8: doFillCredentialsIdItems

import hudson.model.Item; //导入依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable connections.
 * 
 * @param context
 *            filter for login credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return login credentials selection
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId,
		@AncestorInPath Item project)
{
	List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
			Collections.<DomainRequirement> emptyList());

	ListBoxModel model = new ListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (StandardUsernamePasswordCredentials c : creds)
	{
		boolean isSelected = false;
		if (credentialsId != null)
		{
			isSelected = credentialsId.matches(c.getId());
		}

		String description = Util.fixEmptyAndTrim(c.getDescription());
		model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:Compuware-Corp,项目名称:CPWR-CodeCoverage,代码行数:38,代码来源:CodeCoverageBuilder.java

示例9: testConfigureBuildFilterParameter

import hudson.model.Item; //导入依赖的package包/类
@Test
public void testConfigureBuildFilterParameter() throws Exception {
    RunFilterParameter param = new RunFilterParameter(
        "PARAM",
        "description",
        new AndRunFilter(
            new ParametersRunFilter("PARAM1=VALUE1"),
            new SavedRunFilter()
        )
    );
    WorkflowJob job = j.jenkins.createProject(
            WorkflowJob.class,
            RandomStringUtils.randomAlphanumeric(7)
    );
    job.addProperty(new ParametersDefinitionProperty(param));
    j.configRoundtrip((Item)job);
    j.assertEqualDataBoundBeans(
        param,
        job.getProperty(ParametersDefinitionProperty.class)
            .getParameterDefinition("PARAM")
    );
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:23,代码来源:ParameterizedRunFilterTest.java

示例10: doFillCredentialsIdItems

import hudson.model.Item; //导入依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable Jenkins credentials.
 * 
 * @param context
 *            filter for credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return credential selections
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId, @AncestorInPath Item project)
{
	List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
			Collections.<DomainRequirement> emptyList());

	StandardListBoxModel model = new StandardListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (StandardUsernamePasswordCredentials c : creds)
	{
		boolean isSelected = false;
		if (credentialsId != null)
		{
			isSelected = credentialsId.matches(c.getId());
		}

		String description = Util.fixEmptyAndTrim(c.getDescription());
		model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:37,代码来源:PdsConfiguration.java

示例11: getLoginInformation

import hudson.model.Item; //导入依赖的package包/类
/**
 * Retrieves login information given a credential ID.
 * 
 * @param project
 *            the Jenkins project
 *
 * @return a Jenkins credential with login information
 */
protected StandardUsernamePasswordCredentials getLoginInformation(Item project)
{
	StandardUsernamePasswordCredentials credential = null;

	List<StandardUsernamePasswordCredentials> credentials = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM, Collections.<DomainRequirement> emptyList());

	IdMatcher matcher = new IdMatcher(getCredentialsId());
	for (StandardUsernamePasswordCredentials c : credentials)
	{
		if (matcher.matches(c))
		{
			credential = c;
		}
	}

	return credential;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:27,代码来源:CpwrScmConfiguration.java

示例12: getLoginInformation

import hudson.model.Item; //导入依赖的package包/类
/**
 * Retrieves login information given a credential ID
 * 
 * @param project
 *            the Jenkins project
 *
 * @return a Jenkins credential with login information
 */
protected StandardUsernamePasswordCredentials getLoginInformation(Item project)
{
	StandardUsernamePasswordCredentials credential = null;

	List<StandardUsernamePasswordCredentials> credentials = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM, Collections.<DomainRequirement> emptyList());

	IdMatcher matcher = new IdMatcher(getCredentialsId());
	for (StandardUsernamePasswordCredentials c : credentials)
	{
		if (matcher.matches(c))
		{
			credential = c;
		}
	}

	return credential;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:27,代码来源:IspwConfiguration.java

示例13: find

import hudson.model.Item; //导入依赖的package包/类
/**
 * Search in Jenkins for a item with type T based on the job name
 * @param jobName job to find, for jobs inside a folder use : {@literal <folder>/<folder>/<jobName>}
 * @return the Job matching the given name, or {@code null} when not found
 */
static <T extends Item> T find(String jobName, Class<T> type) {
	Jenkins jenkins = Jenkins.getActiveInstance();
	// direct search, can be used to find folder based items <folder>/<folder>/<jobName>
	T item = jenkins.getItemByFullName(jobName, type);
	if (item == null) {
		// not found in a direct search, search in all items since the item might be in a folder but given without folder structure
		// (to keep it backwards compatible)
		for (T allItem : jenkins.getAllItems(type)) {
			 if (allItem.getName().equals(jobName)) {
			 	item = allItem;
			 	break;
			 }
		}
	}
	return item;
}
 
开发者ID:jenkinsci,项目名称:gogs-webhook-plugin,代码行数:22,代码来源:GogsUtils.java

示例14: checkForDuplicates

import hudson.model.Item; //导入依赖的package包/类
@CheckForNull
private static FormValidation checkForDuplicates(String value, ModelObject context, ModelObject object) {
    for (CredentialsStore store : CredentialsProvider.lookupStores(object)) {
        if (!store.hasPermission(CredentialsProvider.VIEW)) {
            continue;
        }
        ModelObject storeContext = store.getContext();
        for (Domain domain : store.getDomains()) {
            if (CredentialsMatchers.firstOrNull(store.getCredentials(domain), CredentialsMatchers.withId(value))
                    != null) {
                if (storeContext == context) {
                    return FormValidation.error("This ID is already in use");
                } else {
                    return FormValidation.warning("The ID ‘%s’ is already in use in %s", value,
                            storeContext instanceof Item
                                    ? ((Item) storeContext).getFullDisplayName()
                                    : storeContext.getDisplayName());
                }
            }
        }
    }
    return null;
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:24,代码来源:BrowserStackCredentials.java

示例15: doFillCredentialsIDItems

import hudson.model.Item; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIDItems(@AncestorInPath Jenkins context) {
    if (context == null || !context.hasPermission(Item.CONFIGURE)) {
        return new StandardListBoxModel();
    }

    List<DomainRequirement> domainRequirements = new ArrayList<DomainRequirement>();
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                            CredentialsMatchers.instanceOf(ConduitCredentials.class)),
                    CredentialsProvider.lookupCredentials(
                            StandardCredentials.class,
                            context,
                            ACL.SYSTEM,
                            domainRequirements));
}
 
开发者ID:uber,项目名称:phabricator-jenkins-plugin,代码行数:18,代码来源:ConduitCredentialsDescriptor.java


注:本文中的hudson.model.Item类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。