Example usage for com.google.common.base Functions compose

List of usage examples for com.google.common.base Functions compose

Introduction

In this page you can find the example usage for com.google.common.base Functions compose.

Prototype

public static <A, B, C> Function<A, C> compose(Function<B, C> g, Function<A, ? extends B> f) 

Source Link

Document

Returns the composition of two functions.

Usage

From source file:org.opensaml.saml.common.profile.impl.AddInResponseToToResponse.java

/** Constructor. */
public AddInResponseToToResponse() {
    responseLookupStrategy = Functions.compose(new MessageLookup<>(SAMLObject.class),
            new OutboundMessageContextLookup());
    requestIdLookupStrategy = new DefaultRequestIdLookupStrategy();
}

From source file:edu.harvard.med.iccbl.screensaver.service.screens.IccblScreenFacilityIdInitializer.java

public boolean updateIdentifierForPrimaryScreen(Screen screen) {
    List<Screen> screens = _dao.findAllEntitiesOfType(Screen.class, true);
    Iterable<Integer> primaryScreenNumericFacilityIds = Iterables
            .filter(Iterables.transform(Iterables.filter(screens, ScreenWithFacilityId),
                    Functions.compose(NonStrictStringToInteger, Screen.ToFacilityId)), Predicates.notNull());

    int nextId = 1;
    if (primaryScreenNumericFacilityIds.iterator().hasNext()) {
        Integer maxNumericFacilityId = Ordering.natural().max(primaryScreenNumericFacilityIds);
        nextId += maxNumericFacilityId;//from   www  .  ja  v a2s.  c  om
    }
    String nextPrimaryScreenFacilityIdentifier = Integer.toString(nextId);
    screen.setFacilityId(nextPrimaryScreenFacilityIdentifier);
    log.info("set new primary screen facility ID to " + nextPrimaryScreenFacilityIdentifier);
    return true;
}

From source file:org.opensaml.saml.saml2.profile.impl.AddGeneratedKeyToAssertions.java

/** Constructor. */
public AddGeneratedKeyToAssertions() {
    ecpContextLookupStrategy = Functions.compose(new ChildContextLookup<>(ECPContext.class),
            new OutboundMessageContextLookup());
    responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class),
            new OutboundMessageContextLookup());
}

From source file:net.shibboleth.idp.consent.flow.ar.impl.AbstractAttributeReleaseAction.java

/** Constructor. */
public AbstractAttributeReleaseAction() {
    attributeReleaseContextLookupStrategy = new ChildContextLookup<>(AttributeReleaseContext.class, false);

    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));
}

From source file:net.shibboleth.idp.saml.impl.profile.saml2.ProcessRequestedAuthnContext.java

/** Constructor. */
public ProcessRequestedAuthnContext() {
    authnRequestLookupStrategy = Functions.compose(new MessageLookup<>(AuthnRequest.class),
            new InboundMessageContextLookup());
}

From source file:net.shibboleth.idp.attribute.filter.policyrule.impl.ScriptedPolicyRule.java

/**
 * Constructor./*from   w  w  w  .j a v a2 s . c  om*/
 * 
 * @param matchingScript script used to determine matching attribute values
 */
public ScriptedPolicyRule(@Nonnull final EvaluableScript matchingScript) {
    setScript(matchingScript);
    // Defaults to ProfileRequestContext -> RelyingPartyContext -> AttributeContext.
    prcLookupStrategy = Functions.compose(new ParentContextLookup<RelyingPartyContext, ProfileRequestContext>(),
            new ParentContextLookup<AttributeFilterContext, RelyingPartyContext>());
}

From source file:org.opensaml.saml.saml2.profile.impl.AddChannelBindingsToAssertions.java

/** Constructor. */
public AddChannelBindingsToAssertions() {
    channelBindingsContextLookupStrategy = Functions.compose(
            new ChildContextLookup<>(ChannelBindingsContext.class), new OutboundMessageContextLookup());
    responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class),
            new OutboundMessageContextLookup());
}

From source file:org.opensaml.saml.saml2.profile.impl.AddProxyRestrictionToAssertions.java

/** Constructor. */
public AddProxyRestrictionToAssertions() {
    responseLookupStrategy = Functions.compose(new MessageLookup<>(Response.class),
            new OutboundMessageContextLookup());
}

From source file:net.shibboleth.idp.saml.saml1.profile.impl.FilterByQueriedAttributeDesignators.java

/**
 * Constructor./*from  www .j  av  a  2  s.c o  m*/
 * 
 * @param mapper mapper used to consume designators
 */
public FilterByQueriedAttributeDesignators(@Nonnull final SAML1AttributeDesignatorsMapperService mapper) {
    mapperService = Constraint.isNotNull(mapper, "MapperService cannot be null");

    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));

    requestLookupStrategy = Functions.compose(new MessageLookup(Request.class),
            new InboundMessageContextLookup());
}

From source file:com.eucalyptus.autoscaling.common.internal.activities.PersistenceScalingActivities.java

@Override
public <T> List<T> list(@Nullable final OwnerFullName ownerFullName,
        @Nullable final AutoScalingGroupMetadata group, @Nonnull final Collection<String> activityIds,
        @Nonnull final Predicate<? super ScalingActivity> filter,
        @Nonnull final Function<? super ScalingActivity, T> transform) throws AutoScalingMetadataException {
    final ScalingActivity example = ScalingActivity.withOwner(ownerFullName);
    final Conjunction conjunction = Restrictions.conjunction();
    final Collection<Predicate<? super ScalingActivity>> predicates = Lists.newArrayList();
    predicates.add(filter);/*from   w w  w.  ja  v a  2s .c  o  m*/
    if (group != null) {
        predicates.add(CollectionUtils.propertyPredicate(group.getArn(),
                Functions.compose(AutoScalingMetadatas.toArn(), ScalingActivities.group())));
        conjunction.add(Restrictions.eq("autoScalingGroupName", group.getDisplayName()));
    }
    if (!activityIds.isEmpty()) {
        conjunction.add(Restrictions.in("displayName", activityIds));
    }
    return persistenceSupport.listByExample(example, Predicates.and(predicates), conjunction,
            Collections.<String, String>emptyMap(), transform);
}