⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 historybuildergenericimpl.java

📁 CRM源码This file describes some issues that should be implemented in future and how it should be imple
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright 2006-2007 Queplix Corp. * * Licensed under the Queplix Public License, Version 1.1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.queplix.com/solutions/commercial-open-source/queplix-public-license/ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */package com.queplix.core.modules.eql.history.generic;import com.queplix.core.error.GenericSystemException;import com.queplix.core.jxb.entity.Dataset;import com.queplix.core.jxb.entity.Efield;import com.queplix.core.jxb.entity.Entity;import com.queplix.core.modules.config.ejb.CustomConfigManagerLocal;import com.queplix.core.modules.config.ejb.CustomConfigManagerLocalHome;import com.queplix.core.modules.config.jxb.CustomField;import com.queplix.core.modules.eql.EQLDRes;import com.queplix.core.modules.eql.EQLObject;import com.queplix.core.modules.eql.EQLReqDataset;import com.queplix.core.modules.eql.EQLReqEntity;import com.queplix.core.modules.eql.EQLReqField;import com.queplix.core.modules.eql.EQLResCell;import com.queplix.core.modules.eql.EQLResRecord;import com.queplix.core.modules.eql.ejb.EQLManagerLocal;import com.queplix.core.modules.eql.ejb.EQLManagerLocalHome;import com.queplix.core.modules.eql.error.EQLException;import com.queplix.core.modules.eql.history.HistoryBuilder;import com.queplix.core.modules.eql.jxb.history.HistoryData;import com.queplix.core.modules.eql.jxb.history.HistoryField;import com.queplix.core.modules.eql.jxb.history.HistoryHeader;import com.queplix.core.modules.eql.jxb.history.HistoryTopic;import com.queplix.core.modules.eql.jxb.history.Ifg;import com.queplix.core.modules.eql.jxb.history.IfgData;import com.queplix.core.modules.eql.jxb.history.IfgRecord;import com.queplix.core.modules.eql.jxb.history.PkeyField;import com.queplix.core.modules.eql.utils.EQLUtils;import com.queplix.core.modules.eqlext.error.EfieldTransformException;import com.queplix.core.modules.eqlext.utils.FieldConverter;import com.queplix.core.modules.jeo.ejb.JEOManagerLocal;import com.queplix.core.modules.jeo.ejb.JEOManagerLocalHome;import com.queplix.core.modules.jeo.gen.HistoryTableFieldObject;import com.queplix.core.modules.jeo.gen.HistoryTableFieldObjectHandler;import com.queplix.core.integrator.security.LogonSession;import com.queplix.core.integrator.security.User;import com.queplix.core.integrator.security.SecurityHelper;import com.queplix.core.integrator.security.AccessRightsManager;import com.queplix.core.utils.DateHelper;import com.queplix.core.utils.JNDINames;import com.queplix.core.utils.StringHelper;import java.util.ArrayList;import java.util.Date;import java.util.Iterator;import java.util.List;import java.util.Locale;import java.util.TimeZone;/** * History builder generic implementation. * * @author [ALB] Baranov Andrey * @author [ONZ] Oleg N. Zhovtanyuk * @version $Revision: 1.1.1.1 $ $Date: 2005/09/12 15:30:26 $ */public class HistoryBuilderGenericImpl    extends HistoryBuilder {    // ================================================================= Fields    // User logon session.    private LogonSession ls;    private String INSERT_ACTION_TYPE = "insert";    private String UPDATE_ACTION_TYPE = "update";    private String DELETE_ACTION_TYPE = "delete";    // ========================================================= Public methods    //    // Constructor.    //    public HistoryBuilderGenericImpl() {        ls = AccessRightsManager.getSystemLogonSession();    }    /* (non-javadoc)     * @see HistoryBuilder#createHistoryTopic     */    public HistoryTopic createHistoryTopic( EQLResRecord resRecord, List historyFieldNames ) {        // Initialization.        User user = getSession().getLogonSession().getUser();        HistoryTopic topic = new HistoryTopic();        // Create the topic header.        HistoryHeader header = new HistoryHeader();        header.setTimestamp( getHistoryTimestapm() );        header.setUser_id( new Long( user.getUserID() ) );        header.setUser_type( new Integer( user.getAuthenticationType() ) );        header.setUser_loginname( user.getLoginName() );        header.setUser_fullname( user.getFullName() );        topic.setHistoryHeader( header );        // Create the topic data.        HistoryData data = new HistoryData();        for( int i = 0; i < resRecord.size(); i++ ) {            HistoryField field = getHistoryField( i, resRecord, historyFieldNames );            if( field != null ) {                data.addHistoryField( field );            }        } // for        int dResSize = resRecord.getDResSize();        IfgData ifgData = new IfgData();        for( int i = 0; i < dResSize; i++ ) {            EQLDRes eqlDRes = resRecord.getDRes( i );            EQLReqDataset reqDataSet = eqlDRes.getReqDataset();            Dataset dataSet = eqlDRes.getReqDataset().getDataset();            Entity dsEntity = reqDataSet.getDatasetEntity();            List dsLogFieldNames = getLogFieldNames( dsEntity.getDbobject() );            if( dsLogFieldNames == null ) {                continue;            }            Ifg ifg = null;            for( int k = 0; k < eqlDRes.getRecords().size(); k++ ) {                EQLResRecord rRecord = eqlDRes.getRecord( k );                EQLResRecord aRecord = getAdditRecord( eqlDRes.getRecords(), rRecord );                boolean doInsert = rRecord.isNew();                boolean doUpdate = rRecord.doUpdate();                boolean doDelete = rRecord.doDelete();                IfgRecord ifgRecord = new IfgRecord();                if( doInsert ) {                    ifgRecord.setAction( INSERT_ACTION_TYPE );                } else if( doUpdate ) {                    ifgRecord.setAction( UPDATE_ACTION_TYPE );                } else if( doDelete ) {                    ifgRecord.setAction( DELETE_ACTION_TYPE );                    rRecord = aRecord;                } else {                    continue;                }                CustomField customField =                    getCustomConfigManager().getLocalizedCustomField(                        ls.getUser().getLangID(),                        dataSet.getEntityName(),                        dataSet.getName() );                if( ifg == null ) {                    ifg = new Ifg();                }                ifg.setCaption( customField.getCaption() );                for( int j = 0; j < rRecord.size(); j++ ) {                    EQLResCell resCell = rRecord.getResCell( j );                    EQLReqField reqField = resCell.getReqField();                    EQLReqEntity reqEntity = reqField.getReqEntity();                    Efield efield = reqField.getField();                    Entity entity = reqEntity.getEntity();                    HistoryField fld = null;                    boolean isPkey = efield.getPkey().booleanValue();                    if( isPkey ) {                        PkeyField pkeyFld = new PkeyField();                        pkeyFld.setPkeyCaption( getFieldCaption( entity, efield ) );                        pkeyFld.setPkeyName( efield.getName() );                        pkeyFld.setPkeyValue( resCell.getEQLObject().getObject().toString() );                        dsLogFieldNames.remove( efield.getName() );                        ifgRecord.addPkeyField( pkeyFld );                    } else if( doDelete && dsLogFieldNames.contains( efield.getName() ) ) {                        String value;                        if( efield.getListref() != null ) {                            try {								value = EQLUtils.getListFieldValue( rRecord, resCell, resCell.getListField().getReqField(), false, ls, getEQLManager() ).toString();                            } catch( EQLException ex ) {                                throw new GenericSystemException( ex );                            }                        } else {                            try {                                value = FieldConverter.EQLObject2String( ls, entity, efield, resCell.getEQLObject() );                            } catch( EfieldTransformException ex ) {                                throw new GenericSystemException( ex );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -