Java Code Examples for java.util.function.Predicate#and()

The following examples show how to use java.util.function.Predicate#and() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndicesModule.java    From crate with Apache License 2.0 6 votes vote down vote up
private static Function<String, Predicate<String>> and(Function<String, Predicate<String>> first,
                                                       Function<String, Predicate<String>> second) {
    //the purpose of this method is to not chain no-op field predicates, so that we can easily find out when no plugins plug in
    //a field filter, hence skip the mappings filtering part as a whole, as it requires parsing mappings into a map.
    if (first == MapperPlugin.NOOP_FIELD_FILTER) {
        return second;
    }
    if (second == MapperPlugin.NOOP_FIELD_FILTER) {
        return first;
    }
    return index -> {
        Predicate<String> firstPredicate = first.apply(index);
        Predicate<String> secondPredicate = second.apply(index);
        if (firstPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) {
            return secondPredicate;
        }
        if (secondPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) {
            return firstPredicate;
        }
        return firstPredicate.and(secondPredicate);
    };
}
 
Example 2
Source File: ProMatches.java    From triplea with GNU General Public License v3.0 6 votes vote down vote up
public static Predicate<Territory> territoryCanLandAirUnits(
    final GamePlayer player,
    final GameData data,
    final boolean isCombatMove,
    final List<Territory> enemyTerritories,
    final List<Territory> alliedTerritories) {
  Predicate<Territory> match =
      Matches.airCanLandOnThisAlliedNonConqueredLandTerritory(player, data)
          .and(
              Matches.territoryIsPassableAndNotRestrictedAndOkByRelationships(
                  player, data, isCombatMove, false, false, true, true))
          .and(Matches.territoryIsInList(enemyTerritories).negate());
  if (!isCombatMove) {
    match =
        match.and(
            Matches.territoryIsNeutralButNotWater()
                .or(
                    Matches.isTerritoryEnemyAndNotUnownedWaterOrImpassableOrRestricted(
                        player, data))
                .negate());
  }
  return Matches.territoryIsInList(alliedTerritories).or(match);
}
 
Example 3
Source File: DependencyProcessor.java    From spring-cloud-formula with Apache License 2.0 6 votes vote down vote up
private List<Dependency> findDependencyInfo(Dependency dependency, Archive archive) {
    Predicate<LauncherProperties.DependencyInfo> predicate = dependencyInfo ->
            dependency.getArtifactId().equals(dependencyInfo.getArtifact().getArtifactId());

    if (dependency.getVersion() == null) {
        predicate.and(info -> {
            String url = archive.toString();
            return url.contains("/" + info.getArtifact().getArtifactId() + "-" + info.getArtifact().getVersion());
        });
    } else {
        predicate.and(info -> dependency.getVersion().equals(info.getArtifact().getVersion()));
    }
    return properties.getDependencyInfos().stream()
            .filter(predicate)
            .map(LauncherProperties.DependencyInfo::getDependencies).findFirst().orElseGet(() -> {
                logger.warn("dependencies info not found, return empty collection, dependency={}, archive={}",
                        dependency, archive);
                return new ArrayList<>();
            });
}
 
Example 4
Source File: Predicates.java    From cyclops with Apache License 2.0 5 votes vote down vote up
@SafeVarargs
public static <T1> Predicate<? super T1> allOf(final Predicate<? super T1>... preds) {
    Predicate<T1> current=  (Predicate<T1>)preds[0];
    for(int i=1;i<preds.length;i++){
        current = current.and((Predicate<T1>)preds[i]);
    }
    return current;
}
 
Example 5
Source File: JdbcNamespaceIntegrationTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void createWithGeneratedDatabaseName() throws Exception {
	Predicate<String> urlPredicate = (url) -> url.startsWith("jdbc:hsqldb:mem:");
	urlPredicate.and((url) -> !url.endsWith("dataSource"));
	urlPredicate.and((url) -> !url.endsWith("shouldBeOverriddenByGeneratedName"));

	assertCorrectSetupForSingleDataSource("jdbc-config-db-name-generated.xml", urlPredicate);
}
 
Example 6
Source File: ProMatches.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
static Predicate<Territory> territoryIsAlliedLandAndHasNoEnemyNeighbors(
    final GamePlayer player, final GameData data) {
  final Predicate<Territory> alliedLand =
      territoryCanMoveLandUnits(player, data, false).and(Matches.isTerritoryAllied(player, data));
  final Predicate<Territory> hasNoEnemyNeighbors =
      Matches.territoryHasNeighborMatching(
              data, ProMatches.territoryIsEnemyNotNeutralLand(player, data))
          .negate();
  return alliedLand.and(hasNoEnemyNeighbors);
}
 
Example 7
Source File: ProMatches.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
public static Predicate<Territory> territoryIsWaterAndAdjacentToOwnedFactory(
    final GamePlayer player, final GameData data) {
  final Predicate<Territory> hasOwnedFactoryNeighbor =
      Matches.territoryHasNeighborMatching(
          data, ProMatches.territoryHasInfraFactoryAndIsOwnedLand(player));
  return hasOwnedFactoryNeighbor.and(ProMatches.territoryCanMoveSeaUnits(player, data, true));
}
 
Example 8
Source File: Creature.java    From L2jOrg with GNU General Public License v3.0 5 votes vote down vote up
@SafeVarargs
public final SkillCaster getSkillCaster(Predicate<SkillCaster> filter, Predicate<SkillCaster>... filters) {
    for (Predicate<SkillCaster> additionalFilter : filters) {
        filter = filter.and(additionalFilter);
    }

    return _skillCasters.values().stream().filter(filter).findAny().orElse(null);
}
 
Example 9
Source File: JdbcNamespaceIntegrationTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void createWithGeneratedDatabaseName() throws Exception {
	Predicate<String> urlPredicate = (url) -> url.startsWith("jdbc:hsqldb:mem:");
	urlPredicate.and((url) -> !url.endsWith("dataSource"));
	urlPredicate.and((url) -> !url.endsWith("shouldBeOverriddenByGeneratedName"));

	assertCorrectSetupForSingleDataSource("jdbc-config-db-name-generated.xml", urlPredicate);
}
 
Example 10
Source File: RecommendToAnonymous.java    From oryx with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{itemID : .+}")
@Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON})
public List<IDValue> get(
    @PathParam("itemID") List<PathSegment> pathSegments,
    @DefaultValue("10") @QueryParam("howMany") int howMany,
    @DefaultValue("0") @QueryParam("offset") int offset,
    @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException {

  check(!pathSegments.isEmpty(), "Need at least 1 item to make recommendations");
  int howManyOffset = checkHowManyOffset(howMany, offset);

  ALSServingModel model = getALSServingModel();
  List<Pair<String,Double>> parsedPathSegments = EstimateForAnonymous.parsePathSegments(pathSegments);
  float[] anonymousUserFeatures = EstimateForAnonymous.buildTemporaryUserVector(model, parsedPathSegments, null);
  check(anonymousUserFeatures != null, pathSegments.toString());

  List<String> knownItems = parsedPathSegments.stream().map(Pair::getFirst).collect(Collectors.toList());

  Collection<String> knownItemsSet = new HashSet<>(knownItems);
  Predicate<String> allowedFn = v -> !knownItemsSet.contains(v);
  ToDoubleObjDoubleBiFunction<String> rescoreFn = null;
  RescorerProvider rescorerProvider = getALSServingModel().getRescorerProvider();
  if (rescorerProvider != null) {
    Rescorer rescorer = rescorerProvider.getRecommendToAnonymousRescorer(knownItems,
                                                                         rescorerParams);
    if (rescorer != null) {
      allowedFn = allowedFn.and(id -> !rescorer.isFiltered(id));
      rescoreFn = rescorer::rescore;
    }
  }

  Stream<Pair<String,Double>> topIDDots = model.topN(
      new DotsFunction(anonymousUserFeatures),
      rescoreFn,
      howManyOffset,
      allowedFn);
  return toIDValueResponse(topIDDots, howMany, offset);
}
 
Example 11
Source File: StandardFunctionalInterfaces.java    From Learn-Java-12-Programming with MIT License 5 votes vote down vote up
private static void predicate(){
    Predicate<Integer> isLessThan10 = i -> i < 10;

    System.out.println(isLessThan10.test(7));  //prints: true
    System.out.println(isLessThan10.test(12)); //prints: false

    int val = 7;
    Consumer<String> printIsSmallerThan10 =
            printWithPrefixAndPostfix("Is " + val + " smaller than 10? ", " Great!");
    printIsSmallerThan10.accept(String.valueOf(isLessThan10.test(val)));         //prints: Is 7 smaller than 10? true Great!

    Predicate<Integer> isEqualOrGreaterThan10 = isLessThan10.negate();
    System.out.println(isEqualOrGreaterThan10.test(7));   //prints: false
    System.out.println(isEqualOrGreaterThan10.test(12));  //prints: true

    isEqualOrGreaterThan10 = Predicate.not(isLessThan10);
    System.out.println(isEqualOrGreaterThan10.test(7));   //prints: false
    System.out.println(isEqualOrGreaterThan10.test(12));  //prints: true

    Predicate<Integer> isGreaterThan10 = i -> i > 10;
    Predicate<Integer> is_lessThan10_OR_greaterThan10 = isLessThan10.or(isGreaterThan10);
    System.out.println(is_lessThan10_OR_greaterThan10.test(20));   //prints: true
    System.out.println(is_lessThan10_OR_greaterThan10.test(10));   //prints: false

    Predicate<Integer> isGreaterThan5 = i -> i > 5;
    Predicate<Integer> is_lessThan10_AND_greaterThan5 = isLessThan10.and(isGreaterThan5);
    System.out.println(is_lessThan10_AND_greaterThan5.test(3));  //prints: false
    System.out.println(is_lessThan10_AND_greaterThan5.test(7));  //prints: true

    Person nick = new Person(42, "Nick", "Samoylov");
    Predicate<Person> isItNick = Predicate.isEqual(nick);
    Person john = new Person(42, "John", "Smith");
    Person person = new Person(42, "Nick", "Samoylov");
    System.out.println(isItNick.test(john));      //prints: false
    System.out.println(isItNick.test(person));    //prints: true
}
 
Example 12
Source File: RecommendWithContext.java    From oryx with Apache License 2.0 4 votes vote down vote up
@GET
@Path("{userID}/{itemID : .*}")
@Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON})
public List<IDValue> get(
    @PathParam("userID") String userID,
    @PathParam("itemID") List<PathSegment> pathSegments,
    @DefaultValue("10") @QueryParam("howMany") int howMany,
    @DefaultValue("0") @QueryParam("offset") int offset,
    @DefaultValue("false") @QueryParam("considerKnownItems") boolean considerKnownItems,
    @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException {

  int howManyOffset = checkHowManyOffset(howMany, offset);

  ALSServingModel model = getALSServingModel();
  List<Pair<String,Double>> parsedPathSegments = EstimateForAnonymous.parsePathSegments(pathSegments);
  float[] userVector = model.getUserVector(userID);
  checkExists(userVector != null, userID);

  float[] tempUserVector = EstimateForAnonymous.buildTemporaryUserVector(model, parsedPathSegments, userVector);

  Set<String> knownItems = parsedPathSegments.stream().map(Pair::getFirst).collect(Collectors.toSet());
  if (!considerKnownItems) {
    knownItems.addAll(model.getKnownItems(userID));
  }

  Predicate<String> allowedFn = v -> !knownItems.contains(v);
  ToDoubleObjDoubleBiFunction<String> rescoreFn = null;
  RescorerProvider rescorerProvider = getALSServingModel().getRescorerProvider();
  if (rescorerProvider != null) {
    Rescorer rescorer = rescorerProvider.getRecommendRescorer(Collections.singletonList(userID),
                                                              rescorerParams);
    if (rescorer != null) {
      allowedFn = allowedFn.and(id -> !rescorer.isFiltered(id));
      rescoreFn = rescorer::rescore;
    }
  }

  Stream<Pair<String,Double>> topIDDots = model.topN(
      new DotsFunction(tempUserVector),
      rescoreFn,
      howManyOffset,
      allowedFn);
  return toIDValueResponse(topIDDots, howMany, offset);
}
 
Example 13
Source File: ManagedDefaultRepositoryContent.java    From archiva with Apache License 2.0 4 votes vote down vote up
private Predicate<StorageAsset> getArtifactFileFilterFromSelector( final ItemSelector selector )
{
    Predicate<StorageAsset> p = StorageAsset::isLeaf;
    StringBuilder fileNamePattern = new StringBuilder( "^" );
    if ( selector.hasArtifactId( ) )
    {
        fileNamePattern.append( Pattern.quote( selector.getArtifactId( ) ) ).append( "-" );
    }
    else
    {
        fileNamePattern.append( "[A-Za-z0-9_\\-.]+-" );
    }
    if ( selector.hasArtifactVersion( ) )
    {
        if ( selector.getArtifactVersion( ).contains( "*" ) )
        {
            String[] tokens = StringUtils.splitByWholeSeparator( selector.getArtifactVersion( ), "*" );
            for ( String currentToken : tokens )
            {
                if ( !currentToken.equals( "" ) )
                {
                    fileNamePattern.append( Pattern.quote( currentToken ) );
                }
                fileNamePattern.append( "[A-Za-z0-9_\\-.]*" );
            }
        }
        else
        {
            fileNamePattern.append( Pattern.quote( selector.getArtifactVersion( ) ) );
        }
    }
    else
    {
        fileNamePattern.append( "[A-Za-z0-9_\\-.]+" );
    }
    String classifier = selector.hasClassifier( ) ? selector.getClassifier( ) :
        ( selector.hasType( ) ? MavenContentHelper.getClassifierFromType( selector.getType( ) ) : null );
    if ( classifier != null )
    {
        if ( "*".equals( classifier ) )
        {
            fileNamePattern.append( "(-[A-Za-z0-9]+)?\\." );
        }
        else
        {
            fileNamePattern.append( "-" ).append( Pattern.quote( classifier ) ).append( "\\." );
        }
    }
    else
    {
        fileNamePattern.append( "\\." );
    }
    String extension = selector.hasExtension( ) ? selector.getExtension( ) :
        ( selector.hasType( ) ? MavenContentHelper.getArtifactExtension( selector ) : null );
    if ( extension != null )
    {
        if ( selector.includeRelatedArtifacts( ) )
        {
            fileNamePattern.append( Pattern.quote( extension ) ).append( "(\\.[A-Za-z0-9]+)?" );
        }
        else
        {
            fileNamePattern.append( Pattern.quote( extension ) );
        }
    }
    else
    {
        fileNamePattern.append( "[A-Za-z0-9.]+" );
    }
    final Pattern pattern = Pattern.compile( fileNamePattern.toString( ) );
    return p.and( a -> pattern.matcher( a.getName( ) ).matches( ) );
}
 
Example 14
Source File: NumberValue.java    From ClientBase with MIT License 4 votes vote down vote up
public NumberValue(String name, T defaultVal, @NotNull T min, @NotNull T max, @Nullable Predicate<T> validator) {
    super(name, defaultVal, validator == null ? val -> val.doubleValue() >= min.doubleValue() && val.doubleValue() <= max.doubleValue() : validator.and(val -> val.doubleValue() >= min.doubleValue() && val.doubleValue() <= max.doubleValue()));
    this.min = min;
    this.max = max;
}
 
Example 15
Source File: ItemAirBaseController.java    From logbook-kai with MIT License 4 votes vote down vote up
private <T> Predicate<T> filterAnd(Predicate<T> base, Predicate<T> add) {
    if (base != null) {
        return base.and(add);
    }
    return add;
}
 
Example 16
Source File: RecommendToMany.java    From oryx with Apache License 2.0 4 votes vote down vote up
@GET
@Path("{userID : .+}")
@Produces({MediaType.TEXT_PLAIN, "text/csv", MediaType.APPLICATION_JSON})
public List<IDValue> get(
    @PathParam("userID") List<PathSegment> pathSegmentsList,
    @DefaultValue("10") @QueryParam("howMany") int howMany,
    @DefaultValue("0") @QueryParam("offset") int offset,
    @DefaultValue("false") @QueryParam("considerKnownItems") boolean considerKnownItems,
    @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException {

  check(!pathSegmentsList.isEmpty(), "Need at least 1 user");
  int howManyOffset = checkHowManyOffset(howMany, offset);

  ALSServingModel alsServingModel = getALSServingModel();
  float[][] userFeaturesVectors = new float[pathSegmentsList.size()][];
  Collection<String> userKnownItems = new HashSet<>();

  List<String> userIDs = new ArrayList<>(userFeaturesVectors.length);
  for (int i = 0; i < userFeaturesVectors.length; i++) {
    String userID = pathSegmentsList.get(i).getPath();
    userIDs.add(userID);
    float[] userFeatureVector = alsServingModel.getUserVector(userID);
    checkExists(userFeatureVector != null, userID);
    userFeaturesVectors[i] = userFeatureVector;
    if (!considerKnownItems) {
      userKnownItems.addAll(alsServingModel.getKnownItems(userID));
    }
  }

  Predicate<String> allowedFn = null;
  if (!userKnownItems.isEmpty()) {
    allowedFn = v -> !userKnownItems.contains(v);
  }

  ToDoubleObjDoubleBiFunction<String> rescoreFn = null;
  RescorerProvider rescorerProvider = getALSServingModel().getRescorerProvider();
  if (rescorerProvider != null) {
    Rescorer rescorer = rescorerProvider.getRecommendRescorer(userIDs, rescorerParams);
    if (rescorer != null) {
      Predicate<String> rescorerPredicate = id -> !rescorer.isFiltered(id);
      allowedFn = allowedFn == null ? rescorerPredicate : allowedFn.and(rescorerPredicate);
      rescoreFn = rescorer::rescore;
    }
  }

  Stream<Pair<String,Double>> topIDDots = alsServingModel.topN(
      new DotsFunction(userFeaturesVectors),
      rescoreFn,
      howManyOffset,
      allowedFn);

  return toIDValueResponse(topIDDots, howMany, offset);
}
 
Example 17
Source File: MovePanel.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
private Predicate<Unit> getMovableMatch(final Route route, final Collection<Unit> units) {
  final PredicateBuilder<Unit> movableBuilder = PredicateBuilder.trueBuilder();
  if (!BaseEditDelegate.getEditMode(getData())) {
    movableBuilder.and(Matches.unitIsOwnedBy(getCurrentPlayer()));
  }
  /*
   * if you do not have selection of zero-movement units enabled,
   * this will restrict selection to units with 1 or more movement
   */
  if (!Properties.getSelectableZeroMovementUnits(getData())) {
    movableBuilder.and(Matches.unitCanMove());
  }
  if (!nonCombat) {
    movableBuilder.and(Matches.unitCanNotMoveDuringCombatMove().negate());
  }
  if (route != null) {
    final Predicate<Unit> enoughMovement =
        u ->
            BaseEditDelegate.getEditMode(getData())
                || (u.getMovementLeft().compareTo(route.getMovementCost(u)) >= 0);

    if (route.isUnload()) {
      final Predicate<Unit> notLandAndCanMove = enoughMovement.and(Matches.unitIsNotLand());
      final Predicate<Unit> landOrCanMove = Matches.unitIsLand().or(notLandAndCanMove);
      movableBuilder.and(landOrCanMove);
    } else {
      movableBuilder.and(enoughMovement);
    }
  }
  if (route != null) {
    final boolean water = route.getEnd().isWater();
    if (water && !route.isLoad()) {
      movableBuilder.and(Matches.unitIsNotLand());
    }
    if (!water) {
      movableBuilder.and(Matches.unitIsNotSea());
    }
  }
  if (units != null && !units.isEmpty()) {
    // force all units to have the same owner in edit mode
    final GamePlayer owner = getUnitOwner(units);
    if (BaseEditDelegate.getEditMode(getData())) {
      movableBuilder.and(Matches.unitIsOwnedBy(owner));
    }
    movableBuilder.and(areOwnedUnitsOfType(units, owner));
  }
  return movableBuilder.build();
}
 
Example 18
Source File: World.java    From L2jOrg with GNU General Public License v3.0 4 votes vote down vote up
public static <T extends WorldObject> Predicate<T> and(Predicate<T> p1, Predicate<T> p2) {
    return p1.and(p2);
}
 
Example 19
Source File: AuthenticationFactoryDefinitions.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
static List<ResolvedMechanismConfiguration> getResolvedMechanismConfiguration(AttributeDefinition mechanismConfigurationAttribute, ServiceBuilder<?> serviceBuilder,
        OperationContext context, ModelNode model) throws OperationFailedException {
    ModelNode mechanismConfiguration = mechanismConfigurationAttribute.resolveModelAttribute(context, model);
    if (mechanismConfiguration.isDefined() == false) {
        return Collections.emptyList();
    }
    List<ModelNode> mechanismConfigurations = mechanismConfiguration.asList();
    List<ResolvedMechanismConfiguration> resolvedMechanismConfigurations = new ArrayList<>(mechanismConfigurations.size());
    for (ModelNode currentMechanismConfiguration : mechanismConfigurations) {
        final String mechanismName = MECHANISM_NAME.resolveModelAttribute(context, currentMechanismConfiguration).asStringOrNull();
        final String hostName = HOST_NAME.resolveModelAttribute(context, currentMechanismConfiguration).asStringOrNull();
        final String protocol = PROTOCOL.resolveModelAttribute(context, currentMechanismConfiguration).asStringOrNull();

        Predicate<MechanismInformation> selectionPredicate = null;
        if (mechanismName != null) {
            selectionPredicate = i -> mechanismName.equalsIgnoreCase(i.getMechanismName());
        }
        if (hostName != null) {
            Predicate<MechanismInformation> hostPredicate = i -> hostName.equalsIgnoreCase(i.getHostName());
            selectionPredicate = selectionPredicate != null ? selectionPredicate.and(hostPredicate) : hostPredicate;
        }
        if (protocol != null) {
            Predicate<MechanismInformation> protocolPredicate = i -> protocol.equalsIgnoreCase(i.getProtocol());
            selectionPredicate = selectionPredicate != null ? selectionPredicate.and(protocolPredicate) : protocolPredicate;
        }

        if (selectionPredicate == null) {
            selectionPredicate = i -> true;
        }

        ResolvedMechanismConfiguration resolvedMechanismConfiguration = new ResolvedMechanismConfiguration(selectionPredicate);

        injectPrincipalTransformer(BASE_PRE_REALM_PRINCIPAL_TRANSFORMER, serviceBuilder, context, currentMechanismConfiguration, resolvedMechanismConfiguration.preRealmPrincipalTranformer);
        injectPrincipalTransformer(BASE_POST_REALM_PRINCIPAL_TRANSFORMER, serviceBuilder, context, currentMechanismConfiguration, resolvedMechanismConfiguration.postRealmPrincipalTransformer);
        injectPrincipalTransformer(BASE_FINAL_PRINCIPAL_TRANSFORMER, serviceBuilder, context, currentMechanismConfiguration, resolvedMechanismConfiguration.finalPrincipalTransformer);
        injectRealmMapper(BASE_REALM_MAPPER, serviceBuilder, context, currentMechanismConfiguration, resolvedMechanismConfiguration.realmMapper);
        injectSecurityFactory(BASE_CREDENTIAL_SECURITY_FACTORY, serviceBuilder, context, currentMechanismConfiguration, resolvedMechanismConfiguration.securityFactory);

        if (currentMechanismConfiguration.hasDefined(ElytronDescriptionConstants.MECHANISM_REALM_CONFIGURATIONS)) {
            for (ModelNode currentMechanismRealm : currentMechanismConfiguration.require(ElytronDescriptionConstants.MECHANISM_REALM_CONFIGURATIONS).asList()) {
                String realmName = REALM_NAME.resolveModelAttribute(context, currentMechanismRealm).asString();
                ResolvedMechanismRealmConfiguration resolvedMechanismRealmConfiguration = new ResolvedMechanismRealmConfiguration();
                injectPrincipalTransformer(BASE_PRE_REALM_PRINCIPAL_TRANSFORMER, serviceBuilder, context, currentMechanismRealm, resolvedMechanismRealmConfiguration.preRealmPrincipalTranformer);
                injectPrincipalTransformer(BASE_POST_REALM_PRINCIPAL_TRANSFORMER, serviceBuilder, context, currentMechanismRealm, resolvedMechanismRealmConfiguration.postRealmPrincipalTransformer);
                injectPrincipalTransformer(BASE_FINAL_PRINCIPAL_TRANSFORMER, serviceBuilder, context, currentMechanismRealm, resolvedMechanismRealmConfiguration.finalPrincipalTransformer);
                injectRealmMapper(BASE_REALM_MAPPER, serviceBuilder, context, currentMechanismRealm, resolvedMechanismRealmConfiguration.realmMapper);
                resolvedMechanismConfiguration.mechanismRealms.put(realmName, resolvedMechanismRealmConfiguration);
            }
        }

        resolvedMechanismConfigurations.add(resolvedMechanismConfiguration);
    }

    return resolvedMechanismConfigurations;
}
 
Example 20
Source File: PropertyFilter.java    From flow with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new filter by combining a predicate with a filter for an outer
 * scope.
 *
 * @param outerFilter
 *            the filter of the outer scope, not <code>null</code>
 * @param scopeName
 *            the name used in the outer filter when referencing properties
 *            in the inner scope, not <code>null</code>
 * @param predicate
 *            a predicate matching property names in the inner scope
 */
public PropertyFilter(PropertyFilter outerFilter, String scopeName,
                      Predicate<String> predicate) {
    this(composePrefix(outerFilter, scopeName),
            predicate.and(composeFilter(outerFilter, scopeName)));
}