本文整理汇总了Java中hudson.model.AbstractProject.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractProject.getProperty方法的具体用法?Java AbstractProject.getProperty怎么用?Java AbstractProject.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.AbstractProject
的用法示例。
在下文中一共展示了AbstractProject.getProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import hudson.model.AbstractProject; //导入方法依赖的package包/类
@Override
public void start(AbstractProject<?, ?> project, boolean newInstance) {
// We should always start the trigger, and handle cases where we don't run in the run function.
super.start(project, newInstance);
this._project = project;
this.project = project.getFullName();
if (project.isDisabled()) {
logger.log(Level.INFO, "Project is disabled, not starting trigger for job " + this.project);
return;
}
if (project.getProperty(GithubProjectProperty.class) == null) {
logger.log(Level.INFO, "GitHub project property is missing the URL, cannot start ghprc trigger for job " + this.project);
return;
}
try {
helper = createGhprc(project);
} catch (IllegalStateException ex) {
logger.log(Level.SEVERE, "Can't start ghprc trigger", ex);
return;
}
logger.log(Level.INFO, "Starting the ghprc trigger for the {0} job; newInstance is {1}",
new String[] { this.project, String.valueOf(newInstance) });
helper.init();
}
示例2: Ghprc
import hudson.model.AbstractProject; //导入方法依赖的package包/类
public Ghprc(AbstractProject<?, ?> project, GhprcTrigger trigger, ConcurrentMap<Integer, GhprcPullRequest> pulls) {
this.project = project;
final GithubProjectProperty ghpp = project.getProperty(GithubProjectProperty.class);
if (ghpp == null || ghpp.getProjectUrl() == null) {
throw new IllegalStateException("A GitHub project url is required.");
}
String baseUrl = ghpp.getProjectUrl().baseUrl();
Matcher m = githubUserRepoPattern.matcher(baseUrl);
if (!m.matches()) {
throw new IllegalStateException(String.format("Invalid GitHub project url: %s", baseUrl));
}
final String user = m.group(2);
final String repo = m.group(3);
this.trigger = trigger;
this.repository = new GhprcRepository(user, repo, this, pulls);
this.builds = new GhprcBuilds(trigger, repository);
}
示例3: onLoaded
import hudson.model.AbstractProject; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void onLoaded() {
logger.info("Starting Settings Migration Process");
for (AbstractProject<?, ?> p : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
logger.info("processing Job: " + p.getName());
final MattermostJobProperty mattermostJobProperty = p.getProperty(MattermostJobProperty.class);
if (mattermostJobProperty == null) {
logger.info(String
.format("Configuration is already up to date for \"%s\", skipping migration",
p.getName()));
continue;
}
MattermostNotifier mattermostNotifier = p.getPublishersList().get(MattermostNotifier.class);
if (mattermostNotifier == null) {
logger.info(String
.format("Configuration does not have a notifier for \"%s\", not migrating settings",
p.getName()));
} else {
//map settings
if (StringUtils.isBlank(mattermostNotifier.endpoint)) {
mattermostNotifier.endpoint = mattermostJobProperty.getEndpoint();
}
if (StringUtils.isBlank(mattermostNotifier.icon)) {
mattermostNotifier.icon = mattermostJobProperty.getIcon();
}
if (StringUtils.isBlank(mattermostNotifier.room)) {
mattermostNotifier.room = mattermostJobProperty.getRoom();
}
mattermostNotifier.startNotification = mattermostJobProperty.getStartNotification();
mattermostNotifier.notifyAborted = mattermostJobProperty.getNotifyAborted();
mattermostNotifier.notifyFailure = mattermostJobProperty.getNotifyFailure();
mattermostNotifier.notifyNotBuilt = mattermostJobProperty.getNotifyNotBuilt();
mattermostNotifier.notifySuccess = mattermostJobProperty.getNotifySuccess();
mattermostNotifier.notifyUnstable = mattermostJobProperty.getNotifyUnstable();
mattermostNotifier.notifyBackToNormal = mattermostJobProperty.getNotifyBackToNormal();
mattermostNotifier.notifyRepeatedFailure = mattermostJobProperty.getNotifyRepeatedFailure();
mattermostNotifier.includeTestSummary = mattermostJobProperty.includeTestSummary();
mattermostNotifier.commitInfoChoice = mattermostJobProperty.getShowCommitList() ? CommitInfoChoice.AUTHORS_AND_TITLES : CommitInfoChoice.NONE;
mattermostNotifier.includeCustomAttachmentMessage = mattermostJobProperty.includeCustomAttachmentMessage();
mattermostNotifier.customAttachmentMessage = mattermostJobProperty.getCustomAttachmentMessage();
mattermostNotifier.includeCustomMessage = mattermostJobProperty.includeCustomMessage();
mattermostNotifier.customMessage = mattermostJobProperty.getCustomMessage();
}
try {
//property section is not used anymore - remove
p.removeProperty(MattermostJobProperty.class);
p.save();
logger.info("Configuration updated successfully");
} catch (IOException e) {
logger.log(Level.SEVERE, e.getMessage(), e);
}
}
}