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

📄 getrecordsejb.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.eqlext.ejb;import com.queplix.core.error.ErrorHelper;import com.queplix.core.integrator.security.LogonSession;import com.queplix.core.jxb.entity.Efield;import com.queplix.core.jxb.entity.Entity;import com.queplix.core.modules.config.jxb.ExternalSet;import com.queplix.core.modules.config.jxb.Form;import com.queplix.core.modules.config.utils.EntityHelper;import com.queplix.core.modules.eql.CompoundKey;import com.queplix.core.modules.eql.ejb.AbstractEQLSupportedEJB;import com.queplix.core.modules.eql.error.EQLException;import com.queplix.core.modules.eqlext.GetRecordsRes;import com.queplix.core.modules.eqlext.actions.AbstractGRAction;import com.queplix.core.modules.eqlext.actions.ActionContext;import com.queplix.core.modules.eqlext.actions.GRAction;import com.queplix.core.modules.eqlext.actions.NewGRAction;import com.queplix.core.modules.eqlext.error.QueryTooBigException;import com.queplix.core.modules.eqlext.jxb.gr.ExtPkey;import com.queplix.core.modules.eqlext.jxb.gr.ExtReqs;import com.queplix.core.modules.eqlext.jxb.gr.Req;import com.queplix.core.modules.eqlext.jxb.gr.ReqEntity;import com.queplix.core.modules.eqlext.jxb.gr.ReqFilter;import com.queplix.core.modules.eqlext.jxb.gr.ReqFilters;import com.queplix.core.modules.eqlext.jxb.gr.ReqFiltersTypeItem;import com.queplix.core.modules.eqlext.jxb.gr.Reqs;import com.queplix.core.modules.eqlext.jxb.gr.Res;import com.queplix.core.modules.eqlext.jxb.gr.ResHeader;import com.queplix.core.modules.eqlext.jxb.gr.Ress;import com.queplix.core.modules.eqlext.jxb.gr.types.ConditionSType;import com.queplix.core.utils.StringHelper;import com.queplix.core.utils.xml.XMLHelper;import java.io.CharArrayWriter;import java.io.PrintWriter;import java.io.Reader;import java.util.Properties;/** * <p>Get records session EJB</p> * @author [ALB] Baranov Andrey * @version $Revision: 1.1.1.1 $ $Date: 2005/09/12 15:30:38 $ */public class GetRecordsEJB    extends AbstractEQLSupportedEJB {    // ----------------------------------------------------- public methods    /**     * Initialize bean     */    public void ejbCreate() {        INFO( "GetRecordsEJB create - " + hashCode() );    }    /**     * Execute get records procedure     * @param entityName entity name     * @param compoundPkey compound primary key     * @param prop GetRecords properties     * @param sc security config     * @return response object     * @throws EQLException     */    public GetRecordsRes process( String entityName,                                  CompoundKey compoundPkey,                                  Properties prop,                                  LogonSession sc )        throws EQLException {        if( compoundPkey == null ) {            return process( entityName, ( CompoundKey[] )null, prop, sc );        } else {            return process( entityName, new CompoundKey[] {compoundPkey}                            , prop, sc );        }    }    /**     * Execute get records procedure     * @param entityName entity name     * @param compoundPkeys compound primary keys array     * @param prop GetRecords properties     * @param sc security config     * @return response object     * @throws EQLException     */    public GetRecordsRes process( String entityName,                                  CompoundKey[] compoundPkeys,                                  Properties prop,                                  LogonSession sc )        throws EQLException {        return process( entityName, entityName, compoundPkeys, prop, sc );    }    /**     * Execute get records procedure     * @param entityName entity name     * @param pkeyEntityName entity name of primary keys     * @param compoundPkeys compound primary keys array     * @param prop GetRecords properties     * @param sc security config     * @return response object     * @throws EQLException     */    public GetRecordsRes process( String entityName,                                  String pkeyEntityName,                                  CompoundKey[] compoundPkeys,                                  Properties prop,                                  LogonSession sc )        throws EQLException {        // get base entity        Entity entity = getEntityViewConfigManager().getEntityViewConfig( entityName );        // get pkey entity and fields        Entity pkeyEntity = getEntityViewConfigManager().getEntityViewConfig( pkeyEntityName );        Efield[] pkeyFields = EntityHelper.getPkeys( pkeyEntity );        // do process        return process( entity, pkeyFields, compoundPkeys, prop, sc );    }    /**     * Execute get records procedure     * @param entityName entity name     * @param pkeyEntityName entity name of primary keys     * @param compoundPkeys compound primary keys array     * @param prop GetRecords properties     * @param out PrintWriter object to write Ress response     * @param sc security config     * @throws EQLException     */    public void process( String entityName,                         String pkeyEntityName,                         CompoundKey[] compoundPkeys,                         Properties prop,                         PrintWriter out,                         LogonSession sc )        throws EQLException {        // get base entity        Entity entity = getEntityViewConfigManager().getEntityViewConfig( entityName );        // get pkey entity and fields        Entity pkeyEntity = getEntityViewConfigManager().getEntityViewConfig( pkeyEntityName );        Efield[] pkeyFields = EntityHelper.getPkeys( pkeyEntity );        // do process        process( out, entity, pkeyFields, compoundPkeys, prop, sc, false );    }    /**     * Execute get records procedure     * @param reqs request object     * @param sc security config     * @return response object     * @throws EQLException     */    public GetRecordsRes process( Reqs reqs, LogonSession sc )        throws EQLException {        long time = System.currentTimeMillis();        GetRecordsRes grRes = null;        try {            // request parameters            int page = reqs.getPage();            int pageSize = reqs.getPagesize();            boolean doHeader = reqs.getDoheader();            boolean getRequest = reqs.getGetrequest();            // create context            ActionContext ctx = new ActionContext( sc,                getEntityViewConfigManager(),                getFocusConfigManager(),                getCustomConfigManager(),                getEQLManager(),                getUserPropertyManager() );            // call action            GRAction gra = AbstractGRAction.process( ctx, reqs, null );            // object contains response object            Ress ress = new Ress();            Res res = new Res();            ress.setRes( res );            // get set of records            res.setResRecord( gra.getResRecords() );            // add request object            if( getRequest ) {                ress.setReqs( reqs );            }            // add header object            if( doHeader ) {                ResHeader resHeader = gra.getHeader();                ress.setResHeader( resHeader );            }            // set Ress attributes            ress.setRows(gra.getRows());            ress.setCount(gra.getCount());            if( page > 0 ) {                ress.setPrev( Boolean.TRUE );            } else {                ress.setPrev( Boolean.FALSE );            }            ress.setNext(gra.hasMore());            ress.setPagesize(pageSize);            ress.setPage(page);            ress.setNew(gra instanceof NewGRAction);            // build Get Records response            grRes = new GetRecordsRes( ress, gra.getEQLRes() );        } catch( EQLException ex ) {            throw ex;        } catch( OutOfMemoryError ex ) {            throw new QueryTooBigException();        } catch( Throwable t ) {            ErrorHelper.throwSystemException( t, this );        }        if( getLogger().isDebugEnabled() ) {            DEBUG( "...getRecords complete time(ms)=" +                   ( System.currentTimeMillis() - time ) );        }        return grRes;    }    /**     * Execute get records procedure     * @param in Reader object to read Reqs request     * @param out PrintWriter object to write Ress response     * @param sc security config     * @throws EQLException     */    public void process( Reader in,                         PrintWriter out,                         LogonSession sc )        throws EQLException {        // Deserialize request.        Reqs reqs = ( Reqs ) XMLHelper.getParsedObject( Reqs.class, in );        // Do process.        process( reqs, out, sc );    }    /**     * Execute get records procedure     * @param reqs request object     * @param out PrintWriter object to write Ress response     * @param sc security config     * @throws EQLException     */    public void process( Reqs reqs,                         PrintWriter out,                         LogonSession sc )        throws EQLException {        // Do process.        process( reqs, out, sc, false );    }    /**     * Execute get records extended procedure     * @param in Reader object to read Reqs request     * @param out PrintWriter object to write Ress response     * @param sc security config     * @throws EQLException     */    public void extProcess( Reader in,                            PrintWriter out,                            LogonSession sc )        throws EQLException {        // Deserialize request.        ExtReqs extReqs = ( ExtReqs ) XMLHelper.getParsedObject( ExtReqs.class, in );        // Call extended process.        extProcess( extReqs, out, sc );    }    /**     * Execute get records extended procedure     * @param extReqs ExtReqs request object     * @param out PrintWriter object to write Ress response     * @param sc security config     * @throws EQLException     */    public void extProcess( ExtReqs extReqs,                            PrintWriter out,                            LogonSession sc )        throws EQLException {        //        // Initialization.        //        long time = System.currentTimeMillis();        if( getLogger().isDebugEnabled() ) {            DEBUG( "Start ext process:" );            printMemoryUsage();            DEBUG( "ExtGetRecords request:" );            DEBUG( "===================" );            DEBUG( new String( XMLHelper.writeObject( extReqs ) ) );            DEBUG( "===================" );        }        // Get Form.        String formName = extReqs.getFormid();        Form form = getFocusConfigManager().getForm( formName );        // Get base entity.        Entity entity = getEntityViewConfigManager().getEntityViewConfig( form.getEntity() );        //        // Do writing.

⌨️ 快捷键说明

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