public PriorityClass removeBuildTypes()

in server/src/jetbrains/buildServer/serverSide/priority/PriorityClassImpl.java [96:116]


  public PriorityClass removeBuildTypes(@NotNull final Collection<String> buildTypeIds) {
    Set<String> newExternalIds = new HashSet<String>(myExternalIds);
    for (String btId : buildTypeIds) {
      SBuildType bt = myProjectManager.findBuildTypeById(btId);
      if (bt != null)
        newExternalIds.remove(bt.getExternalId());
    }

    //It is possible to miss the extId changed event (e.g. when configuration is changed on disk).
    //In this case collection of our extIds contains an alias of a buildType extId, we need to remove it.
    Set<String> intIds = new HashSet<>(buildTypeIds);
    Set<String> aliasesToRemove = new HashSet<>();
    for (String extId : newExternalIds) {
      SBuildType bt = myProjectManager.findBuildTypeByExternalId(extId);
      if (bt != null && intIds.contains(bt.getBuildTypeId()))
        aliasesToRemove.add(extId);
    }
    newExternalIds.removeAll(aliasesToRemove);

    return new PriorityClassImpl(myProjectManager, myId, myName, myDescription, myPriority, newExternalIds);
  }