當前位置: 首頁>>代碼示例>>Java>>正文


Java AncestorInPath類代碼示例

本文整理匯總了Java中org.kohsuke.stapler.AncestorInPath的典型用法代碼示例。如果您正苦於以下問題:Java AncestorInPath類的具體用法?Java AncestorInPath怎麽用?Java AncestorInPath使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AncestorInPath類屬於org.kohsuke.stapler包,在下文中一共展示了AncestorInPath類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doFillPolicyNameItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
/**
 * This method is called to populate the policy list on the Jenkins config page.
 * @param context
 * @param orgName
 * @param credentialsId
 * @return
 */
public ListBoxModel doFillPolicyNameItems(@AncestorInPath ItemGroup context,
                                          @QueryParameter final String orgName,
                                          @QueryParameter final String toolchainName,
                                          @QueryParameter final String credentialsId) {
    String targetAPI = chooseTargetAPI(environment);
    try {
        // if user changes to a different credential, need to get a new token
        if (!credentialsId.equals(preCredentials) || Util.isNullOrEmpty(bluemixToken)) {
            bluemixToken = getBluemixToken(context, credentialsId, targetAPI);
            preCredentials = credentialsId;
        }
    } catch (Exception e) {
        return new ListBoxModel();
    }
    if(debug_mode){
        LOGGER.info("#######GATE : calling getPolicyList#######");
    }
    return getPolicyList(bluemixToken, orgName, toolchainName, environment, debug_mode);

}
 
開發者ID:IBM,項目名稱:ibm-cloud-devops,代碼行數:28,代碼來源:EvaluateGate.java

示例2: doFillPrincipalCredentialIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
public ListBoxModel doFillPrincipalCredentialIdItems(
        @AncestorInPath Item item,
        @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.includeCurrentValue(credentialsId);
        }
    }
    List<AzureCredentials> creds = CredentialsProvider.lookupCredentials(AzureCredentials.class, item, ACL.SYSTEM, Collections.<DomainRequirement>emptyList());
    for (AzureCredentials cred
            :
            creds) {
        result.add(cred.getId());
    }
    return result.includeEmptyValue()
            .includeCurrentValue(credentialsId);
}
 
開發者ID:jenkinsci,項目名稱:azure-cli-plugin,代碼行數:24,代碼來源:AzureCLIBuilder.java

示例3: doFillMirrorgateCredentialsIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例4: doCheckMirrorgateCredentialsId

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例5: doFillCheckoutCredentialsIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例6: doFillConnectionIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例7: doFillCredentialsIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例8: doFillCredentialsIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例9: doCheckLocalPath

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
public FormValidation doCheckLocalPath(@AncestorInPath final AbstractProject project,
                                       @QueryParameter final String localPath) {
    final String path = Util.fixEmptyAndTrim(localPath);
    if (StringUtils.isBlank(path)) {
        return FormValidation.ok();
    }

    try {
        File f = resolvePath(project, localPath);
        if (f != null) {
            return FormValidation.ok();
        }
    } catch (Exception e) {
        return FormValidation.error(e.getMessage());
    }

    return FormValidation.error("Invalid path.");
}
 
開發者ID:jenkinsci,項目名稱:browserstack-integration-plugin,代碼行數:19,代碼來源:BrowserStackBuildWrapperDescriptor.java

示例10: doCheckCredentialsId

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
public FormValidation doCheckCredentialsId(@QueryParameter final String credentialsId,
                                           @AncestorInPath final Job<?,?> owner) {
    String globalCredentialsId = this.getGlobalCredentialsId();

    if (credentialsId == null || credentialsId.isEmpty()) {
        if (globalCredentialsId == null || globalCredentialsId.isEmpty()) {
            return FormValidation.error("Please enter Bitbucket OAuth credentials");
        } else {
            return this.doCheckGlobalCredentialsId(this.getGlobalCredentialsId());
        }
    }

    UsernamePasswordCredentials credentials = BitbucketBuildStatusHelper.getCredentials(credentialsId, owner);

    return this.checkCredentials(credentials);
}
 
開發者ID:jenkinsci,項目名稱:bitbucket-build-status-notifier-plugin,代碼行數:17,代碼來源:BitbucketBuildStatusNotifier.java

示例11: doFillCredentialsIDItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的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

示例12: doFillCredentialsIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item) {
    if (item == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER) ||
        item != null && !item.hasPermission(Item.EXTENDED_READ)) {
        return new StandardListBoxModel();
    }
    // TODO may also need to specify a specific authentication and domain requirements
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(AuthenticationTokens.matcher(DockerRegistryToken.class),
                    CredentialsProvider.lookupCredentials(
                            StandardCredentials.class,
                            item,
                            null,
                            Collections.<DomainRequirement>emptyList()
                    )
            );
}
 
開發者ID:jenkinsci,項目名稱:docker-commons-plugin,代碼行數:18,代碼來源:DockerRegistryEndpoint.java

示例13: doLatchPairConnection

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
public FormValidation doLatchPairConnection(@QueryParameter("pairToken") final String pairToken,
                                            @AncestorInPath User user,
                                            @QueryParameter("csrf") final String csrf) throws IOException {
    if (validCSRF(csrf)) {
        if (pairToken != null && !pairToken.isEmpty()) {
            LatchApp latchApp = LatchSDK.getInstance();
            if (latchApp != null) {
                LatchResponse pairResponse = latchApp.pair(pairToken);

                if (pairResponse == null) {
                    return FormValidation.error(Messages.LatchAccountProperty_UnreachableConnection());
                } else if (pairResponse.getError() != null && pairResponse.getError().getCode() != 205) {
                    return FormValidation.error(Messages.LatchAccountProperty_Invalid_Token());
                } else {
                    LatchAccountProperty lap = newInstance(user);
                    lap.accountId = pairResponse.getData().get("accountId").getAsString();
                    user.addProperty(lap);
                    return FormValidation.ok(Messages.LatchAccountProperty_Pair());
                }
            }
            return FormValidation.ok(Messages.LatchAccountProperty_PluginDisabled());
        }
        return FormValidation.error(Messages.LatchAccountProperty_Invalid_Token());
    }
    return FormValidation.error(Messages.LatchAccountProperty_Csrf());
}
 
開發者ID:ElevenPaths,項目名稱:latch-plugin-jenkins,代碼行數:27,代碼來源:LatchAccountProperty.java

示例14: doLatchUnpairConnection

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
public FormValidation doLatchUnpairConnection(@AncestorInPath User user,
                                              @QueryParameter("csrf") final String csrf) throws IOException {
    if (validCSRF(csrf)) {
        LatchAccountProperty lap = user.getProperty(LatchAccountProperty.class);
        LatchApp latchApp = LatchSDK.getInstance();
        if (latchApp != null) {
            LatchResponse unpairResponse = latchApp.unpair(lap.getAccountId());

            if (unpairResponse == null) {
                return FormValidation.error(Messages.LatchAccountProperty_UnreachableConnection());
            } else if (unpairResponse.getError() != null && unpairResponse.getError().getCode() != 201) {
                return FormValidation.error(unpairResponse.getError().getMessage());
            } else {
                lap.accountId = null;
                lap.user.save();
                return FormValidation.ok(Messages.LatchAccountProperty_Unpair());
            }
        }
        return FormValidation.ok(Messages.LatchAccountProperty_PluginDisabled());
    }
    return FormValidation.error(Messages.LatchAccountProperty_Csrf());
}
 
開發者ID:ElevenPaths,項目名稱:latch-plugin-jenkins,代碼行數:23,代碼來源:LatchAccountProperty.java

示例15: doFillCredentialsIdItems

import org.kohsuke.stapler.AncestorInPath; //導入依賴的package包/類
/**
 * Stapler helper method.
 *
 * @param context
 *            the context.
 * @param remoteBase
 *            the remote base.
 * @return list box model.
 * @throws URISyntaxException 
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item context, @QueryParameter String serverAPIUrl) throws URISyntaxException {
    List<DomainRequirement> domainRequirements = URIRequirementBuilder.fromUri(serverAPIUrl).build();
    
    return new StandardListBoxModel()
            .withEmptySelection()
            .withMatching(
                    CredentialsMatchers.anyOf(
                    CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class),
                    CredentialsMatchers.instanceOf(StringCredentials.class)),
            CredentialsProvider.lookupCredentials(StandardCredentials.class,
                    context,
                    ACL.SYSTEM,
                    domainRequirements)
                    );
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:26,代碼來源:GhprcGitHubAuth.java


注:本文中的org.kohsuke.stapler.AncestorInPath類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。