Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
olur opened this issue May 7, 2012 · 1 comment
Open

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

olur opened this issue May 7, 2012 · 1 comment

Comments

@olur
Copy link

olur commented May 7, 2012

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

@ghost ghost assigned thboileau Jul 18, 2012
@jlouvel jlouvel added 2.1 and removed 2.0 labels Feb 6, 2014
@jlouvel
Copy link
Member

jlouvel commented Aug 15, 2014

Support for complex property has been improved with this pull request #940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants