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


Java ModelObject类代码示例

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


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

示例1: checkForDuplicates

import hudson.model.ModelObject; //导入依赖的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

示例2: doCheckId

import hudson.model.ModelObject; //导入依赖的package包/类
public final FormValidation doCheckId(@QueryParameter String value, @AncestorInPath ModelObject context) {
    if (value.isEmpty()) {
        return FormValidation.ok();
    }
    if (!value.matches("[a-zA-Z0-9_.-]+")) { // anything else considered kosher?
        return FormValidation.error("Unacceptable characters");
    }
    FormValidation problem = checkForDuplicates(value, context, context);
    if (problem != null) {
        return problem;
    }
    if (!(context instanceof User)) {
        User me = User.current();
        if (me != null) {
            problem = checkForDuplicates(value, context, me);
            if (problem != null) {
                return problem;
            }
        }
    }
    if (!(context instanceof Jenkins)) {
        // CredentialsProvider.lookupStores(User) does not return SystemCredentialsProvider.
        Jenkins j = Jenkins.getInstance();
        if (j != null) {
            problem = checkForDuplicates(value, context, j);
            if (problem != null) {
                return problem;
            }
        }
    }
    return FormValidation.ok();
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:33,代码来源:BrowserStackCredentials.java

示例3: isScopeRelevant

import hudson.model.ModelObject; //导入依赖的package包/类
/**
 * @return always returns false since the scope of Local credentials are always Global.
 */
@SuppressWarnings("unused") // used by stapler
public boolean isScopeRelevant(ModelObject object) {
    return false;
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:8,代码来源:BrowserStackCredentials.java


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