use of com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem in project spring-boot-student by wyh-spring-ecosystem-student.
the class GatewayFlowRuleEntity method toGatewayFlowRule.
public GatewayFlowRule toGatewayFlowRule() {
GatewayFlowRule rule = new GatewayFlowRule();
rule.setResource(resource);
rule.setResourceMode(resourceMode);
rule.setGrade(grade);
rule.setCount(count);
rule.setIntervalSec(calIntervalSec(interval, intervalUnit));
rule.setControlBehavior(controlBehavior);
if (burst != null) {
rule.setBurst(burst);
}
if (maxQueueingTimeoutMs != null) {
rule.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs);
}
if (paramItem != null) {
GatewayParamFlowItem ruleItem = new GatewayParamFlowItem();
rule.setParamItem(ruleItem);
ruleItem.setParseStrategy(paramItem.getParseStrategy());
ruleItem.setFieldName(paramItem.getFieldName());
ruleItem.setPattern(paramItem.getPattern());
if (paramItem.getMatchStrategy() != null) {
ruleItem.setMatchStrategy(paramItem.getMatchStrategy());
}
}
return rule;
}
use of com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem in project spring-boot-student by wyh-spring-ecosystem-student.
the class GatewayFlowRuleEntity method fromGatewayFlowRule.
public static GatewayFlowRuleEntity fromGatewayFlowRule(String app, String ip, Integer port, GatewayFlowRule rule) {
GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity();
entity.setApp(app);
entity.setIp(ip);
entity.setPort(port);
entity.setResource(rule.getResource());
entity.setResourceMode(rule.getResourceMode());
entity.setGrade(rule.getGrade());
entity.setCount(rule.getCount());
Object[] intervalSecResult = parseIntervalSec(rule.getIntervalSec());
entity.setInterval((Long) intervalSecResult[0]);
entity.setIntervalUnit((Integer) intervalSecResult[1]);
entity.setControlBehavior(rule.getControlBehavior());
entity.setBurst(rule.getBurst());
entity.setMaxQueueingTimeoutMs(rule.getMaxQueueingTimeoutMs());
GatewayParamFlowItem paramItem = rule.getParamItem();
if (paramItem != null) {
GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity();
entity.setParamItem(itemEntity);
itemEntity.setParseStrategy(paramItem.getParseStrategy());
itemEntity.setFieldName(paramItem.getFieldName());
itemEntity.setPattern(paramItem.getPattern());
itemEntity.setMatchStrategy(paramItem.getMatchStrategy());
}
return entity;
}
use of com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem in project XHuiCloud by sindaZeng.
the class GatewayFlowRuleEntity method toGatewayFlowRule.
public GatewayFlowRule toGatewayFlowRule() {
GatewayFlowRule rule = new GatewayFlowRule();
rule.setResource(resource);
rule.setResourceMode(resourceMode);
rule.setGrade(grade);
rule.setCount(count);
rule.setIntervalSec(calIntervalSec(interval, intervalUnit));
rule.setControlBehavior(controlBehavior);
if (burst != null) {
rule.setBurst(burst);
}
if (maxQueueingTimeoutMs != null) {
rule.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs);
}
if (paramItem != null) {
GatewayParamFlowItem ruleItem = new GatewayParamFlowItem();
rule.setParamItem(ruleItem);
ruleItem.setParseStrategy(paramItem.getParseStrategy());
ruleItem.setFieldName(paramItem.getFieldName());
ruleItem.setPattern(paramItem.getPattern());
if (paramItem.getMatchStrategy() != null) {
ruleItem.setMatchStrategy(paramItem.getMatchStrategy());
}
}
return rule;
}
use of com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem in project XHuiCloud by sindaZeng.
the class GatewayFlowRuleEntity method fromGatewayFlowRule.
public static GatewayFlowRuleEntity fromGatewayFlowRule(String app, String ip, Integer port, GatewayFlowRule rule) {
GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity();
entity.setApp(app);
entity.setIp(ip);
entity.setPort(port);
entity.setResource(rule.getResource());
entity.setResourceMode(rule.getResourceMode());
entity.setGrade(rule.getGrade());
entity.setCount(rule.getCount());
Object[] intervalSecResult = parseIntervalSec(rule.getIntervalSec());
entity.setInterval((Long) intervalSecResult[0]);
entity.setIntervalUnit((Integer) intervalSecResult[1]);
entity.setControlBehavior(rule.getControlBehavior());
entity.setBurst(rule.getBurst());
entity.setMaxQueueingTimeoutMs(rule.getMaxQueueingTimeoutMs());
GatewayParamFlowItem paramItem = rule.getParamItem();
if (paramItem != null) {
GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity();
entity.setParamItem(itemEntity);
itemEntity.setParseStrategy(paramItem.getParseStrategy());
itemEntity.setFieldName(paramItem.getFieldName());
itemEntity.setPattern(paramItem.getPattern());
itemEntity.setMatchStrategy(paramItem.getMatchStrategy());
}
return entity;
}
use of com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem in project RuoYi-Cloud-Plus by JavaLionLi.
the class GatewayFlowRuleEntity method fromGatewayFlowRule.
public static GatewayFlowRuleEntity fromGatewayFlowRule(String app, String ip, Integer port, GatewayFlowRule rule) {
GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity();
entity.setApp(app);
entity.setIp(ip);
entity.setPort(port);
entity.setResource(rule.getResource());
entity.setResourceMode(rule.getResourceMode());
entity.setGrade(rule.getGrade());
entity.setCount(rule.getCount());
Object[] intervalSecResult = parseIntervalSec(rule.getIntervalSec());
entity.setInterval((Long) intervalSecResult[0]);
entity.setIntervalUnit((Integer) intervalSecResult[1]);
entity.setControlBehavior(rule.getControlBehavior());
entity.setBurst(rule.getBurst());
entity.setMaxQueueingTimeoutMs(rule.getMaxQueueingTimeoutMs());
GatewayParamFlowItem paramItem = rule.getParamItem();
if (paramItem != null) {
GatewayParamFlowItemEntity itemEntity = new GatewayParamFlowItemEntity();
entity.setParamItem(itemEntity);
itemEntity.setParseStrategy(paramItem.getParseStrategy());
itemEntity.setFieldName(paramItem.getFieldName());
itemEntity.setPattern(paramItem.getPattern());
itemEntity.setMatchStrategy(paramItem.getMatchStrategy());
}
return entity;
}
Aggregations