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


Java SUser类代码示例

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


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

示例1: populateCommits

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
private void populateCommits(SRunningBuild sRunningBuild) {
     List<SVcsModification> changes = sRunningBuild.getContainingChanges();
     if(changes == null){
         return;
     }

     for(SVcsModification change : changes){
Collection<SUser> committers = change.getCommitters();
String msteamsUserName = null;
if(committers != null && !committers.isEmpty()){
	SUser committer = committers.iterator().next();
	msteamsUserName = committer.getPropertyValue(MsTeamsNotificator.USERNAME_KEY);
	Loggers.ACTIVITIES.debug("Resolved committer " + change.getUserName() + " to MsTeams User " + msteamsUserName);
}
commits.add(new Commit(change.getVersion(), change.getDescription(), change.getUserName(), msteamsUserName));
     }
 }
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:18,代码来源:MsTeamsNotificationPayloadContent.java

示例2: createNotification

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
private MsTeamsNotification createNotification(SUser sUser){
    MsTeamsNotification notification = notificationFactory.getMsTeamsNotification();
    String userName = sUser.getPropertyValue(USERNAME_KEY);
    if(userName.substring(0,1) == "@"){
        userName = userName.substring(1);
    }
    notification.setToken(mainConfig.getToken());
    notification.setIconUrl(mainConfig.getIconUrl());
    notification.setBotName(mainConfig.getBotName());
    notification.setEnabled(mainConfig.getEnabled());
    notification.setShowBuildAgent(mainConfig.getShowBuildAgent());
    notification.setShowElapsedBuildTime(mainConfig.getShowElapsedBuildTime());
    notification.setShowCommits(mainConfig.getShowCommits());
    notification.setMaxCommitsToDisplay(mainConfig.getMaxCommitsToDisplay());
    notification.setMentionChannelEnabled(false);
    notification.setShowFailureReason(mainConfig.getShowFailureReason());

    return notification;

}
 
开发者ID:spyder007,项目名称:teamcity-msteams-notifier,代码行数:21,代码来源:MsTeamsNotificator.java

示例3: fillModel

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
  SUser user = SessionUser.getUser(request);
  String userIdStr = request.getParameter("userId");
  if (userIdStr != null) {
    long userId = Long.parseLong(userIdStr);
    user = userModel.findUserById(userId);
    if (user == null) {
      throw new UserNotFoundException(userId, "User with id " + userIdStr + " does not exist");
    }
  }

  boolean telegramNotConfigured = true;
  if (rulesManager.isRulesWithEventsConfigured(user.getId(), this.getPluginName())) {
    String chatId = user.getPropertyValue(TelegramNotificator.TELEGRAM_PROP_KEY);
    telegramNotConfigured = StringUtil.isEmpty(chatId);
  }

  model.put("showTelegramNotConfiguredWarning", telegramNotConfigured);
  model.put("showTelegramPausedWarning", settingsManager.getSettings().isPaused());
}
 
开发者ID:dancing-elf,项目名称:teamcity-telegram-plugin,代码行数:21,代码来源:UserTelegramSettingsExtension.java

示例4: onOpen

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
/**
 * This method will be invoked when an connection has been received and not haven't yet be suspended. Note that
 * the connection will be suspended AFTER the method has been invoked when used with {@link org.atmosphere.interceptor.AtmosphereResourceLifecycleInterceptor}
 *
 * @param resource an {@link AtmosphereResource}
 * @throws IOException
 */
public void onOpen(AtmosphereResource resource) throws IOException {
    final SUser currentUser = SessionUser.getUser(resource.getRequest());
    if (currentUser == null) {
        LOG.error("Websocket Open request with unknown user. Request: " + WebUtil.getRequestDump(resource.getRequest()));
        return;
    }

    LOG.debug("WebSocket connection is opened by " + currentUser.getUsername() + ". Connection UUID: " + resource.uuid());

    // Store connection
    AtmosphereResourceSessionFactory.getDefault().getSession(resource).setAttribute(USER_ID, currentUser.getId());
    Queue<AtmosphereResource> resources = myResources.get(currentUser.getId());
    if (resources == null){
        resources = new ConcurrentLinkedQueue<AtmosphereResource>();
        myResources.put(currentUser.getId(), resources);
    }

    resources.add(resource);
    resource.suspend();
}
 
开发者ID:dtretyakov,项目名称:teamcity-tray-notifier,代码行数:28,代码来源:NotificationHandler.java

示例5: getServerPrincipal

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
@NotNull
public Optional<ServerPrincipal> getServerPrincipal(@NotNull final OAuthUser user, boolean allowCreatingNewUsersByLogin) {
    Optional<ServerPrincipal> existingPrincipal = findExistingPrincipal(user.getId());
    if (existingPrincipal.isPresent()) {
        LOG.info("Use existing user: " + user.getId());
        return existingPrincipal;
    } else if (allowCreatingNewUsersByLogin) {
        LOG.info("Creating user: " + user);
        SUser created = userModel.createUserAccount(PluginConstants.OAUTH_AUTH_SCHEME_NAME, user.getId());
        created.setUserProperty(PluginConstants.ID_USER_PROPERTY_KEY, user.getId());
        created.updateUserAccount(user.getId(), user.getName(), user.getEmail());
        return Optional.of(new ServerPrincipal(PluginConstants.OAUTH_AUTH_SCHEME_NAME, user.getId()));
    } else {
        LOG.info("User: " + user + " could not be found and allowCreatingNewUsersByLogin is disabled");
        return existingPrincipal;
    }
}
 
开发者ID:pwielgolaski,项目名称:teamcity-oauth,代码行数:18,代码来源:ServerPrincipalFactory.java

示例6: fillModel

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
@Override
protected void fillModel(@NotNull Map<String, Object> map,
                         @NotNull HttpServletRequest httpServletRequest,
                         @NotNull SBuildType sBuildType,
                         @NotNull SUser sUser) {

    /*
     * We need to send two things to the tab:
     * 1) the list of historical builds
     * 2) the parameters of the SinCity feature (if enabled)
     */
    List<FinishedBuildWithChanges> buildsWithChanges = FinishedBuildWithChanges.getListFromBuildType(sBuildType);
    map.put("buildsWithChanges", buildsWithChanges);

    SBuildFeatureDescriptor sinCityFeature = SinCityBuildFeature.getSinCityFeature(sBuildType);
    map.put("sinCityParameters", sinCityFeature == null ? null : sinCityFeature.getParameters());
}
 
开发者ID:sferencik,项目名称:SinCity,代码行数:18,代码来源:ManualTriggerTab.java

示例7: sendNotification

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
private void sendNotification(String project, String build, String statusText, Set<SUser> users) {
    for (SUser user : users) {
        if(!userHasYammerUserNameConfigured(user)){
            continue;
        }
        YammerClient yammerClient = getYammerClient();
        if (yammerClient != null) {
            final String message = YammerMessage.doFormatMessage(project, build, statusText);
            try {
                String username = user.getPropertyValue(yammerUsername);
                UserInfo userInfo = yammerClient.getUserByEmail(username);
                yammerClient.sendPrivateMessage(userInfo.getId(), message);
            } catch (IOException e) {
                log.error("Could not send Yammer private message.");
            }
        }
    }
}
 
开发者ID:iguissouma,项目名称:teamcity-yammer-notifier,代码行数:19,代码来源:YammerNotificator.java

示例8: doNotify

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
private void doNotify(@NotNull String text, @NotNull Set<SUser> users) {
    String jsonString = text
            .replace("\\", "\\\\")
            .replace("\"", "\\\"");

    for (SUser user : users) {
        String token = user.getPropertyValue(PROPERTY_TOKEN_ID);
        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{\"text\": \"" + jsonString + "\"}");
        Request request = new Request.Builder()
                .url(token)
                .post(body)
                .build();
        try {
            client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:dsaved,项目名称:africhat-platform-0.1,代码行数:20,代码来源:ActorNotifier.java

示例9: ProjectMonitorViewState

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
public ProjectMonitorViewState(SProject project, UserGroup userGroup, PiazzaConfiguration piazzaConfiguration, PiazzaProjectSettings projectSettings, SUser user) {
    this.project = project;
    this.piazzaConfiguration = piazzaConfiguration;
    this.projectSettings = projectSettings;

    builds = new ArrayList<>();
    for (SBuildType buildType : project.getBuildTypes()) {
        if (hasAtLeastOneBuild(buildType)) {
            if (buildType.isAllowExternalStatus()) {
                builds.add(new BuildTypeMonitorViewState(buildType, userGroup, piazzaConfiguration.isShowOnFailureOnly()));
            }
        }
    }

    for (BuildTypeMonitorViewState build : builds) {
        committers.addAll(build.getCommitters());
    }

    featureBranchesView = new FeatureBranchesMonitorViewState(project, projectSettings, getOrderedBuildTypesOfProjectAndSubprojects(project, user));
}
 
开发者ID:timomeinen,项目名称:team-piazza,代码行数:21,代码来源:ProjectMonitorViewState.java

示例10: createNotification

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
private SlackNotification createNotification(SUser sUser){
    SlackNotification notification = notificationFactory.getSlackNotification();
    String userName = sUser.getPropertyValue(USERNAME_KEY);
    if(userName.substring(0,1) == "@"){
        userName = userName.substring(1);
    }
    notification.setChannel("@" + userName);

    notification.setTeamName(mainConfig.getTeamName());
    notification.setToken(mainConfig.getToken());
    notification.setIconUrl(mainConfig.getIconUrl());
    notification.setBotName(mainConfig.getBotName());
    notification.setEnabled(mainConfig.getEnabled());
    notification.setShowBuildAgent(mainConfig.getShowBuildAgent());
    notification.setShowElapsedBuildTime(mainConfig.getShowElapsedBuildTime());
    notification.setShowCommits(mainConfig.getShowCommits());
    notification.setMaxCommitsToDisplay(mainConfig.getMaxCommitsToDisplay());
    notification.setMentionChannelEnabled(false);
    notification.setShowFailureReason(mainConfig.getShowFailureReason());

    return notification;

}
 
开发者ID:PeteGoo,项目名称:tcSlackBuildNotifier,代码行数:24,代码来源:SlackNotificator.java

示例11: populateCommits

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
private void populateCommits(SRunningBuild sRunningBuild) {
     List<SVcsModification> changes = sRunningBuild.getContainingChanges();
     if(changes == null){
         return;
     }

     for(SVcsModification change : changes){
Collection<SUser> committers = change.getCommitters();
String slackUserName = null;
if(committers != null && !committers.isEmpty()){
	SUser committer = committers.iterator().next();
	slackUserName = committer.getPropertyValue(SlackNotificator.USERNAME_KEY);
	Loggers.ACTIVITIES.debug("Resolved committer " + change.getUserName() + " to Slack User " + slackUserName);
}
commits.add(new Commit(change.getVersion(), change.getDescription(), change.getUserName(), slackUserName));
     }
 }
 
开发者ID:PeteGoo,项目名称:tcSlackBuildNotifier,代码行数:18,代码来源:SlackNotificationPayloadContent.java

示例12: fillModel

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
@Override
public void fillModel(@NotNull Map<String, Object> model, @NotNull HttpServletRequest request) {
  super.fillModel(model, request);
  final SUser user = SessionUser.getUser(request);

  List<Achievement> granted = myAchievementsGrantor.getGrantedAchievements(user);

  List<Achievement> available = new ArrayList<Achievement>();
  available.addAll(myAchievementsConfig.getAchievements());
  available.removeAll(granted);

  model.put("grantedAchievements", granted);
  model.put("availableAchievements", available);
  model.put("allAchievementsMap", myAchievementsGrantor.getAchievementUsersMap());
  model.put("achievementsEnabled", myAchievementsGrantor.isEnabled(user));
}
 
开发者ID:JetBrains,项目名称:teamcity-achievements,代码行数:17,代码来源:MyAchievementsTab.java

示例13: doHandle

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
@Nullable
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse httpServletResponse) throws Exception {
  final SUser user = SessionUser.getUser(request);
  if (user == null) return simpleView("User not found");

  if (request.getParameter("userAction") != null) {
    reportUserAction(user, request);
    return null;
  }

  List<Achievement> granted = myAchievementsGrantor.getGrantedAchievements(user);

  List<AchievementBean> newAchievements = new ArrayList<AchievementBean>();
  for (Achievement a: granted) {
    AchievementBean ab = new AchievementBean(a);
    if (ab.isHidden(user)) continue;
    newAchievements.add(ab);
  }

  ModelAndView mv = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("/grantedAchievements.jsp"));
  mv.getModel().put("newAchievements", newAchievements);
  return mv;
}
 
开发者ID:JetBrains,项目名称:teamcity-achievements,代码行数:25,代码来源:GrantedAchievementsController.java

示例14: test_productivity_boost_not_granted

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
public void test_productivity_boost_not_granted() {
  Achievement achievement = new ProductivityBoost(getRegistry());
  SUser user = createUser();
  UserEvents userEvents = getUserEvents(user);

  Calendar c = Calendar.getInstance();
  c.add(Calendar.DAY_OF_MONTH, -2);

  Mock modMock = mock(SVcsModification.class);
  modMock.stubs().method("getVcsDate").will(returnValue(c.getTime()));

  SVcsModification mod = (SVcsModification) modMock.proxy();

  for (int i=0; i<25; i++) {
    userEvents.registerEvent(AchievementEvents.changeAdded.name(), mod);
    assertFalse(achievement.shouldGrantAchievement(user, userEvents, AchievementEvents.changeAdded.name(), mod));
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-achievements,代码行数:19,代码来源:AchievementsConfigTest.java

示例15: test_productivity_boost

import jetbrains.buildServer.users.SUser; //导入依赖的package包/类
public void test_productivity_boost() {
  Achievement achievement = new ProductivityBoost(getRegistry());
  SUser user = createUser();
  UserEvents userEvents = getUserEvents(user);

  Mock modMock = mock(SVcsModification.class);
  modMock.stubs().method("getVcsDate").will(returnValue(new Date()));

  SVcsModification mod = (SVcsModification) modMock.proxy();

  for (int i=0; i<19; i++) {
    userEvents.registerEvent(AchievementEvents.changeAdded.name(), mod);
    assertFalse(achievement.shouldGrantAchievement(user, userEvents, AchievementEvents.changeAdded.name(), mod));
  }

  userEvents.registerEvent(AchievementEvents.changeAdded.name(), mod);
  assertTrue(achievement.shouldGrantAchievement(user, userEvents, AchievementEvents.changeAdded.name(), mod));
}
 
开发者ID:JetBrains,项目名称:teamcity-achievements,代码行数:19,代码来源:AchievementsConfigTest.java


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