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:com.persinity.ndt.dbagent.relational.impl.CdcMountFunctor.java

@Override
public Function<RelDb, RelDb> apply(final String tableName) {
    final String clogName = appSchemaInfo.getClogTableName(tableName);

    final String clogTrigSql = ddlSql.createCdcClogTrigger(ndtUserName,
            appSchemaInfo.getClogTriggerName(tableName), tableName, appSchemaInfo.getTableCols(tableName),
            appSchemaInfo.getTablePk(tableName), clogName);
    final RelFunc clogTrigFunc = new RelFunc(clogTrigSql);

    final String trlogTrigSql = ddlSql.createCdcTrlogTrigger(ndtUserName,
            appSchemaInfo.getTrlogTriggerName(tableName), tableName, clogName, SchemaInfo.TAB_TRLOG);
    final RelFunc trlogTrigFunc = new RelFunc(trlogTrigSql);

    final Function<RelDb, RelDb> logFunc = new LoggingRepeaterFunc<>(log, "Cdc mount at table \"{}\"",
            tableName);//from w  w w.  jav  a2s.  c o m

    final Function<RelDb, RelDb> createTrigsFunc = Functions.compose(logFunc,
            Functions.compose(trlogTrigFunc, clogTrigFunc));
    return createTrigsFunc;
}

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

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

From source file:org.opensaml.saml.saml1.profile.impl.AddDoNotCacheConditionToAssertions.java

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

From source file:org.opensaml.saml.common.binding.impl.SAMLAddAttributeConsumingServiceHandler.java

/**
 * Constructor./*from  ww w.  j  ava2s  .c om*/
 */
public SAMLAddAttributeConsumingServiceHandler() {
    metadataContextLookupStrategy = Functions.compose(
            new ChildContextLookup<SAMLPeerEntityContext, SAMLMetadataContext>(SAMLMetadataContext.class),
            new ChildContextLookup<MessageContext, SAMLPeerEntityContext>(SAMLPeerEntityContext.class));
    indexLookupStrategy = new AuthnRequestIndexLookup();
}

From source file:fi.vm.kapa.identification.shibboleth.audit.impl.AttributeValueAuditExtractor.java

/**
 * Constructor.//from w  ww .j av a 2 s .c o  m
 *
 * @param attrId The attributeId whose value is returned by this {@link Function}.
 */
public AttributeValueAuditExtractor(@Nonnull @NotEmpty final String attrId) {
    // Defaults to ProfileRequestContext -> RelyingPartyContext -> AttributeContext.
    this(Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class)),
            attrId);
}

From source file:com.eucalyptus.reporting.export.Export.java

public static ReportingExport export(final Date startDate, final Date endDate,
        final boolean includeDependencies) {
    final ReportingExport export = new ReportingExport();
    final Conjunction criterion = Restrictions.conjunction();
    if (startDate != null) {
        criterion.add(Restrictions.ge(CREATION_TIMESTAMP, startDate));
    }/*from  w  w w  .ja v  a2  s. com*/
    if (endDate != null) {
        criterion.add(Restrictions.lt(CREATION_TIMESTAMP, endDate));
    }

    final List<ReportingEventSupport> actions = Lists.newArrayList();
    export.addUsage(
            Iterables.filter(
                    Iterables.transform(
                            iterableExporter(criterion, getUsageClasses(),
                                    Collections.<ReportingEventSupport>emptyList(), includeDependencies),
                            ExportUtils.toExportUsage(includeDependencies ? actions : null)),
                    Predicates.notNull()));
    export.addActions(
            Iterables
                    .transform(
                            Iterables.concat(actions,
                                    iterableExporter(criterion, getEventClasses(), actions,
                                            includeDependencies)),
                            Functions.compose(userAccountDecorator(), ExportUtils.toExportAction())));

    return export;
}

From source file:com.persinity.ndt.etlmodule.relational.common.EtlRelTransferFunc.java

/**
 * @param extractF/*from www . j  a  v  a2 s.  com*/
 * @param transformF
 * @param loadF
 * @param rangeModBase
 *         the mod base used to calculate ranges
 * @param idRange
 *         the range of ID values or their hash codes of the records
 * @param tids
 *         window TIDs, padded with last TID to fit power of two nums for stmt caching
 * @param schemas
 * @param sqlStrategy
 */
public EtlRelTransferFunc(final RelExtractFunc extractF, final TupleFunc transformF, final RelLoadFunc loadF,
        final int rangeModBase, final DirectedEdge<Integer, Integer> idRange,
        final List<? extends TransactionId> tids, final DirectedEdge<SchemaInfo, SchemaInfo> schemas,
        final AgentSqlStrategy sqlStrategy) {
    super(rangeModBase, idRange, tids, schemas, sqlStrategy);

    notNull(extractF);
    notNull(transformF);
    notNull(loadF);
    notNull(idRange);
    notEmpty(tids);
    notNull(schemas);
    notNull(sqlStrategy);

    this.extractF = extractF;
    this.transformF = transformF;
    this.loadF = loadF;
    etFunc = Functions.compose(transformF, extractF);
}

From source file:net.shibboleth.idp.consent.logic.impl.AttributeValueLookupFunction.java

/**
 * Constructor./*from   w  w w .  j ava2 s  .c o  m*/
 *
 * @param userAttributeId the attribute id
 */
public AttributeValueLookupFunction(@Nonnull @NotEmpty final String userAttributeId) {
    attributeId = Constraint.isNotNull(StringSupport.trimOrNull(userAttributeId),
            "User attribute ID cannot be null nor empty");

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

    useUnfilteredAttributes = true;
}

From source file:fi.okm.mpass.shibboleth.profile.audit.impl.AttributeValueAuditExtractor.java

/**
 * Constructor.//from w w w  .  jav a  2s  .  co  m
 * 
 * @param attrId The attributeId whose value is returned by this {@link Function}.
 */
public AttributeValueAuditExtractor(@Nonnull @NotEmpty final String attrId) {
    // Defaults to ProfileRequestContext -> RelyingPartyContext -> AttributeContext.
    attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
            new ChildContextLookup<ProfileRequestContext, RelyingPartyContext>(RelyingPartyContext.class));
    attributeId = Constraint.isNotEmpty(attrId, "attrId cannot be null nor empty!");
}

From source file:org.opensaml.saml.saml2.profile.AbstractSAML2NameIDGenerator.java

/** Constructor. */
protected AbstractSAML2NameIDGenerator() {
    nameBuilder = (SAMLObjectBuilder<NameID>) XMLObjectProviderRegistrySupport.getBuilderFactory()
            .<NameID>getBuilderOrThrow(NameID.DEFAULT_ELEMENT_NAME);
    requestLookupStrategy = Functions.compose(new MessageLookup<>(AuthnRequest.class),
            new InboundMessageContextLookup());
}