code: protected CmsSubscriptionFilter getSubscriptionFilter(CmsObject cms, Map<String, String> params)
      throws CmsException {
  
          CmsSubscriptionFilter filter = new CmsSubscriptionFilter();
  
          // initialize the filter
          initVisitedByFilter(filter, cms, params, false);
  
          // set subscription filter specific parameters
  
          // determine the mode to read subscribed resources
          if (params.containsKey(PARAM_KEY_MODE)) {
              String modeName = params.get(PARAM_KEY_MODE);
              filter.setMode(CmsSubscriptionReadMode.modeForName(modeName));
          }
  
          // determine the groups to set in the filter
          if (params.containsKey(PARAM_KEY_GROUPS)) {
              List<String> groupNames = CmsStringUtil.splitAsList(params.get(PARAM_KEY_GROUPS), ',', true);
              for (Iterator<String> i = groupNames.iterator(); i.hasNext();) {
                  String groupName = i.next();
                  try {
                      CmsGroup group = cms.readGroup(groupName);
                      filter.addGroup(group);
                  } catch (CmsException e) {
                      // error reading a group
                      LOG.error(
                          Messages.get().getBundle().key(
                              Messages.ERR_COLLECTOR_PARAM_INVALID_1,
                              PARAM_KEY_GROUPS + "=" + params.get(PARAM_KEY_GROUPS)));
                      throw e;
                  }
              }
          }
          boolean includeUserGroups = Boolean.valueOf(params.get(PARAM_KEY_INCLUDEGROUPS)).booleanValue();
          if (filter.getGroups().isEmpty() && includeUserGroups) {
              // include the given or current users groups
              String userName = null;
              if (filter.getUser() != null) {
                  userName = filter.getUser().getName();
              } else {
                  userName = cms.getRequestContext().getCurrentUser().getName();
              }
              filter.setGroups(cms.getGroupsOfUser(userName, false));
          }
  
          return filter;
      }
docs: Returns the configured subscription filter to use.<p>
  
  @param cms the current users context
  @param params the optional collector parameters
  
  @return the configured subscription filter to use
  
  @throws CmsException if something goes wrong