Example usage for com.google.common.base Predicates alwaysTrue

List of usage examples for com.google.common.base Predicates alwaysTrue

Introduction

In this page you can find the example usage for com.google.common.base Predicates alwaysTrue.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> alwaysTrue() 

Source Link

Document

Returns a predicate that always evaluates to true .

Usage

From source file:org.activityinfo.server.schedule.ReportMailerServlet.java

private Predicate<ReportSubscription> parseFilter(HttpServletRequest req) {
    // for testing purposes, check for an id parameter that will only
    // dispatch/*w  ww. jav a  2 s  .c o m*/
    // a single report
    if (Strings.isNullOrEmpty(req.getParameter("userId"))) {
        return Predicates.alwaysTrue();
    }

    final int userId = Integer.parseInt(req.getParameter("userId"));

    return new Predicate<ReportSubscription>() {

        @Override
        public boolean apply(@Nullable ReportSubscription input) {
            return input != null && input.getId().getUserId() == userId;
        }
    };
}

From source file:org.opensaml.messaging.handler.AbstractMessageHandler.java

/** Constructor. */
public AbstractMessageHandler() {
    activationCondition = Predicates.alwaysTrue();
}

From source file:com.eucalyptus.compute.vpc.persist.PersistenceNetworkAcls.java

@Override
public <T> T lookupDefault(final String vpcId, final Function<? super NetworkAcl, T> transform)
        throws VpcMetadataException {
    try {/*  w w w . j av a2 s .c  om*/
        return Iterables.getOnlyElement(listByExample(NetworkAcl.exampleDefault(), Predicates.alwaysTrue(),
                Restrictions.eq("vpc.displayName", vpcId), Collections.singletonMap("vpc", "vpc"), transform));
    } catch (NoSuchElementException e) {
        throw new VpcMetadataNotFoundException("Default network acl not found for " + vpcId);
    }
}

From source file:com.eucalyptus.compute.vpc.persist.PersistenceNatGateways.java

@Override
public <T> T lookupByClientToken(final OwnerFullName ownerFullName, final String clientToken,
        final Function<? super NatGateway, T> transform) throws VpcMetadataException {
    return lookupByExample(NatGateway.exampleWithClientToken(ownerFullName, clientToken), ownerFullName,
            clientToken, Predicates.alwaysTrue(), transform);
}

From source file:com.eucalyptus.compute.vpc.persist.PersistenceRouteTables.java

@Override
public <T> T lookupMain(final String vpcId, final Function<? super RouteTable, T> transform)
        throws VpcMetadataException {
    try {//ww w.ja va 2s . c o  m
        return Iterables.getOnlyElement(listByExample(RouteTable.exampleMain(), Predicates.alwaysTrue(),
                Restrictions.eq("vpc.displayName", vpcId), Collections.singletonMap("vpc", "vpc"), transform));
    } catch (NoSuchElementException e) {
        throw new VpcMetadataNotFoundException("Main route table not found for " + vpcId);
    }
}

From source file:com.google.jenkins.plugins.dsl.util.FilteredDescribableList.java

/**
 * Called when we deserialize, which is after we've bound the object, so
 * filtration is no longer necessary./*from   ww w  .j a  v  a  2 s .c  o m*/
 */
public FilteredDescribableList() {
    this.filter = Predicates.alwaysTrue();
}

From source file:org.eclipse.emf.compare.tests.framework.EMFCompareAssert.java

/**
 * This can be used to check whether all objects of the given list have a corresponding {@link Match} in
 * the given {@link Comparison}. If one of said EObjects is not matched, we will check whether it is
 * included in the given <code>scope</code> if it is a {@link FilterComparisonScope}.
 * //from w  ww .ja  v a  2s  .co  m
 * @param eObjects
 *            The list of EObjects for which we need corresponding {@link Match}es.
 * @param comparison
 *            The {@link Comparison} in which we are to check for Matches.
 * @param scope
 *            The scope that has been used to create the given <code>comparison</code>.
 */
public static void assertAllMatched(List<EObject> eObjects, Comparison comparison, IComparisonScope scope) {
    final Predicate<? super EObject> scopeFilter;
    if (scope instanceof FilterComparisonScope) {
        scopeFilter = getResourceChildrenFilteringPredicate((FilterComparisonScope) scope);
    } else {
        scopeFilter = Predicates.alwaysTrue();
    }

    final Iterator<EObject> eObjectIterator = eObjects.iterator();
    while (eObjectIterator.hasNext()) {
        final EObject eObject = eObjectIterator.next();
        final Match match = comparison.getMatch(eObject);
        assertTrue(eObject + " has no match", match != null || !scopeFilter.apply(eObject));
    }
}

From source file:de.metas.ui.web.pickingV2.packageable.process.PackageablesView_UnlockAll.java

private boolean hasLockedShipmentScheduleIds() {
    return streamLockedShipmentScheduleIds().anyMatch(Predicates.alwaysTrue());
}

From source file:com.oschrenk.flatfiles.util.PredicateFilterReader.java

/**
 * Instantiates a new comment filter reader.
 *
 * @param in// w  w  w  .j a v  a 2s . co  m
 *            the in
 */
protected PredicateFilterReader(final Reader in) {
    super(in);
    bufferedReader = new BufferedReader(in);
    linePredicate = Predicates.alwaysTrue();
}

From source file:net.shibboleth.idp.attribute.resolver.MockAttributeEncoder.java

/** {@inheritDoc} */
@Override
public Predicate<ProfileRequestContext> getActivationCondition() {
    return Predicates.alwaysTrue();
}