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


Java PluginSettings类代码示例

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


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

示例1: onIssueEvent

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@EventListener
public void onIssueEvent(final IssueEvent issueEvent) {
    try {
        final Long eventTypeID = issueEvent.getEventTypeId();
        final Issue issue = issueEvent.getIssue();

        if (!eventTypeID.equals(EventType.ISSUE_CREATED_ID)) {
            logger.debug("=== ISSUE EVENT ===");
            logger.debug(String.format("Event Type ID:    %s", eventTypeID));
            logger.debug(String.format("Issue:            %s", issue));

            final String propertyKey = hubIssueTrackerPropertyHandler.createEntityPropertyKey(issue);
            final EntityProperty hubIssueUrlProperty = getHubIssueTrackerUrlProperty(propertyKey, issue);

            if (hubIssueUrlProperty == null) {
                logger.debug(String.format("Hub Issue Tracker URL not present. No further processing for issue: %s", issue));
            } else {
                final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
                executorService.submit(createTask(issue, eventTypeID, jiraServices, settings, propertyKey, hubIssueUrlProperty));
            }
        }
    } catch (final Exception ex) {
        logger.error("An unexpected error occurred processing issue event ", ex);
    }
}
 
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:26,代码来源:IssueEventListener.java

示例2: checkUserPermissions

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
private Response checkUserPermissions(final HttpServletRequest request, final PluginSettings settings) {
    final String username = userManager.getRemoteUsername(request);
    if (username == null) {
        return Response.status(Status.UNAUTHORIZED).build();
    }
    if (userManager.isSystemAdmin(username)) {
        return null;
    }

    final String hubJiraGroupsString = getValue(settings, HubConfigKeys.HUB_CONFIG_GROUPS);

    if (StringUtils.isNotBlank(hubJiraGroupsString)) {
        final String[] hubJiraGroups = hubJiraGroupsString.split(",");
        boolean userIsInGroups = false;
        for (final String hubJiraGroup : hubJiraGroups) {
            if (userManager.isUserInGroup(username, hubJiraGroup.trim())) {
                userIsInGroups = true;
                break;
            }
        }
        if (userIsInGroups) {
            return null;
        }
    }
    return Response.status(Status.UNAUTHORIZED).build();
}
 
开发者ID:blackducksoftware,项目名称:hub-bamboo,代码行数:27,代码来源:HubConfigController.java

示例3: doGet

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException
{
	String username = userManager.getRemoteUsername(request);
	if (username == null || !userManager.isSystemAdmin(username))
	{
		SettingsManager settingsManager = (SettingsManager) ContainerManager.getComponent("settingsManager");
		String baseUrl = settingsManager.getGlobalSettings().getBaseUrl();
		response.sendRedirect(baseUrl);
		return;
	}

	PluginSettings pluginSettings = pluginSettingsFactory.createGlobalSettings();
	String apiUrl = (String) pluginSettings.get("onlyoffice.apiUrl");
	if (apiUrl == null || apiUrl.isEmpty())
	{
		apiUrl = "";
	}

	response.setContentType("text/html;charset=UTF-8");
	PrintWriter writer = response.getWriter();

	writer.write(getTemplate(apiUrl));
}
 
开发者ID:ONLYOFFICE,项目名称:onlyoffice-confluence,代码行数:26,代码来源:OnlyOfficeConfServlet.java

示例4: getHubJiraTicketErrors

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Path("/hubJiraTicketErrors")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getHubJiraTicketErrors(@Context final HttpServletRequest request) {
    final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
    final Response response = checkUserPermissions(request, settings);
    if (response != null) {
        return response;
    }
    final Object obj = transactionTemplate.execute(new TransactionCallback() {
        @Override
        public Object doInTransaction() {
            final TicketCreationErrorSerializable creationError = new TicketCreationErrorSerializable();

            final List<TicketCreationError> ticketErrors = JiraSettingsService.expireOldErrors(settings);
            if (ticketErrors != null) {
                Collections.sort(ticketErrors);
                creationError.setHubJiraTicketErrors(ticketErrors);
                logger.debug("Errors to UI : " + creationError.getHubJiraTicketErrors().size());
            }
            return creationError;
        }
    });

    return Response.ok(obj).build();
}
 
开发者ID:blackducksoftware,项目名称:hub-jira,代码行数:27,代码来源:HubJiraConfigController.java

示例5: readConfig

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
Config readConfig(PluginSettings settings) {
  return Config.builder()
      .requiredReviews(parseInt(get(settings, REQUIRED_REVIEWS, null)))
      .blockMergeIfPrNeedsWork(parseBoolean(get(settings, BLOCK_MERGE_IF_PR_NEEDS_WORK, null)))
      .requiredReviewers(split(get(settings, REQUIRED_REVIWERS, "")))
      .requiredReviewerGroups(split(get(settings, REQUIRED_REVIWER_GROUPS, "")))
      .defaultReviewers(split(get(settings, DEFAULT_REVIEWERS, "")))
      .defaultReviewerGroups(split(get(settings, DEFAULT_REVIEWER_GROUPS, "")))
      .excludedUsers(split(get(settings, EXCLUDED_USERS, "")))
      .excludedGroups(split(get(settings, EXCLUDED_GROUPS, "")))
      .blockedCommits(split(get(settings, BLOCKED_COMMITS, "")))
      .blockedPRs(split(get(settings, BLOCKED_PRS, "")))
      .automergePRs(split(get(settings, AUTOMERGE_PRS, "")))
      .automergePRsFrom(split(get(settings, AUTOMERGE_PRS_FROM, "")))
      .build();
}
 
开发者ID:monitorjbl,项目名称:pr-harmony,代码行数:17,代码来源:ConfigDao.java

示例6: updateAdminConfigResourcesModel

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Transactional
public AdminConfigResourceModel updateAdminConfigResourcesModel(final AdminConfigResourceModel updatedConfig) {

   Validate.isTrue(updatedConfig.getDaysToKeepBambooKeys() >= 0,"must keep keys at least 1 day (or 0 to disable)");
   Validate.isTrue(updatedConfig.getDaysToKeepUserKeys() >= 0,"must keep keys at least 1 day (or 0 to disable)");
   Validate.isTrue(updatedConfig.getMillisBetweenRuns() >= 300000 || updatedConfig.getMillisBetweenRuns() ==0,"Must space at least 5 minutes apart (or 0 to disable all jobs)");
    PluginSettings settings = pluginSettingsFactory.createGlobalSettings();

    settings.put(SETTINGS_KEY_AUTHORIZED_GROUP, updatedConfig.getAuthorizedGroup());
    settings.put(SETTINGS_KEY_BAMBOO_USER, updatedConfig.getBambooUser());
    settings.put(SETTINGS_KEY_POLICY_LINK, updatedConfig.getInternalKeyPolicyLink());
     settings.put(SETTINGS_KEY_DAYS_KEEP_USERS, String.valueOf(updatedConfig.getDaysToKeepUserKeys()));
    settings.put(SETTINGS_KEY_DAYS_KEEP_BAMBOO,  String.valueOf(updatedConfig.getDaysToKeepBambooKeys()));
    settings.put(SETTINGS_KEY_MILLIS_INTERVAL,  String.valueOf(updatedConfig.getMillisBetweenRuns()));

    //refresh cache, including logic on default values in case some were not provided.
    cachedModel = updatedConfig;
    return cachedModel;

}
 
开发者ID:libertymutual,项目名称:ssh-key-enforcer-stash,代码行数:21,代码来源:PluginSettingsService.java

示例7: gettingSettingsForNewRepoReturnsDefaultSettingsTest

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Test
public void gettingSettingsForNewRepoReturnsDefaultSettingsTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final PullRequestTriggerSettings settings = service.getPullRequestTriggerSettings(repository);

  assertEquals(new ImmutablePullRequestTriggerSettings(), settings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:17,代码来源:SettingsTest.java

示例8: settingsCanBeSavedTest

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Test
public void settingsCanBeSavedTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.put("1", settingsMapEnabled)).thenReturn(settingsMapEnabled);
  when(pluginSettings.get("1")).thenReturn(settingsMapEnabled);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  service.setPullRequestTriggerSettings(repository, settingsEnabled);
  final PullRequestTriggerSettings settings = service.getPullRequestTriggerSettings(repository);

  InOrder inOrder = inOrder(pluginSettings);
  inOrder.verify(pluginSettings).put("1", settingsMapEnabled);
  inOrder.verify(pluginSettings).get("1");

  assertEquals(settingsEnabled, settings);
  assertNotSame(new ImmutablePullRequestTriggerSettings(), settings);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:25,代码来源:SettingsTest.java

示例9: gettingSettingsForBranchReturnsBranchesMatchingNameTest

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsBranchesMatchingNameTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(expandedBranchList());
  when(pluginSettings.get(branchName + ":1")).thenReturn(branchSettingsMap);
  when(pluginSettings.get(anotherBranchName + ":1")).thenReturn(anotherBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, branchName);

  assertEquals(Lists.newArrayList(immutableBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:SettingsTest.java

示例10: gettingSettingsForBranchReturnsBranchesMatchingRegexTest

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsBranchesMatchingRegexTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(regexBranchList());
  when(pluginSettings.get(regexBranchPattern + ":1")).thenReturn(regexBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, anotherBranchName);

  assertEquals(Lists.newArrayList(regexBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:19,代码来源:SettingsTest.java

示例11: gettingSettingsForBranchReturnsBranchesWithPartialNameMatchesTest

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsBranchesWithPartialNameMatchesTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(expandedBranchList());
  when(pluginSettings.get(branchName + ":1")).thenReturn(branchSettingsMap);
  when(pluginSettings.get(anotherBranchName + ":1")).thenReturn(anotherBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, anotherBranchName);

  assertEquals(Lists.newArrayList(anotherBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:SettingsTest.java

示例12: gettingSettingsForBranchReturnsAllBranchesMatchingNameTest

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Test
public void gettingSettingsForBranchReturnsAllBranchesMatchingNameTest() {
  final PermissionValidationService permService = mock(PermissionValidationService.class);
  final PluginSettingsFactory factory = mock(PluginSettingsFactory.class);
  final PluginSettings pluginSettings = mock(PluginSettings.class);
  final Repository repository = mock(Repository.class);

  when(repository.getId()).thenReturn(1);
  when(factory.createSettingsForKey(PluginMetadata.getPluginKey())).thenReturn(pluginSettings);
  when(pluginSettings.get("branchList:1")).thenReturn(regexExpandedBranchList());
  when(pluginSettings.get(branchName + ":1")).thenReturn(branchSettingsMap);
  when(pluginSettings.get(regexBranchPattern + ":1")).thenReturn(regexBranchMap);

  final DefaultPullRequestTriggerSettingsService service = new DefaultPullRequestTriggerSettingsService(permService, factory);

  final List<BranchSettings> settingsList = service.getBranchSettingsForBranch(repository, branchName);

  assertEquals(Lists.newArrayList(immutableBranchSettings, regexBranchSettings), settingsList);
}
 
开发者ID:RichRelevance,项目名称:StashPRTriggerPlugin,代码行数:20,代码来源:SettingsTest.java

示例13: resetSettings

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
/**
 * Reset the Plug-in settings
 * @param slug - Repository Key
 * @param pluginSettings
 */
public static void resetSettings(String slug, PluginSettings pluginSettings) {
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.JENKINS_USERNAME,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.JENKINS_PASSWORD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.BUILD_TITLE_FIELD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.FROM_BRANCH_FIELD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.TO_BRANCH_FIELD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.BUILD_REF_FIELD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.JENKINS_PR_URL_FIELD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.BUILD_DELAY_FIELD,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.DISABLE_AUTOMATIC_BUILD_BY_DEFAULT,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.TRIGGER_BUILD_ON_CREATE,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.TRIGGER_BUILD_ON_UPDATE,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.TRIGGER_BUILD_ON_REOPEN,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.JENKINS_CI_SERVER_LIST,slug));
    pluginSettings.remove(PluginSettingsHelper.getPluginKey(PluginSettingsHelper.JENKINS_LAST_CI_SERVER,slug));
}
 
开发者ID:umbrew,项目名称:stash-pullrequest-jenkins,代码行数:22,代码来源:PluginSettingsHelper.java

示例14: execute

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
@Override
public void execute(@NotNull final StageExecution stageExecution, @NotNull final BuildContext buildContext) {
    PluginSettings pluginSettings = this.pluginSettingsFactory.createGlobalSettings();
    String api_id = (String) pluginSettings.get(AdminServlet.API_ID);
    String api_secret = (String) pluginSettings.get(AdminServlet.API_SECRET);
    String serverUrl = (String) pluginSettings.get(AdminServlet.URL);
    buildContext.getBuildDefinition().getTaskDefinitions().get(0).getPluginKey();
    List<TaskDefinition> tds = buildContext.getBuildDefinition().getTaskDefinitions();
    for (TaskDefinition d : tds) {
        if (d.getPluginKey().equals(Constants.PLUGIN_KEY)) {
            Map<String, String> conf = d.getConfiguration();
            conf.put(AdminServlet.API_ID, api_id);
            conf.put(AdminServlet.API_SECRET, api_secret);
            conf.put(AdminServlet.URL, serverUrl);
        }
    }
}
 
开发者ID:Blazemeter,项目名称:blazemeter-bamboo-plugin,代码行数:18,代码来源:SettingsProcessor.java

示例15: populateContextForEdit

import com.atlassian.sal.api.pluginsettings.PluginSettings; //导入依赖的package包/类
/**
 * from backend to view
 */
public void populateContextForEdit(Map<String, Object> context, TaskDefinition taskDefinition) {
    super.populateContextForEdit(context, taskDefinition);
    PluginSettings pluginSettings = this.pluginSettingsFactory.createGlobalSettings();
    String psai = (String) pluginSettings.get(AdminServlet.API_ID);
    String psas = (String) pluginSettings.get(AdminServlet.API_SECRET);
    String pssu = (String) pluginSettings.get(AdminServlet.URL);
    Map<String, String> config = taskDefinition.getConfiguration();
    context.put(AdminServlet.API_ID, psai);
    context.put(AdminServlet.API_SECRET, psas);
    context.put(AdminServlet.URL, psai);
    context.put(Constants.SETTINGS_SELECTED_TEST_ID, config.get(Constants.SETTINGS_SELECTED_TEST_ID));
    context.put(Constants.SETTINGS_NOTES, config.get(Constants.SETTINGS_NOTES));
    context.put(Constants.SETTINGS_JUNIT_REPORT, config.get(Constants.SETTINGS_JUNIT_REPORT));
    context.put(Constants.SETTINGS_JTL_REPORT, config.get(Constants.SETTINGS_JTL_REPORT));
    context.put(Constants.SETTINGS_JMETER_PROPERTIES, config.get(Constants.SETTINGS_JMETER_PROPERTIES));
    context.put(Constants.SETTINGS_JTL_PATH, config.get(Constants.SETTINGS_JTL_PATH));
    context.put(Constants.SETTINGS_JUNIT_PATH, config.get(Constants.SETTINGS_JUNIT_PATH));
    UserNotifier serverUserNotifier = new ServerUserNotifier();
    Logger logger = new ServerLogger();
    utils = new BambooBzmUtils(psai, psas, pssu, pssu, serverUserNotifier, logger);
    logger.info("BlazeMeter task is opened for configuration.");
    fillContextWithTests(context);
}
 
开发者ID:Blazemeter,项目名称:blazemeter-bamboo-plugin,代码行数:27,代码来源:ConfigTask.java


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