001// ______________________________________________________ 002// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 003// modified by guyadong from 004// sql2java original version https://sourceforge.net/projects/sql2java/ 005// JDBC driver used at code generation time: com.mysql.jdbc.Driver 006// template: bean.java.vm 007// ______________________________________________________ 008package net.gdface.facelog.db; 009import java.io.Serializable; 010import java.util.List; 011import java.util.Objects; 012 013import com.facebook.swift.codec.ThriftStruct; 014import com.facebook.swift.codec.ThriftField; 015import com.facebook.swift.codec.ThriftField.Requiredness; 016import io.swagger.annotations.ApiModel; 017import io.swagger.annotations.ApiModelProperty; 018/** 019 * LogBean is a mapping of fl_log Table. 020 * <br>Meta Data Information (in progress): 021 * <ul> 022 * <li>comments: 人脸验证日志,记录所有通过验证的人员 </li> 023 * </ul> 024 * @author guyadong 025*/ 026@ThriftStruct 027@ApiModel(description="人脸验证日志,记录所有通过验证的人员") 028public final class LogBean 029 implements Serializable,BaseBean<LogBean>,Comparable<LogBean>,Constant,Cloneable 030{ 031 private static final long serialVersionUID = 46995545005652737L; 032 /** NULL {@link LogBean} bean , IMMUTABLE instance */ 033 public static final LogBean NULL = new LogBean().asNULL().asImmutable(); 034 /** comments:日志id */ 035 @ApiModelProperty(value = "日志id" ,required=true ,dataType="Integer") 036 private Integer id; 037 038 /** comments:外键,用户id */ 039 @ApiModelProperty(value = "外键,用户id" ,required=true ,dataType="Integer") 040 private Integer personId; 041 042 /** comments:外键,日志来源设备id */ 043 @ApiModelProperty(value = "外键,日志来源设备id" ,dataType="Integer") 044 private Integer deviceId; 045 046 /** comments:外键,用于验证身份的人脸特征数据MD5 id */ 047 @ApiModelProperty(value = "外键,用于验证身份的人脸特征数据MD5 id" ,dataType="String") 048 private String verifyFeature; 049 050 /** comments:外键,现场采集的人脸信息记录id */ 051 @ApiModelProperty(value = "外键,现场采集的人脸信息记录id" ,dataType="Integer") 052 private Integer compareFace; 053 054 /** comments:验证状态,NULL,0:允许通过,其他:拒绝 */ 055 @ApiModelProperty(value = "验证状态,NULL,0:允许通过,其他:拒绝" ,dataType="Integer") 056 private Integer verifyStatus; 057 058 /** comments:验证相似度 */ 059 @ApiModelProperty(value = "验证相似度" ,dataType="Double") 060 private Double similarty; 061 062 /** comments:通行方向,NULL,0:入口,1:出口,默认0 */ 063 @ApiModelProperty(value = "通行方向,NULL,0:入口,1:出口,默认0" ,dataType="Integer") 064 private Integer direction; 065 066 /** comments:验证时间(可能由前端设备提供时间) */ 067 @ApiModelProperty(value = "验证时间(可能由前端设备提供时间)" ,dataType="Date") 068 private java.util.Date verifyTime; 069 070 @ApiModelProperty(value = "create_time" ,dataType="Date") 071 private java.util.Date createTime; 072 073 /** flag whether {@code this} can be modified */ 074 private Boolean immutable; 075 /** columns modified flag */ 076 @ApiModelProperty(value="columns modified flag",dataType="int",required=true) 077 private int modified; 078 /** columns initialized flag */ 079 @ApiModelProperty(value="columns initialized flag",dataType="int",required=true) 080 private int initialized; 081 /** new record flag */ 082 @ApiModelProperty(value="new record flag",dataType="boolean",required=true) 083 private boolean isNew; 084 /** 085 * set immutable status 086 * @return {@code this} 087 */ 088 private LogBean immutable(Boolean immutable) { 089 this.immutable = immutable; 090 return this; 091 } 092 /** 093 * set {@code this} as immutable object 094 * @return {@code this} 095 */ 096 public LogBean asImmutable() { 097 return immutable(Boolean.TRUE); 098 } 099 /** 100 * @return {@code true} if {@code this} is a mutable object 101 */ 102 public boolean mutable(){ 103 return !Boolean.TRUE.equals(this.immutable); 104 } 105 /** 106 * @return {@code this} 107 * @throws IllegalStateException if {@code this} is a immutable object 108 */ 109 private LogBean checkMutable(){ 110 if(!mutable()){ 111 throw new IllegalStateException("this is a immutable object"); 112 } 113 return this; 114 } 115 /** 116 * @return return a new mutable copy of this object. 117 */ 118 public LogBean cloneMutable(){ 119 return clone().immutable(null); 120 } 121 @ThriftField(value=1,name="_new",requiredness=Requiredness.REQUIRED) 122 @Override 123 public boolean isNew() 124 { 125 return this.isNew; 126 } 127 128 129 @Override 130 public void isNew(boolean isNew) 131 { 132 this.isNew = isNew; 133 } 134 /** 135 * Specifies to the object if it has been set as new. 136 * 137 * @param isNew the boolean value to be assigned to the isNew field 138 */ 139 @ThriftField() 140 public void setNew(boolean isNew) 141 { 142 this.isNew = isNew; 143 } 144 /** 145 * @return the modified status of columns 146 */ 147 @ThriftField(value=2,requiredness=Requiredness.REQUIRED) 148 public int getModified(){ 149 return modified; 150 } 151 152 /** 153 * @param modified the modified status bit to be assigned to {@link #modified} 154 */ 155 @ThriftField() 156 public void setModified(int modified){ 157 this.modified = modified; 158 } 159 /** 160 * @return the initialized status of columns 161 */ 162 @ThriftField(value=3,requiredness=Requiredness.REQUIRED) 163 public int getInitialized(){ 164 return initialized; 165 } 166 167 /** 168 * @param initialized the initialized status bit to be assigned to {@link #initialized} 169 */ 170 @ThriftField() 171 public void setInitialized(int initialized){ 172 this.initialized = initialized; 173 } 174 protected static final <T extends Comparable<T>>boolean equals(T a, T b) { 175 return a == b || (a != null && 0==a.compareTo(b)); 176 } 177 public LogBean(){ 178 super(); 179 reset(); 180 } 181 /** 182 * construct a new instance filled with primary keys 183 * @param id PK# 1 184 */ 185 public LogBean(Integer id){ 186 this(); 187 setId(id); 188 } 189 /** 190 * Getter method for {@link #id}.<br> 191 * PRIMARY KEY.<br> 192 * Meta Data Information (in progress): 193 * <ul> 194 * <li>full name: fl_log.id</li> 195 * <li>comments: 日志id</li> 196 * <li>AUTO_INCREMENT</li> 197 * <li>NOT NULL</li> 198 * <li>column size: 10</li> 199 * <li>JDBC type returned by the driver: Types.INTEGER</li> 200 * </ul> 201 * 202 * @return the value of id 203 */ 204 @ThriftField(value=4) 205 public Integer getId(){ 206 return id; 207 } 208 /** 209 * Setter method for {@link #id}.<br> 210 * The new value is set only if equals() says it is different, 211 * or if one of either the new value or the current value is null. 212 * In case the new value is different, it is set and the field is marked as 'modified'. 213 * 214 * @param newVal the new value to be assigned to id 215 */ 216 public void setId(Integer newVal) 217 { 218 checkMutable(); 219 220 modified |= FL_LOG_ID_ID_MASK; 221 initialized |= FL_LOG_ID_ID_MASK; 222 223 if (Objects.equals(newVal, id)) { 224 return; 225 } 226 id = newVal; 227 } 228 /** 229 * setter for thrift:swift support<br> 230 * without modification for {@link #modified} and {@link #initialized}<br> 231 * <b>NOTE:</b>DO NOT use the method in your code 232 */ 233 @ThriftField(name = "id") 234 public void writeId(Integer newVal){ 235 checkMutable(); 236 id = newVal; 237 } 238 /** 239 * Setter method for {@link #id}.<br> 240 * Convenient for those who do not want to deal with Objects for primary types. 241 * 242 * @param newVal the new value to be assigned to id 243 */ 244 public void setId(int newVal) 245 { 246 setId(new Integer(newVal)); 247 } 248 /** 249 * Determines if the id has been modified. 250 * 251 * @return true if the field has been modified, false if the field has not been modified 252 */ 253 public boolean checkIdModified() 254 { 255 return 0L != (modified & FL_LOG_ID_ID_MASK); 256 } 257 258 /** 259 * Determines if the id has been initialized.<br> 260 * 261 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 262 * 263 * @return true if the field has been initialized, false otherwise 264 */ 265 public boolean checkIdInitialized() 266 { 267 return 0L != (initialized & FL_LOG_ID_ID_MASK); 268 } 269 /** 270 * Getter method for {@link #personId}.<br> 271 * Meta Data Information (in progress): 272 * <ul> 273 * <li>full name: fl_log.person_id</li> 274 * <li> foreign key: fl_person.id</li> 275 * <li>comments: 外键,用户id</li> 276 * <li>NOT NULL</li> 277 * <li>column size: 10</li> 278 * <li>JDBC type returned by the driver: Types.INTEGER</li> 279 * </ul> 280 * 281 * @return the value of personId 282 */ 283 @ThriftField(value=5) 284 public Integer getPersonId(){ 285 return personId; 286 } 287 /** 288 * Setter method for {@link #personId}.<br> 289 * The new value is set only if equals() says it is different, 290 * or if one of either the new value or the current value is null. 291 * In case the new value is different, it is set and the field is marked as 'modified'. 292 * 293 * @param newVal the new value( NOT NULL) to be assigned to personId 294 */ 295 public void setPersonId(Integer newVal) 296 { 297 checkMutable(); 298 299 modified |= FL_LOG_ID_PERSON_ID_MASK; 300 initialized |= FL_LOG_ID_PERSON_ID_MASK; 301 302 if (Objects.equals(newVal, personId)) { 303 return; 304 } 305 personId = newVal; 306 } 307 /** 308 * setter for thrift:swift support<br> 309 * without modification for {@link #modified} and {@link #initialized}<br> 310 * <b>NOTE:</b>DO NOT use the method in your code 311 */ 312 @ThriftField(name = "personId") 313 public void writePersonId(Integer newVal){ 314 checkMutable(); 315 personId = newVal; 316 } 317 /** 318 * Setter method for {@link #personId}.<br> 319 * Convenient for those who do not want to deal with Objects for primary types. 320 * 321 * @param newVal the new value to be assigned to personId 322 */ 323 public void setPersonId(int newVal) 324 { 325 setPersonId(new Integer(newVal)); 326 } 327 /** 328 * Determines if the personId has been modified. 329 * 330 * @return true if the field has been modified, false if the field has not been modified 331 */ 332 public boolean checkPersonIdModified() 333 { 334 return 0L != (modified & FL_LOG_ID_PERSON_ID_MASK); 335 } 336 337 /** 338 * Determines if the personId has been initialized.<br> 339 * 340 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 341 * 342 * @return true if the field has been initialized, false otherwise 343 */ 344 public boolean checkPersonIdInitialized() 345 { 346 return 0L != (initialized & FL_LOG_ID_PERSON_ID_MASK); 347 } 348 /** 349 * Getter method for {@link #deviceId}.<br> 350 * Meta Data Information (in progress): 351 * <ul> 352 * <li>full name: fl_log.device_id</li> 353 * <li> foreign key: fl_device.id</li> 354 * <li>comments: 外键,日志来源设备id</li> 355 * <li>column size: 10</li> 356 * <li>JDBC type returned by the driver: Types.INTEGER</li> 357 * </ul> 358 * 359 * @return the value of deviceId 360 */ 361 @ThriftField(value=6) 362 public Integer getDeviceId(){ 363 return deviceId; 364 } 365 /** 366 * Setter method for {@link #deviceId}.<br> 367 * The new value is set only if equals() says it is different, 368 * or if one of either the new value or the current value is null. 369 * In case the new value is different, it is set and the field is marked as 'modified'. 370 * 371 * @param newVal the new value to be assigned to deviceId 372 */ 373 public void setDeviceId(Integer newVal) 374 { 375 checkMutable(); 376 377 modified |= FL_LOG_ID_DEVICE_ID_MASK; 378 initialized |= FL_LOG_ID_DEVICE_ID_MASK; 379 380 if (Objects.equals(newVal, deviceId)) { 381 return; 382 } 383 deviceId = newVal; 384 } 385 /** 386 * setter for thrift:swift support<br> 387 * without modification for {@link #modified} and {@link #initialized}<br> 388 * <b>NOTE:</b>DO NOT use the method in your code 389 */ 390 @ThriftField(name = "deviceId") 391 public void writeDeviceId(Integer newVal){ 392 checkMutable(); 393 deviceId = newVal; 394 } 395 /** 396 * Setter method for {@link #deviceId}.<br> 397 * Convenient for those who do not want to deal with Objects for primary types. 398 * 399 * @param newVal the new value to be assigned to deviceId 400 */ 401 public void setDeviceId(int newVal) 402 { 403 setDeviceId(new Integer(newVal)); 404 } 405 /** 406 * Determines if the deviceId has been modified. 407 * 408 * @return true if the field has been modified, false if the field has not been modified 409 */ 410 public boolean checkDeviceIdModified() 411 { 412 return 0L != (modified & FL_LOG_ID_DEVICE_ID_MASK); 413 } 414 415 /** 416 * Determines if the deviceId has been initialized.<br> 417 * 418 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 419 * 420 * @return true if the field has been initialized, false otherwise 421 */ 422 public boolean checkDeviceIdInitialized() 423 { 424 return 0L != (initialized & FL_LOG_ID_DEVICE_ID_MASK); 425 } 426 /** 427 * Getter method for {@link #verifyFeature}.<br> 428 * Meta Data Information (in progress): 429 * <ul> 430 * <li>full name: fl_log.verify_feature</li> 431 * <li> foreign key: fl_feature.md5</li> 432 * <li>comments: 外键,用于验证身份的人脸特征数据MD5 id</li> 433 * <li>column size: 32</li> 434 * <li>JDBC type returned by the driver: Types.CHAR</li> 435 * </ul> 436 * 437 * @return the value of verifyFeature 438 */ 439 @ThriftField(value=7) 440 public String getVerifyFeature(){ 441 return verifyFeature; 442 } 443 /** 444 * Setter method for {@link #verifyFeature}.<br> 445 * The new value is set only if equals() says it is different, 446 * or if one of either the new value or the current value is null. 447 * In case the new value is different, it is set and the field is marked as 'modified'. 448 * 449 * @param newVal the new value to be assigned to verifyFeature 450 */ 451 public void setVerifyFeature(String newVal) 452 { 453 checkMutable(); 454 455 modified |= FL_LOG_ID_VERIFY_FEATURE_MASK; 456 initialized |= FL_LOG_ID_VERIFY_FEATURE_MASK; 457 458 if (Objects.equals(newVal, verifyFeature)) { 459 return; 460 } 461 verifyFeature = newVal; 462 } 463 /** 464 * setter for thrift:swift support<br> 465 * without modification for {@link #modified} and {@link #initialized}<br> 466 * <b>NOTE:</b>DO NOT use the method in your code 467 */ 468 @ThriftField(name = "verifyFeature") 469 public void writeVerifyFeature(String newVal){ 470 checkMutable(); 471 verifyFeature = newVal; 472 } 473 /** 474 * Determines if the verifyFeature has been modified. 475 * 476 * @return true if the field has been modified, false if the field has not been modified 477 */ 478 public boolean checkVerifyFeatureModified() 479 { 480 return 0L != (modified & FL_LOG_ID_VERIFY_FEATURE_MASK); 481 } 482 483 /** 484 * Determines if the verifyFeature has been initialized.<br> 485 * 486 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 487 * 488 * @return true if the field has been initialized, false otherwise 489 */ 490 public boolean checkVerifyFeatureInitialized() 491 { 492 return 0L != (initialized & FL_LOG_ID_VERIFY_FEATURE_MASK); 493 } 494 /** 495 * Getter method for {@link #compareFace}.<br> 496 * Meta Data Information (in progress): 497 * <ul> 498 * <li>full name: fl_log.compare_face</li> 499 * <li> foreign key: fl_face.id</li> 500 * <li>comments: 外键,现场采集的人脸信息记录id</li> 501 * <li>column size: 10</li> 502 * <li>JDBC type returned by the driver: Types.INTEGER</li> 503 * </ul> 504 * 505 * @return the value of compareFace 506 */ 507 @ThriftField(value=8) 508 public Integer getCompareFace(){ 509 return compareFace; 510 } 511 /** 512 * Setter method for {@link #compareFace}.<br> 513 * The new value is set only if equals() says it is different, 514 * or if one of either the new value or the current value is null. 515 * In case the new value is different, it is set and the field is marked as 'modified'. 516 * 517 * @param newVal the new value to be assigned to compareFace 518 */ 519 public void setCompareFace(Integer newVal) 520 { 521 checkMutable(); 522 523 modified |= FL_LOG_ID_COMPARE_FACE_MASK; 524 initialized |= FL_LOG_ID_COMPARE_FACE_MASK; 525 526 if (Objects.equals(newVal, compareFace)) { 527 return; 528 } 529 compareFace = newVal; 530 } 531 /** 532 * setter for thrift:swift support<br> 533 * without modification for {@link #modified} and {@link #initialized}<br> 534 * <b>NOTE:</b>DO NOT use the method in your code 535 */ 536 @ThriftField(name = "compareFace") 537 public void writeCompareFace(Integer newVal){ 538 checkMutable(); 539 compareFace = newVal; 540 } 541 /** 542 * Setter method for {@link #compareFace}.<br> 543 * Convenient for those who do not want to deal with Objects for primary types. 544 * 545 * @param newVal the new value to be assigned to compareFace 546 */ 547 public void setCompareFace(int newVal) 548 { 549 setCompareFace(new Integer(newVal)); 550 } 551 /** 552 * Determines if the compareFace has been modified. 553 * 554 * @return true if the field has been modified, false if the field has not been modified 555 */ 556 public boolean checkCompareFaceModified() 557 { 558 return 0L != (modified & FL_LOG_ID_COMPARE_FACE_MASK); 559 } 560 561 /** 562 * Determines if the compareFace has been initialized.<br> 563 * 564 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 565 * 566 * @return true if the field has been initialized, false otherwise 567 */ 568 public boolean checkCompareFaceInitialized() 569 { 570 return 0L != (initialized & FL_LOG_ID_COMPARE_FACE_MASK); 571 } 572 /** 573 * Getter method for {@link #verifyStatus}.<br> 574 * Meta Data Information (in progress): 575 * <ul> 576 * <li>full name: fl_log.verify_status</li> 577 * <li>comments: 验证状态,NULL,0:允许通过,其他:拒绝</li> 578 * <li>column size: 3</li> 579 * <li>JDBC type returned by the driver: Types.TINYINT</li> 580 * </ul> 581 * 582 * @return the value of verifyStatus 583 */ 584 @ThriftField(value=9) 585 public Integer getVerifyStatus(){ 586 return verifyStatus; 587 } 588 /** 589 * Setter method for {@link #verifyStatus}.<br> 590 * The new value is set only if equals() says it is different, 591 * or if one of either the new value or the current value is null. 592 * In case the new value is different, it is set and the field is marked as 'modified'. 593 * 594 * @param newVal the new value to be assigned to verifyStatus 595 */ 596 public void setVerifyStatus(Integer newVal) 597 { 598 checkMutable(); 599 600 modified |= FL_LOG_ID_VERIFY_STATUS_MASK; 601 initialized |= FL_LOG_ID_VERIFY_STATUS_MASK; 602 603 if (Objects.equals(newVal, verifyStatus)) { 604 return; 605 } 606 verifyStatus = newVal; 607 } 608 /** 609 * setter for thrift:swift support<br> 610 * without modification for {@link #modified} and {@link #initialized}<br> 611 * <b>NOTE:</b>DO NOT use the method in your code 612 */ 613 @ThriftField(name = "verifyStatus") 614 public void writeVerifyStatus(Integer newVal){ 615 checkMutable(); 616 verifyStatus = newVal; 617 } 618 /** 619 * Setter method for {@link #verifyStatus}.<br> 620 * Convenient for those who do not want to deal with Objects for primary types. 621 * 622 * @param newVal the new value to be assigned to verifyStatus 623 */ 624 public void setVerifyStatus(int newVal) 625 { 626 setVerifyStatus(new Integer(newVal)); 627 } 628 /** 629 * Determines if the verifyStatus has been modified. 630 * 631 * @return true if the field has been modified, false if the field has not been modified 632 */ 633 public boolean checkVerifyStatusModified() 634 { 635 return 0L != (modified & FL_LOG_ID_VERIFY_STATUS_MASK); 636 } 637 638 /** 639 * Determines if the verifyStatus has been initialized.<br> 640 * 641 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 642 * 643 * @return true if the field has been initialized, false otherwise 644 */ 645 public boolean checkVerifyStatusInitialized() 646 { 647 return 0L != (initialized & FL_LOG_ID_VERIFY_STATUS_MASK); 648 } 649 /** 650 * Getter method for {@link #similarty}.<br> 651 * Meta Data Information (in progress): 652 * <ul> 653 * <li>full name: fl_log.similarty</li> 654 * <li>comments: 验证相似度</li> 655 * <li>column size: 22</li> 656 * <li>JDBC type returned by the driver: Types.DOUBLE</li> 657 * </ul> 658 * 659 * @return the value of similarty 660 */ 661 @ThriftField(value=10) 662 public Double getSimilarty(){ 663 return similarty; 664 } 665 /** 666 * Setter method for {@link #similarty}.<br> 667 * The new value is set only if equals() says it is different, 668 * or if one of either the new value or the current value is null. 669 * In case the new value is different, it is set and the field is marked as 'modified'. 670 * 671 * @param newVal the new value to be assigned to similarty 672 */ 673 public void setSimilarty(Double newVal) 674 { 675 checkMutable(); 676 677 modified |= FL_LOG_ID_SIMILARTY_MASK; 678 initialized |= FL_LOG_ID_SIMILARTY_MASK; 679 680 if (Objects.equals(newVal, similarty)) { 681 return; 682 } 683 similarty = newVal; 684 } 685 /** 686 * setter for thrift:swift support<br> 687 * without modification for {@link #modified} and {@link #initialized}<br> 688 * <b>NOTE:</b>DO NOT use the method in your code 689 */ 690 @ThriftField(name = "similarty") 691 public void writeSimilarty(Double newVal){ 692 checkMutable(); 693 similarty = newVal; 694 } 695 /** 696 * Setter method for {@link #similarty}.<br> 697 * Convenient for those who do not want to deal with Objects for primary types. 698 * 699 * @param newVal the new value to be assigned to similarty 700 */ 701 public void setSimilarty(double newVal) 702 { 703 setSimilarty(new Double(newVal)); 704 } 705 /** 706 * Determines if the similarty has been modified. 707 * 708 * @return true if the field has been modified, false if the field has not been modified 709 */ 710 public boolean checkSimilartyModified() 711 { 712 return 0L != (modified & FL_LOG_ID_SIMILARTY_MASK); 713 } 714 715 /** 716 * Determines if the similarty has been initialized.<br> 717 * 718 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 719 * 720 * @return true if the field has been initialized, false otherwise 721 */ 722 public boolean checkSimilartyInitialized() 723 { 724 return 0L != (initialized & FL_LOG_ID_SIMILARTY_MASK); 725 } 726 /** 727 * Getter method for {@link #direction}.<br> 728 * Meta Data Information (in progress): 729 * <ul> 730 * <li>full name: fl_log.direction</li> 731 * <li>comments: 通行方向,NULL,0:入口,1:出口,默认0</li> 732 * <li>column size: 10</li> 733 * <li>JDBC type returned by the driver: Types.INTEGER</li> 734 * </ul> 735 * 736 * @return the value of direction 737 */ 738 @ThriftField(value=11) 739 public Integer getDirection(){ 740 return direction; 741 } 742 /** 743 * Setter method for {@link #direction}.<br> 744 * The new value is set only if equals() says it is different, 745 * or if one of either the new value or the current value is null. 746 * In case the new value is different, it is set and the field is marked as 'modified'. 747 * 748 * @param newVal the new value to be assigned to direction 749 */ 750 public void setDirection(Integer newVal) 751 { 752 checkMutable(); 753 754 modified |= FL_LOG_ID_DIRECTION_MASK; 755 initialized |= FL_LOG_ID_DIRECTION_MASK; 756 757 if (Objects.equals(newVal, direction)) { 758 return; 759 } 760 direction = newVal; 761 } 762 /** 763 * setter for thrift:swift support<br> 764 * without modification for {@link #modified} and {@link #initialized}<br> 765 * <b>NOTE:</b>DO NOT use the method in your code 766 */ 767 @ThriftField(name = "direction") 768 public void writeDirection(Integer newVal){ 769 checkMutable(); 770 direction = newVal; 771 } 772 /** 773 * Setter method for {@link #direction}.<br> 774 * Convenient for those who do not want to deal with Objects for primary types. 775 * 776 * @param newVal the new value to be assigned to direction 777 */ 778 public void setDirection(int newVal) 779 { 780 setDirection(new Integer(newVal)); 781 } 782 /** 783 * Determines if the direction has been modified. 784 * 785 * @return true if the field has been modified, false if the field has not been modified 786 */ 787 public boolean checkDirectionModified() 788 { 789 return 0L != (modified & FL_LOG_ID_DIRECTION_MASK); 790 } 791 792 /** 793 * Determines if the direction has been initialized.<br> 794 * 795 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 796 * 797 * @return true if the field has been initialized, false otherwise 798 */ 799 public boolean checkDirectionInitialized() 800 { 801 return 0L != (initialized & FL_LOG_ID_DIRECTION_MASK); 802 } 803 /** 804 * Getter method for {@link #verifyTime}.<br> 805 * Meta Data Information (in progress): 806 * <ul> 807 * <li>full name: fl_log.verify_time</li> 808 * <li>comments: 验证时间(可能由前端设备提供时间)</li> 809 * <li>default value: 'CURRENT_TIMESTAMP'</li> 810 * <li>NOT NULL</li> 811 * <li>column size: 19</li> 812 * <li>JDBC type returned by the driver: Types.TIMESTAMP</li> 813 * </ul> 814 * 815 * @return the value of verifyTime 816 */ 817 public java.util.Date getVerifyTime(){ 818 return verifyTime; 819 } 820 /** 821 * use Long to represent date type for thrift:swift support 822 * @see #getVerifyTime() 823 */ 824 @ThriftField(name = "verifyTime",value = 12) 825 public Long readVerifyTime(){ 826 return null == verifyTime ? null:verifyTime.getTime(); 827 } 828 /** 829 * Setter method for {@link #verifyTime}.<br> 830 * The new value is set only if equals() says it is different, 831 * or if one of either the new value or the current value is null. 832 * In case the new value is different, it is set and the field is marked as 'modified'. 833 * 834 * @param newVal the new value( NOT NULL) to be assigned to verifyTime 835 */ 836 public void setVerifyTime(java.util.Date newVal) 837 { 838 checkMutable(); 839 840 modified |= FL_LOG_ID_VERIFY_TIME_MASK; 841 initialized |= FL_LOG_ID_VERIFY_TIME_MASK; 842 843 if (Objects.equals(newVal, verifyTime)) { 844 return; 845 } 846 verifyTime = newVal; 847 } 848 /** 849 * setter for thrift:swift support<br> 850 * without modification for {@link #modified} and {@link #initialized}<br> 851 * <b>NOTE:</b>DO NOT use the method in your code 852 */ 853 @ThriftField(name = "verifyTime") 854 public void writeVerifyTime(Long newVal){ 855 checkMutable(); 856 verifyTime = null == newVal?null:new java.util.Date(newVal); 857 } 858 /** 859 * Setter method for {@link #verifyTime}.<br> 860 * Convenient for those who do not want to deal with Objects for primary types. 861 * 862 * @param newVal the new value to be assigned to verifyTime 863 */ 864 public void setVerifyTime(long newVal) 865 { 866 setVerifyTime(new java.util.Date(newVal)); 867 } 868 /** 869 * Setter method for {@link #verifyTime}.<br> 870 * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. 871 */ 872 public void setVerifyTime(Long newVal) 873 { 874 setVerifyTime(null == newVal ? null : new java.util.Date(newVal)); 875 } 876 /** 877 * Determines if the verifyTime has been modified. 878 * 879 * @return true if the field has been modified, false if the field has not been modified 880 */ 881 public boolean checkVerifyTimeModified() 882 { 883 return 0L != (modified & FL_LOG_ID_VERIFY_TIME_MASK); 884 } 885 886 /** 887 * Determines if the verifyTime has been initialized.<br> 888 * 889 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 890 * 891 * @return true if the field has been initialized, false otherwise 892 */ 893 public boolean checkVerifyTimeInitialized() 894 { 895 return 0L != (initialized & FL_LOG_ID_VERIFY_TIME_MASK); 896 } 897 /** 898 * Getter method for {@link #createTime}.<br> 899 * Meta Data Information (in progress): 900 * <ul> 901 * <li>full name: fl_log.create_time</li> 902 * <li>default value: 'CURRENT_TIMESTAMP'</li> 903 * <li>NOT NULL</li> 904 * <li>column size: 19</li> 905 * <li>JDBC type returned by the driver: Types.TIMESTAMP</li> 906 * </ul> 907 * 908 * @return the value of createTime 909 */ 910 public java.util.Date getCreateTime(){ 911 return createTime; 912 } 913 /** 914 * use Long to represent date type for thrift:swift support 915 * @see #getCreateTime() 916 */ 917 @ThriftField(name = "createTime",value = 13) 918 public Long readCreateTime(){ 919 return null == createTime ? null:createTime.getTime(); 920 } 921 /** 922 * Setter method for {@link #createTime}.<br> 923 * The new value is set only if equals() says it is different, 924 * or if one of either the new value or the current value is null. 925 * In case the new value is different, it is set and the field is marked as 'modified'. 926 * 927 * @param newVal the new value( NOT NULL) to be assigned to createTime 928 */ 929 public void setCreateTime(java.util.Date newVal) 930 { 931 checkMutable(); 932 933 modified |= FL_LOG_ID_CREATE_TIME_MASK; 934 initialized |= FL_LOG_ID_CREATE_TIME_MASK; 935 936 if (Objects.equals(newVal, createTime)) { 937 return; 938 } 939 createTime = newVal; 940 } 941 /** 942 * setter for thrift:swift support<br> 943 * without modification for {@link #modified} and {@link #initialized}<br> 944 * <b>NOTE:</b>DO NOT use the method in your code 945 */ 946 @ThriftField(name = "createTime") 947 public void writeCreateTime(Long newVal){ 948 checkMutable(); 949 createTime = null == newVal?null:new java.util.Date(newVal); 950 } 951 /** 952 * Setter method for {@link #createTime}.<br> 953 * Convenient for those who do not want to deal with Objects for primary types. 954 * 955 * @param newVal the new value to be assigned to createTime 956 */ 957 public void setCreateTime(long newVal) 958 { 959 setCreateTime(new java.util.Date(newVal)); 960 } 961 /** 962 * Setter method for {@link #createTime}.<br> 963 * @param newVal the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. 964 */ 965 public void setCreateTime(Long newVal) 966 { 967 setCreateTime(null == newVal ? null : new java.util.Date(newVal)); 968 } 969 /** 970 * Determines if the createTime has been modified. 971 * 972 * @return true if the field has been modified, false if the field has not been modified 973 */ 974 public boolean checkCreateTimeModified() 975 { 976 return 0L != (modified & FL_LOG_ID_CREATE_TIME_MASK); 977 } 978 979 /** 980 * Determines if the createTime has been initialized.<br> 981 * 982 * It is useful to determine if a field is null on purpose or just because it has not been initialized. 983 * 984 * @return true if the field has been initialized, false otherwise 985 */ 986 public boolean checkCreateTimeInitialized() 987 { 988 return 0L != (initialized & FL_LOG_ID_CREATE_TIME_MASK); 989 } 990 ////////////////////////////////////// 991 // referenced bean for FOREIGN KEYS 992 ////////////////////////////////////// 993 /** 994 * The referenced {@link DeviceBean} by {@link #deviceId} . <br> 995 * FOREIGN KEY (device_id) REFERENCES fl_device(id) 996 */ 997 @ApiModelProperty(hidden = true) 998 private DeviceBean referencedByDeviceId; 999 /** 1000 * Getter method for {@link #referencedByDeviceId}. 1001 * @return DeviceBean 1002 */ 1003 public DeviceBean getReferencedByDeviceId() { 1004 return this.referencedByDeviceId; 1005 } 1006 /** 1007 * Setter method for {@link #referencedByDeviceId}. 1008 * @param reference DeviceBean 1009 */ 1010 public void setReferencedByDeviceId(DeviceBean reference) { 1011 this.referencedByDeviceId = reference; 1012 } 1013 /** 1014 * The referenced {@link FaceBean} by {@link #compareFace} . <br> 1015 * FOREIGN KEY (compare_face) REFERENCES fl_face(id) 1016 */ 1017 @ApiModelProperty(hidden = true) 1018 private FaceBean referencedByCompareFace; 1019 /** 1020 * Getter method for {@link #referencedByCompareFace}. 1021 * @return FaceBean 1022 */ 1023 public FaceBean getReferencedByCompareFace() { 1024 return this.referencedByCompareFace; 1025 } 1026 /** 1027 * Setter method for {@link #referencedByCompareFace}. 1028 * @param reference FaceBean 1029 */ 1030 public void setReferencedByCompareFace(FaceBean reference) { 1031 this.referencedByCompareFace = reference; 1032 } 1033 /** 1034 * The referenced {@link FeatureBean} by {@link #verifyFeature} . <br> 1035 * FOREIGN KEY (verify_feature) REFERENCES fl_feature(md5) 1036 */ 1037 @ApiModelProperty(hidden = true) 1038 private FeatureBean referencedByVerifyFeature; 1039 /** 1040 * Getter method for {@link #referencedByVerifyFeature}. 1041 * @return FeatureBean 1042 */ 1043 public FeatureBean getReferencedByVerifyFeature() { 1044 return this.referencedByVerifyFeature; 1045 } 1046 /** 1047 * Setter method for {@link #referencedByVerifyFeature}. 1048 * @param reference FeatureBean 1049 */ 1050 public void setReferencedByVerifyFeature(FeatureBean reference) { 1051 this.referencedByVerifyFeature = reference; 1052 } 1053 /** 1054 * The referenced {@link PersonBean} by {@link #personId} . <br> 1055 * FOREIGN KEY (person_id) REFERENCES fl_person(id) 1056 */ 1057 @ApiModelProperty(hidden = true) 1058 private PersonBean referencedByPersonId; 1059 /** 1060 * Getter method for {@link #referencedByPersonId}. 1061 * @return PersonBean 1062 */ 1063 public PersonBean getReferencedByPersonId() { 1064 return this.referencedByPersonId; 1065 } 1066 /** 1067 * Setter method for {@link #referencedByPersonId}. 1068 * @param reference PersonBean 1069 */ 1070 public void setReferencedByPersonId(PersonBean reference) { 1071 this.referencedByPersonId = reference; 1072 } 1073 1074 @Override 1075 public boolean isModified() 1076 { 1077 return 0 != modified; 1078 } 1079 1080 @Override 1081 public boolean isModified(int columnID){ 1082 switch ( columnID ){ 1083 case FL_LOG_ID_ID: 1084 return checkIdModified(); 1085 case FL_LOG_ID_PERSON_ID: 1086 return checkPersonIdModified(); 1087 case FL_LOG_ID_DEVICE_ID: 1088 return checkDeviceIdModified(); 1089 case FL_LOG_ID_VERIFY_FEATURE: 1090 return checkVerifyFeatureModified(); 1091 case FL_LOG_ID_COMPARE_FACE: 1092 return checkCompareFaceModified(); 1093 case FL_LOG_ID_VERIFY_STATUS: 1094 return checkVerifyStatusModified(); 1095 case FL_LOG_ID_SIMILARTY: 1096 return checkSimilartyModified(); 1097 case FL_LOG_ID_DIRECTION: 1098 return checkDirectionModified(); 1099 case FL_LOG_ID_VERIFY_TIME: 1100 return checkVerifyTimeModified(); 1101 case FL_LOG_ID_CREATE_TIME: 1102 return checkCreateTimeModified(); 1103 default: 1104 return false; 1105 } 1106 } 1107 1108 @Override 1109 public boolean isInitialized(int columnID){ 1110 switch(columnID) { 1111 case FL_LOG_ID_ID: 1112 return checkIdInitialized(); 1113 case FL_LOG_ID_PERSON_ID: 1114 return checkPersonIdInitialized(); 1115 case FL_LOG_ID_DEVICE_ID: 1116 return checkDeviceIdInitialized(); 1117 case FL_LOG_ID_VERIFY_FEATURE: 1118 return checkVerifyFeatureInitialized(); 1119 case FL_LOG_ID_COMPARE_FACE: 1120 return checkCompareFaceInitialized(); 1121 case FL_LOG_ID_VERIFY_STATUS: 1122 return checkVerifyStatusInitialized(); 1123 case FL_LOG_ID_SIMILARTY: 1124 return checkSimilartyInitialized(); 1125 case FL_LOG_ID_DIRECTION: 1126 return checkDirectionInitialized(); 1127 case FL_LOG_ID_VERIFY_TIME: 1128 return checkVerifyTimeInitialized(); 1129 case FL_LOG_ID_CREATE_TIME: 1130 return checkCreateTimeInitialized(); 1131 default: 1132 return false; 1133 } 1134 } 1135 1136 @Override 1137 public boolean isModified(String column){ 1138 return isModified(columnIDOf(column)); 1139 } 1140 1141 @Override 1142 public boolean isInitialized(String column){ 1143 return isInitialized(columnIDOf(column)); 1144 } 1145 1146 @Override 1147 public void resetIsModified() 1148 { 1149 checkMutable(); 1150 modified = 0; 1151 } 1152 1153 @Override 1154 public void resetPrimaryKeysModified() 1155 { 1156 modified &= (~(FL_LOG_ID_ID_MASK)); 1157 } 1158 /** 1159 * Resets columns modification status except primary keys to 'not modified'. 1160 */ 1161 public void resetModifiedExceptPrimaryKeys() 1162 { 1163 modified &= (~(FL_LOG_ID_PERSON_ID_MASK | 1164 FL_LOG_ID_DEVICE_ID_MASK | 1165 FL_LOG_ID_VERIFY_FEATURE_MASK | 1166 FL_LOG_ID_COMPARE_FACE_MASK | 1167 FL_LOG_ID_VERIFY_STATUS_MASK | 1168 FL_LOG_ID_SIMILARTY_MASK | 1169 FL_LOG_ID_DIRECTION_MASK | 1170 FL_LOG_ID_VERIFY_TIME_MASK | 1171 FL_LOG_ID_CREATE_TIME_MASK)); 1172 } 1173 /** 1174 * Resets the object initialization status to 'not initialized'. 1175 */ 1176 private void resetInitialized() 1177 { 1178 initialized = 0; 1179 } 1180 /** reset all fields to initial value, equal to a new bean */ 1181 public void reset(){ 1182 checkMutable(); 1183 this.id = null; 1184 this.personId = null; 1185 this.deviceId = null; 1186 this.verifyFeature = null; 1187 this.compareFace = null; 1188 this.verifyStatus = null; 1189 this.similarty = null; 1190 this.direction = null; 1191 /* DEFAULT:'CURRENT_TIMESTAMP'*/ 1192 this.verifyTime = null; 1193 /* DEFAULT:'CURRENT_TIMESTAMP'*/ 1194 this.createTime = null; 1195 this.isNew = true; 1196 this.modified = 0; 1197 this.initialized = 0; 1198 } 1199 @Override 1200 public boolean equals(Object object) 1201 { 1202 if (!(object instanceof LogBean)) { 1203 return false; 1204 } 1205 1206 LogBean obj = (LogBean) object; 1207 return new EqualsBuilder() 1208 .append(getId(), obj.getId()) 1209 .append(getPersonId(), obj.getPersonId()) 1210 .append(getDeviceId(), obj.getDeviceId()) 1211 .append(getVerifyFeature(), obj.getVerifyFeature()) 1212 .append(getCompareFace(), obj.getCompareFace()) 1213 .append(getVerifyStatus(), obj.getVerifyStatus()) 1214 .append(getSimilarty(), obj.getSimilarty()) 1215 .append(getDirection(), obj.getDirection()) 1216 .append(getVerifyTime(), obj.getVerifyTime()) 1217 .append(getCreateTime(), obj.getCreateTime()) 1218 .isEquals(); 1219 } 1220 1221 @Override 1222 public int hashCode() 1223 { 1224 return new HashCodeBuilder(-82280557, -700257973) 1225 .append(getId()) 1226 .toHashCode(); 1227 } 1228 1229 @Override 1230 public String toString() { 1231 return toString(true,false); 1232 } 1233 /** 1234 * cast byte array to HEX string 1235 * 1236 * @param input 1237 * @return {@code null} if {@code input} is null 1238 */ 1239 private static final String toHex(byte[] input) { 1240 if (null == input){ 1241 return null; 1242 } 1243 StringBuffer sb = new StringBuffer(input.length * 2); 1244 for (int i = 0; i < input.length; i++) { 1245 sb.append(Character.forDigit((input[i] & 240) >> 4, 16)); 1246 sb.append(Character.forDigit(input[i] & 15, 16)); 1247 } 1248 return sb.toString(); 1249 } 1250 protected static final StringBuilder append(StringBuilder buffer,boolean full,byte[] value){ 1251 if(full || null == value){ 1252 buffer.append(toHex(value)); 1253 }else{ 1254 buffer.append(value.length).append(" bytes"); 1255 } 1256 return buffer; 1257 } 1258 private static int stringLimit = 64; 1259 private static final int MINIMUM_LIMIT = 16; 1260 protected static final StringBuilder append(StringBuilder buffer,boolean full,String value){ 1261 if(full || null == value || value.length() <= stringLimit){ 1262 buffer.append(value); 1263 }else{ 1264 buffer.append(value.substring(0,stringLimit - 8)).append(" ...").append(value.substring(stringLimit-4,stringLimit)); 1265 } 1266 return buffer; 1267 } 1268 protected static final <T>StringBuilder append(StringBuilder buffer,boolean full,T value){ 1269 return buffer.append(value); 1270 } 1271 public static final void setStringLimit(int limit){ 1272 if(limit < MINIMUM_LIMIT){ 1273 throw new IllegalArgumentException(String.format("INVALID limit %d,minimum value %d",limit,MINIMUM_LIMIT)); 1274 } 1275 stringLimit = limit; 1276 } 1277 @Override 1278 public String toString(boolean notNull, boolean fullIfStringOrBytes) { 1279 // only output initialized field 1280 StringBuilder builder = new StringBuilder(this.getClass().getName()).append("@").append(Integer.toHexString(this.hashCode())).append("["); 1281 int count = 0; 1282 if(checkIdInitialized()){ 1283 if(!notNull || null != getId()){ 1284 if(count++ >0){ 1285 builder.append(","); 1286 } 1287 builder.append("id="); 1288 append(builder,fullIfStringOrBytes,getId()); 1289 } 1290 } 1291 if(checkPersonIdInitialized()){ 1292 if(!notNull || null != getPersonId()){ 1293 if(count++ >0){ 1294 builder.append(","); 1295 } 1296 builder.append("person_id="); 1297 append(builder,fullIfStringOrBytes,getPersonId()); 1298 } 1299 } 1300 if(checkDeviceIdInitialized()){ 1301 if(!notNull || null != getDeviceId()){ 1302 if(count++ >0){ 1303 builder.append(","); 1304 } 1305 builder.append("device_id="); 1306 append(builder,fullIfStringOrBytes,getDeviceId()); 1307 } 1308 } 1309 if(checkVerifyFeatureInitialized()){ 1310 if(!notNull || null != getVerifyFeature()){ 1311 if(count++ >0){ 1312 builder.append(","); 1313 } 1314 builder.append("verify_feature="); 1315 append(builder,fullIfStringOrBytes,getVerifyFeature()); 1316 } 1317 } 1318 if(checkCompareFaceInitialized()){ 1319 if(!notNull || null != getCompareFace()){ 1320 if(count++ >0){ 1321 builder.append(","); 1322 } 1323 builder.append("compare_face="); 1324 append(builder,fullIfStringOrBytes,getCompareFace()); 1325 } 1326 } 1327 if(checkVerifyStatusInitialized()){ 1328 if(!notNull || null != getVerifyStatus()){ 1329 if(count++ >0){ 1330 builder.append(","); 1331 } 1332 builder.append("verify_status="); 1333 append(builder,fullIfStringOrBytes,getVerifyStatus()); 1334 } 1335 } 1336 if(checkSimilartyInitialized()){ 1337 if(!notNull || null != getSimilarty()){ 1338 if(count++ >0){ 1339 builder.append(","); 1340 } 1341 builder.append("similarty="); 1342 append(builder,fullIfStringOrBytes,getSimilarty()); 1343 } 1344 } 1345 if(checkDirectionInitialized()){ 1346 if(!notNull || null != getDirection()){ 1347 if(count++ >0){ 1348 builder.append(","); 1349 } 1350 builder.append("direction="); 1351 append(builder,fullIfStringOrBytes,getDirection()); 1352 } 1353 } 1354 if(checkVerifyTimeInitialized()){ 1355 if(!notNull || null != getVerifyTime()){ 1356 if(count++ >0){ 1357 builder.append(","); 1358 } 1359 builder.append("verify_time="); 1360 append(builder,fullIfStringOrBytes,getVerifyTime()); 1361 } 1362 } 1363 if(checkCreateTimeInitialized()){ 1364 if(!notNull || null != getCreateTime()){ 1365 if(count++ >0){ 1366 builder.append(","); 1367 } 1368 builder.append("create_time="); 1369 append(builder,fullIfStringOrBytes,getCreateTime()); 1370 } 1371 } 1372 builder.append("]"); 1373 return builder.toString(); 1374 } 1375 @Override 1376 public int compareTo(LogBean object){ 1377 return new CompareToBuilder() 1378 .append(getId(), object.getId()) 1379 .append(getPersonId(), object.getPersonId()) 1380 .append(getDeviceId(), object.getDeviceId()) 1381 .append(getVerifyFeature(), object.getVerifyFeature()) 1382 .append(getCompareFace(), object.getCompareFace()) 1383 .append(getVerifyStatus(), object.getVerifyStatus()) 1384 .append(getSimilarty(), object.getSimilarty()) 1385 .append(getDirection(), object.getDirection()) 1386 .append(getVerifyTime(), object.getVerifyTime()) 1387 .append(getCreateTime(), object.getCreateTime()) 1388 .toComparison(); 1389 } 1390 @Override 1391 public LogBean clone(){ 1392 try { 1393 return (LogBean) super.clone(); 1394 } catch (CloneNotSupportedException e) { 1395 throw new RuntimeException(e); 1396 } 1397 } 1398 /** 1399 * Make {@code this} to a NULL bean<br> 1400 * set all fields to null, {@link #modified} and {@link #initialized} be set to 0 1401 * @return {@code this} bean 1402 * @author guyadong 1403 */ 1404 public LogBean asNULL() 1405 { 1406 checkMutable(); 1407 1408 setId((Integer)null); 1409 setPersonId((Integer)null); 1410 setDeviceId((Integer)null); 1411 setVerifyFeature((String)null); 1412 setCompareFace((Integer)null); 1413 setVerifyStatus((Integer)null); 1414 setSimilarty((Double)null); 1415 setDirection((Integer)null); 1416 setVerifyTime((java.util.Date)null); 1417 setCreateTime((java.util.Date)null); 1418 isNew(true); 1419 resetInitialized(); 1420 resetIsModified(); 1421 return this; 1422 } 1423 /** 1424 * check whether this bean is a NULL bean 1425 * @return {@code true} if {@link #initialized} be set to zero 1426 * @see #asNULL() 1427 */ 1428 public boolean checkNULL(){ 1429 return 0 == getInitialized(); 1430 } 1431 /** 1432 * @param source source list 1433 * @return {@code source} replace {@code null} element with null instance({@link #NULL}) 1434 */ 1435 public static final List<LogBean> replaceNull(List<LogBean> source){ 1436 if(null != source){ 1437 for(int i = 0,endIndex = source.size();i<endIndex;++i){ 1438 if(null == source.get(i)){ 1439 source.set(i, NULL); 1440 } 1441 } 1442 } 1443 return source; 1444 } 1445 /** 1446 * @param source input list 1447 * @return replace null instance element with {@code null} 1448 * @see #checkNULL() 1449 */ 1450 public static final List<LogBean> replaceNullInstance(List<LogBean> source){ 1451 if(null != source){ 1452 for(int i = 0,endIndex = source.size();i<endIndex;++i){ 1453 if(source.get(i).checkNULL()){ 1454 source.set(i, null); 1455 } 1456 } 1457 } 1458 return source; 1459 } 1460 @Override 1461 public LogBean copy(LogBean bean) 1462 { 1463 return copy(bean,new int[]{}); 1464 } 1465 @Override 1466 public LogBean copy(LogBean bean, int... fieldList) 1467 { 1468 if (null == fieldList || 0 == fieldList.length){ 1469 fieldList = new int[]{0,1,2,3,4,5,6,7,8,9}; 1470 } 1471 for (int i = 0; i < fieldList.length; ++i) { 1472 if( bean.isInitialized(fieldList[i]) && !Objects.deepEquals(bean.getValue(fieldList[i]), getValue(fieldList[i]))){ 1473 setValue(fieldList[i], bean.getValue(fieldList[i])); 1474 } 1475 } 1476 return this; 1477 } 1478 1479 @Override 1480 public LogBean copy(LogBean bean, String... fieldList) 1481 { 1482 if (null == fieldList || 0 == fieldList.length){ 1483 copy(bean,(int[])null); 1484 }else{ 1485 int field; 1486 for (int i = 0; i < fieldList.length; i++) { 1487 field = columnIDOf(fieldList[i].trim()); 1488 if(bean.isInitialized(field) && !Objects.deepEquals(bean.getValue(field), getValue(field))){ 1489 setValue(field, bean.getValue(field)); 1490 } 1491 } 1492 } 1493 return this; 1494 } 1495 1496 @SuppressWarnings("unchecked") 1497 @Override 1498 public <T>T getValue(int columnID) 1499 { 1500 switch( columnID ){ 1501 case FL_LOG_ID_ID: 1502 return (T)getId(); 1503 case FL_LOG_ID_PERSON_ID: 1504 return (T)getPersonId(); 1505 case FL_LOG_ID_DEVICE_ID: 1506 return (T)getDeviceId(); 1507 case FL_LOG_ID_VERIFY_FEATURE: 1508 return (T)getVerifyFeature(); 1509 case FL_LOG_ID_COMPARE_FACE: 1510 return (T)getCompareFace(); 1511 case FL_LOG_ID_VERIFY_STATUS: 1512 return (T)getVerifyStatus(); 1513 case FL_LOG_ID_SIMILARTY: 1514 return (T)getSimilarty(); 1515 case FL_LOG_ID_DIRECTION: 1516 return (T)getDirection(); 1517 case FL_LOG_ID_VERIFY_TIME: 1518 return (T)getVerifyTime(); 1519 case FL_LOG_ID_CREATE_TIME: 1520 return (T)getCreateTime(); 1521 default: 1522 return null; 1523 } 1524 } 1525 1526 @Override 1527 public <T> void setValue(int columnID,T value) 1528 { 1529 switch( columnID ) { 1530 case FL_LOG_ID_ID: 1531 setId((Integer)value); 1532 break; 1533 case FL_LOG_ID_PERSON_ID: 1534 setPersonId((Integer)value); 1535 break; 1536 case FL_LOG_ID_DEVICE_ID: 1537 setDeviceId((Integer)value); 1538 break; 1539 case FL_LOG_ID_VERIFY_FEATURE: 1540 setVerifyFeature((String)value); 1541 break; 1542 case FL_LOG_ID_COMPARE_FACE: 1543 setCompareFace((Integer)value); 1544 break; 1545 case FL_LOG_ID_VERIFY_STATUS: 1546 setVerifyStatus((Integer)value); 1547 break; 1548 case FL_LOG_ID_SIMILARTY: 1549 setSimilarty((Double)value); 1550 break; 1551 case FL_LOG_ID_DIRECTION: 1552 setDirection((Integer)value); 1553 break; 1554 case FL_LOG_ID_VERIFY_TIME: 1555 setVerifyTime((java.util.Date)value); 1556 break; 1557 case FL_LOG_ID_CREATE_TIME: 1558 setCreateTime((java.util.Date)value); 1559 break; 1560 default: 1561 break; 1562 } 1563 } 1564 1565 @Override 1566 public <T> T getValue(String column) 1567 { 1568 return getValue(columnIDOf(column)); 1569 } 1570 1571 @Override 1572 public <T> void setValue(String column,T value) 1573 { 1574 setValue(columnIDOf(column),value); 1575 } 1576 1577 /** 1578 * @param column column name 1579 * @return column id for the given field name or negative if {@code column} is invalid name 1580 */ 1581 public static int columnIDOf(String column){ 1582 int index = FL_LOG_FIELDS_LIST.indexOf(column); 1583 return index < 0 1584 ? FL_LOG_JAVA_FIELDS_LIST.indexOf(column) 1585 : index; 1586 } 1587 1588 public static String columnNameOf(int columnId){ 1589 try{ 1590 return FL_LOG_FIELDS_LIST.get(columnId); 1591 } catch(IndexOutOfBoundsException e){ 1592 return null; 1593 } 1594 } 1595 1596 public static Class<?> typeOf(int columnId){ 1597 try{ 1598 return FL_LOG_FIELD_TYPES[columnId]; 1599 } catch(IndexOutOfBoundsException e){ 1600 return null; 1601 } 1602 } 1603 1604 public static final Builder builder(){ 1605 return new Builder().reset(); 1606 } 1607 /** 1608 * a builder for LogBean,the template instance is thread local variable 1609 * a instance of Builder can be reused. 1610 */ 1611 public static final class Builder{ 1612 /** LogBean instance used for template to create new LogBean instance. */ 1613 static final ThreadLocal<LogBean> TEMPLATE = new ThreadLocal<LogBean>(){ 1614 @Override 1615 protected LogBean initialValue() { 1616 return new LogBean(); 1617 }}; 1618 private Builder() {} 1619 /** 1620 * reset the bean as template 1621 * @see LogBean#reset() 1622 */ 1623 public Builder reset(){ 1624 TEMPLATE.get().reset(); 1625 return this; 1626 } 1627 /** set a bean as template,must not be {@code null} */ 1628 public Builder template(LogBean bean){ 1629 if(null == bean){ 1630 throw new NullPointerException(); 1631 } 1632 TEMPLATE.set(bean); 1633 return this; 1634 } 1635 /** return a clone instance of {@link #TEMPLATE}*/ 1636 public LogBean build(){ 1637 return TEMPLATE.get().clone(); 1638 } 1639 /** 1640 * fill the field : fl_log.id 1641 * @param id 日志id 1642 * @see LogBean#getId() 1643 * @see LogBean#setId(Integer) 1644 */ 1645 public Builder id(Integer id){ 1646 TEMPLATE.get().setId(id); 1647 return this; 1648 } 1649 /** 1650 * fill the field : fl_log.person_id 1651 * @param personId 外键,用户id 1652 * @see LogBean#getPersonId() 1653 * @see LogBean#setPersonId(Integer) 1654 */ 1655 public Builder personId(Integer personId){ 1656 TEMPLATE.get().setPersonId(personId); 1657 return this; 1658 } 1659 /** 1660 * fill the field : fl_log.device_id 1661 * @param deviceId 外键,日志来源设备id 1662 * @see LogBean#getDeviceId() 1663 * @see LogBean#setDeviceId(Integer) 1664 */ 1665 public Builder deviceId(Integer deviceId){ 1666 TEMPLATE.get().setDeviceId(deviceId); 1667 return this; 1668 } 1669 /** 1670 * fill the field : fl_log.verify_feature 1671 * @param verifyFeature 外键,用于验证身份的人脸特征数据MD5 id 1672 * @see LogBean#getVerifyFeature() 1673 * @see LogBean#setVerifyFeature(String) 1674 */ 1675 public Builder verifyFeature(String verifyFeature){ 1676 TEMPLATE.get().setVerifyFeature(verifyFeature); 1677 return this; 1678 } 1679 /** 1680 * fill the field : fl_log.compare_face 1681 * @param compareFace 外键,现场采集的人脸信息记录id 1682 * @see LogBean#getCompareFace() 1683 * @see LogBean#setCompareFace(Integer) 1684 */ 1685 public Builder compareFace(Integer compareFace){ 1686 TEMPLATE.get().setCompareFace(compareFace); 1687 return this; 1688 } 1689 /** 1690 * fill the field : fl_log.verify_status 1691 * @param verifyStatus 验证状态,NULL,0:允许通过,其他:拒绝 1692 * @see LogBean#getVerifyStatus() 1693 * @see LogBean#setVerifyStatus(Integer) 1694 */ 1695 public Builder verifyStatus(Integer verifyStatus){ 1696 TEMPLATE.get().setVerifyStatus(verifyStatus); 1697 return this; 1698 } 1699 /** 1700 * fill the field : fl_log.similarty 1701 * @param similarty 验证相似度 1702 * @see LogBean#getSimilarty() 1703 * @see LogBean#setSimilarty(Double) 1704 */ 1705 public Builder similarty(Double similarty){ 1706 TEMPLATE.get().setSimilarty(similarty); 1707 return this; 1708 } 1709 /** 1710 * fill the field : fl_log.direction 1711 * @param direction 通行方向,NULL,0:入口,1:出口,默认0 1712 * @see LogBean#getDirection() 1713 * @see LogBean#setDirection(Integer) 1714 */ 1715 public Builder direction(Integer direction){ 1716 TEMPLATE.get().setDirection(direction); 1717 return this; 1718 } 1719 /** 1720 * fill the field : fl_log.verify_time 1721 * @param verifyTime 验证时间(可能由前端设备提供时间) 1722 * @see LogBean#getVerifyTime() 1723 * @see LogBean#setVerifyTime(java.util.Date) 1724 */ 1725 public Builder verifyTime(java.util.Date verifyTime){ 1726 TEMPLATE.get().setVerifyTime(verifyTime); 1727 return this; 1728 } 1729 /** 1730 * fill the field : fl_log.create_time 1731 * @param createTime 1732 * @see LogBean#getCreateTime() 1733 * @see LogBean#setCreateTime(java.util.Date) 1734 */ 1735 public Builder createTime(java.util.Date createTime){ 1736 TEMPLATE.get().setCreateTime(createTime); 1737 return this; 1738 } 1739 } 1740}