public int getNumberOfColumns() { ColumnMetaData[] colmds = getInternal().getColumnMetaData(); return (colmds != null ? colmds.length : 0); }
public ColumnMetadata[] getColumns() { ColumnMetaData[] internalColmds = getInternal().getColumnMetaData(); if (internalColmds == null) { return null; } ColumnMetadataImpl[] colmds = new ColumnMetadataImpl[internalColmds.length]; for (int i=0;i<colmds.length;i++) { colmds[i] = new ColumnMetadataImpl(internalColmds[i]); colmds[i].parent = this; } return colmds; }
/** * Method to prepare a field mapping for use in the datastore. * This creates the column in the table. */ protected void prepareDatastoreMapping() { MappingManager mmgr = storeMgr.getMappingManager(); ColumnMetaData colmd = null; if (mmd.getElementMetaData() != null && mmd.getElementMetaData().getColumnMetaData() != null && mmd.getElementMetaData().getColumnMetaData().length > 0) { colmd = mmd.getElementMetaData().getColumnMetaData()[0]; } Column col = mmgr.createColumn(this, getType(), colmd); mmgr.createDatastoreMapping(this, mmd, 0, col); } }
if (elemmd != null && elemmd.getColumnMetaData() != null && elemmd.getColumnMetaData().length > 0) jdbcType = elemmd.getColumnMetaData()[0].getJdbcTypeName();
/** * * Returns the name of a column as specified in a JPA annotation (can possibly be {@code null}). * * @param ammd the metadata object for the field we're retrieving a name for * @return {@code null} if the field name is not defined by a JPA annotation, otherwise return the field name */ public static String getFieldNameFromJPAAnnotation(AbstractMemberMetaData ammd) { String fieldName = null; // Try the first column if specified ColumnMetaData[] colmds = ammd.getColumnMetaData(); ElementMetaData elemmd; if (colmds != null && colmds.length > 0) { fieldName = colmds[0].getName(); // In some cases (for example Collections and Arrays) // the ColumnMetaData will be embedded in ElementMetaData } else if ((elemmd = ammd.getElementMetaData()) != null) { colmds = elemmd.getColumnMetaData(); if (colmds != null && colmds.length > 0) { fieldName = colmds[0].getName(); } } return fieldName; } }
/** * * Returns the name of a column as specified in a JPA annotation (can possibly be {@code null}). * * @param ammd the metadata object for the field we're retrieving a name for * @return {@code null} if the field name is not defined by a JPA annotation, otherwise return the field name */ public static String getFieldNameFromJPAAnnotation(AbstractMemberMetaData ammd) { String fieldName = null; // Try the first column if specified ColumnMetaData[] colmds = ammd.getColumnMetaData(); ElementMetaData elemmd; if (colmds != null && colmds.length > 0) { fieldName = colmds[0].getName(); // In some cases (for example Collections and Arrays) // the ColumnMetaData will be embedded in ElementMetaData } else if ((elemmd = ammd.getElementMetaData()) != null) { colmds = elemmd.getColumnMetaData(); if (colmds != null && colmds.length > 0) { fieldName = colmds[0].getName(); } } return fieldName; } }
ColumnMetaData[] columns = elemmd.getColumnMetaData(); if (columns != null)
private String determinePropertyName(AbstractMemberMetaData ammd) { if (ammd.hasExtension(DatastoreManager.PK_ID) || ammd.hasExtension(DatastoreManager.PK_NAME)) { // the datsatore doesn't support filtering or sorting by the individual // components of the key, so if the field corresponds to one of these // components it's a mistake by the user throw new org.datanucleus.exceptions.NucleusFatalUserException(query.getSingleStringQuery() + ": Field " + ammd.getFullFieldName() + " is a sub-component of the primary key. The " + "datastore does not support filtering or sorting by primary key components, only the " + "entire primary key."); } if (ammd.getColumn() != null) { return ammd.getColumn(); } else if (ammd.getColumnMetaData() != null && ammd.getColumnMetaData().length != 0) { return ammd.getColumnMetaData()[0].getName(); } else if (ammd.getElementMetaData() != null && ammd.getElementMetaData().getColumnMetaData() != null && ammd.getElementMetaData().getColumnMetaData().length != 0) { return ammd.getElementMetaData().getColumnMetaData()[0].getName(); } else { return getIdentifierFactory().newDatastoreFieldIdentifier(ammd.getName()).getIdentifierName(); } }
/** * Accessor for the name of the java-type actually used when mapping the particular datastore field. This java-type must have an entry in the datastore mappings. * @param index requested datastore field index. * @return the name of java-type for the requested datastore field. */ public String getJavaTypeForDatastoreMapping(int index) { if (containerIsStoredInSingleColumn()) { if (mmd.hasCollection() || mmd.hasArray()) { ColumnMetaData[] colmds = (mmd.getElementMetaData() != null ? mmd.getElementMetaData().getColumnMetaData() : null); if (colmds != null && colmds.length == 1 && colmds[0].getJdbcType() != null && colmds[0].getJdbcType().equals(JdbcType.ARRAY)) { // Element column using JDBC ARRAY type return Collection.class.getName(); } // Check if they specified just @Column since storing in single column in owner table colmds = mmd.getColumnMetaData(); if (colmds != null && colmds.length == 1 && colmds[0].getJdbcType() != null && colmds[0].getJdbcType().equals(JdbcType.ARRAY)) { // Column using JDBC ARRAY type return Collection.class.getName(); } } // Serialised container so just return serialised return ClassNameConstants.JAVA_IO_SERIALIZABLE; } return super.getJavaTypeForDatastoreMapping(index); }
public WrappedMemberMetaData(AbstractMemberMetaData fmd, Class type, ClassLoaderResolver clr) { super(fmd.getParent(), fmd); this.singleCollectionMetadata = fmd; this.type = type; // Use element definition in preference to field since it may be copied to the element in metadata processing this.columnMetaData = (fmd.getElementMetaData() != null) ? fmd.getElementMetaData().getColumnMetaData() : fmd.getColumnMetaData(); this.relationType = fmd.getRelationType(clr); this.relatedMemberMetaData = fmd.getRelatedMemberMetaData(clr); // Copy the Element embedded definition to the field embedded metaData because EmbeddedPCMapping reads it from there. (Maybe it should use EmbeddedElementPCMapping?) ElementMetaData fmdElementMetaData = fmd.getElementMetaData(); if (fmdElementMetaData != null && fmdElementMetaData.getEmbeddedMetaData() != null) { setEmbeddedMetaData(fmdElementMetaData.getEmbeddedMetaData()); } }
if (metaData.getElementMetaData() == null || (elementMetaData = metaData.getElementMetaData().getColumnMetaData()) == null) { targetIdColumnMapping = Collections.emptyMap(); } else {
if (metaData.getElementMetaData() == null || (elementMetaData = metaData.getElementMetaData().getColumnMetaData()) == null) { targetIdColumnMapping = Collections.emptyMap(); } else {
if (metaData.getElementMetaData() == null || (elementMetaData = metaData.getElementMetaData().getColumnMetaData()) == null) { targetIdColumnMapping = Collections.emptyMap(); } else {
/** * Method to prepare a field mapping for use in the datastore. * This creates the column in the table. */ protected void prepareDatastoreMapping() { if (containerIsStoredInSingleColumn()) { // Serialised collections/maps/arrays should just create a (typically BLOB) column as normal in the owning table MappingManager mmgr = storeMgr.getMappingManager(); ColumnMetaData colmd = null; ColumnMetaData[] colmds = mmd.getColumnMetaData(); if (colmds != null && colmds.length > 0) { // Try the field column info colmd = colmds[0]; } else if (mmd.hasCollection() || mmd.hasArray()) { // Fallback to the element column info colmds = (mmd.getElementMetaData() != null) ? mmd.getElementMetaData().getColumnMetaData() : null; if (colmds != null && colmds.length > 0) { colmd = colmds[0]; } } Column col = mmgr.createColumn(this, getJavaTypeForDatastoreMapping(0), colmd); mmgr.createDatastoreMapping(this, mmd, 0, col); } }
if (mmd.getElementMetaData() != null && mmd.getElementMetaData().getColumnMetaData() != null) colmds = mmd.getElementMetaData().getColumnMetaData();
else if (relatedMmds != null && relatedMmds[0].getElementMetaData() != null && relatedMmds[0].getElementMetaData().getColumnMetaData() != null && relatedMmds[0].getElementMetaData().getColumnMetaData().length > 0) columnMetaData = relatedMmds[0].getElementMetaData().getColumnMetaData();
.getColumnMetaData()[0].getName(); String emptyValue = LDAPUtils.getEmptyValue(mmd); deleteDnReference(otherCmd, name, op, emptyValue);
if (fmd.getElementMetaData() != null && fmd.getElementMetaData().getColumnMetaData() != null) colmds = fmd.getElementMetaData().getColumnMetaData();
ColumnMetaData[] colmds = (elemmd != null ? elemmd.getColumnMetaData() : null); if (colmds != null && colmds.length > 0 && colmds[0].getName() != null) ColumnMetaData[] colmds = (elemmd != null ? elemmd.getColumnMetaData() : null); if (colmds != null && colmds.length > 0 && colmds[0].getName() != null)
if (elemmd != null && elemmd.getColumnMetaData() != null && elemmd.getColumnMetaData().length > 0) elemColmd = elemmd.getColumnMetaData();