public boolean isActive(Feature feature) {

    FeatureState state = featureStore.getFeatureState(feature);

    if (state == null) {
      FeatureMetaData metaData = new FeatureMetaData(feature);
      return metaData.isEnabledByDefault();
    }

    // disabled features are never active
    if (!state.isEnabled()) {
      return false;
    }

    // no user restriction? active!
    if (state.getUsers().isEmpty()) {
      return true;
    }

    // check if user is in user list
    FeatureUser user = featureUserProvider.getCurrentUser();
    if (user != null && user.getName() != null) {
      for (String username : state.getUsers()) {
        if (username.equals(user.getName())) {
          return true;
        }
      }
    }
    return false;
  }
 public FeatureState getFeatureState(Feature feature) {
   FeatureState state = featureStore.getFeatureState(feature);
   if (state == null) {
     FeatureMetaData metaData = new FeatureMetaData(feature);
     state = new FeatureState(feature, metaData.isEnabledByDefault());
   }
   return state;
 }