* </p>
*
* @param prefs the {@link UserPreferences} instance.
*/
public void setBugCatagories(final UserPreferences prefs) throws CoreException {
final ProjectFilterSettings pfs = prefs.getFilterSettings();
final String bugCatagories = this.configurator.getParameterValue(BUG_CATEGORIES, String.class, session,
execution);
if (bugCatagories == null) {
log.debug("bugCatagories is null");
return;
}
List<String> addBugCatagoriesList = Arrays.asList(StringUtils.split(bugCatagories, ","));
List<String> availableBugCategories = new LinkedList<String>(DetectorFactoryCollection.instance()
.getBugCategories());
if (addBugCatagoriesList.size() > 0) {
for (String removeBugCategory : availableBugCategories) {
pfs.removeCategory(removeBugCategory);
}
}
final Set<String> removeBugCategoriesSet = new HashSet<String>();
for (String bc : addBugCatagoriesList) {
final String bcUpper = bc.toUpperCase();
if (availableBugCategories.contains(bcUpper)) {
pfs.addCategory(bcUpper);
} else {
log.debug(String.format("[%s]: Unknown Bug Catagory [%s]", LOG_PREFIX, bc));
}
if (pfs.getActiveCategorySet().contains(bcUpper)) {
removeBugCategoriesSet.add(bcUpper);
}
}
}