Skip to content

ext.OData - Cannot add an Entity with a ComplexProperty #581

Open
@olur

Description

@olur

restlet-jse-2.0.11
using odata extenstion


I'm trying to POST a Document Entity (as described in the following metadata) using addEntity(Document document)

<EntityType Name="Document"
<Property Name="DocumentId" Type="Edm.String" Nullable="false"
<Property Name=FileReference" Type="MyNamespace.FileReference" Nullable="false"
</EntityType
<ComplexType Name="FileInfo"
<Property Name="FileName" Type="Edm.String" Nullable="true"
</ComplexType

The POST resquest contains the DocumentID property
but is NOT containing FileInfo property


Problem:

Whatever they are defined, properties which type is a ComplexType are NOT posted

I would expect them to be posted.


Short Analysis:

Metadata is containing the correct info for CompelxType FileInfo and the correct list of Properties for the EntityType Document

but
the XML writer in odata.Service is calling odata.internal.edm.Metadata.getProperty() (at line 1118)
However Metadata.getProperty() is parsing at the EntityType's List but NOT the List (at line321) :

public Property getProperty(Object entity, String propertyName) {
Property result = null;
if (entity != null) {
EntityType et = getEntityType(entity.getClass());
if (et != null) {
for (Property property : et.getProperties()) {
if (property.getName().equals(propertyName)
|| property.getNormalizedName()
.equals(propertyName)) {
result = property;
break;
}
}
}

public List<Property> getProperties() {
    if (properties == null) {
        properties = new ArrayList<Property>();
    }
    return properties;
}

getComplexProperties is never called :(

Hope that helps

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions