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


Java AbstractProject.getProperty方法代碼示例

本文整理匯總了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();
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:27,代碼來源:GhprcTrigger.java

示例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);
}
 
開發者ID:bratchenko,項目名稱:jenkins-github-pull-request-comments,代碼行數:21,代碼來源:Ghprc.java

示例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);
		}
	}
}
 
開發者ID:jovandeginste,項目名稱:jenkins-mattermost-plugin,代碼行數:64,代碼來源:MattermostNotifier.java


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