code format

This commit is contained in:
zengqiao
2021-05-18 14:33:02 +08:00
parent c5b1bed7dc
commit 892e195f0e
30 changed files with 88 additions and 94 deletions

View File

@@ -1,19 +0,0 @@
package com.xiaojukeji.kafka.manager.common.bizenum;
/**
* @author zengqiao
* @date 20/7/27
*/
public enum ApiLevelEnum {
LEVEL_0(0),
LEVEL_1(1),
LEVEL_2(2),
LEVEL_3(3)
;
private int level;
ApiLevelEnum(int level) {
this.level = level;
}
}

View File

@@ -24,18 +24,10 @@ public enum ConsumeHealthEnum {
return code; return code;
} }
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() { public String getMessage() {
return message; return message;
} }
public void setMessage(String message) {
this.message = message;
}
@Override @Override
public String toString() { public String toString() {
return "ConsumeHealthEnum{" + return "ConsumeHealthEnum{" +

View File

@@ -19,7 +19,10 @@ public enum DBStatusEnum {
return status; return status;
} }
public void setStatus(int status) { @Override
this.status = status; public String toString() {
return "DBStatusEnum{" +
"status=" + status +
'}';
} }
} }

View File

@@ -21,18 +21,10 @@ public enum IDCEnum {
return idc; return idc;
} }
public void setIdc(String idc) {
this.idc = idc;
}
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
@Override @Override
public String toString() { public String toString() {
return "IDCEnum{" + return "IDCEnum{" +

View File

@@ -21,10 +21,6 @@ public enum KafkaBrokerRoleEnum {
return role; return role;
} }
public void setRole(String role) {
this.role = role;
}
@Override @Override
public String toString() { public String toString() {
return "KafkaBrokerRoleEnum{" + return "KafkaBrokerRoleEnum{" +

View File

@@ -24,18 +24,10 @@ public enum KafkaClientEnum {
return code; return code;
} }
public void setCode(Integer code) {
this.code = code;
}
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
@Override @Override
public String toString() { public String toString() {
return "KafkaClientEnum{" + return "KafkaClientEnum{" +

View File

@@ -18,4 +18,11 @@ public enum OffsetResetTypeEnum {
public Integer getCode() { public Integer getCode() {
return code; return code;
} }
@Override
public String toString() {
return "OffsetResetTypeEnum{" +
"code=" + code +
'}';
}
} }

View File

@@ -27,4 +27,12 @@ public enum OperationStatusEnum {
public String getMessage() { public String getMessage() {
return message; return message;
} }
@Override
public String toString() {
return "OperationStatusEnum{" +
"code=" + code +
", message='" + message + '\'' +
'}';
}
} }

View File

@@ -15,9 +15,9 @@ public enum PeakFlowStatusEnum {
; ;
public Integer code; private Integer code;
public String message; private String message;
PeakFlowStatusEnum(Integer code, String message) { PeakFlowStatusEnum(Integer code, String message) {
this.code = code; this.code = code;
@@ -28,18 +28,10 @@ public enum PeakFlowStatusEnum {
return code; return code;
} }
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() { public String getMessage() {
return message; return message;
} }
public void setMessage(String message) {
this.message = message;
}
@Override @Override
public String toString() { public String toString() {
return "PeakFlowStatusEnum{" + return "PeakFlowStatusEnum{" +

View File

@@ -29,4 +29,12 @@ public enum RebalanceDimensionEnum {
public String getMessage() { public String getMessage() {
return message; return message;
} }
@Override
public String toString() {
return "RebalanceDimensionEnum{" +
"code=" + code +
", message='" + message + '\'' +
'}';
}
} }

View File

@@ -43,18 +43,10 @@ public enum TaskStatusEnum {
return code; return code;
} }
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() { public String getMessage() {
return message; return message;
} }
public void setMessage(String message) {
this.message = message;
}
@Override @Override
public String toString() { public String toString() {
return "TaskStatusEnum{" + return "TaskStatusEnum{" +
@@ -64,9 +56,6 @@ public enum TaskStatusEnum {
} }
public static Boolean isFinished(Integer code) { public static Boolean isFinished(Integer code) {
if (code >= FINISHED.getCode()) { return code >= FINISHED.getCode();
return true;
}
return false;
} }
} }

View File

@@ -45,11 +45,6 @@ public enum TaskStatusReassignEnum {
} }
public static Boolean isFinished(Integer code) { public static Boolean isFinished(Integer code) {
if (SUCCEED.getCode().equals(code) return SUCCEED.getCode().equals(code) || FAILED.getCode().equals(code) || CANCELED.getCode().equals(code);
|| FAILED.getCode().equals(code)
|| CANCELED.getCode().equals(code)) {
return true;
}
return false;
} }
} }

View File

@@ -33,4 +33,12 @@ public enum TopicAuthorityEnum {
public String getMessage() { public String getMessage() {
return message; return message;
} }
@Override
public String toString() {
return "TopicAuthorityEnum{" +
"code=" + code +
", message='" + message + '\'' +
'}';
}
} }

View File

@@ -29,4 +29,12 @@ public enum TopicExpiredStatusEnum {
public String getMessage() { public String getMessage() {
return message; return message;
} }
@Override
public String toString() {
return "TopicExpiredStatusEnum{" +
"status=" + status +
", message='" + message + '\'' +
'}';
}
} }

View File

@@ -23,18 +23,10 @@ public enum TopicOffsetChangedEnum {
return code; return code;
} }
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() { public String getMessage() {
return message; return message;
} }
public void setMessage(String message) {
this.message = message;
}
@Override @Override
public String toString() { public String toString() {
return "TopicOffsetChangedEnum{" + return "TopicOffsetChangedEnum{" +

View File

@@ -26,18 +26,10 @@ public enum GatewayConfigKeyEnum {
return configType; return configType;
} }
public void setConfigType(String configType) {
this.configType = configType;
}
public String getConfigName() { public String getConfigName() {
return configName; return configName;
} }
public void setConfigName(String configName) {
this.configName = configName;
}
@Override @Override
public String toString() { public String toString() {
return "GatewayConfigKeyEnum{" + return "GatewayConfigKeyEnum{" +

View File

@@ -12,4 +12,7 @@ public class ApiLevelContent {
public static final int LEVEL_NORMAL_3 = 3; public static final int LEVEL_NORMAL_3 = 3;
public static final int LEVEL_DEFAULT_4 = 4; public static final int LEVEL_DEFAULT_4 = 4;
private ApiLevelContent() {
}
} }

View File

@@ -28,4 +28,7 @@ public class ApiPrefix {
// gateway // gateway
public static final String GATEWAY_API_V1_PREFIX = "/gateway" + API_V1_PREFIX; public static final String GATEWAY_API_V1_PREFIX = "/gateway" + API_V1_PREFIX;
private ApiPrefix() {
}
} }

View File

@@ -30,4 +30,7 @@ public class ConfigConstant {
public static final String BROKER_CAPACITY_LIMIT_CONFIG_KEY = "BROKER_CAPACITY_LIMIT_CONFIG"; public static final String BROKER_CAPACITY_LIMIT_CONFIG_KEY = "BROKER_CAPACITY_LIMIT_CONFIG";
public static final String KAFKA_CLUSTER_DO_CONFIG_KEY = "KAFKA_CLUSTER_DO_CONFIG"; public static final String KAFKA_CLUSTER_DO_CONFIG_KEY = "KAFKA_CLUSTER_DO_CONFIG";
private ConfigConstant() {
}
} }

View File

@@ -45,4 +45,7 @@ public class Constant {
public static final Integer DEFAULT_MAX_CAL_TOPIC_EXPIRED_DAY = 90; public static final Integer DEFAULT_MAX_CAL_TOPIC_EXPIRED_DAY = 90;
public static final Integer INVALID_CODE = -1; public static final Integer INVALID_CODE = -1;
private Constant() {
}
} }

View File

@@ -16,4 +16,7 @@ public class KafkaConstant {
public static final String CLIENT_VERSION_NAME_UNKNOWN = "unknown"; public static final String CLIENT_VERSION_NAME_UNKNOWN = "unknown";
public static final String RETENTION_MS_KEY = "retention.ms"; public static final String RETENTION_MS_KEY = "retention.ms";
private KafkaConstant() {
}
} }

View File

@@ -39,4 +39,7 @@ public class KafkaMetricsCollections {
* Broker信息 * Broker信息
*/ */
public static final int BROKER_VERSION = 400; public static final int BROKER_VERSION = 400;
private KafkaMetricsCollections() {
}
} }

View File

@@ -10,4 +10,7 @@ public class LogConstant {
public static final String API_METRICS_LOGGER = "API_METRICS_LOGGER"; public static final String API_METRICS_LOGGER = "API_METRICS_LOGGER";
public static final String SCHEDULED_TASK_LOGGER = "SCHEDULED_TASK_LOGGER"; public static final String SCHEDULED_TASK_LOGGER = "SCHEDULED_TASK_LOGGER";
private LogConstant() {
}
} }

View File

@@ -11,4 +11,7 @@ public class LoginConstant {
public static final String COOKIE_CHINESE_USERNAME_KEY = "chineseName"; public static final String COOKIE_CHINESE_USERNAME_KEY = "chineseName";
public static final Integer COOKIE_OR_SESSION_MAX_AGE_UNIT_MS = 24 * 60 * 60 * 1000; public static final Integer COOKIE_OR_SESSION_MAX_AGE_UNIT_MS = 24 * 60 * 60 * 1000;
private LoginConstant() {
}
} }

View File

@@ -6,4 +6,7 @@ package com.xiaojukeji.kafka.manager.common.constant;
*/ */
public class SystemCodeConstant { public class SystemCodeConstant {
public static final String KAFKA_MANAGER = "kafka-manager"; public static final String KAFKA_MANAGER = "kafka-manager";
private SystemCodeConstant() {
}
} }

View File

@@ -54,4 +54,7 @@ public class TopicCreationConstant {
* 单次自动化审批, 最多允许的通过单子 * 单次自动化审批, 最多允许的通过单子
*/ */
public static final Integer MAX_PASSED_ORDER_NUM_PER_TASK = 200; public static final Integer MAX_PASSED_ORDER_NUM_PER_TASK = 200;
private TopicCreationConstant() {
}
} }

View File

@@ -16,4 +16,7 @@ public class TopicSampleConstant {
public static final Integer MAX_TIMEOUT_UNIT_MS = 10000; public static final Integer MAX_TIMEOUT_UNIT_MS = 10000;
public static final Integer POLL_TIME_OUT_UNIT_MS = 2000; public static final Integer POLL_TIME_OUT_UNIT_MS = 2000;
public static final Integer MAX_DATA_LENGTH_UNIT_BYTE = 2048; public static final Integer MAX_DATA_LENGTH_UNIT_BYTE = 2048;
private TopicSampleConstant() {
}
} }

View File

@@ -18,4 +18,7 @@ public class TrickLoginConstant {
*/ */
public static final String TRICK_LOGIN_SWITCH_ON = "on"; public static final String TRICK_LOGIN_SWITCH_ON = "on";
public static final String TRICK_LOGIN_SWITCH_OFF = "off"; public static final String TRICK_LOGIN_SWITCH_OFF = "off";
private TrickLoginConstant() {
}
} }

View File

@@ -119,4 +119,7 @@ public class ZkPathUtil {
public static String getControllerCandidatePath(Integer brokerId) { public static String getControllerCandidatePath(Integer brokerId) {
return D_CONTROLLER_CANDIDATES + ZOOKEEPER_SEPARATOR + brokerId; return D_CONTROLLER_CANDIDATES + ZOOKEEPER_SEPARATOR + brokerId;
} }
private ZkPathUtil() {
}
} }

View File

@@ -91,7 +91,7 @@ public class BrokerServiceImpl implements BrokerService {
for (BrokerDO brokerDO : brokerDOList) { for (BrokerDO brokerDO : brokerDOList) {
PeakFlowStatusEnum peakFlowStatus = getPeakFlowStatus(brokerDO.getMaxAvgBytesIn(), peakFlow); PeakFlowStatusEnum peakFlowStatus = getPeakFlowStatus(brokerDO.getMaxAvgBytesIn(), peakFlow);
peakFlowStatusMap.put( peakFlowStatusMap.put(
peakFlowStatus.code, peakFlowStatus.getCode(),
peakFlowStatusMap.getOrDefault(peakFlowStatus.getCode(), 0) + 1 peakFlowStatusMap.getOrDefault(peakFlowStatus.getCode(), 0) + 1
); );
} }