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

📄 entityhelper.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.config.utils;import com.queplix.core.jxb.entity.ChainTable;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.error.UnknownEfieldException;import com.queplix.core.modules.config.jxb.Button;import com.queplix.core.modules.config.jxb.Buttons;import com.queplix.core.modules.config.jxb.Custom;import com.queplix.core.modules.config.jxb.CustomField;import com.queplix.core.modules.config.jxb.Form;import com.queplix.core.modules.config.jxb.Header;import com.queplix.core.modules.config.jxb.Headers;import com.queplix.core.modules.config.jxb.HiddenControl;import com.queplix.core.modules.config.jxb.HiddenControls;import com.queplix.core.modules.config.jxb.Htmlelement;import com.queplix.core.modules.config.jxb.Layout;import com.queplix.core.modules.config.jxb.Link;import com.queplix.core.modules.config.jxb.Links;import com.queplix.core.modules.config.jxb.Row;import com.queplix.core.modules.config.jxb.SubFocus;import com.queplix.core.modules.config.jxb.Tab;import com.queplix.core.modules.config.jxb.Captions;import com.queplix.core.modules.config.jxb.Caption;import java.util.ArrayList;import java.util.List;/** * Helper class for working with configs. * * @author [ALB] Baranov Andrey * @author [ONZ] Oleg N. Zhovtanyuk * @version $Revision: 1.1.1.1 $ $Date: 2005/09/12 15:30:16 $ */public final class EntityHelper {    // =============================================================== Constants    /**     * Entity tag name.     */    public static final String ENTITY_TAG = "entity";    /**     * Entity name attribute.     */    public static final String NAME_ATTRIBUTE = "name";    /**     * Name separator for nested entities (e.g. 'calls.attachment').     */    public static final String NAME_SEPARATOR = ".";    /**     * Name separator for the form names (e.g. 'admin__employee__skill.admin').     */    public static final String FORM_NAME_SEPARATOR = "__";    // Class.    private static final Class CLASS = EntityHelper.class;    // Form names separator length.    private static final int FORM_SEP_LENGTH = FORM_NAME_SEPARATOR.length();    // ========================================================== Public methods    /**     * Get efield ID.     *     * @param entityName Entity name attribute     * @param efieldName Efield name attribute     * @return id of efield     */    public static String getFieldId(String entityName, String efieldName) {        return entityName + NAME_SEPARATOR + efieldName;    }    /**     * Get Efield object position in Entity object.     *     * @param entity Entity object     * @param efield Efield object     * @return Efield position     */    public static int getFieldPos(Entity entity, Efield efield) {        return entity.getPos(efield.getName());    }    /**     * Get dataset ID.     *     * @param entity  Entity object     * @param dataset Dataset object     * @return id of efield     */    public static String getDatasetId(Entity entity, Dataset dataset) {        return entity.getName() + NAME_SEPARATOR + dataset.getName();    }    /**     * Get efield full name.     *     * @param dbobjAlias alias of db object     * @param srcName    the efield src attribute     * @return name of efield     */    public static String getFieldFullName(String dbobjAlias, String srcName) {        if(dbobjAlias != null) {            return dbobjAlias.toUpperCase() + NAME_SEPARATOR + srcName.toUpperCase();        } else {            return srcName.toUpperCase();        }    }    /**     * Get efield full name.     *     * @param field  the Efield object     * @param entity the Entity object     * @return source attribute of efield     */    public static String getFieldFullName(Efield field, Entity entity) {        return getFieldFullName(entity.getDbobjAlias(), field.getName());    }    /**     * Get parent entity name (the structure of name like: <parent>.<child>).     *     * @param entityName the entity name     * @return name of parent or null     */    public static String getParentEntityName(String entityName) {        int pos = entityName.lastIndexOf(NAME_SEPARATOR);        if(pos < 0) {            return null;        } else {            return entityName.substring(0, pos);        }    }    /**     * Get subfocus full name.     *     * @param focusName Focus name attribute     * @param subFocus  SubFocus object     * @return subfocus full name     */    public static String getSubFocusFullName(String focusName, SubFocus subFocus) {        return focusName + FORM_NAME_SEPARATOR + subFocus.getName();    }    /**     * Get tab full name.     *     * @param subFocusName SubFocus name attribute     * @param tab          Tab object     * @return tab full name     */    public static String getTabFullName(String subFocusName, Tab tab) {        return subFocusName + FORM_NAME_SEPARATOR + tab.getName();    }    /**     * Get focus name of subfocus     *     * @param subFocusName Subfocus name     * @return focus name     */    public static String getParentFocusName(String subFocusName) {        int pos = subFocusName.lastIndexOf(FORM_NAME_SEPARATOR);        if(pos < 0) {            return null;        } else {            return subFocusName.substring(0, pos);        }    }    /**     * Get subfocus name of tab     *     * @param tabName tab name     * @return subfocus name     */    public static String getParentSubFocusName(String tabName) {        int pos = tabName.lastIndexOf(FORM_NAME_SEPARATOR);        if(pos < 0) {            return null;        } else {            return tabName.substring(0, pos);        }    }    /**     * Get form full name.     *     * @param tabName Tab name attribute     * @param form    Form object     * @return form full name     */    public static String getFormFullName(String tabName, Form form) {        return tabName + FORM_NAME_SEPARATOR + form.getEntity();    }    /**     * Get base entity name for the given form.     *     * @param formName Form name attribute     * @return entity name     */    public static String getFormEntityName(String formName) {        int pos = formName.lastIndexOf(FORM_NAME_SEPARATOR);        if(pos < 0) {            return null;        } else {            return formName.substring(pos + FORM_SEP_LENGTH);        }    }    /**     * Get tab name of from     *     * @param formName form name     * @return form tab     */    public static String getParentTabName(String formName) {        int pos = formName.lastIndexOf(FORM_NAME_SEPARATOR);        if(pos < 0) {            return null;        } else {            return formName.substring(0, pos);        }    }    /**     * Get focus name     *     * @param objectName Name of any object from focus structure (focus -> subfocus -> tab -> form)     * @return form tab     */    public static String getFocusName(String objectName) {        int pos = objectName.indexOf(FORM_NAME_SEPARATOR);        return pos == -1 ? objectName:objectName.substring(0, pos);    }    public static boolean isParentObject(String parentObjectName, String childObjectName) {        return childObjectName.startsWith(parentObjectName);

⌨️ 快捷键说明

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