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

📄 entitygraction.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.actions;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.jxb.entity.Metainf;import com.queplix.core.jxb.entity.types.ControlSType;import com.queplix.core.modules.config.ejb.UserPropertyManagerLocal;import com.queplix.core.modules.config.jxb.Form;import com.queplix.core.modules.config.utils.EntityHelper;import com.queplix.core.modules.eql.EQLReqMetaData;import com.queplix.core.modules.eql.EQLRes;import com.queplix.core.modules.eql.ejb.EQLManagerLocal;import com.queplix.core.modules.eql.error.EQLException;import com.queplix.core.modules.eql.error.UserQueryParseException;import com.queplix.core.modules.eql.parser.EQLIntPreparedStatement;import com.queplix.core.modules.eqlext.jxb.gr.ReqEntity;import com.queplix.core.modules.eqlext.jxb.gr.Reqs;import com.queplix.core.modules.eqlext.jxb.gr.ResHeader;import com.queplix.core.modules.eqlext.jxb.gr.ResRecord;import com.queplix.core.modules.eqlext.jxb.gr.types.OrderDirectionSType;import com.queplix.core.utils.StringHelper;import com.queplix.core.utils.SystemHelper;import com.queplix.core.utils.xml.XMLBinding;import com.queplix.core.utils.xml.XMLFactory;import java.io.IOException;import java.io.StringWriter;import java.io.Writer;import java.util.ArrayList;import java.util.List;import java.util.Map;import java.util.HashMap;/** * <p>Entity Get Records Action</p> * @author [ALB] Baranov Andrey * @version $Revision: 1.3 $ $Date: 2006/06/02 13:42:59 $ */public class EntityGRAction    extends AbstractGRAction {    // ----------------------------------------------------- variables    ReqEntity reqEntity;    Entity entity;    Form form;    EQLReqMetaData meta;    // distinct flag    boolean distinct = false;    // Req distinct flag    boolean reqDistinct = false;    // use built-in count flag    boolean builtinCount = false;    // eql count query    String eqlCountQuery;    // ----------------------------------------------------- getters    /*     * No javadoc     * @see GRAction#getHeader     */    public ResHeader getHeader() {        if( form != null ) {            return getHeader( entity, form );        } else {            return getHeader( entity );        }    }    /*     * No javadoc     * @see AbstractGRAction#getFields     */    protected Efield[] getFields() {        return entity.getEfield();    }    /*     * No javadoc     * @see AbstractGRAction#getDatasets     */    protected Dataset[] getDatasets() {        return entity.getDataset();    }    /**     * Base entity getter.     * @return Entity object     */    protected Entity getEntity() {        return entity;    }    /**     * Base form getter.     * @return Form object     */    protected Form getForm() {        return form;    }    /**     * EQL meta data getter.     * @return EQLReqMetaData object     */    protected EQLReqMetaData getMetaData() {        return meta;    }    // ----------------------------------------------------- protected methods    /*     * No javadoc     * @see AbstractGRAction#init     */    protected void init( Reqs reqs ) {        super.init( reqs );        this.reqEntity = reqs.getReq().getReqEntity();        this.entity = ctx.getEntityViewConfig( reqEntity.getName() );                String formID = reqEntity.getFormid();        if( formID != null ) {            this.form = ctx.getFormConfig( formID );        }        if (SystemHelper.IGNORE_LOWER != null && SystemHelper.IGNORE_LOWER.equals("true")) {            this.ignoreLower = true;        }         this.meta = new EQLReqMetaData();    }    /*     * No javadoc     * @see AbstractGRAction#buildEQL     */    protected void buildEQL()        throws UserQueryParseException {        StringBuffer mainEql = new StringBuffer( "SELECT " );        StringBuffer countEql = new StringBuffer( "AGGREGATE " );        // build EQL meta information        buildEQLRequestMetaInf( mainEql );        // build EQL select clause        buildEQLSelectClause( mainEql );        buildEQLCountClause( countEql );        boolean hasFilters = ( eqlFilters != null ) ||            ( reqFilters != null &&              reqFilters.getReqFiltersTypeItemCount() > 0 );        if( hasFilters ) {            // build EQL where clause            StringBuffer whereClause = new StringBuffer( " WHERE " );            buildEQLWhereClause( whereClause );            mainEql.append( whereClause.toString() );            countEql.append( whereClause.toString() );        }        // build EQL order clause        buildEQLOrderClause( mainEql );        // set class variables        eqlQuery = mainEql.toString();        eqlCountQuery = countEql.toString();    }    /*     * No javadoc     * @see AbstractGRAction#callEQLManager     */    protected EQLRes callEQLManager()        throws EQLException {        //        // Initialization        //        // get EQL manager EJB local interface        EQLManagerLocal local = ctx.getEQLManager();        // add some field names in LAZY LOAD list        if( !ignoreSendOnRequest ) {            UserPropertyManagerLocal userPropManager = ctx.getUserPropertyManager();                        String[] fieldNames = userPropManager.getFieldsForGrid(ctx.getSC().getUser(), getEntity().getName());            if(fieldNames != null) {                Map<String, Efield> efields = new HashMap<String, Efield>();                for(Efield efield : getFields()) {                    efields.put(efield.getName(), efield);                }                efields.remove(getEntity().getPkeyfield());                for(String fieldName : fieldNames) {                    efields.remove(fieldName);                }                Efield[] lazyFields = efields.values().toArray(new Efield[efields.size()]);                for(Efield field : lazyFields) {                    DEBUG( "Add field in lazy load list: " + field.getName() );                    meta.addLazyLoadField( field );                }            } else {//take simple grid set                for(Efield field : getFields()) {                    if( !field.getGrid() && !field.getPkey() ) {                        DEBUG( "Add field in lazy load list: " + field.getName() );                        meta.addLazyLoadField( field );                    }                }            }        } else {//take simple grid set            for(Efield field : getFields()) {                ControlSType controlType = field.getControl();                if( controlType != null ) {                    if( controlType.getType() == ControlSType.HISTORY_TYPE ) {                        DEBUG( "Add field in lazy load list: " + field.getName() );                        meta.addLazyLoadField( field );                    }                }            }                }                // add some dataset names in LAZY LOAD list        if( !ignoreSendOnRequest ) {            int size = entity.getDatasetCount();            for( int i = 0; i < size; i++ ) {                Dataset dataset = entity.getDataset( i );                if( !dataset.getSendonrequest().booleanValue() ) {                    DEBUG( "Add dataset in lazy load: " + dataset.getName() );

⌨️ 快捷键说明

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