class FailoverResourceImpl extends ConsoleResourceDelegateImpl implements FailoverResource {
    @Autowired
    private ConfigResource configResource;

    @Override
    public String createFailover(FailoverType failoverType, String group, String failoverValue) {
        return createFailover(failoverType, group, null, failoverValue);
    }

    @Override
    public String clearFailover(FailoverType failoverType, String group) {
        return clearFailover(failoverType, group, null);
    }

    @Override
    public String createFailover(FailoverType failoverType, String group, String serviceId, String failoverValue) {
        RuleEntity ruleEntity = getRemoteRuleEntity(group, serviceId);

        createFailover(failoverType, ruleEntity, failoverValue);

        updateRemoteRuleEntity(group, serviceId, ruleEntity);

        return configResource.fromRuleEntity(ruleEntity);
    }

    @Override
    public String clearFailover(FailoverType failoverType, String group, String serviceId) {
        RuleEntity ruleEntity = getRemoteRuleEntity(group, serviceId);

        clearFailover(failoverType, ruleEntity);

        updateRemoteRuleEntity(group, serviceId, ruleEntity);

        return configResource.fromRuleEntity(ruleEntity);
    }

    private void createFailover(FailoverType failoverType, RuleEntity ruleEntity, String failoverValue) {
        StrategyFailoverEntity strategyFailoverEntity = ruleEntity.getStrategyFailoverEntity();
        if (strategyFailoverEntity == null) {
            strategyFailoverEntity = new StrategyFailoverEntity();
            ruleEntity.setStrategyFailoverEntity(strategyFailoverEntity);
        }

        setFailover(failoverType, strategyFailoverEntity, failoverValue);
    }

    private void clearFailover(FailoverType failoverType, RuleEntity ruleEntity) {<FILL_FUNCTION_BODY>}

    private void setFailover(FailoverType failoverType, StrategyFailoverEntity strategyFailoverEntity, String failoverValue) {
        switch (failoverType) {
            case VERSION_PREFER:
                strategyFailoverEntity.setVersionPreferValue(failoverValue);
                break;
            case VERSION_FAILOVER:
                strategyFailoverEntity.setVersionFailoverValue(failoverValue);
                break;
            case REGION_TRANSFER:
                strategyFailoverEntity.setRegionTransferValue(failoverValue);
                break;
            case REGION_FAILOVER:
                strategyFailoverEntity.setRegionFailoverValue(failoverValue);
                break;
            case ENVIRONMENT_FAILOVER:
                strategyFailoverEntity.setEnvironmentFailoverValue(failoverValue);
                break;
            case ZONE_FAILOVER:
                strategyFailoverEntity.setZoneFailoverValue(failoverValue);
                break;
            case ADDRESS_FAILOVER:
                strategyFailoverEntity.setAddressFailoverValue(failoverValue);
                break;
        }
    }
}

        StrategyFailoverEntity strategyFailoverEntity = ruleEntity.getStrategyFailoverEntity();
        if (strategyFailoverEntity != null) {
            setFailover(failoverType, strategyFailoverEntity, null);
        }
    
<methods>public non-sealed void <init>() ,public com.nepxion.discovery.common.entity.RuleEntity getRemoteRuleEntity(java.lang.String, java.lang.String) ,public boolean updateRemoteRuleEntity(java.lang.String, java.lang.String, com.nepxion.discovery.common.entity.RuleEntity) <variables>private static final Logger LOG,private com.nepxion.discovery.console.resource.ConfigResource configResource