Package org.datanucleus.metadata

Examples of org.datanucleus.metadata.EmbeddedMetaData


                        Embedded[] embeddedMappings = (Embedded[])annotationValues.get("embeddedMapping");
                        if (embeddedMappings != null && embeddedMappings.length > 0)
                        {
                            // Embedded element
                            EmbeddedMetaData embmd = new EmbeddedMetaData();
                            embmd.setOwnerMember(embeddedMappings[0].ownerMember());
                            embmd.setNullIndicatorColumn(embeddedMappings[0].nullIndicatorColumn());
                            embmd.setNullIndicatorValue(embeddedMappings[0].nullIndicatorValue());
                            elemmd.setEmbeddedMetaData(embmd);
                            embeddedElementMembers = embeddedMappings[0].members();
                            // Delay addition of embeddedElementMembers til completion of this loop so we have the element type
                        }
                    }
                    else if (annName.equals(JDOAnnotationUtils.KEY))
                    {
                        // Key of a Map
                        Class[] keyTypes = (Class[])annotationValues.get("types");
                        if (keyTypes != null && keyTypes.length > 0)
                        {
                            // TODO Support more than 1 value
                            keyType = keyTypes[0];
                        }
                        embeddedKey = (String)annotationValues.get("embedded");
                        serializedKey = (String)annotationValues.get("serialized");
                        dependentKey = (String)annotationValues.get("dependent");
                        String keyColumn = (String)annotationValues.get("column");
                        String keyDeleteAction = JDOAnnotationUtils.getForeignKeyActionString(
                            (ForeignKeyAction)annotationValues.get("deleteAction"));
                        String keyUpdateAction = JDOAnnotationUtils.getForeignKeyActionString(
                            (ForeignKeyAction)annotationValues.get("updateAction"));
                        String keyMappedBy = (String)annotationValues.get("mappedBy");
                        Column[] keyColumns = (Column[])annotationValues.get("columns");
                        String fkName = (String)annotationValues.get("foreignKey");
                        String generateFK = (String)annotationValues.get("generateForeignKey");
                        String indexed = (String)annotationValues.get("indexed");
                        String indexName = (String)annotationValues.get("index");
                        String unique = (String)annotationValues.get("unique");
                        String uniqueName = (String)annotationValues.get("uniqueKey");
                        if (!StringUtils.isWhitespace(uniqueName))
                        {
                            unique = "true";
                        }
                        if (!StringUtils.isWhitespace(indexName))
                        {
                            indexed = "true";
                        }
                        keymd = new KeyMetaData();
                        keymd.setColumnName(keyColumn);
                        keymd.setDeleteAction(keyDeleteAction);
                        keymd.setUpdateAction(keyUpdateAction);
                        keymd.setIndexed(IndexedValue.getIndexedValue(indexed));
                        keymd.setUnique(unique);
                        keymd.setMappedBy(keyMappedBy);
                        if (!StringUtils.isWhitespace(fkName))
                        {
                            ForeignKeyMetaData keyFkmd = keymd.getForeignKeyMetaData();
                            if (keyFkmd == null)
                            {
                                keyFkmd = new ForeignKeyMetaData();
                                keyFkmd.setName(fkName);
                                keymd.setForeignKeyMetaData(keyFkmd);
                            }
                            else
                            {
                                keyFkmd.setName(fkName);
                            }
                        }
                        else if (generateFK != null && generateFK.equalsIgnoreCase("true"))
                        {
                            keymd.setForeignKeyMetaData(new ForeignKeyMetaData());
                        }

                        if (!StringUtils.isWhitespace(indexName))
                        {
                            IndexMetaData keyIdxmd = keymd.getIndexMetaData();
                            if (keyIdxmd == null)
                            {
                                keyIdxmd = new IndexMetaData();
                                keymd.setIndexMetaData(keyIdxmd);
                            }
                            keyIdxmd.setName(indexName);
                        }

                        if (!StringUtils.isWhitespace(uniqueName))
                        {
                            UniqueMetaData keyUnimd = keymd.getUniqueMetaData();
                            if (keyUnimd == null)
                            {
                                keyUnimd = new UniqueMetaData();
                                keymd.setUniqueMetaData(keyUnimd);
                            }
                            keyUnimd.setName(uniqueName);
                        }
                        if (keyColumns != null && keyColumns.length > 0)
                        {
                            for (int j=0;j<keyColumns.length;j++)
                            {
                                keymd.addColumn(JDOAnnotationUtils.getColumnMetaDataForColumnAnnotation(keyColumns[j]));
                            }
                        }
                        JDOAnnotationUtils.addExtensionsToMetaData(keymd, (Extension[])annotationValues.get("extensions"));

                        Embedded[] embeddedMappings = (Embedded[])annotationValues.get("embeddedMapping");
                        if (embeddedMappings != null && embeddedMappings.length > 0)
                        {
                            // Embedded key
                            EmbeddedMetaData embmd = new EmbeddedMetaData();
                            embmd.setOwnerMember(embeddedMappings[0].ownerMember());
                            embmd.setNullIndicatorColumn(embeddedMappings[0].nullIndicatorColumn());
                            embmd.setNullIndicatorValue(embeddedMappings[0].nullIndicatorValue());
                            keymd.setEmbeddedMetaData(embmd);
                            embeddedKeyMembers = embeddedMappings[0].members();
                            // Delay addition of embeddedKeyMembers til completion of this loop so we have the key type
                        }
                    }
                    else if (annName.equals(JDOAnnotationUtils.VALUE))
                    {
                        // Value of a Map
                        Class[] valueTypes = (Class[])annotationValues.get("types");
                        if (valueTypes != null && valueTypes.length > 0)
                        {
                            // TODO Support more than 1 value
                            valueType = valueTypes[0];
                        }
                        embeddedValue = (String)annotationValues.get("embedded");
                        serializedValue = (String)annotationValues.get("serialized");
                        dependentValue = (String)annotationValues.get("dependent");
                        String valueColumn = (String)annotationValues.get("column");
                        String valueDeleteAction = JDOAnnotationUtils.getForeignKeyActionString(
                            (ForeignKeyAction)annotationValues.get("deleteAction"));
                        String valueUpdateAction = JDOAnnotationUtils.getForeignKeyActionString(
                            (ForeignKeyAction)annotationValues.get("updateAction"));
                        String valueMappedBy = (String)annotationValues.get("mappedBy");
                        Column[] valueColumns = (Column[])annotationValues.get("columns");
                        String fkName = (String)annotationValues.get("foreignKey");
                        String generateFK = (String)annotationValues.get("generateForeignKey");
                        String indexed = (String)annotationValues.get("indexed");
                        String indexName = (String)annotationValues.get("index");
                        String unique = (String)annotationValues.get("unique");
                        String uniqueName = (String)annotationValues.get("uniqueKey");
                        if (!StringUtils.isWhitespace(uniqueName))
                        {
                            unique = "true";
                        }
                        if (!StringUtils.isWhitespace(indexName))
                        {
                            indexed = "true";
                        }
                        valuemd = new ValueMetaData();
                        valuemd.setColumnName(valueColumn);
                        valuemd.setDeleteAction(valueDeleteAction);
                        valuemd.setUpdateAction(valueUpdateAction);
                        valuemd.setIndexed(IndexedValue.getIndexedValue(indexed));
                        valuemd.setUnique(unique);
                        valuemd.setMappedBy(valueMappedBy);
                        if (!StringUtils.isWhitespace(fkName))
                        {
                            ForeignKeyMetaData valueFkmd = valuemd.getForeignKeyMetaData();
                            if (valueFkmd == null)
                            {
                                valueFkmd = new ForeignKeyMetaData();
                                valueFkmd.setName(fkName);
                                valuemd.setForeignKeyMetaData(valueFkmd);
                            }
                            else
                            {
                                valueFkmd.setName(fkName);
                            }
                        }
                        else if (generateFK != null && generateFK.equalsIgnoreCase("true"))
                        {
                            valuemd.setForeignKeyMetaData(new ForeignKeyMetaData());
                        }

                        if (!StringUtils.isWhitespace(indexName))
                        {
                            IndexMetaData valueIdxmd = valuemd.getIndexMetaData();
                            if (valueIdxmd == null)
                            {
                                valueIdxmd = new IndexMetaData();
                                valuemd.setIndexMetaData(valueIdxmd);
                            }
                            valueIdxmd.setName(indexName);
                        }

                        if (!StringUtils.isWhitespace(uniqueName))
                        {
                            UniqueMetaData valueUnimd = valuemd.getUniqueMetaData();
                            if (valueUnimd == null)
                            {
                                valueUnimd = new UniqueMetaData();
                                valuemd.setUniqueMetaData(valueUnimd);
                            }
                            valueUnimd.setName(uniqueName);
                        }
                        if (valueColumns != null && valueColumns.length > 0)
                        {
                            for (int j=0;j<valueColumns.length;j++)
                            {
                                valuemd.addColumn(JDOAnnotationUtils.getColumnMetaDataForColumnAnnotation(valueColumns[j]));
                            }
                        }
                        JDOAnnotationUtils.addExtensionsToMetaData(valuemd, (Extension[])annotationValues.get("extensions"));

                        Embedded[] embeddedMappings = (Embedded[])annotationValues.get("embeddedMapping");
                        if (embeddedMappings != null && embeddedMappings.length > 0)
                        {
                            // Embedded value
                            EmbeddedMetaData embmd = new EmbeddedMetaData();
                            embmd.setOwnerMember(embeddedMappings[0].ownerMember());
                            embmd.setNullIndicatorColumn(embeddedMappings[0].nullIndicatorColumn());
                            embmd.setNullIndicatorValue(embeddedMappings[0].nullIndicatorValue());
                            valuemd.setEmbeddedMetaData(embmd);
                            embeddedValueMembers = embeddedMappings[0].members();
                            // Delay addition of embeddedValueMembers til completion of this loop so we have the value type
                        }
                    }
                    else if (annName.equals(JDOAnnotationUtils.ORDER))
                    {
                        String orderColumn = (String)annotationValues.get("column");
                        String orderMappedBy = (String)annotationValues.get("mappedBy");
                        Column[] orderColumns = (Column[])annotationValues.get("columns");
                        ordermd = new OrderMetaData();
                        ordermd.setColumnName(orderColumn);
                        ordermd.setMappedBy(orderMappedBy);
                        if (orderColumns != null && orderColumns.length > 0)
                        {
                            for (int j=0;j<orderColumns.length;j++)
                            {
                                ordermd.addColumn(JDOAnnotationUtils.getColumnMetaDataForColumnAnnotation(orderColumns[j]));
                            }
                        }
                        JDOAnnotationUtils.addExtensionsToMetaData(ordermd, (Extension[])annotationValues.get("extensions"));
                    }
                    else if (annName.equals(JDOAnnotationUtils.EMBEDDED))
                    {
                        embeddedOwnerField = (String)annotationValues.get("ownerMember");
                        embeddedNullIndicatorColumn = (String)annotationValues.get("nullIndicatorColumn");
                        embeddedNullIndicatorValue = (String)annotationValues.get("nullIndicatorValue");
                        embeddedMembers = (Persistent[])annotationValues.get("members");
                    }
                    else if (annName.equals(JDOAnnotationUtils.INDEX))
                    {
                        // Index for the field
                        String name = (String)annotationValues.get("name");
                        String table = (String)annotationValues.get("table");
                        String unique = (String)annotationValues.get("unique");
                        String[] members = (String[])annotationValues.get("members");
                        Column[] columns = (Column[])annotationValues.get("columns");

                        idxmd = JDOAnnotationUtils.getIndexMetaData(name, table, unique, members, columns);
                    }
                    else if (annName.equals(JDOAnnotationUtils.UNIQUE))
                    {
                        // Unique for the field
                        String name = (String)annotationValues.get("name");
                        String table = (String)annotationValues.get("table");
                        String deferred = (String)annotationValues.get("deferred");
                        String[] members = (String[])annotationValues.get("members");
                        Column[] columns = (Column[])annotationValues.get("columns");

                        unimd = JDOAnnotationUtils.getUniqueMetaData(name, table, deferred, members, columns);
                    }
                    else if (annName.equals(JDOAnnotationUtils.FOREIGNKEY))
                    {
                        // ForeignKey for field
                        String name = (String)annotationValues.get("name");
                        String table = (String)annotationValues.get("table");
                        String unique = (String)annotationValues.get("unique");
                        String deferred = (String)annotationValues.get("deferred");
                        String deleteAction = JDOAnnotationUtils.getForeignKeyActionString(
                            (ForeignKeyAction)annotationValues.get("deleteAction"));
                        String updateAction = JDOAnnotationUtils.getForeignKeyActionString(
                            (ForeignKeyAction)annotationValues.get("updateAction"));
                        String[] members = (String[])annotationValues.get("members");
                        Column[] columns = (Column[])annotationValues.get("columns");

                        fkmd = JDOAnnotationUtils.getFKMetaData(name, table, unique, deferred, deleteAction, updateAction,
                            members, columns);
                    }
                    else if (annName.equals(JDOAnnotationUtils.CACHEABLE))
                    {
                        String cache = (String)annotationValues.get("value");
                        if (cache != null)
                        {
                            cacheable = cache;
                        }
                    }
                    else if (annName.equals(JDOAnnotationUtils.EXTENSIONS))
                    {
                        Extension[] values = (Extension[])annotationValues.get("value");
                        if (values != null && values.length > 0)
                        {
                            extensions = new HashSet<ExtensionMetaData>(values.length);
                            for (int j=0;j<values.length;j++)
                            {
                                ExtensionMetaData extmd = new ExtensionMetaData(values[j].vendorName(),
                                    values[j].key().toString(), values[j].value().toString());
                                extensions.add(extmd);
                            }
                        }
                    }
                    else if (annName.equals(JDOAnnotationUtils.EXTENSION))
                    {
                        ExtensionMetaData extmd = new ExtensionMetaData((String)annotationValues.get("vendorName"),
                            (String)annotationValues.get("key"), (String)annotationValues.get("value"));
                        extensions = new HashSet<ExtensionMetaData>(1);
                        extensions.add(extmd);
                    }
                    else
                    {
                        NucleusLogger.METADATA.error(LOCALISER.msg("044203",
                            member.getName(), annotations[i].getName()));
                    }
                }
            }

            if (mmd == null &&
                (transactionalField || nonPersistentField || primaryKey || colmds != null || serialised ||
                 embeddedOwnerField != null || embeddedNullIndicatorColumn != null || embeddedNullIndicatorValue != null ||
                 embeddedMembers != null ||
                 elemmd != null || keymd != null || valuemd != null || ordermd != null ||
                 idxmd != null || unimd != null || fkmd != null || joinmd != null))
            {
                // @Persistent not supplied but other relevant annotations defined, so add default metadata element
                if (member.isProperty())
                {
                    mmd = new PropertyMetaData(cmd, member.getName());
                }
                else
                {
                    mmd = new FieldMetaData(cmd, member.getName());
                }
                mmd.setPrimaryKey("" + primaryKey);
            }

            if (mmd != null)
            {
                cmd.addMember(mmd);

                if (primaryKey)
                {
                    mmd.setPrimaryKey(true);
                }
                if (serialised)
                {
                    mmd.setSerialised(true);
                }
                if (nonPersistentField)
                {
                    mmd.setNotPersistent();
                }
                if (transactionalField)
                {
                    mmd.setTransactional();
                }

                // Add any embedded info
                if (embeddedOwnerField != null || embeddedNullIndicatorColumn != null ||
                    embeddedNullIndicatorValue != null || embeddedMembers != null)
                {
                    EmbeddedMetaData embmd = new EmbeddedMetaData();
                    embmd.setOwnerMember(embeddedOwnerField);
                    embmd.setNullIndicatorColumn(embeddedNullIndicatorColumn);
                    embmd.setNullIndicatorValue(embeddedNullIndicatorValue);
                    mmd.setEmbeddedMetaData(embmd);
                    if (embeddedMembers != null && embeddedMembers.length > 0)
                    {
                        for (int j=0;j<embeddedMembers.length;j++)
                        {
                            // Add the metadata for the embedded field/property to the embedded metadata
                            String memberName = embeddedMembers[j].name();
                            if (memberName.indexOf('.') > 0)
                            {
                                memberName = memberName.substring(memberName.lastIndexOf('.')+1);
                            }
                            AbstractMemberMetaData embfmd = getFieldMetaDataForPersistent(embmd, embeddedMembers[j],
                                isMemberOfClassAField(member.getType(), memberName));
                            embmd.addMember(embfmd);
                        }
                    }
                }

                // If the field is a container then add its container element
                ContainerMetaData contmd = null;
                if (Collection.class.isAssignableFrom(member.getType()))
                {
                    Class collectionElementType = null;
                    StringBuffer elementTypeStr = new StringBuffer();
                    if (elementTypes != null && elementTypes.length > 0 && elementTypes[0] != void.class)
                    {
                        // User-specified element type(s)
                        for (int j=0;j<elementTypes.length;j++)
                        {
                            if (elementTypeStr.length() > 0)
                            {
                                elementTypeStr.append(',');
                            }
                            elementTypeStr.append(elementTypes[j].getName());
                        }
                        collectionElementType = elementTypes[0]; // Use the first only
                    }
                    else
                    {
                        // Try to derive element type from generics info
                        if (member.getGenericType() instanceof ParameterizedType)
                        {
                            ParameterizedType paramtype = (ParameterizedType)member.getGenericType();
                            if (paramtype.getActualTypeArguments().length == 1)
                            {
                                Type type = paramtype.getActualTypeArguments()[0];
                                if (type instanceof Class)
                                {
                                    collectionElementType = (Class) type;
                                }
                                else if (type instanceof ParameterizedType)
                                {
                                    collectionElementType = (Class) ((ParameterizedType)type).getRawType();
                                }
                                else
                                {
                                    throw new IllegalStateException("Unknown type: " + type);
                                }

                                elementTypeStr.append(collectionElementType.getName());
                            }
                        }
                    }

                    contmd = new CollectionMetaData();
                    CollectionMetaData collmd = (CollectionMetaData)contmd;
                    collmd.setElementType(elementTypeStr.toString());
                    collmd.setEmbeddedElement(embeddedElement);
                    collmd.setSerializedElement(serializedElement);
                    collmd.setDependentElement(dependentElement);

                    // Add any embedded element mappings
                    if (embeddedElementMembers != null)
                    {
                        EmbeddedMetaData embmd = elemmd.getEmbeddedMetaData();
                        for (int j=0;j<embeddedElementMembers.length;j++)
                        {
                            // Add the metadata for the embedded element to the embedded metadata
                            String memberName = embeddedElementMembers[j].name();
                            if (memberName.indexOf('.') > 0)
                            {
                                memberName = memberName.substring(memberName.lastIndexOf('.')+1);
                            }
                            AbstractMemberMetaData embfmd = getFieldMetaDataForPersistent(embmd,
                                embeddedElementMembers[j],
                                isMemberOfClassAField(collectionElementType, memberName));
                            embmd.addMember(embfmd);
                        }
                    }
                }
                else if (member.getType().isArray())
                {
                    StringBuffer elementTypeStr = new StringBuffer();
                    if (elementTypes != null && elementTypes.length > 0 && elementTypes[0] != void.class)
                    {
                        // User-specified element type(s)
                        for (int j=0;j<elementTypes.length;j++)
                        {
                            if (elementTypeStr.length() > 0)
                            {
                                elementTypeStr.append(',');
                            }
                            elementTypeStr.append(elementTypes[j].getName());
                        }
                    }
                    else
                    {
                        // Derive from component type
                        elementTypeStr.append(member.getType().getComponentType().getName());
                    }

                    contmd = new ArrayMetaData();
                    ArrayMetaData arrmd = (ArrayMetaData)contmd;
                    arrmd.setElementType(elementTypeStr.toString());
                    arrmd.setEmbeddedElement(embeddedElement);
                    arrmd.setSerializedElement(serializedElement);
                    arrmd.setDependentElement(dependentElement);
                }
                else if (Map.class.isAssignableFrom(member.getType()))
                {
                    Class mapKeyType = null;
                    if (keyType != null && keyType != void.class)
                    {
                        // User-specified key type
                        mapKeyType = keyType;
                    }
                    else
                    {
                        // Try to derive key type from generics info
                        if (member.getGenericType() instanceof ParameterizedType)
                        {
                            ParameterizedType paramtype = (ParameterizedType)member.getGenericType();
                            if (paramtype.getActualTypeArguments().length == 2)
                            {
                                Type type = paramtype.getActualTypeArguments()[0];
                                if (type instanceof Class)
                                {
                                    mapKeyType = (Class) type;
                                }
                                else if (type instanceof ParameterizedType)
                                {
                                    mapKeyType = (Class) ((ParameterizedType)type).getRawType();
                                }
                                else
                                {
                                    throw new IllegalStateException("Unknown type: " + type);
                                }
                            }
                        }
                    }

                    Class mapValueType = null;
                    if (valueType != null && valueType != void.class)
                    {
                        // User-specified value type
                        mapValueType = valueType;
                    }
                    else
                    {
                        // Try to derive value type from generics info
                        if (member.getGenericType() instanceof ParameterizedType)
                        {
                            ParameterizedType paramtype = (ParameterizedType)member.getGenericType();
                            if (paramtype.getActualTypeArguments().length == 2)
                            {
                                Type type = paramtype.getActualTypeArguments()[1];
                                if (type instanceof Class)
                                {
                                    mapValueType = (Class) type;
                                }
                                else if (type instanceof ParameterizedType)
                                {
                                    mapValueType = (Class) ((ParameterizedType)type).getRawType();
                                }
                                else
                                {
                                    throw new IllegalStateException("Unknown type: " + type);
                                }
                            }
                        }
                    }

                    contmd = new MapMetaData();
                    MapMetaData mapmd = (MapMetaData)contmd;
                    mapmd.setKeyType((mapKeyType != null ? mapKeyType.getName() : null));
                    mapmd.setEmbeddedKey(embeddedKey);
                    mapmd.setSerializedKey(serializedKey);
                    mapmd.setDependentKey(dependentKey);
                    mapmd.setValueType((mapValueType != null ? mapValueType.getName() : null));
                    mapmd.setEmbeddedValue(embeddedValue);
                    mapmd.setSerializedValue(serializedValue);
                    mapmd.setDependentValue(dependentValue);

                    if (embeddedKeyMembers != null)
                    {
                        // Add any embedded key mappings
                        EmbeddedMetaData embmd = keymd.getEmbeddedMetaData();
                        for (int j=0;j<embeddedKeyMembers.length;j++)
                        {
                            // Add the metadata for the embedded key to the embedded metadata
                            String memberName = embeddedKeyMembers[j].name();
                            if (memberName.indexOf('.') > 0)
                            {
                                memberName = memberName.substring(memberName.lastIndexOf('.')+1);
                            }
                            AbstractMemberMetaData embfmd = getFieldMetaDataForPersistent(embmd, embeddedKeyMembers[j],
                                isMemberOfClassAField(mapKeyType, memberName));
                            embmd.addMember(embfmd);
                        }
                    }

                    if (embeddedValueMembers != null)
                    {
                        // Add any embedded value mappings
                        EmbeddedMetaData embmd = valuemd.getEmbeddedMetaData();
                        for (int j=0;j<embeddedValueMembers.length;j++)
                        {
                            // Add the metadata for the embedded value to the embedded metadata
                            String memberName = embeddedValueMembers[j].name();
                            if (memberName.indexOf('.') > 0)
                            {
                                memberName = memberName.substring(memberName.lastIndexOf('.')+1);
                            }
                            AbstractMemberMetaData embfmd = getFieldMetaDataForPersistent(embmd, embeddedValueMembers[j],
                                isMemberOfClassAField(mapValueType, memberName));
                            embmd.addMember(embfmd);
                        }
                    }
                }
                if (contmd != null)
                {
View Full Code Here


                        columnMetaData[0].setUnique(colUnique);
                    }
                    else if (annName.equals(JPAAnnotationUtils.ATTRIBUTE_OVERRIDES) && mmd.isEmbedded())
                    {
                        // Embedded field overrides
                        EmbeddedMetaData embmd = new EmbeddedMetaData();
                        embmd.setOwnerMember(mmd.getName());
                        mmd.setEmbeddedMetaData(embmd);                           
                        AttributeOverride[] attributeOverride = (AttributeOverride[])annotationValues.get("value");
                        for (int j=0; j<attributeOverride.length; j++)
                        {
                            AbstractMemberMetaData apmd = new FieldMetaData(embmd, attributeOverride[j].name());
                            embmd.addMember(apmd);
                            try
                            {
                                //needs to do the same for methods
                                Field overrideField = member.getType().getDeclaredField(attributeOverride[j].name());
                                apmd.addColumn(JPAAnnotationUtils.getColumnMetaDataForColumnAnnotation(apmd,
View Full Code Here

    /* (non-Javadoc)
     * @see javax.jdo.metadata.ValueMetadata#getEmbeddedMetadata()
     */
    public EmbeddedMetadata getEmbeddedMetadata()
    {
        EmbeddedMetaData internalEmbmd = getInternal().getEmbeddedMetaData();
        if (internalEmbmd == null)
        {
            return null;
        }
        EmbeddedMetadataImpl embmd = new EmbeddedMetadataImpl(internalEmbmd);
View Full Code Here

    /* (non-Javadoc)
     * @see javax.jdo.metadata.ValueMetadata#newEmbeddedMetadata()
     */
    public EmbeddedMetadata newEmbeddedMetadata()
    {
        EmbeddedMetaData internalEmbmd = getInternal().newEmbeddedMetaData();
        EmbeddedMetadataImpl embmd = new EmbeddedMetadataImpl(internalEmbmd);
        embmd.parent = this;
        return embmd;
    }
View Full Code Here

        return getInternal().isEmbedded();
    }

    public EmbeddedMetadata getEmbeddedMetadata()
    {
        EmbeddedMetaData internalEmbmd = getInternal().getEmbeddedMetaData();
        EmbeddedMetadataImpl embmd = new EmbeddedMetadataImpl(internalEmbmd);
        embmd.parent = this;
        return embmd;
    }
View Full Code Here

        return elemmd;
    }

    public EmbeddedMetadata newEmbeddedMetadata()
    {
        EmbeddedMetaData internalEmbmd = getInternal().newEmbeddedMetaData();
        EmbeddedMetadataImpl embmd = new EmbeddedMetadataImpl(internalEmbmd);
        embmd.parent = this;
        return embmd;
    }
View Full Code Here

      return ammd;
    }
    // more than one tuple, so it must be embedded data
    String parentFullClassName = acmd.getFullClassName();
    for (String tuple : tuples.subList(1, tuples.size())) {
      EmbeddedMetaData emd = ammd.getEmbeddedMetaData();
      if (emd == null) {
        throw new FatalNucleusUserException(
            query.getSingleStringQuery() + ": Can only reference properties of a sub-object if "
            + "the sub-object is embedded.");
      }
      DatastoreTable parentTable =
          getStoreManager().getDatastoreClass(parentFullClassName, getClassLoaderResolver());
      parentFullClassName = ammd.getTypeName();
      AbstractMemberMetaData parentField = (AbstractMemberMetaData) emd.getParent();
      EmbeddedMapping embeddedMapping =
          (EmbeddedMapping) parentTable.getMappingForFullFieldName(parentField.getFullFieldName());
      ammd = findMemberMetaDataWithName(tuple, embeddedMapping);
      if (ammd == null) {
        break;
View Full Code Here

TOP

Related Classes of org.datanucleus.metadata.EmbeddedMetaData

Copyright © 2018 www.massapicom. 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.