本文整理汇总了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;
}
示例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();
}
示例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;
}