亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? classmap.java

?? Persistence Layer s ebook and source code.
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package pl.map;

import java.util.*;
import java.lang.reflect.*;

import pl.*;
import pl.sql.*;

/*
 TODO we assume one one ClassMap instance can map only one table
 We should create tree - like structure with the attribute maps

 tableMap1
        |---- attributeMap1
        |---- attributeMap2
        +---- attributeMap3
 talelMap2
        |---- attributeMap4
        +---- attributeMap5
 */

/**
 * This class is responsible for mapping objects to tables of relational database.
 * @author: Artyom Rudoy
 */
public class ClassMap
{
    private String name = null;
    private SqlStatement selectStatement = null;
    private SqlStatement selectProxyStatement = null;
    private SqlStatement selectTimestampStatement = null;
    private SqlStatement insertStatement = null;
    private SqlStatement deleteStatement = null;
    private SqlStatement updateStatement = null;
    private ArrayList updateAttributeMaps = new ArrayList();
    private ArrayList attributeMaps = new ArrayList();
    private TreeMap hashedAttributeMaps = new TreeMap();
    private RelationalDatabase relationalDatabase = null;
    private ArrayList keyAttributeMaps = new ArrayList();
    private ArrayList proxyAttributeMaps = new ArrayList();
    private Class mapObjectClass = null;
    private TreeMap associationMaps = new TreeMap();
    private ClassMap superClass = null;
    private java.util.Vector referenceAttributeMaps = new Vector();
    private HashSet tables = new HashSet();
    private ArrayList inverseAssociationMaps = new ArrayList();
    private ArrayList straightAssociationMaps = new ArrayList();
    private AttributeMap timestampAttributeMap = null;
    private ClassLoader classLoader = null;
    private boolean isInited = false;
    private String xmlName = null;
    private ArrayList xmlAttributeMaps = new ArrayList();

    /**
     * Creates ClassMap for given class name with the specified class loader.
     *
     * @param name name of the class
     * @param classLoader
     */
    public ClassMap(String name, RelationalDatabase relationalDatabase, ClassLoader classLoader, PersistenceManagerFactory configurable) throws PlException
    {
        super();

        this.name = name;
        this.relationalDatabase = relationalDatabase;
        this.classLoader = classLoader;
        this.xmlName = name;

        // Load class for this map object
        try
        {
            mapObjectClass = Class.forName(getName(), true, classLoader);

            // Try to find superclass map for this class map
            Class sc = mapObjectClass.getSuperclass();
            if(sc != PersistentObject.class && PersistentObject.class.isAssignableFrom(sc))
            {
                // Try to find class map for the superclass
                ClassMap superClassMap = configurable.getClassMap(sc.getName());
                if(superClassMap != null)
                    setSuperClass(superClassMap);
            }
        }
        catch (ClassNotFoundException e)
        {
            throw new PlException("Class " + getName() + " not found");
        }
    }

    /**
     * Adds attribute map to this class map.
     * @param attributeMap pl.map.AttributeMap
     */
    public void addAttributeMap(AttributeMap attributeMap) throws PlException
    {
        hashedAttributeMaps.put(attributeMap.getName(), attributeMap);
        if(attributeMap.getColumnMap() != null)
        {
            attributeMaps.add(attributeMap);
            if(attributeMap.getColumnMap().getKeyType() != ColumnMap.KEY_NONE)
                keyAttributeMaps.add(attributeMap);
            else
                updateAttributeMaps.add(attributeMap);
            if(attributeMap.getReference() != null)
                referenceAttributeMaps.add(attributeMap);
            // Add attributeMap table to the table map collection
            tables.add(attributeMap.getColumnMap().getTableMap());

            if(attributeMap.isProxy() || attributeMap.getColumnMap().getKeyType() != ColumnMap.KEY_NONE)
            {
                proxyAttributeMaps.add(attributeMap);
            }

            if(attributeMap.getXmlMap() != null && attributeMap.getReference() == null)
                xmlAttributeMaps.add(attributeMap);
        }

        // Init accessors
        attributeMap.initAccessors(mapObjectClass);
    }

    public Class getMapObjectClass()
    {
        return mapObjectClass;
    }

    /**
     * Returns association map by the given name.
     *
     * @return UniDirectionalAssociationMap
     */
    public UniDirectionalAssociationMap getAssociationMap(String name)
    {
        return (UniDirectionalAssociationMap)associationMaps.get(name);
    }

    /**
     * Returns association maps for this class map.
     *
     * @return java.util.TreeMap
     */
    public TreeMap getAssociationMaps()
    {
        return associationMaps;
    }

    public int getXmlSize()
    {
        return xmlAttributeMaps.size();
    }

    public AttributeMap getXmlAttributeMap(int index)
    {
        return (AttributeMap)xmlAttributeMaps.get(index);
    }

    /**
     * Returns attribute map for the given index.
     * @return pl.map.AttributeMap
     * @param index int index of the attribute
     */
    public AttributeMap getAttributeMap(int index)
    {
        return (AttributeMap)attributeMaps.get(index);
    }

    /**
     * Returns AttributeMap for the given attribute name.
     * @return pl.map.AttributeMap
     * @param name java.lang.String name of the attribute
     */
    public AttributeMap getAttributeMap(String name)
    {
        return getAttributeMap(name, false);
    }

    /**
     * Returns AttributeMap for the given attribute name.
     * If areSuperClassesIncluded is <code>true</code> tries to find AttributeMap
     * in superclasses
     * @return pl.map.AttributeMap
     * @param name java.lang.String name of the attribute
     */
    public AttributeMap getAttributeMap(String name, boolean areSuperClassesIncluded)
    {
        AttributeMap am = null;

        ClassMap cm = this;
        do
        {
            am = (AttributeMap)cm.hashedAttributeMaps.get(name);
            cm = cm.getSuperClass();
        }
        while(areSuperClassesIncluded && am == null && cm != null);

        return am;
    }

    /**
     * Returns class loader of the current class map.
     *
     * @return java.lang.ClassLoader
     */
    public ClassLoader getClassLoader()
    {
        return classLoader;
    }

    /**
     * Returns delete sql statement for the given object.
     * @return pl.sql.SqlStatement
     * @param obj pl.PersistentObject
     */
    public SqlStatement getDeleteSqlFor(PersistentObject object) throws PlException
    {
        // Clone statement
        SqlStatement statement = (SqlStatement)deleteStatement.clone();

        // Fill statement with values
        for(int i = 0; i < getKeySize(); i++)
        {
            AttributeMap aMap = getKeyAttributeMap(i);
            Object value = aMap.getColumnMap().getConverter().convertFrom(aMap.getValue(object));
            statement.addParameter(value, aMap.getColumnMap().getPlType());
        }

        return statement;
    }

    /**
     * Returns the second and the third part of the select sql statement for this class map.
     * @return pl.sql.SqlStatement
     * @param obj pl.PersistentObject
     */
    public SqlStatement getFromAndWhereSql() throws PlException
    {
        // Create new statement
        SqlStatement statement = new SqlStatement();

        // Add 'FROM' clause to the select statement
        statement.addSqlClause(" " + getRelationalDatabase().getClauseStringFrom() + " ");
        boolean isFirst = true;
        ClassMap classMap = this;
        do
        {
            AttributeMap map = classMap.getAttributeMap(0);
            if (map != null)
            {
                statement.addSqlClause((isFirst ? "" : ", ") + map.getColumnMap().getTableMap().getName());
            }
            classMap = classMap.getSuperClass();
            isFirst = false;
        }
        while(classMap != null);

        // Add part for keys and inheritance support
        String inheritanceAssociations = getInheritanceAssociations();

        // Add 'WHERE key=?' to the select statement
        if(getKeySize() > 0 || inheritanceAssociations.length() > 0)
        {
            statement.addSqlClause(" ");

            statement.addSqlClause(getRelationalDatabase().getClauseStringWhere() + " ");
            for(int i = 0; i < getKeySize(); i++)
            {
                statement.addSqlClause((i > 0 ? " " + getRelationalDatabase().getClauseStringAnd() + " " : "") +
                getKeyAttributeMap(i).getColumnMap().getFullyQualifiedName() + "=?");
            }

            // Add part for inheritance support
            if(inheritanceAssociations.length() > 0)
            {
                statement.addSqlClause((getKeySize() > 0 ? (" " + getRelationalDatabase().getClauseStringAnd() + " ") : "") +
                inheritanceAssociations);
            }
        }

        return statement;
    }

    /**
     * Returns 'table.column=superclass_table.column' part of the select statement
     * for this class map.
     *
     * @return java.lang.String
     */
    public String getInheritanceAssociations()
    {
        StringBuffer result = new StringBuffer();
        ClassMap classMap = this;
        do
        {
            for(int i = 0; i < classMap.getReferenceSize(); i++)
            {
                result.append((i > 0 ? (" " + getRelationalDatabase().getClauseStringAnd() + " ") : "") +
                classMap.getReferenceAttributeMap(i).getColumnMap().getFullyQualifiedName() + "=" +
                classMap.getReferenceAttributeMap(i).getReference().getColumnMap().getFullyQualifiedName());
            }
            classMap = classMap.getSuperClass();
        }
        while(classMap != null);

        return result.toString();
    }

    /**
     * Returns insert sql statement for the given object.
     * @return pl.sql.SqlStatement
     * @param obj pl.PersistentObject
     */
    public SqlStatement getInsertSqlFor(PersistentObject object) throws PlException
    {
        // Clone statement
        SqlStatement statement = (SqlStatement)insertStatement.clone();

        // Fill statement with values
        for(int i = 0; i < getSize(); i++)
        {
            AttributeMap aMap = getAttributeMap(i);
            Object value = aMap.getColumnMap().getConverter().convertFrom(aMap.getValue(object));
            statement.addParameter(value, aMap.getColumnMap().getPlType());
        }

        return statement;
    }

    /**
     * Returns the inverse association map with the specified index.
     *
     * @return pl.map.UniDirectionalAssociationMap
     * @param index index
     */
    public UniDirectionalAssociationMap getInverseAssociationMap(int index)
    {
        return (UniDirectionalAssociationMap)inverseAssociationMaps.get(index);
    }

    /**
     * Returns the number of inverse association maps.
     *
     * @return int
     */
    public int getInverseAssociationMapSize()
    {
        return inverseAssociationMaps.size();
    }

    /**
     * Returns key AttributeMap for the given index.
     * @return pl.map.AttributeMap
     * @param index int index of the attribute map
     */
    public AttributeMap getKeyAttributeMap(int index)
    {
        return (AttributeMap)keyAttributeMaps.get(index);
    }

    /**
     * Returns number of key attribute maps.
     * @return int
     */
    public int getKeySize()
    {
        return keyAttributeMaps.size();
    }

    public AttributeMap getProxyAttributeMap(int index)
    {
        return (AttributeMap)proxyAttributeMaps.get(index);
    }

    public int getProxySize()
    {
        return proxyAttributeMaps.size();
    }

    /**
     * Return update attribute map with the specified index.
     */
    public AttributeMap getUpdateAttributeMap(int index)
    {
        return (AttributeMap)updateAttributeMaps.get(index);
    }

    /**
     * Return number of attributes for a select statement.
     */
    public int getUpdateSize()
    {
        return updateAttributeMaps.size();
    }

    /**
     * Returns name of the class.
     * @return java.lang.String
     */
    public java.lang.String getName()
    {
        return name;
    }

    /**
     * Return reference AttributeMap for the given index.
     * @return pl.map.AttributeMap
     * @param index int index of the reference attribute map
     */
    public AttributeMap getReferenceAttributeMap(int index)
    {
        return (AttributeMap)referenceAttributeMaps.elementAt(index);
    }

    /**
     * Returns number of the reference attribute map.
     * @return int
     */
    public int getReferenceSize()
    {
        return referenceAttributeMaps.size();
    }

    /**
     * Returns RelationalDatabase for this ClassMap.
     * @return pl.pm.RelationalDatabase
     */
    public RelationalDatabase getRelationalDatabase()
    {
        return relationalDatabase;
    }

    /**
     * Returns the first select sql statement for this class map.
     * @return pl.sql.SqlStatement
     * @param obj pl.PersistentObject
     */
    public SqlStatement getSelectSql() throws PlException
    {
        // Create new statement
        SqlStatement statement = new SqlStatement();

        // Add 'SELECT' clause to the select statement
        statement.addSqlClause(getRelationalDatabase().getClauseStringSelect() + " ");

        // Add clauses for all attributes. Do not add ", " before the first attribute
        boolean isFirst = true;
        ClassMap classMap = this;
        do

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久免费美女视频| 亚洲精品久久7777| 中文字幕亚洲精品在线观看| 亚洲电影一区二区三区| 国产福利91精品一区二区三区| 色婷婷综合久久久久中文| 精品日韩一区二区| 亚洲一区二区三区视频在线播放| 国产一区二区日韩精品| 777奇米成人网| 亚洲精品视频在线| 成人福利视频在线| 久久免费偷拍视频| 美美哒免费高清在线观看视频一区二区 | 99国产精品久久久久久久久久久 | 99久精品国产| 精品999在线播放| 午夜不卡av免费| 日本精品裸体写真集在线观看| 国产亚洲成aⅴ人片在线观看 | 国产精品青草综合久久久久99| 免费成人结看片| 欧美肥大bbwbbw高潮| 三级在线观看一区二区 | 日韩欧美卡一卡二| 天天影视色香欲综合网老头| 日本福利一区二区| 一区免费观看视频| 99精品一区二区| 亚洲欧美在线高清| 91麻豆福利精品推荐| 自拍偷拍国产精品| 日本韩国视频一区二区| 亚洲欧美日韩中文字幕一区二区三区| 国产宾馆实践打屁股91| 国产亚洲欧美中文| 成人国产电影网| 亚洲欧洲一区二区在线播放| 91玉足脚交白嫩脚丫在线播放| 中文字幕亚洲区| 欧美综合一区二区| 亚洲不卡一区二区三区| 欧美日韩免费高清一区色橹橹| 亚洲一区二区三区在线看| 欧美日韩精品三区| 久色婷婷小香蕉久久| 久久久久久久免费视频了| 国产成人综合在线播放| 国产亚洲精品aa| 91在线你懂得| 午夜视频一区二区三区| 日韩精品在线一区二区| 国产原创一区二区三区| 国产精品乱码久久久久久| 99精品黄色片免费大全| 亚洲国产aⅴ天堂久久| 欧美一区二区黄| 国产美女视频一区| 综合av第一页| 宅男在线国产精品| 国产成人在线视频网站| 亚洲欧美日韩在线不卡| 日韩欧美电影在线| www.性欧美| 日本不卡的三区四区五区| 26uuu亚洲综合色| 一本色道a无线码一区v| 日本v片在线高清不卡在线观看| 久久久777精品电影网影网 | 成人欧美一区二区三区视频网页| 日本韩国一区二区三区视频| 久久成人av少妇免费| 一区精品在线播放| 精品久久久久久久久久久久久久久久久 | 91国产福利在线| 久久丁香综合五月国产三级网站| 国产拍欧美日韩视频二区| 99re6这里只有精品视频在线观看| 亚洲成人综合网站| 欧美高清在线一区二区| 欧美日韩国产123区| 成年人国产精品| 久久激情五月激情| 一区二区在线观看不卡| 亚洲精品一区二区三区蜜桃下载 | 久久超碰97中文字幕| 国产精品国模大尺度视频| 日韩一区二区精品葵司在线| 99久久精品免费观看| 久99久精品视频免费观看| 亚洲激情校园春色| 国产欧美精品一区aⅴ影院 | 欧美午夜在线观看| 国产成人精品午夜视频免费| 日韩黄色在线观看| 亚洲蜜臀av乱码久久精品蜜桃| 久久综合999| 日韩一区二区三区在线| 欧美色网站导航| 91官网在线观看| 92精品国产成人观看免费| 国产精品一区二区免费不卡| 麻豆免费看一区二区三区| 亚洲欧美另类综合偷拍| 91蜜桃网址入口| 成人性生交大片免费看在线播放| 日本女人一区二区三区| 性做久久久久久免费观看| 一区二区三区免费看视频| 国产精品乱人伦| 日本一区二区三区在线不卡| 精品国产91乱码一区二区三区 | 欧美日本在线观看| 色偷偷久久一区二区三区| 99九九99九九九视频精品| 成人aaaa免费全部观看| 成人av免费在线观看| 风间由美中文字幕在线看视频国产欧美 | 国内精品伊人久久久久av影院 | 自拍偷拍亚洲欧美日韩| 国产精品免费久久久久| 国产精品免费av| 成人免费在线视频| 亚洲激情自拍偷拍| 亚洲一区二区影院| 天天av天天翘天天综合网| 五月天激情小说综合| 美女视频一区二区| 国产精品羞羞答答xxdd| 岛国av在线一区| 色婷婷综合久久久中文字幕| av亚洲精华国产精华精华| 成人久久18免费网站麻豆| 波多野结衣91| 欧洲一区二区三区免费视频| 欧美日韩国产中文| 日韩欧美国产不卡| 欧美激情一区二区在线| 亚洲男人都懂的| 午夜影院在线观看欧美| 久久国产精品区| 不卡视频在线看| 欧美夫妻性生活| 国产无一区二区| 一区二区三区在线免费观看| 日本不卡一区二区| 国产九九视频一区二区三区| 91小视频免费观看| 制服丝袜亚洲色图| 欧美国产精品一区| 午夜久久久久久久久久一区二区| 激情图片小说一区| 一本色道久久综合亚洲精品按摩| 9191久久久久久久久久久| 久久精品夜夜夜夜久久| 亚洲美女区一区| 蜜臂av日日欢夜夜爽一区| av在线不卡网| 日韩精品一区二区在线| 一区二区三区自拍| 国产剧情在线观看一区二区| 色狠狠一区二区三区香蕉| 日韩精品一区二区三区四区视频| 中文字幕一区二区不卡| 久久99精品国产.久久久久| 久久99精品国产麻豆不卡| 成人avav影音| 日韩欧美在线影院| 自拍偷拍国产亚洲| 国产乱人伦偷精品视频免下载| 欧美主播一区二区三区美女| 国产欧美日韩卡一| 三级久久三级久久久| 99精品欧美一区二区三区小说| 欧美xxxxxxxx| 亚洲大片免费看| 日本韩国欧美一区二区三区| 国产欧美精品一区二区色综合朱莉| 日本少妇一区二区| 欧美色老头old∨ideo| 国产精品短视频| 高清在线观看日韩| www国产精品av| 捆绑调教一区二区三区| 9191成人精品久久| 亚洲电影在线免费观看| 91黄色免费版| 亚洲精品一二三| 色综合激情久久| 亚洲日本丝袜连裤袜办公室| 懂色av一区二区三区蜜臀 | 欧美成人乱码一区二区三区| 亚洲成av人片在线观看| 色婷婷国产精品| 亚洲精品网站在线观看| 一本大道久久a久久精品综合| 中文字幕视频一区| 91免费观看在线| 亚洲黄一区二区三区| 91在线观看下载|