Examples of DatastoreIdentifier


Examples of org.datanucleus.store.mapped.DatastoreIdentifier

                        orderColmd.setName(mmd.getValueForExtension("adapter-column-name"));
                    }
                    else
                    {
                        // No column name so use default
                        DatastoreIdentifier id = storeMgr.getIdentifierFactory().newIndexFieldIdentifier(mmd);
                        orderColmd.setName(id.getIdentifierName());
                    }
                }
            }
            else
            {
                if (mmd.hasExtension("adapter-column-name"))
                {
                    // Specified "extension" column name
                    // TODO Is this needed? The user can just specify <order column="...">
                    orderColmd = new ColumnMetaData();
                    orderColmd.setName(mmd.getValueForExtension("adapter-column-name"));
                }
                else
                {
                    // No column name so use default
                    DatastoreIdentifier id = storeMgr.getIdentifierFactory().newIndexFieldIdentifier(mmd);
                    orderColmd = new ColumnMetaData();
                    orderColmd.setName(id.getIdentifierName());
                }
            }
            orderMapping = storeMgr.getMappingManager().getMapping(int.class); // JDO2 spec [18.5] order column is assumed to be "int"
            ColumnCreator.createIndexColumn(orderMapping, storeMgr, clr, this, orderColmd, pkRequired && !pkColsSpecified);
            if (NucleusLogger.DATASTORE.isDebugEnabled())
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

                        orderColmd.setName(mmd.getValueForExtension("adapter-column-name"));
                    }
                    else
                    {
                        // No column name so use default
                        DatastoreIdentifier id = storeMgr.getIdentifierFactory().newIndexFieldIdentifier(mmd);
                        orderColmd.setName(id.getIdentifierName());
                    }
                }
            }
            else
            {
                if (mmd.hasExtension("adapter-column-name"))
                {
                    // Specified "extension" column name
                    // TODO Is this needed? The user can just specify <order column="...">
                    orderColmd = new ColumnMetaData();
                    orderColmd.setName(mmd.getValueForExtension("adapter-column-name"));
                }
                else
                {
                    // No column name so use default
                    DatastoreIdentifier id = storeMgr.getIdentifierFactory().newIndexFieldIdentifier(mmd);
                    orderColmd = new ColumnMetaData();
                    orderColmd.setName(id.getIdentifierName());
                }
            }
            orderMapping = storeMgr.getMappingManager().getMapping(int.class); // JDO2 spec [18.5] order column is assumed to be "int"
            ColumnCreator.createIndexColumn(orderMapping, storeMgr, clr, this, orderColmd, pkRequired && !pkColsSpecified);
            if (NucleusLogger.DATASTORE.isDebugEnabled())
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

        // Set the index name if required
        if (imd.getName() != null)
        {
            IdentifierFactory idFactory = table.getStoreManager().getIdentifierFactory();
            DatastoreIdentifier idxId = idFactory.newIdentifier(IdentifierType.INDEX, imd.getName());
            index.setName(idxId.toString());
        }

        // Field-level index so use all columns for the field
        int countFields = fieldMapping.getNumberOfDatastoreMappings();
        for (int j=0; j<countFields; j++)
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

        // Set the key name if required
        if (umd.getName() != null)
        {
            IdentifierFactory idFactory = table.getStoreManager().getIdentifierFactory();
            DatastoreIdentifier ckId = idFactory.newIdentifier(IdentifierType.CANDIDATE_KEY, umd.getName());
            ck.setName(ckId.toString());
        }

        // Field-level index so use all columns for the field
        int countFields = fieldMapping.getNumberOfDatastoreMappings();
        for (int j=0; j<countFields; j++)
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

        while (i.hasNext())
        {
            RDBMSColumnInfo ci = (RDBMSColumnInfo) i.next();

            // Create an identifier to use for the real column - use "CUSTOM" because we dont want truncation
            DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newDatastoreFieldIdentifier(ci.getColumnName(),
                this.storeMgr.getNucleusContext().getTypeManager().isDefaultEmbeddedType(String.class), FieldRole.ROLE_CUSTOM);
            Column col = (Column) unvalidated.get(colName);
            if (col != null)
            {
                if (validateColumnStructure)
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

        HashMap columns = new HashMap(columnsByName);
        Iterator i = storeMgr.getColumnInfoForTable(this, conn).iterator();
        while (i.hasNext())
        {
            RDBMSColumnInfo ci = (RDBMSColumnInfo) i.next();
            DatastoreIdentifier colName = storeMgr.getIdentifierFactory().newIdentifier(IdentifierType.COLUMN, ci.getColumnName());
            Column col = (Column) columns.get(colName);
            if (col != null)
            {
                col.initializeColumnInfoFromDatastore(ci);
            }
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

            Iterator pkColsIter = tablePkInfo.getChildren().iterator();
            while (pkColsIter.hasNext())
            {
                PrimaryKeyInfo pkInfo = (PrimaryKeyInfo)pkColsIter.next();
                String pkName = (String)pkInfo.getProperty("pk_name");
                DatastoreIdentifier pkIdentifier;
   
                if (pkName == null)
                {
                    pkIdentifier = idFactory.newPrimaryKeyIdentifier(this);
                }
                else
                {
                    pkIdentifier = idFactory.newIdentifier(IdentifierType.COLUMN, pkName);
                }
   
                PrimaryKey pk = (PrimaryKey) primaryKeysByName.get(pkIdentifier);
                if (pk == null)
                {
                    pk = new PrimaryKey(this);
                    pk.setName(pkIdentifier.getIdentifierName());
                    primaryKeysByName.put(pkIdentifier, pk);
                }
   
                int keySeq = (((Short)pkInfo.getProperty("key_seq")).shortValue()) - 1;
                String colName = (String)pkInfo.getProperty("column_name");
                DatastoreIdentifier colIdentifier = idFactory.newIdentifier(IdentifierType.COLUMN, colName);
                Column col = columnsByName.get(colIdentifier);
   
                if (col == null)
                {
                    throw new UnexpectedColumnException(this.toString(), colIdentifier.getIdentifierName(), this.getSchemaName(), this.getCatalogName());
                }
                pk.setDatastoreField(keySeq, col);
            }
        }
        return primaryKeysByName;
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

                new Object[] {this});
            Iterator fksIter = tableFkInfo.getChildren().iterator();
            while (fksIter.hasNext())
            {
                ForeignKeyInfo fkInfo = (ForeignKeyInfo)fksIter.next();
                DatastoreIdentifier fkIdentifier;
                String fkName = (String)fkInfo.getProperty("fk_name");
                if (fkName == null)
                {
                    fkIdentifier = idFactory.newForeignKeyIdentifier(this, foreignKeysByName.size());
                }
                else
                {
                    fkIdentifier = idFactory.newIdentifier(IdentifierType.FOREIGN_KEY, fkName);
                }
   
                short deferrability = ((Short)fkInfo.getProperty("deferrability")).shortValue();
                boolean initiallyDeferred = deferrability == DatabaseMetaData.importedKeyInitiallyDeferred;
                ForeignKey fk = (ForeignKey) foreignKeysByName.get(fkIdentifier);
                if (fk == null)
                {
                    fk = new ForeignKey(initiallyDeferred);
                    fk.setName(fkIdentifier.getIdentifierName());
                    foreignKeysByName.put(fkIdentifier, fk);
                }
   
                String pkTableName = (String)fkInfo.getProperty("pk_table_name");
                AbstractTable refTable = (AbstractTable)storeMgr.getDatastoreClass(
                    idFactory.newDatastoreContainerIdentifier(pkTableName));
                if (refTable != null)
                {
                    String fkColumnName = (String)fkInfo.getProperty("fk_column_name");
                    String pkColumnName = (String)fkInfo.getProperty("pk_column_name");
                    DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierType.COLUMN, fkColumnName);
                    DatastoreIdentifier refColName = idFactory.newIdentifier(IdentifierType.COLUMN, pkColumnName);
                    DatastoreField col = columnsByName.get(colName);
                    DatastoreField refCol = refTable.columnsByName.get(refColName);
                    if (col != null && refCol != null)
                    {
                        fk.addDatastoreField(col, refCol);
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

                        // Ignore
                        continue;
                    }
   
                    String keyName = (String)indexInfo.getProperty("index_name");
                    DatastoreIdentifier idxName = idFactory.newIdentifier(IdentifierType.CANDIDATE_KEY, keyName);
                    CandidateKey key = (CandidateKey) candidateKeysByName.get(idxName);
                    if (key == null)
                    {
                        key = new CandidateKey(this);
                        key.setName(keyName);
                        candidateKeysByName.put(idxName, key);
                    }
   
                    // Set the column
                    int colSeq = ((Short)indexInfo.getProperty("ordinal_position")).shortValue() - 1;
                    DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierType.COLUMN,
                        (String)indexInfo.getProperty("column_name"));
                    Column col = columnsByName.get(colName);
                    if (col != null)
                    {
                        key.setDatastoreField(colSeq, col);
View Full Code Here

Examples of org.datanucleus.store.mapped.DatastoreIdentifier

                    // Ignore
                    continue;
                }
   
                String indexName = (String)indexInfo.getProperty("index_name");
                DatastoreIdentifier indexIdentifier = idFactory.newIdentifier(IdentifierType.CANDIDATE_KEY,
                    indexName);
                Index idx = (Index) indicesByName.get(indexIdentifier);
                if (idx == null)
                {
                    boolean isUnique = !((Boolean)indexInfo.getProperty("non_unique")).booleanValue();
                    idx = new Index(this, isUnique, null);
                    idx.setName(indexName);
                    indicesByName.put(indexIdentifier, idx);
                }
   
                // Set the column
                int colSeq = ((Short)indexInfo.getProperty("ordinal_position")).shortValue() - 1;
                DatastoreIdentifier colName = idFactory.newIdentifier(IdentifierType.COLUMN,
                    (String)indexInfo.getProperty("column_name"));
                Column col = columnsByName.get(colName);
                if (col != null)
                {
                    idx.setColumn(colSeq, col);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.