List of usage examples for com.google.common.collect Iterables find
@Nullable public static <T> T find(Iterable<? extends T> iterable, Predicate<? super T> predicate, @Nullable T defaultValue)
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.DegreeSectionHelper.java
private DegreeListing getListingByValues(final Degree degree) { return Iterables.find(section.getListings(), new Predicate<DegreeListing>() { @Override/*from w ww . j a v a2 s .c o m*/ public boolean apply(DegreeListing listing) { return isEquivalent(degree, listing); } }, null); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.IrbSectionHelper.java
public IrbListing getListing(final Organization organization) { return Iterables.find(section.getListings(), new Predicate<IrbListing>() { @Override/* w ww . jav a 2 s. co m*/ public boolean apply(IrbListing listing) { return isEquivalent(listing, organization); } }, null); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.WorkHistorySectionHelper.java
private WorkHistoryListing getListingByValues(final WorkHistory certificate) { return Iterables.find(section.getListings(), new Predicate<WorkHistoryListing>() { @Override/* w w w . j av a 2 s. c o m*/ public boolean apply(WorkHistoryListing listing) { return isEquivalent(certificate, listing); } }, null); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.ClinicalLabSectionHelper.java
public ClinicalLabListing getListing(final Organization organization) { return Iterables.find(section.getListings(), new Predicate<ClinicalLabListing>() { @Override/*from w w w. j a v a2 s. c om*/ public boolean apply(ClinicalLabListing listing) { return isEquivalent(listing, organization); } }, null); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.TrainingCertificateSectionHelper.java
private TrainingCertificateListing getListingByValues(final TrainingCertificate certificate) { return Iterables.find(section.getListings(), new Predicate<TrainingCertificateListing>() { @Override/*w w w .j a v a2 s . co m*/ public boolean apply(TrainingCertificateListing listing) { return isEquivalent(certificate, listing); } }, null); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.CertificationSectionHelper.java
private CertificationListing getListingByValues(final Certification certification) { return Iterables.find(section.getListings(), new Predicate<CertificationListing>() { @Override/* www .j a va2 s . com*/ public boolean apply(CertificationListing listing) { return isEquivalent(certification, listing); } }, null); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.protocol.registration.Form1572SectionHelper.java
private Form1572OrganizationAssociationListing getByExternalId(final Organization organization) { return Iterables.find(section.getListings(), new Predicate<Form1572OrganizationAssociationListing>() { @Override/* ww w . j a v a 2 s . c om*/ public boolean apply(Form1572OrganizationAssociationListing listing) { return ObjectUtils.equals(listing.getId(), organization.getExternalId()); } }, null); }
From source file:com.eucalyptus.auth.tokens.SecurityTokenManager.java
/** * *///from w w w. j av a 2s . c o m @Nonnull protected SecurityToken doIssueSecurityToken(@Nonnull final User user, @Nullable final AccessKey accessKey, final int durationSeconds) throws AuthException { Preconditions.checkNotNull(user, "User is required"); final AccessKey key = accessKey != null ? accessKey : Iterables.find(Objects.firstNonNull(user.getKeys(), Collections.<AccessKey>emptyList()), AccessKeys.isActive(), null); if (key == null) throw new AuthException("Key not found for user"); final long restrictedDurationMillis = restrictDuration(36, user.isAccountAdmin(), durationSeconds); if (!key.getUser().getUserId().equals(user.getUserId())) { throw new AuthException("Key not valid for user"); } final EncryptedSecurityToken encryptedToken = new EncryptedSecurityToken(key.getAccessKey(), user.getUserId(), getCurrentTimeMillis(), restrictedDurationMillis); return new SecurityToken(encryptedToken.getAccessKeyId(), encryptedToken.getSecretKey(key.getSecretKey()), encryptedToken.encrypt(getEncryptionKey(encryptedToken.getAccessKeyId())), encryptedToken.getExpires()); }
From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.LabCertificatesDialogHelper.java
public LabCertificateListing getListing(final LaboratoryCertificate certificate) { return Iterables.find(dialog.getListings(), new Predicate<LabCertificateListing>() { @Override//from www . j ava 2 s . c o m public boolean apply(LabCertificateListing listing) { return isEquivalent(listing, certificate); } }, null); }
From source file:org.solovyev.android.messenger.users.BaseContactsAdapter.java
@Nullable protected ContactListItem findInAllElements(@Nonnull User contact) { return Iterables.find(getAllElements(), equalTo(ContactListItem.newEmpty(contact)), null); }