All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.datasource.jdbc.condition.DefaultRuleCondition Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.datasource.jdbc.condition;

import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class DefaultRuleCondition extends SpringBootCondition {

    @Override
    public ConditionOutcome getMatchOutcome(final ConditionContext conditionContext,
        final AnnotatedTypeMetadata annotatedTypeMetadata) {
        boolean isMasterSlaveRule =
            new MasterSlaveRuleCondition().getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch();
        boolean isEncryptRule =
            new EncryptRuleCondition().getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch();
        boolean isShardingRule =
            new ShardingRuleCondition().getMatchOutcome(conditionContext, annotatedTypeMetadata).isMatch();
        return (isMasterSlaveRule || isEncryptRule || isShardingRule)
            ? ConditionOutcome.noMatch("Have found encrypt, master-slave, or sharding rule in environment")
            : ConditionOutcome.match();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy