All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.facelog.db.mysql.DbConverter Maven / Gradle / Ivy

There is a newer version: 2.5.1
Show newest version
// ______________________________________________________
// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 
// modified by guyadong from
// sql2java original version https://sourceforge.net/projects/sql2java/ 
// JDBC driver used at code generation time: com.mysql.jdbc.Driver
// template: impl.dbconverter.java.vm
// ______________________________________________________
package net.gdface.facelog.db.mysql;

import java.util.Vector;
import net.gdface.facelog.db.IBeanConverter;
import net.gdface.facelog.db.IDbConverter;

import net.gdface.facelog.db.DeviceBean;
import net.gdface.facelog.db.DeviceGroupBean;
import net.gdface.facelog.db.FaceBean;
import net.gdface.facelog.db.FeatureBean;
import net.gdface.facelog.db.ImageBean;
import net.gdface.facelog.db.LogBean;
import net.gdface.facelog.db.PermitBean;
import net.gdface.facelog.db.PersonBean;
import net.gdface.facelog.db.PersonGroupBean;
import net.gdface.facelog.db.StoreBean;
import net.gdface.facelog.db.LogLightBean;

/**
 * {@link IDbConverter} implemention for MySQL
 * @author guyadong
 *
 */
public class DbConverter implements IDbConverter<
                                                net.gdface.facelog.dborm.device.FlDeviceBean,
                                                net.gdface.facelog.dborm.device.FlDeviceGroupBean,
                                                net.gdface.facelog.dborm.face.FlFaceBean,
                                                net.gdface.facelog.dborm.face.FlFeatureBean,
                                                net.gdface.facelog.dborm.image.FlImageBean,
                                                net.gdface.facelog.dborm.log.FlLogBean,
                                                net.gdface.facelog.dborm.permit.FlPermitBean,
                                                net.gdface.facelog.dborm.person.FlPersonBean,
                                                net.gdface.facelog.dborm.person.FlPersonGroupBean,
                                                net.gdface.facelog.dborm.image.FlStoreBean,
                                                net.gdface.facelog.dborm.log.FlLogLightBean> {
    public static final IBeanConverter CONVERTER_DEVICEBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(DeviceBean left, net.gdface.facelog.dborm.device.FlDeviceBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkGroupIdInitialized()){
                left.setGroupId(right.getGroupId());
            }
            if(right.checkNameInitialized()){
                left.setName(right.getName());
            }
            if(right.checkProductNameInitialized()){
                left.setProductName(right.getProductName());
            }
            if(right.checkModelInitialized()){
                left.setModel(right.getModel());
            }
            if(right.checkVendorInitialized()){
                left.setVendor(right.getVendor());
            }
            if(right.checkManufacturerInitialized()){
                left.setManufacturer(right.getManufacturer());
            }
            if(right.checkMadeDateInitialized()){
                left.setMadeDate(right.getMadeDate());
            }
            if(right.checkVersionInitialized()){
                left.setVersion(right.getVersion());
            }
            if(right.checkUsedSdksInitialized()){
                left.setUsedSdks(right.getUsedSdks());
            }
            if(right.checkSerialNoInitialized()){
                left.setSerialNo(right.getSerialNo());
            }
            if(right.checkMacInitialized()){
                left.setMac(right.getMac());
            }
            if(right.checkRemarkInitialized()){
                left.setRemark(right.getRemark());
            }
            if(right.checkExtBinInitialized()){
                left.setExtBin(right.getExtBin());
            }
            if(right.checkExtTxtInitialized()){
                left.setExtTxt(right.getExtTxt());
            }
            if(right.checkCreateTimeInitialized()){
                left.setCreateTime(right.getCreateTime());
            }
            if(right.checkUpdateTimeInitialized()){
                left.setUpdateTime(right.getUpdateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(DeviceBean left, net.gdface.facelog.dborm.device.FlDeviceBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkGroupIdInitialized() ){
                right.setGroupId(left.getGroupId());
            }
            if(left.checkNameInitialized() ){
                right.setName(left.getName());
            }
            if(left.checkProductNameInitialized() ){
                right.setProductName(left.getProductName());
            }
            if(left.checkModelInitialized() ){
                right.setModel(left.getModel());
            }
            if(left.checkVendorInitialized() ){
                right.setVendor(left.getVendor());
            }
            if(left.checkManufacturerInitialized() ){
                right.setManufacturer(left.getManufacturer());
            }
            if(left.checkMadeDateInitialized() ){
                right.setMadeDate(left.getMadeDate());
            }
            if(left.checkVersionInitialized() ){
                right.setVersion(left.getVersion());
            }
            if(left.checkUsedSdksInitialized() ){
                right.setUsedSdks(left.getUsedSdks());
            }
            if(left.checkSerialNoInitialized() ){
                right.setSerialNo(left.getSerialNo());
            }
            if(left.checkMacInitialized() ){
                right.setMac(left.getMac());
            }
            if(left.checkRemarkInitialized() ){
                right.setRemark(left.getRemark());
            }
            if(left.checkExtBinInitialized() ){
                right.setExtBin(left.getExtBin());
            }
            if(left.checkExtTxtInitialized() ){
                right.setExtTxt(left.getExtTxt());
            }
// IGNORE field fl_device.create_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkCreateTimeInitialized() ){
//                 right.setCreateTime(left.getCreateTime());
//             }
// IGNORE field fl_device.update_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkUpdateTimeInitialized() ){
//                 right.setUpdateTime(left.getUpdateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_DEVICEGROUPBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(DeviceGroupBean left, net.gdface.facelog.dborm.device.FlDeviceGroupBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkNameInitialized()){
                left.setName(right.getName());
            }
            if(right.checkLeafInitialized()){
                left.setLeaf(right.getLeaf());
            }
            if(right.checkParentInitialized()){
                left.setParent(right.getParent());
            }
            if(right.checkRootGroupInitialized()){
                left.setRootGroup(right.getRootGroup());
            }
            if(right.checkScheduleInitialized()){
                left.setSchedule(right.getSchedule());
            }
            if(right.checkRemarkInitialized()){
                left.setRemark(right.getRemark());
            }
            if(right.checkExtBinInitialized()){
                left.setExtBin(right.getExtBin());
            }
            if(right.checkExtTxtInitialized()){
                left.setExtTxt(right.getExtTxt());
            }
            if(right.checkCreateTimeInitialized()){
                left.setCreateTime(right.getCreateTime());
            }
            if(right.checkUpdateTimeInitialized()){
                left.setUpdateTime(right.getUpdateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(DeviceGroupBean left, net.gdface.facelog.dborm.device.FlDeviceGroupBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkNameInitialized() ){
                right.setName(left.getName());
            }
            if(left.checkLeafInitialized() ){
                right.setLeaf(left.getLeaf());
            }
            if(left.checkParentInitialized() ){
                right.setParent(left.getParent());
            }
            if(left.checkRootGroupInitialized() ){
                right.setRootGroup(left.getRootGroup());
            }
            if(left.checkScheduleInitialized() ){
                right.setSchedule(left.getSchedule());
            }
            if(left.checkRemarkInitialized() ){
                right.setRemark(left.getRemark());
            }
            if(left.checkExtBinInitialized() ){
                right.setExtBin(left.getExtBin());
            }
            if(left.checkExtTxtInitialized() ){
                right.setExtTxt(left.getExtTxt());
            }
// IGNORE field fl_device_group.create_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkCreateTimeInitialized() ){
//                 right.setCreateTime(left.getCreateTime());
//             }
// IGNORE field fl_device_group.update_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkUpdateTimeInitialized() ){
//                 right.setUpdateTime(left.getUpdateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_FACEBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(FaceBean left, net.gdface.facelog.dborm.face.FlFaceBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkImageMd5Initialized()){
                left.setImageMd5(right.getImageMd5());
            }
            if(right.checkFaceLeftInitialized()){
                left.setFaceLeft(right.getFaceLeft());
            }
            if(right.checkFaceTopInitialized()){
                left.setFaceTop(right.getFaceTop());
            }
            if(right.checkFaceWidthInitialized()){
                left.setFaceWidth(right.getFaceWidth());
            }
            if(right.checkFaceHeightInitialized()){
                left.setFaceHeight(right.getFaceHeight());
            }
            if(right.checkEyeLeftxInitialized()){
                left.setEyeLeftx(right.getEyeLeftx());
            }
            if(right.checkEyeLeftyInitialized()){
                left.setEyeLefty(right.getEyeLefty());
            }
            if(right.checkEyeRightxInitialized()){
                left.setEyeRightx(right.getEyeRightx());
            }
            if(right.checkEyeRightyInitialized()){
                left.setEyeRighty(right.getEyeRighty());
            }
            if(right.checkMouthXInitialized()){
                left.setMouthX(right.getMouthX());
            }
            if(right.checkMouthYInitialized()){
                left.setMouthY(right.getMouthY());
            }
            if(right.checkNoseXInitialized()){
                left.setNoseX(right.getNoseX());
            }
            if(right.checkNoseYInitialized()){
                left.setNoseY(right.getNoseY());
            }
            if(right.checkAngleYawInitialized()){
                left.setAngleYaw(right.getAngleYaw());
            }
            if(right.checkAnglePitchInitialized()){
                left.setAnglePitch(right.getAnglePitch());
            }
            if(right.checkAngleRollInitialized()){
                left.setAngleRoll(right.getAngleRoll());
            }
            if(right.checkExtInfoInitialized()){
                left.setExtInfo(right.getExtInfo());
            }
            if(right.checkFeatureMd5Initialized()){
                left.setFeatureMd5(right.getFeatureMd5());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(FaceBean left, net.gdface.facelog.dborm.face.FlFaceBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkImageMd5Initialized() ){
                right.setImageMd5(left.getImageMd5());
            }
            if(left.checkFaceLeftInitialized() ){
                right.setFaceLeft(left.getFaceLeft());
            }
            if(left.checkFaceTopInitialized() ){
                right.setFaceTop(left.getFaceTop());
            }
            if(left.checkFaceWidthInitialized() ){
                right.setFaceWidth(left.getFaceWidth());
            }
            if(left.checkFaceHeightInitialized() ){
                right.setFaceHeight(left.getFaceHeight());
            }
            if(left.checkEyeLeftxInitialized() ){
                right.setEyeLeftx(left.getEyeLeftx());
            }
            if(left.checkEyeLeftyInitialized() ){
                right.setEyeLefty(left.getEyeLefty());
            }
            if(left.checkEyeRightxInitialized() ){
                right.setEyeRightx(left.getEyeRightx());
            }
            if(left.checkEyeRightyInitialized() ){
                right.setEyeRighty(left.getEyeRighty());
            }
            if(left.checkMouthXInitialized() ){
                right.setMouthX(left.getMouthX());
            }
            if(left.checkMouthYInitialized() ){
                right.setMouthY(left.getMouthY());
            }
            if(left.checkNoseXInitialized() ){
                right.setNoseX(left.getNoseX());
            }
            if(left.checkNoseYInitialized() ){
                right.setNoseY(left.getNoseY());
            }
            if(left.checkAngleYawInitialized() ){
                right.setAngleYaw(left.getAngleYaw());
            }
            if(left.checkAnglePitchInitialized() ){
                right.setAnglePitch(left.getAnglePitch());
            }
            if(left.checkAngleRollInitialized() ){
                right.setAngleRoll(left.getAngleRoll());
            }
            if(left.checkExtInfoInitialized() ){
                right.setExtInfo(left.getExtInfo());
            }
            if(left.checkFeatureMd5Initialized() ){
                right.setFeatureMd5(left.getFeatureMd5());
            }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_FEATUREBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(FeatureBean left, net.gdface.facelog.dborm.face.FlFeatureBean right) {
            if(right.checkMd5Initialized()){
                left.setMd5(right.getMd5());
            }
            if(right.checkVersionInitialized()){
                left.setVersion(right.getVersion());
            }
            if(right.checkPersonIdInitialized()){
                left.setPersonId(right.getPersonId());
            }
            if(right.checkFeatureInitialized()){
                left.setFeature(right.getFeature());
            }
            if(right.checkUpdateTimeInitialized()){
                left.setUpdateTime(right.getUpdateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(FeatureBean left, net.gdface.facelog.dborm.face.FlFeatureBean right) {
            if(left.checkMd5Initialized() ){
                right.setMd5(left.getMd5());
            }
            if(left.checkVersionInitialized() ){
                right.setVersion(left.getVersion());
            }
            if(left.checkPersonIdInitialized() ){
                right.setPersonId(left.getPersonId());
            }
            if(left.checkFeatureInitialized() ){
                right.setFeature(left.getFeature());
            }
// IGNORE field fl_feature.update_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkUpdateTimeInitialized() ){
//                 right.setUpdateTime(left.getUpdateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_IMAGEBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(ImageBean left, net.gdface.facelog.dborm.image.FlImageBean right) {
            if(right.checkMd5Initialized()){
                left.setMd5(right.getMd5());
            }
            if(right.checkFormatInitialized()){
                left.setFormat(right.getFormat());
            }
            if(right.checkWidthInitialized()){
                left.setWidth(right.getWidth());
            }
            if(right.checkHeightInitialized()){
                left.setHeight(right.getHeight());
            }
            if(right.checkDepthInitialized()){
                left.setDepth(right.getDepth());
            }
            if(right.checkFaceNumInitialized()){
                left.setFaceNum(right.getFaceNum());
            }
            if(right.checkThumbMd5Initialized()){
                left.setThumbMd5(right.getThumbMd5());
            }
            if(right.checkDeviceIdInitialized()){
                left.setDeviceId(right.getDeviceId());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(ImageBean left, net.gdface.facelog.dborm.image.FlImageBean right) {
            if(left.checkMd5Initialized() ){
                right.setMd5(left.getMd5());
            }
            if(left.checkFormatInitialized() ){
                right.setFormat(left.getFormat());
            }
            if(left.checkWidthInitialized() ){
                right.setWidth(left.getWidth());
            }
            if(left.checkHeightInitialized() ){
                right.setHeight(left.getHeight());
            }
            if(left.checkDepthInitialized() ){
                right.setDepth(left.getDepth());
            }
            if(left.checkFaceNumInitialized() ){
                right.setFaceNum(left.getFaceNum());
            }
            if(left.checkThumbMd5Initialized() ){
                right.setThumbMd5(left.getThumbMd5());
            }
            if(left.checkDeviceIdInitialized() ){
                right.setDeviceId(left.getDeviceId());
            }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_LOGBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(LogBean left, net.gdface.facelog.dborm.log.FlLogBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkPersonIdInitialized()){
                left.setPersonId(right.getPersonId());
            }
            if(right.checkDeviceIdInitialized()){
                left.setDeviceId(right.getDeviceId());
            }
            if(right.checkVerifyFeatureInitialized()){
                left.setVerifyFeature(right.getVerifyFeature());
            }
            if(right.checkCompareFaceInitialized()){
                left.setCompareFace(right.getCompareFace());
            }
            if(right.checkVerifyStatusInitialized()){
                left.setVerifyStatus(right.getVerifyStatus());
            }
            if(right.checkSimilartyInitialized()){
                left.setSimilarty(right.getSimilarty());
            }
            if(right.checkVerifyTimeInitialized()){
                left.setVerifyTime(right.getVerifyTime());
            }
            if(right.checkCreateTimeInitialized()){
                left.setCreateTime(right.getCreateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(LogBean left, net.gdface.facelog.dborm.log.FlLogBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkPersonIdInitialized() ){
                right.setPersonId(left.getPersonId());
            }
            if(left.checkDeviceIdInitialized() ){
                right.setDeviceId(left.getDeviceId());
            }
            if(left.checkVerifyFeatureInitialized() ){
                right.setVerifyFeature(left.getVerifyFeature());
            }
            if(left.checkCompareFaceInitialized() ){
                right.setCompareFace(left.getCompareFace());
            }
            if(left.checkVerifyStatusInitialized() ){
                right.setVerifyStatus(left.getVerifyStatus());
            }
            if(left.checkSimilartyInitialized() ){
                right.setSimilarty(left.getSimilarty());
            }
            if(left.checkVerifyTimeInitialized() ){
                right.setVerifyTime(left.getVerifyTime());
            }
// IGNORE field fl_log.create_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkCreateTimeInitialized() ){
//                 right.setCreateTime(left.getCreateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_PERMITBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(PermitBean left, net.gdface.facelog.dborm.permit.FlPermitBean right) {
            if(right.checkDeviceGroupIdInitialized()){
                left.setDeviceGroupId(right.getDeviceGroupId());
            }
            if(right.checkPersonGroupIdInitialized()){
                left.setPersonGroupId(right.getPersonGroupId());
            }
            if(right.checkScheduleInitialized()){
                left.setSchedule(right.getSchedule());
            }
            if(right.checkRemarkInitialized()){
                left.setRemark(right.getRemark());
            }
            if(right.checkExtBinInitialized()){
                left.setExtBin(right.getExtBin());
            }
            if(right.checkExtTxtInitialized()){
                left.setExtTxt(right.getExtTxt());
            }
            if(right.checkCreateTimeInitialized()){
                left.setCreateTime(right.getCreateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(PermitBean left, net.gdface.facelog.dborm.permit.FlPermitBean right) {
            if(left.checkDeviceGroupIdInitialized() ){
                right.setDeviceGroupId(left.getDeviceGroupId());
            }
            if(left.checkPersonGroupIdInitialized() ){
                right.setPersonGroupId(left.getPersonGroupId());
            }
            if(left.checkScheduleInitialized() ){
                right.setSchedule(left.getSchedule());
            }
            if(left.checkRemarkInitialized() ){
                right.setRemark(left.getRemark());
            }
            if(left.checkExtBinInitialized() ){
                right.setExtBin(left.getExtBin());
            }
            if(left.checkExtTxtInitialized() ){
                right.setExtTxt(left.getExtTxt());
            }
// IGNORE field fl_permit.create_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkCreateTimeInitialized() ){
//                 right.setCreateTime(left.getCreateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_PERSONBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(PersonBean left, net.gdface.facelog.dborm.person.FlPersonBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkGroupIdInitialized()){
                left.setGroupId(right.getGroupId());
            }
            if(right.checkNameInitialized()){
                left.setName(right.getName());
            }
            if(right.checkSexInitialized()){
                left.setSex(right.getSex());
            }
            if(right.checkRankInitialized()){
                left.setRank(right.getRank());
            }
            if(right.checkPasswordInitialized()){
                left.setPassword(right.getPassword());
            }
            if(right.checkBirthdateInitialized()){
                left.setBirthdate(right.getBirthdate());
            }
            if(right.checkMobilePhoneInitialized()){
                left.setMobilePhone(right.getMobilePhone());
            }
            if(right.checkPapersTypeInitialized()){
                left.setPapersType(right.getPapersType());
            }
            if(right.checkPapersNumInitialized()){
                left.setPapersNum(right.getPapersNum());
            }
            if(right.checkImageMd5Initialized()){
                left.setImageMd5(right.getImageMd5());
            }
            if(right.checkExpiryDateInitialized()){
                left.setExpiryDate(right.getExpiryDate());
            }
            if(right.checkRemarkInitialized()){
                left.setRemark(right.getRemark());
            }
            if(right.checkExtBinInitialized()){
                left.setExtBin(right.getExtBin());
            }
            if(right.checkExtTxtInitialized()){
                left.setExtTxt(right.getExtTxt());
            }
            if(right.checkCreateTimeInitialized()){
                left.setCreateTime(right.getCreateTime());
            }
            if(right.checkUpdateTimeInitialized()){
                left.setUpdateTime(right.getUpdateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(PersonBean left, net.gdface.facelog.dborm.person.FlPersonBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkGroupIdInitialized() ){
                right.setGroupId(left.getGroupId());
            }
            if(left.checkNameInitialized() ){
                right.setName(left.getName());
            }
            if(left.checkSexInitialized() ){
                right.setSex(left.getSex());
            }
            if(left.checkRankInitialized() ){
                right.setRank(left.getRank());
            }
            if(left.checkPasswordInitialized() ){
                right.setPassword(left.getPassword());
            }
            if(left.checkBirthdateInitialized() ){
                right.setBirthdate(left.getBirthdate());
            }
            if(left.checkMobilePhoneInitialized() ){
                right.setMobilePhone(left.getMobilePhone());
            }
            if(left.checkPapersTypeInitialized() ){
                right.setPapersType(left.getPapersType());
            }
            if(left.checkPapersNumInitialized() ){
                right.setPapersNum(left.getPapersNum());
            }
            if(left.checkImageMd5Initialized() ){
                right.setImageMd5(left.getImageMd5());
            }
            if(left.checkExpiryDateInitialized() ){
                right.setExpiryDate(left.getExpiryDate());
            }
            if(left.checkRemarkInitialized() ){
                right.setRemark(left.getRemark());
            }
            if(left.checkExtBinInitialized() ){
                right.setExtBin(left.getExtBin());
            }
            if(left.checkExtTxtInitialized() ){
                right.setExtTxt(left.getExtTxt());
            }
// IGNORE field fl_person.create_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkCreateTimeInitialized() ){
//                 right.setCreateTime(left.getCreateTime());
//             }
// IGNORE field fl_person.update_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkUpdateTimeInitialized() ){
//                 right.setUpdateTime(left.getUpdateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_PERSONGROUPBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(PersonGroupBean left, net.gdface.facelog.dborm.person.FlPersonGroupBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkNameInitialized()){
                left.setName(right.getName());
            }
            if(right.checkLeafInitialized()){
                left.setLeaf(right.getLeaf());
            }
            if(right.checkParentInitialized()){
                left.setParent(right.getParent());
            }
            if(right.checkRootGroupInitialized()){
                left.setRootGroup(right.getRootGroup());
            }
            if(right.checkRemarkInitialized()){
                left.setRemark(right.getRemark());
            }
            if(right.checkExtBinInitialized()){
                left.setExtBin(right.getExtBin());
            }
            if(right.checkExtTxtInitialized()){
                left.setExtTxt(right.getExtTxt());
            }
            if(right.checkCreateTimeInitialized()){
                left.setCreateTime(right.getCreateTime());
            }
            if(right.checkUpdateTimeInitialized()){
                left.setUpdateTime(right.getUpdateTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(PersonGroupBean left, net.gdface.facelog.dborm.person.FlPersonGroupBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkNameInitialized() ){
                right.setName(left.getName());
            }
            if(left.checkLeafInitialized() ){
                right.setLeaf(left.getLeaf());
            }
            if(left.checkParentInitialized() ){
                right.setParent(left.getParent());
            }
            if(left.checkRootGroupInitialized() ){
                right.setRootGroup(left.getRootGroup());
            }
            if(left.checkRemarkInitialized() ){
                right.setRemark(left.getRemark());
            }
            if(left.checkExtBinInitialized() ){
                right.setExtBin(left.getExtBin());
            }
            if(left.checkExtTxtInitialized() ){
                right.setExtTxt(left.getExtTxt());
            }
// IGNORE field fl_person_group.create_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkCreateTimeInitialized() ){
//                 right.setCreateTime(left.getCreateTime());
//             }
// IGNORE field fl_person_group.update_time , controlled by 'general.beanconverter.tonative.ignore' in properties file
//             if(left.checkUpdateTimeInitialized() ){
//                 right.setUpdateTime(left.getUpdateTime());
//             }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_STOREBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(StoreBean left, net.gdface.facelog.dborm.image.FlStoreBean right) {
            if(right.checkMd5Initialized()){
                left.setMd5(right.getMd5());
            }
            if(right.checkEncodingInitialized()){
                left.setEncoding(right.getEncoding());
            }
            if(right.checkDataInitialized()){
                left.setData(right.getData());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(StoreBean left, net.gdface.facelog.dborm.image.FlStoreBean right) {
            if(left.checkMd5Initialized() ){
                right.setMd5(left.getMd5());
            }
            if(left.checkEncodingInitialized() ){
                right.setEncoding(left.getEncoding());
            }
            if(left.checkDataInitialized() ){
                right.setData(left.getData());
            }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final IBeanConverter CONVERTER_LOGLIGHTBEAN=new IBeanConverter.AbstractHandle(){

        @Override
        protected void doFromRight(LogLightBean left, net.gdface.facelog.dborm.log.FlLogLightBean right) {
            if(right.checkIdInitialized()){
                left.setId(right.getId());
            }
            if(right.checkPersonIdInitialized()){
                left.setPersonId(right.getPersonId());
            }
            if(right.checkNameInitialized()){
                left.setName(right.getName());
            }
            if(right.checkPapersTypeInitialized()){
                left.setPapersType(right.getPapersType());
            }
            if(right.checkPapersNumInitialized()){
                left.setPapersNum(right.getPapersNum());
            }
            if(right.checkVerifyTimeInitialized()){
                left.setVerifyTime(right.getVerifyTime());
            }
            left.setNew(right.isNew());
            left.setModified(right.getModified());
            left.setInitialized(right.getInitialized());
        }

        @Override
        protected void doToRight(LogLightBean left, net.gdface.facelog.dborm.log.FlLogLightBean right) {
            if(left.checkIdInitialized() ){
                right.setId(left.getId());
            }
            if(left.checkPersonIdInitialized() ){
                right.setPersonId(left.getPersonId());
            }
            if(left.checkNameInitialized() ){
                right.setName(left.getName());
            }
            if(left.checkPapersTypeInitialized() ){
                right.setPapersType(left.getPapersType());
            }
            if(left.checkPapersNumInitialized() ){
                right.setPapersNum(left.getPapersNum());
            }
            if(left.checkVerifyTimeInitialized() ){
                right.setVerifyTime(left.getVerifyTime());
            }
            right.setNew(left.isNew());
            right.setModified(left.getModified());
            right.setInitialized(left.getInitialized());
        }};
        
    public static final DbConverter INSTANCE = new DbConverter();
    protected DbConverter() {
    	
    }

    private static final Vector CONVERTERS= new Vector(){
        private static final long serialVersionUID = 1L;
        {
            add(new Object[]{DeviceBean.class, net.gdface.facelog.dborm.device.FlDeviceBean.class, CONVERTER_DEVICEBEAN});
            add(new Object[]{DeviceGroupBean.class, net.gdface.facelog.dborm.device.FlDeviceGroupBean.class, CONVERTER_DEVICEGROUPBEAN});
            add(new Object[]{FaceBean.class, net.gdface.facelog.dborm.face.FlFaceBean.class, CONVERTER_FACEBEAN});
            add(new Object[]{FeatureBean.class, net.gdface.facelog.dborm.face.FlFeatureBean.class, CONVERTER_FEATUREBEAN});
            add(new Object[]{ImageBean.class, net.gdface.facelog.dborm.image.FlImageBean.class, CONVERTER_IMAGEBEAN});
            add(new Object[]{LogBean.class, net.gdface.facelog.dborm.log.FlLogBean.class, CONVERTER_LOGBEAN});
            add(new Object[]{PermitBean.class, net.gdface.facelog.dborm.permit.FlPermitBean.class, CONVERTER_PERMITBEAN});
            add(new Object[]{PersonBean.class, net.gdface.facelog.dborm.person.FlPersonBean.class, CONVERTER_PERSONBEAN});
            add(new Object[]{PersonGroupBean.class, net.gdface.facelog.dborm.person.FlPersonGroupBean.class, CONVERTER_PERSONGROUPBEAN});
            add(new Object[]{StoreBean.class, net.gdface.facelog.dborm.image.FlStoreBean.class, CONVERTER_STOREBEAN});
            add(new Object[]{LogLightBean.class, net.gdface.facelog.dborm.log.FlLogLightBean.class, CONVERTER_LOGLIGHTBEAN});
        }};
    
    private static final  int getIndex(Class lClass,Class rClass){
            Vectorfind= new Vector();
            if(null!=lClass && null != rClass){
                for(int i=0;i)converter[0]).isAssignableFrom(lClass) 
                            && ((Class)converter[1]).isAssignableFrom(rClass)){
                        return i;
                    }
                }
            }else if(null != lClass){
                for(int i=0;i)converter[0]).isAssignableFrom(lClass) 
                            ){
                        find.add(i);
                    }
                }
            }else if(null != rClass){
                for(int i=0;i)converter[1]).isAssignableFrom(rClass)){
                        find.add(i);
                    }
                }
            }
            return  1==find.size() ? find.get(0) : -1;
    }  
        
    @Override
    @SuppressWarnings("unchecked")
    public IBeanConvertergetBeanConverter(Class lClass,Class rClass){
        int index = getIndex(lClass, rClass);
        if(index<0){
            throw new IllegalArgumentException(
                    String.format("not found converter for (%s,%s)"
                            ,null==lClass?"null":lClass.getSimpleName()
                            ,null==rClass?"null":rClass.getSimpleName()));
        }
        return (IBeanConverter) CONVERTERS.get(index)[2];
    }
    
    @Override
    public void setBeanConverter(Class lClass,Class rClass,IBeanConverterconverter){
        if(null == lClass || null == rClass || null == converter){
            throw new NullPointerException();
        }
        synchronized(this){
            Object[] c = new Object[]{lClass,rClass,converter};
            int index = getIndex(lClass, rClass);
            if(index<0){
                CONVERTERS.add(c);
            }else{
                CONVERTERS.set(index, c);
            }
        }
    }
    @Override
    public IBeanConverter getDeviceBeanConverter() {
        return CONVERTER_DEVICEBEAN;
    }
    @Override
    public IBeanConverter getDeviceGroupBeanConverter() {
        return CONVERTER_DEVICEGROUPBEAN;
    }
    @Override
    public IBeanConverter getFaceBeanConverter() {
        return CONVERTER_FACEBEAN;
    }
    @Override
    public IBeanConverter getFeatureBeanConverter() {
        return CONVERTER_FEATUREBEAN;
    }
    @Override
    public IBeanConverter getImageBeanConverter() {
        return CONVERTER_IMAGEBEAN;
    }
    @Override
    public IBeanConverter getLogBeanConverter() {
        return CONVERTER_LOGBEAN;
    }
    @Override
    public IBeanConverter getPermitBeanConverter() {
        return CONVERTER_PERMITBEAN;
    }
    @Override
    public IBeanConverter getPersonBeanConverter() {
        return CONVERTER_PERSONBEAN;
    }
    @Override
    public IBeanConverter getPersonGroupBeanConverter() {
        return CONVERTER_PERSONGROUPBEAN;
    }
    @Override
    public IBeanConverter getStoreBeanConverter() {
        return CONVERTER_STOREBEAN;
    }
    @Override
    public IBeanConverter getLogLightBeanConverter() {
        return CONVERTER_LOGLIGHTBEAN;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy