List of usage examples for com.google.common.base Predicates alwaysTrue
@GwtCompatible(serializable = true) public static <T> Predicate<T> alwaysTrue()
From source file:com.eucalyptus.entities.AbstractPersistentSupport.java
public <T> T updateByExample(final AP example, final Criterion criterion, final Map<String, String> aliases, final OwnerFullName ownerFullName, final String key, final Function<? super AP, T> updateTransform) throws PE { try {/*from w w w. j a va 2s . c o m*/ return Transactions.one(example, criterion, aliases, Predicates.alwaysTrue(), updateTransform); } catch (NoSuchElementException e) { throw notFoundException( qualifyOwner("Unable to find " + typeDescription + " '" + key + "'", ownerFullName), e); } catch (Exception e) { throw metadataException( qualifyOwner("Error updating " + typeDescription + " '" + key + "'", ownerFullName), e); } }
From source file:com.google.jenkins.flakyTestHandler.plugin.HistoryAggregatedFlakyTestResultAction.java
/** * Get filtered tests to display on the project page. Users can decide whether to show all tests * or just flaky tests//from w ww .j a v a2 s . c o m * * @return the filtered tests */ public Map<String, SingleTestFlakyStats> getFilteredAggregatedFlakyStats() { Predicate<Entry<String, SingleTestFlakyStats>> flakyTestsFilter; if (onlyShowFlakyTests) { flakyTestsFilter = new Predicate<Entry<String, SingleTestFlakyStats>>() { @Override public boolean apply(Entry<String, SingleTestFlakyStats> singleTestFlakyStatsEntry) { return singleTestFlakyStatsEntry.getValue().getFlake() > 0; } }; } else { flakyTestsFilter = Predicates.alwaysTrue(); } return Maps.filterEntries(aggregatedFlakyStats, flakyTestsFilter); }
From source file:org.apache.aurora.scheduler.storage.db.DbTaskStore.java
private FluentIterable<IScheduledTask> matches(Query.Builder query) { Iterable<DbScheduledTask> results; Predicate<IScheduledTask> filter; if (query.get().getTaskIds().size() == 1) { // Optimize queries that are scoped to a single task, as the dynamic SQL used for arbitrary // queries comes with a performance penalty. results = Optional/* ww w . j av a2s .c o m*/ .fromNullable(taskMapper.selectById(Iterables.getOnlyElement(query.get().getTaskIds()))) .asSet(); filter = Util.queryFilter(query); } else { results = taskMapper.select(query.get()); // Additional filtering is not necessary in this case, since the query does it for us. filter = Predicates.alwaysTrue(); } return FluentIterable.from(results).transform(DbScheduledTask::toImmutable).filter(filter); }
From source file:org.janusgraph.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreAdapter.java
final KVQuery convertQuery(final KeySliceQuery query) { Predicate<StaticBuffer> filter = Predicates.alwaysTrue(); if (!hasFixedKeyLength()) filter = new Predicate<StaticBuffer>() { @Override//w w w. j ava2s. c o m public boolean apply(@Nullable StaticBuffer keyAndColumn) { return equalKey(keyAndColumn, query.getKey()); } }; return new KVQuery(concatenatePrefix(query.getKey(), query.getSliceStart()), concatenatePrefix(query.getKey(), query.getSliceEnd()), filter, query.getLimit()); }
From source file:org.apache.brooklyn.core.config.BasicConfigKey.java
/** @see ConfigKey#getConstraint() */ @Override//from w w w . j a va 2 s. c om @Nonnull public Predicate<? super T> getConstraint() { // Could be null after rebinding if (constraint != null) { return constraint; } else { return Predicates.alwaysTrue(); } }
From source file:com.isotrol.impe3.palette.menu.category.CategoryComponent.java
private Predicate<? super Category> calculateFilterByContent() { if (config != null && config.filterByContentAvailability() && contentLoader != null) { final OneLevelGroupResult<Category> g = contentLoader.newCriteria().groupByCategory(); final Predicate<Category> p = new Predicate<Category>() { public boolean apply(Category input) { return g.apply(input) > 0; }// www .ja v a 2 s . c om }; return p; } return Predicates.alwaysTrue(); }
From source file:net.derquinse.common.meta.MetaProperty.java
@Override public String toString() { final Metas.ToStringHelper<?> h = Metas.toStringHelper(this).add(NAME).add(REQUIRED); if (defaultValue != null) { h.add("defaultValue", defaultValue); }//www. ja va 2 s.co m if (!Predicates.alwaysTrue().equals(validity)) { h.add("validity", validity); } return h.toString(); }
From source file:org.apache.brooklyn.enricher.stock.Aggregator.java
@Override protected Predicate<?> getDefaultValueFilter() { if (getConfig(EXCLUDE_BLANK)) return StringPredicates.isNonBlank(); else/*from w ww .j a v a 2 s.c o m*/ return Predicates.alwaysTrue(); }
From source file:org.obeonetwork.dsl.uml2.core.internal.services.AddElementToDiagramServices.java
/** * Get valid elements for a diagram./* w w w . ja v a 2 s. co m*/ * * @param diagram * diagram * @param container * selected container * @return List of valid elements for the current representation */ public Predicate<Object> isValidForDiagram(DDiagram diagram, EObject container) { Predicate<Object> results = Predicates.alwaysTrue(); if (diagram instanceof DSemanticDiagram) { final DiagramDescription description = ((DSemanticDiagram) diagram).getDescription(); if ("Class Diagram".equals(description.getName()) //$NON-NLS-1$ || "Profile Diagram".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForClassDiagram(); } else if ("Component Diagram".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForComponentDiagram(); } else if ("Composite Diagram".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForCompositeDiagram(); } else if ("Composite Structure Diagram".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForCompositeStructureDiagram(diagram, container); } else if ("Deployment Diagram".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForDeploymentDiagram(); } else if ("Package Hierarchy".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForPackageDiagram(); } else if ("Use Case Diagram".equals(description.getName())) { //$NON-NLS-1$ results = getValidsForUseCaseDiagram(); } } return results; }
From source file:com.eucalyptus.entities.Transactions.java
public static <S, T> List<S> transform(T search, Function<T, S> f) throws TransactionException { Predicate<T> p = Predicates.alwaysTrue(); return filteredTransform(search, p, f); }