List of usage examples for com.google.common.base Predicates notNull
@GwtCompatible(serializable = true) public static <T> Predicate<T> notNull()
From source file:org.jclouds.softlayer.domain.ContainerVirtualGuestConfiguration.java
public Set<OperatingSystem> getVirtualGuestOperatingSystems() { return Sets.newHashSet(FluentIterable.from(operatingSystems) .transform(new Function<ContainerVirtualGuestConfigurationOption, OperatingSystem>() { @Override//from w w w . jav a 2 s . com public OperatingSystem apply(ContainerVirtualGuestConfigurationOption input) { String operatingSystemReferenceCode = input.getTemplate().getOperatingSystemReferenceCode(); if (operatingSystemReferenceCode == null) { return null; } else { return OperatingSystem.builder().id(operatingSystemReferenceCode) .operatingSystemReferenceCode(operatingSystemReferenceCode).build(); } } }).filter(Predicates.notNull())); }
From source file:es.uah.aut.srg.micobs.xtext.MICOBSAbstractScopeProvider.java
/** * Returns a scope from a collection of model referenceable objects and including * a parent scope./* w w w. j a v a2 s . c o m*/ * * The description of the objects is only their name. * * @param elements the collection of referenceable objects to be included * in the scope. * @param parentScope the parent scope. * @return the scope from the collection of elements. */ public IScope getSimpleObjectScope(final Collection<? extends MCommonReferenceableObj> elements, IScope parentScope) { if (elements.isEmpty()) { return parentScope; } Iterable<IEObjectDescription> fullQN = Iterables.transform(elements, new Function<MCommonReferenceableObj, IEObjectDescription>() { @Override public IEObjectDescription apply(MCommonReferenceableObj from) { if (from.getName() == null) { return null; } return EObjectDescription.create(qualifiedNameConverter.toQualifiedName(from.getName()), from); } }); return new SimpleScope(parentScope, Iterables.filter(fullQN, Predicates.notNull())); }
From source file:org.apache.cassandra.auth.CassandraRoleManager.java
public void alterRole(AuthenticatedUser performer, RoleResource role, RoleOptions options) { // Unlike most of the other data access methods here, this does not use a // prepared statement in order to allow the set of assignments to be variable. String assignments = Joiner.on(',') .join(Iterables.filter(optionsToAssignments(options.getOptions()), Predicates.notNull())); if (!Strings.isNullOrEmpty(assignments)) { process(String.format("UPDATE %s.%s SET %s WHERE role = '%s'", AuthKeyspace.NAME, AuthKeyspace.ROLES, assignments, escape(role.getRoleName())), consistencyForRole(role.getRoleName())); }/* w w w . j av a 2 s. c o m*/ }
From source file:com.eucalyptus.simpleworkflow.WorkflowExecution.java
public Date calculateNextTimeout() { final Long timeout = CollectionUtils.reduce( Iterables.filter(// www . j a v a2s .c o m Lists.newArrayList(toTimeout(getCreationTimestamp(), getExecutionStartToCloseTimeout()), toTimeout(getDecisionTimestamp(), getDecisionStatus() == DecisionStatus.Active ? getTaskStartToCloseTimeout() : null)), Predicates.notNull()), Long.MAX_VALUE, CollectionUtils.lmin()); return timeout == Long.MAX_VALUE ? null : new Date(timeout); }
From source file:edu.harvard.med.screensaver.model.meta.RelationshipPath.java
public boolean hasRestrictions() { return Iterables.any(_restrictions, Predicates.notNull()); }
From source file:edu.harvard.med.screensaver.model.libraries.SilencingReagent.java
@Transient public Set<SilencingReagent> getDuplexSilencingReagents() { Iterable<SilencingReagent> reagents = Iterables.transform(getDuplexWells(), wellToReagentTransformer); reagents = Iterables.filter(reagents, Predicates.notNull()); return ImmutableSet.copyOf(reagents); }
From source file:de.metas.ui.web.handlingunits.HUEditorView.java
private static final Set<HuId> extractHUIds(final Collection<I_M_HU> hus) { if (hus == null || hus.isEmpty()) { return ImmutableSet.of(); }//from www.ja v a 2 s.c om return hus.stream().filter(Predicates.notNull()).map(I_M_HU::getM_HU_ID).map(HuId::ofRepoId) .collect(Collectors.toSet()); }
From source file:net.shibboleth.idp.authn.AuthenticationFlowDescriptor.java
/** * Get a collection of supported non-user-specific principals that the flow may produce when it operates. * /*from w w w. jav a 2 s. c om*/ * <p> * The {@link Collection#remove(java.lang.Object)} method is not supported. * </p> * * @return a live collection of supported principals */ @Nonnull @NonnullElements public Collection<Principal> getSupportedPrincipals() { return Collections2.filter(supportedPrincipals.getPrincipals(), Predicates.notNull()); }
From source file:net.shibboleth.idp.authn.AbstractValidationAction.java
/** * Set supported non-user-specific principals that the action will include in the subjects * it generates, in place of any default principals from the flow. * /* w ww . j a v a 2 s. c om*/ * <p>Setting to a null or empty collection will maintain the default behavior of relying on the flow.</p> * * @param <T> a type of principal to add, if not generic * @param principals supported principals to include */ public <T extends Principal> void setSupportedPrincipals( @Nullable @NonnullElements final Collection<T> principals) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); authenticatedSubject.getPrincipals().clear(); if (principals != null && !principals.isEmpty()) { addDefaultPrincipals = false; authenticatedSubject.getPrincipals().addAll(Collections2.filter(principals, Predicates.notNull())); } else { addDefaultPrincipals = true; } }