/carrera-console/carrera-console/src/main/java/com/didi/carrera/console/dao/model/Topic.java

https://github.com/didi/DDMQ · Java · 441 lines · 265 code · 76 blank · 100 comment · 95 complexity · 1076b759888fb96adf38228842b26894 MD5 · raw file

  1. package com.didi.carrera.console.dao.model;
  2. import java.io.Serializable;
  3. import java.util.Date;
  4. import java.util.List;
  5. import java.util.Map;
  6. import com.alibaba.fastjson.TypeReference;
  7. import com.didi.carrera.console.common.util.FastJsonUtils;
  8. import com.didi.carrera.console.dao.model.custom.TopicConfig;
  9. import org.apache.commons.lang3.StringUtils;
  10. public class Topic implements Serializable {
  11. /**
  12. * 主键id
  13. * default = null
  14. * length = 20
  15. */
  16. private Long id;
  17. /**
  18. * topic名称
  19. * default =
  20. * length = 256
  21. */
  22. private String topicName;
  23. /**
  24. * 成本分摊方
  25. * default =
  26. * length = 256
  27. */
  28. private String service;
  29. /**
  30. * 部门 一级部门 - 二级部门
  31. * default =
  32. * length = 256
  33. */
  34. private String department;
  35. /**
  36. * 联系人,;分割
  37. * default =
  38. * length = 1024
  39. */
  40. private String contacters;
  41. /**
  42. * 报警组信息, ;分割
  43. * default =
  44. * length = 256
  45. */
  46. private List<String> alarmGroup;
  47. /**
  48. * 是否启用报警,0 启用 1禁用,默认启用
  49. * default = 0
  50. * length = 3
  51. */
  52. private Byte alarmIsEnable;
  53. /**
  54. * 是否是延时Topic,0 延时 1非延时,默认1
  55. * default = 1
  56. * length = 3
  57. */
  58. private Byte delayTopic;
  59. /**
  60. * 是否需要审核订阅信息 0需要审核订阅信息 1不需要审核订阅信息,默认1
  61. * default = 1
  62. * length = 3
  63. */
  64. private Byte needAuditSubinfo;
  65. /**
  66. * 是否启用schema校验 0启用 1禁用,默认1
  67. * default = 1
  68. * length = 3
  69. */
  70. private Byte enableSchemaVerify;
  71. /**
  72. * 0 同机房生产 1 自定义,默认0
  73. * default = 0
  74. * length = 3
  75. */
  76. private Byte produceMode;
  77. /**
  78. * 生产模式自定义,map结构,key为client idc,value为pproxy idc列表
  79. * default =
  80. * length = 2048
  81. */
  82. private Map<String/**client idc*/, List<String>/*pproxy idc*/> produceModeMapper;
  83. /**
  84. * topic状态,0启用,1禁用
  85. * default = 0
  86. * length = 3
  87. */
  88. private Byte state;
  89. /**
  90. * 运维端配置参数
  91. * default =
  92. * length = 2048
  93. */
  94. private TopicConfig config;
  95. /**
  96. * topic描述信息
  97. * default =
  98. * length = 1024
  99. */
  100. private String description;
  101. /**
  102. * 额外参数
  103. * default =
  104. * length = 2048
  105. */
  106. private Map<String, String> extraParams;
  107. /**
  108. * 是否删除 0:未删除 1:删除
  109. * default = 0
  110. * length = 3
  111. */
  112. private Byte isDelete;
  113. /**
  114. * 创建时间
  115. * default = 1970-01-01 00:00:00
  116. * length = 19
  117. */
  118. private Date createTime;
  119. /**
  120. * 修改时间
  121. * default = CURRENT_TIMESTAMP
  122. * length = 19
  123. */
  124. private Date modifyTime;
  125. /**
  126. * topicschema
  127. * default = null
  128. * length = 65535
  129. */
  130. private String topicSchema;
  131. private static final long serialVersionUID = 1L;
  132. public Long getId() {
  133. return id;
  134. }
  135. public void setId(Long id) {
  136. this.id = id;
  137. }
  138. public String getTopicName() {
  139. return topicName;
  140. }
  141. public void setTopicName(String topicName) {
  142. this.topicName = topicName == null ? null : topicName.trim();
  143. }
  144. public String getService() {
  145. return service;
  146. }
  147. public void setService(String service) {
  148. this.service = service == null ? null : service.trim();
  149. }
  150. public String getDepartment() {
  151. return department;
  152. }
  153. public void setDepartment(String department) {
  154. this.department = department == null ? null : department.trim();
  155. }
  156. public String getContacters() {
  157. return contacters;
  158. }
  159. public void setContacters(String contacters) {
  160. this.contacters = contacters == null ? null : contacters.trim();
  161. }
  162. public String getAlarmGroup() {
  163. return this.alarmGroup == null ? null : FastJsonUtils.toJsonString(alarmGroup);
  164. }
  165. public void setAlarmGroup(String alarmGroup) {
  166. this.alarmGroup = StringUtils.isBlank(alarmGroup) ? null : FastJsonUtils.toObject(alarmGroup, List.class);
  167. }
  168. public List<String> getTopicAlarmGroup() {
  169. return alarmGroup;
  170. }
  171. public void setTopicAlarmGroup(List<String> alarmGroup) {
  172. this.alarmGroup = alarmGroup;
  173. }
  174. public Byte getAlarmIsEnable() {
  175. return alarmIsEnable;
  176. }
  177. public void setAlarmIsEnable(Byte alarmIsEnable) {
  178. this.alarmIsEnable = alarmIsEnable;
  179. }
  180. public Byte getDelayTopic() {
  181. return delayTopic;
  182. }
  183. public void setDelayTopic(Byte delayTopic) {
  184. this.delayTopic = delayTopic;
  185. }
  186. public Byte getNeedAuditSubinfo() {
  187. return needAuditSubinfo;
  188. }
  189. public void setNeedAuditSubinfo(Byte needAuditSubinfo) {
  190. this.needAuditSubinfo = needAuditSubinfo;
  191. }
  192. public Byte getEnableSchemaVerify() {
  193. return enableSchemaVerify;
  194. }
  195. public void setEnableSchemaVerify(Byte enableSchemaVerify) {
  196. this.enableSchemaVerify = enableSchemaVerify;
  197. }
  198. public Byte getProduceMode() {
  199. return produceMode;
  200. }
  201. public void setProduceMode(Byte produceMode) {
  202. this.produceMode = produceMode;
  203. }
  204. public String getProduceModeMapper() {
  205. return this.produceModeMapper == null ? null : FastJsonUtils.toJsonString(produceModeMapper);
  206. }
  207. public void setProduceModeMapper(String produceModeMapper) {
  208. this.produceModeMapper = StringUtils.isBlank(produceModeMapper) ? null : FastJsonUtils.toObject(produceModeMapper, new TypeReference<Map<String/**client idc*/, List<String>/*pproxy idc*/>>() {
  209. });
  210. }
  211. public Map<String/**client idc*/, List<String>/*pproxy idc*/> getTopicProduceModeMapper() {
  212. return produceModeMapper;
  213. }
  214. public void setTopicProduceModeMapper(Map<String/**client idc*/, List<String>/*pproxy idc*/> produceModeMapper) {
  215. this.produceModeMapper = produceModeMapper;
  216. }
  217. public Byte getState() {
  218. return state;
  219. }
  220. public void setState(Byte state) {
  221. this.state = state;
  222. }
  223. public TopicConfig getTopicConfig() {
  224. return config;
  225. }
  226. public void setTopicConfig(TopicConfig config) {
  227. this.config = config;
  228. }
  229. public String getConfig() {
  230. return this.config == null ? null : FastJsonUtils.toJsonString(config);
  231. }
  232. public void setConfig(String config) {
  233. this.config = StringUtils.isBlank(config) ? null : FastJsonUtils.toObject(config, TopicConfig.class);
  234. }
  235. public String getDescription() {
  236. return description;
  237. }
  238. public void setDescription(String description) {
  239. this.description = description == null ? null : description.trim();
  240. }
  241. public String getExtraParams() {
  242. return this.extraParams == null ? null : FastJsonUtils.toJsonString(extraParams);
  243. }
  244. public void setExtraParams(String extraParams) {
  245. this.extraParams = StringUtils.isBlank(extraParams) ? null : FastJsonUtils.toObject(extraParams, Map.class);
  246. }
  247. public Map<String, String> getTopicExtraParams() {
  248. return extraParams;
  249. }
  250. public void setTopicExtraParams(Map<String, String> extraParams) {
  251. this.extraParams = extraParams;
  252. }
  253. public Byte getIsDelete() {
  254. return isDelete;
  255. }
  256. public void setIsDelete(Byte isDelete) {
  257. this.isDelete = isDelete;
  258. }
  259. public Date getCreateTime() {
  260. return createTime;
  261. }
  262. public void setCreateTime(Date createTime) {
  263. this.createTime = createTime;
  264. }
  265. public Date getModifyTime() {
  266. return modifyTime;
  267. }
  268. public void setModifyTime(Date modifyTime) {
  269. this.modifyTime = modifyTime;
  270. }
  271. public String getTopicSchema() {
  272. return topicSchema;
  273. }
  274. public void setTopicSchema(String topicSchema) {
  275. this.topicSchema = topicSchema == null ? null : topicSchema.trim();
  276. }
  277. @Override
  278. public boolean equals(Object that) {
  279. if (this == that) {
  280. return true;
  281. }
  282. if (that == null) {
  283. return false;
  284. }
  285. if (getClass() != that.getClass()) {
  286. return false;
  287. }
  288. Topic other = (Topic) that;
  289. return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
  290. && (this.getTopicName() == null ? other.getTopicName() == null : this.getTopicName().equals(other.getTopicName()))
  291. && (this.getService() == null ? other.getService() == null : this.getService().equals(other.getService()))
  292. && (this.getDepartment() == null ? other.getDepartment() == null : this.getDepartment().equals(other.getDepartment()))
  293. && (this.getContacters() == null ? other.getContacters() == null : this.getContacters().equals(other.getContacters()))
  294. && (this.getAlarmGroup() == null ? other.getAlarmGroup() == null : this.getAlarmGroup().equals(other.getAlarmGroup()))
  295. && (this.getAlarmIsEnable() == null ? other.getAlarmIsEnable() == null : this.getAlarmIsEnable().equals(other.getAlarmIsEnable()))
  296. && (this.getDelayTopic() == null ? other.getDelayTopic() == null : this.getDelayTopic().equals(other.getDelayTopic()))
  297. && (this.getNeedAuditSubinfo() == null ? other.getNeedAuditSubinfo() == null : this.getNeedAuditSubinfo().equals(other.getNeedAuditSubinfo()))
  298. && (this.getEnableSchemaVerify() == null ? other.getEnableSchemaVerify() == null : this.getEnableSchemaVerify().equals(other.getEnableSchemaVerify()))
  299. && (this.getProduceMode() == null ? other.getProduceMode() == null : this.getProduceMode().equals(other.getProduceMode()))
  300. && (this.getProduceModeMapper() == null ? other.getProduceModeMapper() == null : this.getProduceModeMapper().equals(other.getProduceModeMapper()))
  301. && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
  302. && (this.getConfig() == null ? other.getConfig() == null : this.getConfig().equals(other.getConfig()))
  303. && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
  304. && (this.getExtraParams() == null ? other.getExtraParams() == null : this.getExtraParams().equals(other.getExtraParams()))
  305. && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
  306. && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
  307. && (this.getModifyTime() == null ? other.getModifyTime() == null : this.getModifyTime().equals(other.getModifyTime()))
  308. && (this.getTopicSchema() == null ? other.getTopicSchema() == null : this.getTopicSchema().equals(other.getTopicSchema()));
  309. }
  310. @Override
  311. public int hashCode() {
  312. final int prime = 31;
  313. int result = 1;
  314. result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
  315. result = prime * result + ((getTopicName() == null) ? 0 : getTopicName().hashCode());
  316. result = prime * result + ((getService() == null) ? 0 : getService().hashCode());
  317. result = prime * result + ((getDepartment() == null) ? 0 : getDepartment().hashCode());
  318. result = prime * result + ((getContacters() == null) ? 0 : getContacters().hashCode());
  319. result = prime * result + ((getAlarmGroup() == null) ? 0 : getAlarmGroup().hashCode());
  320. result = prime * result + ((getAlarmIsEnable() == null) ? 0 : getAlarmIsEnable().hashCode());
  321. result = prime * result + ((getDelayTopic() == null) ? 0 : getDelayTopic().hashCode());
  322. result = prime * result + ((getNeedAuditSubinfo() == null) ? 0 : getNeedAuditSubinfo().hashCode());
  323. result = prime * result + ((getEnableSchemaVerify() == null) ? 0 : getEnableSchemaVerify().hashCode());
  324. result = prime * result + ((getProduceMode() == null) ? 0 : getProduceMode().hashCode());
  325. result = prime * result + ((getProduceModeMapper() == null) ? 0 : getProduceModeMapper().hashCode());
  326. result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
  327. result = prime * result + ((getConfig() == null) ? 0 : getConfig().hashCode());
  328. result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
  329. result = prime * result + ((getExtraParams() == null) ? 0 : getExtraParams().hashCode());
  330. result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
  331. result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
  332. result = prime * result + ((getModifyTime() == null) ? 0 : getModifyTime().hashCode());
  333. result = prime * result + ((getTopicSchema() == null) ? 0 : getTopicSchema().hashCode());
  334. return result;
  335. }
  336. @Override
  337. public String toString() {
  338. String sb = getClass().getSimpleName() +
  339. " [" +
  340. "Hash = " + hashCode() +
  341. ", id=" + id +
  342. ", topicName=" + topicName +
  343. ", service=" + service +
  344. ", department=" + department +
  345. ", contacters=" + contacters +
  346. ", alarmGroup=" + alarmGroup +
  347. ", alarmIsEnable=" + alarmIsEnable +
  348. ", delayTopic=" + delayTopic +
  349. ", needAuditSubinfo=" + needAuditSubinfo +
  350. ", enableSchemaVerify=" + enableSchemaVerify +
  351. ", produceMode=" + produceMode +
  352. ", produceModeMapper=" + produceModeMapper +
  353. ", state=" + state +
  354. ", config=" + config +
  355. ", description=" + description +
  356. ", extraParams=" + extraParams +
  357. ", isDelete=" + isDelete +
  358. ", createTime=" + createTime +
  359. ", modifyTime=" + modifyTime +
  360. ", topicSchema=" + topicSchema +
  361. ", serialVersionUID=" + serialVersionUID +
  362. "]";
  363. return sb;
  364. }
  365. }