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

📄 modelentity.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    public void setTableName(String tableName) {        this.tableName = tableName;    }    /** The package-name of the Entity */    public String getPackageName() {        return this.packageName;    }    public void setPackageName(String packageName) {        this.packageName = packageName;    }    /** The default-resource-name of the Entity */    public String getDefaultResourceName() {        return this.defaultResourceName;    }    public void setDefaultResourceName(String defaultResourceName) {        this.defaultResourceName = defaultResourceName;    }    /** The entity-name of the Entity that this Entity is dependent on, if empty then no dependency */    public String getDependentOn() {        return this.dependentOn;    }    public void setDependentOn(String dependentOn) {        this.dependentOn = dependentOn;    }    /** An indicator to specify if this entity is never cached.      * If true causes the delegator to not clear caches on write and to not get      * from cache on read showing a warning messages to that effect      */    public boolean getNeverCache() {        return this.neverCache;    }    public void setNeverCache(boolean neverCache) {        this.neverCache = neverCache;    }    public boolean getAutoClearCache() {        return this.autoClearCache;    }    public void setAutoClearCache(boolean autoClearCache) {        this.autoClearCache = autoClearCache;    }    /** An indicator to specify if this entity requires locking for updates */    public boolean getDoLock() {        return this.doLock;    }    public void setDoLock(boolean doLock) {        this.doLock = doLock;    }    public boolean lock() {        if (doLock && isField(STAMP_FIELD)) {            return true;        } else {            doLock = false;            return false;        }    }    public void updatePkLists() {        pks = FastList.newInstance();        nopks = FastList.newInstance();        for (int i = 0; i < fields.size(); i++) {            ModelField field = (ModelField) fields.get(i);            if (field.isPk)                pks.add(field);            else                nopks.add(field);        }    }    public boolean isField(String fieldName) {        if (fieldName == null) return false;        for (int i = 0; i < fields.size(); i++) {            ModelField field = (ModelField) fields.get(i);            if (field.name.equals(fieldName)) return true;        }        return false;    }    public boolean areFields(Collection fieldNames) {        if (fieldNames == null) return false;        Iterator iter = fieldNames.iterator();        while (iter.hasNext()) {            String fieldName = (String) iter.next();            if (!isField(fieldName)) return false;        }        return true;    }    public int getPksSize() {        return this.pks.size();    }    /**     * @deprecated     */    public ModelField getPk(int index) {        return (ModelField) this.pks.get(index);    }    public ModelField getOnlyPk() {        if (this.pks.size() == 1) {            return (ModelField) this.pks.get(0);        } else {            throw new IllegalArgumentException("Error in getOnlyPk, the [" + this.getEntityName() + "] entity has more than one pk!");        }    }    public Iterator getPksIterator() {        return this.pks.iterator();    }    public List getPksCopy() {        List newList = FastList.newInstance();        newList.addAll(this.pks);        return newList;    }    public String getFirstPkFieldName() {        List pkFieldNames = this.getPkFieldNames();        String idFieldName = null;        if (pkFieldNames != null && pkFieldNames.size() > 0) {            idFieldName = (String) pkFieldNames.get(0);        }        return idFieldName;    }    public int getNopksSize() {        return this.nopks.size();    }    /**     * @deprecated     */    public ModelField getNopk(int index) {        return (ModelField) this.nopks.get(index);    }    public Iterator getNopksIterator() {        return this.nopks.iterator();    }    public List getNopksCopy() {        List newList = FastList.newInstance();        newList.addAll(this.nopks);        return newList;    }    public int getFieldsSize() {        return this.fields.size();    }    /**     * @deprecated     */    public ModelField getField(int index) {        return (ModelField) this.fields.get(index);    }    public Iterator getFieldsIterator() {        return this.fields.iterator();    }    public List getFieldsCopy() {        List newList = FastList.newInstance();        newList.addAll(this.fields);        return newList;    }    /** The col-name of the Field, the alias of the field if this is on a view-entity */    public String getColNameOrAlias(String fieldName) {        ModelField modelField = this.getField(fieldName);        String fieldString = modelField.getColName();        return fieldString;    }    public ModelField getField(String fieldName) {        if (fieldName == null) return null;        if (fieldsMap == null) {            createFieldsMap();        }        ModelField modelField = (ModelField) fieldsMap.get(fieldName);        if (modelField == null) {            // sometimes weird things happen and this getField method is called before the fields are all populated, so before moving on just re-create the fieldsMap again real quick...            // the purpose of the fieldsMap is for speed, but if failures are a little slower, no biggie            createFieldsMap();            modelField = (ModelField) fieldsMap.get(fieldName);        }        return modelField;    }    protected synchronized void createFieldsMap() {        Map tempMap = FastMap.newInstance();        for (int i = 0; i < fields.size(); i++) {            ModelField field = (ModelField) fields.get(i);            tempMap.put(field.name, field);        }        fieldsMap = tempMap;    }    public void addField(ModelField field) {        if (field == null) return;        field.setModelEntity(this);        this.fields.add(field);        if (field.isPk) {            pks.add(field);        } else {            nopks.add(field);        }    }    public ModelField removeField(int index) {        ModelField field = null;        field = (ModelField) fields.remove(index);        if (field == null) return null;        if (field.isPk) {            pks.remove(field);        } else {            nopks.remove(field);        }        return field;    }    public ModelField removeField(String fieldName) {        if (fieldName == null) return null;        ModelField field = null;        for (int i = 0; i < fields.size(); i++) {            field = (ModelField) fields.get(i);            if (field.name.equals(fieldName)) {                fields.remove(i);                if (field.isPk) {                    pks.remove(field);                } else {                    nopks.remove(field);                }            }            field = null;        }        return field;    }    public List getAllFieldNames() {        return getFieldNamesFromFieldVector(fields);    }    public List getPkFieldNames() {        return getFieldNamesFromFieldVector(pks);    }    public List getNoPkFieldNames() {        return getFieldNamesFromFieldVector(nopks);    }    public List getFieldNamesFromFieldVector(List modelFields) {        List nameList = FastList.newInstance();        if (modelFields == null || modelFields.size() <= 0) return nameList;        for (int i = 0; i < modelFields.size(); i++) {            ModelField field = (ModelField) modelFields.get(i);            nameList.add(field.name);        }        return nameList;    }    public int getRelationsSize() {        return this.relations.size();    }    public int getRelationsOneSize() {        int numRels = 0;        Iterator relationsIter = this.getRelationsIterator();        while (relationsIter.hasNext()) {            ModelRelation modelRelation = (ModelRelation) relationsIter.next();            if ("one".equals(modelRelation.getType())) {                numRels++;            }        }        return numRels;    }    public ModelRelation getRelation(int index) {        return (ModelRelation) this.relations.get(index);    }    public Iterator getRelationsIterator() {        return this.relations.iterator();    }    public ModelRelation getRelation(String relationName) {        if (relationName == null) return null;        for (int i = 0; i < relations.size(); i++) {            ModelRelation relation = (ModelRelation) relations.get(i);            if (relationName.equals(relation.title + relation.relEntityName)) return relation;        }        return null;    }    public void addRelation(ModelRelation relation) {        relation.setModelEntity(this);

⌨️ 快捷键说明

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