本文整理汇总了Java中hudson.model.AbstractProject.save方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractProject.save方法的具体用法?Java AbstractProject.save怎么用?Java AbstractProject.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.AbstractProject
的用法示例。
在下文中一共展示了AbstractProject.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jobLoaded
import hudson.model.AbstractProject; //导入方法依赖的package包/类
@Initializer(before = InitMilestone.COMPLETED, after = InitMilestone.JOB_LOADED)
public static void jobLoaded() throws IOException
{
m_logger.fine("Initialization milestone: All jobs have been loaded"); //$NON-NLS-1$
Jenkins jenkins = Jenkins.getInstance();
for (AbstractProject<?, ?> project : jenkins.getAllItems(AbstractProject.class))
{
try
{
SCM scmConfig = project.getScm();
if (scmConfig instanceof AbstractConfiguration && ((AbstractConfiguration) scmConfig).isMigrated())
{
project.save();
m_logger.info(String.format(
"Project %s has been migrated.", //$NON-NLS-1$
project.getFullName()));
}
}
catch (IOException e)
{
m_logger.log(Level.SEVERE, String.format("Failed to upgrade job %s", project.getFullName()), e); //$NON-NLS-1$
}
}
}
示例2: 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);
}
}
}